@things-factory/operato-wms 4.3.356 → 4.3.358

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/client/pages/components/select-cc-product-popup.js +321 -0
  2. package/client/pages/constants/order.js +15 -0
  3. package/client/pages/inventory-check/add-extra-inventory-popup.js +306 -0
  4. package/client/pages/inventory-check/check-inventory-popup.js +183 -167
  5. package/client/pages/inventory-check/create-cycle-count.js +292 -141
  6. package/client/pages/inventory-check/cycle-count-inventory-details-popup.js +282 -0
  7. package/client/pages/inventory-check/cycle-count-recheck-popup.js +129 -31
  8. package/client/pages/inventory-check/cycle-count-report.js +425 -306
  9. package/client/pages/inventory-check/cycle-count-review.js +742 -0
  10. package/client/pages/inventory-check/cycle-count-worksheet-list.js +476 -0
  11. package/client/pages/inventory-check/inspecting-product.js +954 -1029
  12. package/client/pages/inventory-check/inventory-check-detail.js +378 -0
  13. package/client/pages/inventory-check/inventory-check-list.js +35 -109
  14. package/client/pages/inventory-check/relocate-inventory-popup.js +222 -0
  15. package/client/pages/inventory-check/search-popup.js +1 -1
  16. package/client/pages/inventory-check/select-cc-location-popup.js +230 -0
  17. package/client/pages/inventory-check/worksheet-cycle-count.js +112 -90
  18. package/client/pages/outbound/route-label-popup.js +16 -0
  19. package/client/route.js +8 -0
  20. package/dist-server/graphql/resolvers/reports/cycle-count-report.js +244 -0
  21. package/dist-server/graphql/resolvers/reports/cycle-count-report.js.map +1 -0
  22. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  23. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  24. package/dist-server/graphql/types/reports/cycle-count-report-list.js +14 -0
  25. package/dist-server/graphql/types/reports/cycle-count-report-list.js.map +1 -0
  26. package/dist-server/graphql/types/reports/cycle-count-report.js +25 -0
  27. package/dist-server/graphql/types/reports/cycle-count-report.js.map +1 -0
  28. package/dist-server/graphql/types/reports/index.js +5 -0
  29. package/dist-server/graphql/types/reports/index.js.map +1 -1
  30. package/package.json +6 -6
  31. package/server/graphql/resolvers/reports/cycle-count-report.ts +267 -0
  32. package/server/graphql/resolvers/reports/index.ts +3 -4
  33. package/server/graphql/types/reports/cycle-count-report-list.ts +8 -0
  34. package/server/graphql/types/reports/cycle-count-report.ts +19 -0
  35. package/server/graphql/types/reports/index.ts +7 -8
  36. package/things-factory.config.js +8 -0
  37. package/translations/en.json +34 -0
  38. package/translations/ko.json +34 -0
  39. package/translations/ms.json +35 -1
  40. package/translations/zh.json +37 -3
@@ -15,17 +15,18 @@ import { isMobileDevice } from '@things-factory/utils'
15
15
 
16
16
  import { fetchLocationSortingRule } from '../../fetch-location-sorting-rule'
17
17
  import { LOCATION_SORTING_RULE } from '../constants'
18
+ import './select-cc-location-popup'
18
19
 
19
20
  class CreateCycleCount extends localize(i18next)(PageView) {
20
21
  static get properties() {
21
22
  return {
22
- _searchFields: Array,
23
23
  config: Object,
24
24
  data: Object,
25
+ inventoryData: Object,
26
+ locationData: Object,
27
+ _searchField: Array,
25
28
  _bizplaceId: String,
26
29
  _bizplaceName: String,
27
- fullRecords: Object,
28
- inventoryData: Object,
29
30
  _locationSortingRules: Object,
30
31
  _ccStrat: String
31
32
  }
@@ -159,7 +160,8 @@ class CreateCycleCount extends localize(i18next)(PageView) {
159
160
  basicArgs: {
160
161
  filters: [
161
162
  { name: 'bizplace_id', operator: 'eq', value: this._bizplaceId },
162
- { name: 'hideBundle', operator: 'eq', value: true }
163
+ { name: 'hideBundle', operator: 'eq', value: true },
164
+ { name: 'showAllInventory', operator: 'eq', value: true }
163
165
  ]
164
166
  },
165
167
  nameField: 'batchId',
@@ -198,6 +200,16 @@ class CreateCycleCount extends localize(i18next)(PageView) {
198
200
  header: i18next.t('field.remain_uom_value'),
199
201
  ignoreCondition: true
200
202
  },
203
+ {
204
+ name: 'lockedQty',
205
+ header: i18next.t('field.release_qty'),
206
+ ignoreCondition: true
207
+ },
208
+ {
209
+ name: 'unassignedQty',
210
+ header: i18next.t('field.unassigned_qty'),
211
+ ignoreCondition: true
212
+ },
201
213
  {
202
214
  name: 'groupType',
203
215
  header: i18next.t('field.group_type'),
@@ -212,6 +224,8 @@ class CreateCycleCount extends localize(i18next)(PageView) {
212
224
  'packingType',
213
225
  'remainQty',
214
226
  'remainUomValue',
227
+ 'lockedQty',
228
+ 'unassignedQty',
215
229
  'groupType'
216
230
  ]
217
231
  }
@@ -263,6 +277,70 @@ class CreateCycleCount extends localize(i18next)(PageView) {
263
277
  name: 'remainUomValueWithUom',
264
278
  header: i18next.t('field.available_uom_value'),
265
279
  width: 140
280
+ },
281
+ {
282
+ type: 'integer',
283
+ name: 'lockedQty',
284
+ header: i18next.t('field.release_qty'),
285
+ width: 140
286
+ },
287
+ {
288
+ type: 'integer',
289
+ name: 'unassignedQty',
290
+ header: i18next.t('field.unassigned_qty'),
291
+ width: 140
292
+ }
293
+ ]
294
+ }
295
+ }
296
+
297
+ get locationGristConfig() {
298
+ return {
299
+ pagination: { infinite: true },
300
+ rows: {
301
+ selectable: { multiple: false },
302
+ classifier: (record, rowIndex) => {
303
+ return {
304
+ emphasized: record.isError
305
+ }
306
+ }
307
+ },
308
+ list: { fields: ['locationName', 'locationType'] },
309
+ columns: [
310
+ { type: 'gutter', gutterName: 'sequence' },
311
+ {
312
+ type: 'gutter',
313
+ gutterName: 'button',
314
+ icon: 'close',
315
+ handlers: {
316
+ click: (columns, data, column, record, rowIndex) => {
317
+ try {
318
+ const newData = data.records.filter((_, idx) => idx !== rowIndex)
319
+ this.locationData = { ...this.locationData, records: newData }
320
+ this.dataGrist.dirtyData.records = newData
321
+ this._updateInventoryGrist()
322
+ } catch (e) {
323
+ this._showToast(e)
324
+ }
325
+ }
326
+ }
327
+ },
328
+ {
329
+ type: 'string',
330
+ name: 'locationName',
331
+ header: i18next.t('field.location_list'),
332
+ handlers: {
333
+ click: (columns, data, column, record, rowIndex) => {
334
+ this._openSelectLocationPopup(rowIndex, record)
335
+ }
336
+ },
337
+ width: 350
338
+ },
339
+ {
340
+ type: 'string',
341
+ name: 'locationType',
342
+ header: i18next.t('field.type'),
343
+ width: 100
266
344
  }
267
345
  ]
268
346
  }
@@ -288,7 +366,7 @@ class CreateCycleCount extends localize(i18next)(PageView) {
288
366
  switch (this._ccStrat) {
289
367
  case 'random':
290
368
  dynamicFields = html`
291
- <form id="input-form" name="randomStratForm" class="multi-column-form">
369
+ <form id="input-form" name="randomStratFrom" class="multi-column-form">
292
370
  <fieldset>
293
371
  <label>${i18next.t('label.no_of_random_item')}</label>
294
372
  <input name="limit" type="number" />
@@ -310,6 +388,22 @@ class CreateCycleCount extends localize(i18next)(PageView) {
310
388
  </div>
311
389
  </div>
312
390
  `
391
+ break
392
+ case 'location':
393
+ dynamicFields = html`
394
+ <div class="grist-container">
395
+ <div class="grist">
396
+ <data-grist
397
+ id="location"
398
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
399
+ .config=${this.locGristConfig}
400
+ .data=${this.locationData}
401
+ @field-change="${this._gristFieldChange.bind(this)}"
402
+ ></data-grist>
403
+ </div>
404
+ </div>
405
+ `
406
+ break
313
407
  default:
314
408
  break
315
409
  }
@@ -361,26 +455,25 @@ class CreateCycleCount extends localize(i18next)(PageView) {
361
455
  checked
362
456
  />
363
457
  <label for="cc-by-product">By Product</label>
458
+
459
+ <input
460
+ id="cc-by-location"
461
+ name="cc-strat"
462
+ type="radio"
463
+ value="location"
464
+ @change="${e => {
465
+ this._ccStrat = e.currentTarget.value
466
+ this.locGristConfig = this.locationGristConfig
467
+ }}"
468
+ .checked="${this._ccStrat === 'location'}"
469
+ checked
470
+ />
471
+ <label for="cc-by-location">By Location</label>
364
472
  </fieldset>
365
473
  </form>
366
474
 
367
475
  ${dynamicFields}
368
476
  `
369
-
370
- /* <label>${i18next.t('label.no_of_random_item')}</label>
371
- <input name="limit" type="number" />
372
- <div class="grist-container">
373
- <div class="grist">
374
- <data-grist
375
- id="inventory"
376
- .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
377
- .config=${this.inventoryGristConfig}
378
- .data=${this.inventoryData}
379
- .fetchHandler="${this.fetchHandler.bind(this)}"
380
- @field-change="${this._gristFieldChange.bind(this)}"
381
- ></data-grist>
382
- </div>
383
- </div> */
384
477
  }
385
478
 
386
479
  pageUpdated(changes) {
@@ -393,58 +486,14 @@ class CreateCycleCount extends localize(i18next)(PageView) {
393
486
  constructor() {
394
487
  super()
395
488
  this.inventoryData = { ...this.inventoryData, records: [] }
489
+ this.locationData = { ...this.locationData, records: [] }
396
490
  }
397
491
 
398
492
  async pageInitialized() {
399
493
  this._ccStrat = 'random'
400
494
  this._locationSortingRules = await fetchLocationSortingRule(LOCATION_SORTING_RULE.CREATE_RELEASE_ORDER.value)
401
495
  this.inventoryGristConfig = this.dataGristConfig
402
- }
403
-
404
- // fetchHandler({ page, limit, sorters }) {
405
- // if (this.fullRecords?.length > 0) {
406
- // this.inventoryData = {
407
- // total: this.fullRecords.length,
408
- // records: _(this.fullRecords)
409
- // .drop((page - 1) * limit)
410
- // .take(limit)
411
- // .value()
412
- // }
413
- // } else {
414
- // this.inventoryData = {
415
- // total: 0,
416
- // records: []
417
- // }
418
- // }
419
- // }
420
-
421
- async _fetchPartners({ page, limit, sorters = [] }) {
422
- const filters = await this.searchForm.getQueryFilters()
423
- const pagination = { page, limit }
424
- const sortings = sorters
425
-
426
- const response = await client.query({
427
- query: gql`
428
- query partnersBizplaces($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
429
- partnersBizplaces(filters: $filters, pagination: $pagination, sortings: $sortings) {
430
- items {
431
- id
432
- name
433
- description
434
- }
435
- total
436
- }
437
- }
438
- `,
439
- variables: { filters, pagination, sortings }
440
- })
441
-
442
- if (!response.errors) {
443
- return {
444
- total: response.data.partnersBizplaces.total || 0,
445
- records: response.data.partnersBizplaces.items || []
446
- }
447
- }
496
+ this.locGristConfig = this.locationGristConfig
448
497
  }
449
498
 
450
499
  async _createCycleCount() {
@@ -474,7 +523,8 @@ class CreateCycleCount extends localize(i18next)(PageView) {
474
523
  const worksheetNo = await this.generateCycleCountWorksheet(
475
524
  this._bizplaceId,
476
525
  this.date.value,
477
- limit ? parseInt(limit) : null
526
+ limit ? parseInt(limit) : null,
527
+ this?.locationData?.records
478
528
  )
479
529
 
480
530
  if (worksheetNo) {
@@ -503,12 +553,54 @@ class CreateCycleCount extends localize(i18next)(PageView) {
503
553
  }
504
554
  }
505
555
 
506
- _validate() {
507
- // const _selectedInventory = this.dataGrist.selected
508
- // if (_selectedInventory && _selectedInventory.length == 0) {
509
- // throw new Error(i18next.t('text.there_no_selected'))
510
- // }
556
+ _openSelectLocationPopup(rowIndex, record) {
557
+ if (!this._bizplaceId || this?._bizplaceId == '') {
558
+ this._showToast({ message: i18next.t('text.bizplace_is_not_selected') })
559
+ return
560
+ }
511
561
 
562
+ openPopup(
563
+ html`
564
+ <select-cc-location-popup
565
+ .bizplaceId="${this._bizplaceId}"
566
+ .selectMultipleLocations="${true}"
567
+ @location-selected="${e => {
568
+ let newRecords = e.detail.multipleLocations.map(itm => ({
569
+ locationId: itm.location.id,
570
+ locationName: itm.location.name,
571
+ locationType: itm.location.type
572
+ }))
573
+
574
+ if (newRecords) {
575
+ this.locationData = {
576
+ ...this.locationData,
577
+ records: [...this.locationData.records, ...newRecords]
578
+ }
579
+ } else {
580
+ // Update existing location data records
581
+ if (this.dataGrist && this.dataGrist.dirtyData) {
582
+ this.dataGrist.dirtyData.records[rowIndex] = {
583
+ ...this.dataGrist.dirtyData.records[rowIndex],
584
+ ...newRecords[0]
585
+ }
586
+ }
587
+ this.locationData = {
588
+ ...this.locationData,
589
+ records: [...this.dataGrist.dirtyData.records]
590
+ }
591
+ }
592
+ }}"
593
+ ></select-cc-location-popup>
594
+ `,
595
+ {
596
+ backdrop: true,
597
+ size: 'medium',
598
+ title: i18next.t('title.select_location')
599
+ }
600
+ )
601
+ }
602
+
603
+ _validate() {
512
604
  if (!this._bizplaceId || this?._bizplaceId == '') {
513
605
  throw new Error(i18next.t('text.bizplace_is_not_selected'))
514
606
  }
@@ -529,54 +621,55 @@ class CreateCycleCount extends localize(i18next)(PageView) {
529
621
  throw new Error(i18next.t('text.nothing_selected'))
530
622
  }
531
623
  break
624
+
625
+ case 'location':
626
+ if (this?.locationData?.records && this?.locationData?.records <= 0) {
627
+ throw new Error(i18next.t('text.nothing_selected'))
628
+ }
629
+ break
532
630
  default:
533
631
  break
534
632
  }
535
633
  }
536
634
 
537
- async generateCycleCountWorksheet(customerId, executionDate, limit) {
538
- // const response = await client.query({
539
- // query: gql`
540
- // mutation {
541
- // generateCycleCountWorksheet(${gqlBuilder.buildArgs({
542
- // executionDate,
543
- // customerId,
544
- // limit
545
- // })}) {
546
- // name
547
- // }
548
- // }
549
- // `
550
- // })
551
-
552
- let orderInventories =
553
- this?.inventoryData?.records.map(itm => {
554
- return {
555
- batchId: itm.batchId,
556
- batchIdRef: itm.batchIdRef,
557
- productDetailId: itm.productDetailId
558
- }
559
- }) || []
635
+ async generateCycleCountWorksheet(customerId, executionDate, limit, selectedLocation) {
636
+ let inventoryCheckItems = []
637
+ // let selectedLocation = null // Initialize selectedLocation
638
+
639
+ if (this._ccStrat === 'product' || this._ccStrat === 'random') {
640
+ inventoryCheckItems =
641
+ this?.inventoryData?.records.map(item => {
642
+ return {
643
+ batchId: item.batchId,
644
+ batchIdRef: item.batchIdRef,
645
+ productDetailId: item.productDetailId
646
+ }
647
+ }) || []
648
+ } else if (this._ccStrat === 'location') {
649
+ selectedLocation = this?.locationData?.records.map(location => location.locationId) || []
650
+ }
560
651
 
561
652
  const response = await client.mutate({
562
653
  mutation: gql`
563
654
  mutation generateCycleCountWorksheet(
564
655
  $executionDate: String!
565
656
  $customerId: String!
566
- $orderInventories: [OrderInventoryPatch]
657
+ $inventoryCheckItems: [InventoryCheckItemPatch]
567
658
  $limit: Int
659
+ $selectedLocation: [String]!
568
660
  ) {
569
661
  generateCycleCountWorksheet(
570
662
  executionDate: $executionDate
571
663
  customerId: $customerId
572
- orderInventories: $orderInventories
664
+ inventoryCheckItems: $inventoryCheckItems
573
665
  limit: $limit
666
+ selectedLocation: $selectedLocation
574
667
  ) {
575
668
  name
576
669
  }
577
670
  }
578
671
  `,
579
- variables: { executionDate, customerId, orderInventories, limit }
672
+ variables: { executionDate, customerId, inventoryCheckItems, limit, selectedLocation }
580
673
  })
581
674
 
582
675
  if (!response.errors) {
@@ -588,7 +681,6 @@ class CreateCycleCount extends localize(i18next)(PageView) {
588
681
  }
589
682
 
590
683
  _clearView() {
591
- // this.cycleCountForm.reset()
592
684
  this._clearGristConditions()
593
685
  }
594
686
 
@@ -600,7 +692,9 @@ class CreateCycleCount extends localize(i18next)(PageView) {
600
692
  this._bizplaceId = e.detail.id
601
693
  this._bizplaceName = e.detail.name
602
694
  this.inventoryGristConfig = this.dataGristConfig
695
+ this.locGristConfig = this.locationGristConfig
603
696
  this.inventoryData = { records: [] }
697
+ this.locationData = { records: [] }
604
698
  this._clearGristConditions()
605
699
  }}"
606
700
  ></popup-partner-bizplaces-selector>
@@ -614,63 +708,120 @@ class CreateCycleCount extends localize(i18next)(PageView) {
614
708
  }
615
709
 
616
710
  _updateInventoryGrist(e) {
617
- const _selectedInv = (this.dataGrist.dirtyData.records || []).map(record => {
618
- return {
619
- batchId: record?.inventory?.batchId,
620
- packingType: record?.inventory?.packingType,
621
- packingSize: record?.inventory?.packingSize,
622
- productId: record?.inventory?.productId,
623
- groupType: record?.inventory?.groupType
624
- }
625
- })
711
+ if (!this._bizplaceId || this?._bizplaceId == '') {
712
+ this._showToast(i18next.t('text.bizplace_is_not_selected'))
713
+ return
714
+ }
715
+
716
+ if (this._ccStrat === 'product' || this._ccStrat === 'random') {
717
+ const _selectedInv = (this.dataGrist.dirtyData.records || []).map(record => {
718
+ return {
719
+ batchId: record?.inventory?.batchId,
720
+ packingType: record?.inventory?.packingType,
721
+ packingSize: record?.inventory?.packingSize,
722
+ productId: record?.inventory?.productId,
723
+ groupType: record?.inventory?.groupType
724
+ }
725
+ })
726
+
727
+ this.inventoryGristConfig = {
728
+ ...this.inventoryGristConfig,
729
+ columns: this.inventoryGristConfig.columns.map(column => {
730
+ if (column.name === 'inventory') {
731
+ column.record.options.basicArgs = {
732
+ ...column.record.options.basicArgs,
733
+ filters: [...column.record.options.basicArgs.filters.filter(filter => filter.name !== 'batch_product')]
734
+ }
626
735
 
627
- this.inventoryGristConfig = {
628
- ...this.inventoryGristConfig,
629
- columns: this.inventoryGristConfig.columns.map(column => {
630
- if (column.name === 'inventory') {
631
- column.record.options.basicArgs = {
632
- ...column.record.options.basicArgs,
633
- filters: [...column.record.options.basicArgs.filters.filter(filter => filter.name !== 'batch_product')]
736
+ if (_selectedInv.length) {
737
+ column.record.options.basicArgs.filters.push({
738
+ name: 'batch_product',
739
+ value: _selectedInv,
740
+ operator: 'notin'
741
+ })
742
+ }
634
743
  }
635
744
 
636
- if (_selectedInv.length) {
637
- column.record.options.basicArgs.filters.push({
638
- name: 'batch_product',
639
- value: _selectedInv,
640
- operator: 'notin'
641
- })
745
+ return column
746
+ })
747
+ }
748
+ } else if (this._ccStrat === 'location') {
749
+ const _selectedLocations = (this.dataGrist.dirtyData.records || []).map(record => record?.location?.id)
750
+ this.locGristConfig = {
751
+ ...this.locGristConfig,
752
+ columns: this.locGristConfig.columns.map(column => {
753
+ if (column.name === 'location') {
754
+ column.record.options.basicArgs = {
755
+ ...column.record.options.basicArgs,
756
+ filters: [...column.record.options.basicArgs.filters.filter(filter => filter.name !== 'id')]
757
+ }
758
+
759
+ if (_selectedLocations.length)
760
+ column.record.options.basicArgs.filters = [
761
+ ...column.record.options.basicArgs.filters,
762
+ {
763
+ name: 'id',
764
+ value: _selectedLocations,
765
+ operator: 'notin'
766
+ }
767
+ ]
642
768
  }
643
- }
644
769
 
645
- return column
646
- })
770
+ return column
771
+ })
772
+ }
647
773
  }
648
774
  }
649
775
 
650
776
  _gristFieldChange(e) {
651
777
  var { after, before, column, record, row } = e.detail
652
778
  if (column?.name == 'inventory') {
653
- this.inventoryData = {
654
- ...this.inventoryData,
655
- ...this.dataGrist.dirtyData,
656
- records: this.dataGrist.dirtyData.records.map((record, idx) => {
657
- // const factor = this._pickingStd === PICKING_STANDARD.SELECT_BY_PRODUCT.value ? e.detail.row : e.detail.record.id
658
-
659
- let returnObj = {
660
- ...record,
661
- ...record.inventory,
662
- name: record.name ? record.name : idx,
663
- id: idx,
664
- product: {
665
- id: record?.inventory?.productId,
666
- name: record?.inventory?.productName
779
+ if (this.inventoryData && this.dataGrist && this.dataGrist.dirtyData) {
780
+ this.inventoryData = {
781
+ ...this.inventoryData,
782
+ ...this.dataGrist.dirtyData,
783
+ records: this.dataGrist.dirtyData.records.map((record, idx) => {
784
+ let returnObj = {
785
+ ...record,
786
+ ...record.inventory,
787
+ name: record.name ? record.name : idx,
788
+ id: idx,
789
+ product: {
790
+ id: record?.inventory?.productId,
791
+ name: record?.inventory?.productName
792
+ }
667
793
  }
668
- }
669
794
 
670
- return returnObj
671
- })
795
+ return returnObj
796
+ })
797
+ }
798
+ }
799
+ }
800
+
801
+ if (column?.name == 'locationName') {
802
+ if (this.locationData && this.dataGrist && this.dataGrist.dirtyData) {
803
+ this.locationData = {
804
+ ...this.locationData,
805
+ ...this.dataGrist.dirtyData,
806
+ records: this.dataGrist.dirtyData.records.map((record, idx) => {
807
+ let returnObj = {
808
+ ...record,
809
+ ...record.location,
810
+ name: record.name ? record.name : idx,
811
+ id: idx,
812
+ location: {
813
+ id: record?.location?.locationId,
814
+ name: record?.location?.locationName,
815
+ type: record?.location.locationType
816
+ }
817
+ }
818
+
819
+ returnObj
820
+ })
821
+ }
672
822
  }
673
823
  }
824
+
674
825
  this._updateInventoryGrist()
675
826
  }
676
827