@things-factory/operato-wms 4.3.0-alpha.0 → 4.3.1

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 (94) hide show
  1. package/client/constants/index.js +1 -0
  2. package/client/constants/order.js +14 -0
  3. package/client/pages/constants/index.js +1 -0
  4. package/client/pages/constants/setting.js +1 -0
  5. package/client/pages/constants/tote.js +14 -0
  6. package/client/pages/inbound/unload-product.js +9 -5
  7. package/client/pages/inventory/inventory-adjustment-approval.js +24 -9
  8. package/client/pages/inventory/inventory-adjustment.js +79 -13
  9. package/client/pages/master/product/product-list.js +1 -1
  10. package/client/pages/master/tote-list.js +740 -0
  11. package/client/pages/order/arrival-notice/arrival-notice-detail.js +0 -2
  12. package/client/pages/order/arrival-notice/receive-arrival-notice.js +0 -2
  13. package/client/pages/order/draft-release-good/draft-release-good-detail.js +1163 -0
  14. package/client/pages/order/draft-release-good/draft-release-good-list.js +546 -0
  15. package/client/pages/order/goods-received-note/customer-received-note.js +3 -0
  16. package/client/pages/order/goods-received-note/received-note-detail.js +3 -0
  17. package/client/pages/order/release-order/b2c/b2c-order-requests.js +21 -30
  18. package/client/pages/order/release-order/bulk-print-packing-list.js +4 -0
  19. package/client/pages/order/release-order/receive-release-order-request.js +0 -2
  20. package/client/pages/order/release-order/release-order-detail.js +44 -26
  21. package/client/pages/order/return-order/receive-return-order-requests.js +0 -2
  22. package/client/pages/order/transfer-order/receive-transfer-order-request.js +1 -1
  23. package/client/pages/order/transport-order/print-delivery-note.js +0 -1
  24. package/client/pages/order/transport-order/view-delivery-note.js +1 -1
  25. package/client/pages/order/vas-order/receive-vas-order.js +0 -2
  26. package/client/pages/outbound/inventory-assign-popup.js +7 -2
  27. package/client/pages/outbound/inventory-auto-assign-popup.js +2 -1
  28. package/client/pages/outbound/loading-product.js +35 -3
  29. package/client/pages/outbound/order-remark-popup.js +112 -0
  30. package/client/pages/outbound/packing-product.js +38 -5
  31. package/client/pages/outbound/packing-worksheet-list.js +15 -0
  32. package/client/pages/outbound/picking-product.js +142 -10
  33. package/client/pages/outbound/single-outbound-worksheet.js +10 -22
  34. package/client/pages/outbound/sorting-product.js +72 -12
  35. package/client/pages/outbound/tote-popup.js +461 -0
  36. package/client/pages/outbound/worksheet-batch-picking.js +9 -2
  37. package/client/pages/outbound/worksheet-packing.js +7 -2
  38. package/client/pages/outbound/worksheet-picking.js +9 -2
  39. package/client/pages/report/inventory-summary-report.js +8 -0
  40. package/client/pages/report/outbound-order-details-report.js +18 -0
  41. package/client/pages/vas/print-product-label.js +15 -6
  42. package/client/route.js +12 -0
  43. package/dist-server/entities/index.js +2 -1
  44. package/dist-server/entities/index.js.map +1 -1
  45. package/dist-server/entities/warehouse-bizplace-onhand-inventory.js +168 -0
  46. package/dist-server/entities/warehouse-bizplace-onhand-inventory.js.map +1 -0
  47. package/dist-server/graphql/index.js +1 -5
  48. package/dist-server/graphql/index.js.map +1 -1
  49. package/dist-server/graphql/resolvers/board-setting/board-settings.js +2 -1
  50. package/dist-server/graphql/resolvers/board-setting/board-settings.js.map +1 -1
  51. package/dist-server/graphql/resolvers/index.js +4 -7
  52. package/dist-server/graphql/resolvers/index.js.map +1 -1
  53. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +3 -1
  54. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
  55. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/index.js +6 -0
  56. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/index.js.map +1 -0
  57. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js +58 -0
  58. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js.map +1 -0
  59. package/dist-server/graphql/types/index.js +5 -8
  60. package/dist-server/graphql/types/index.js.map +1 -1
  61. package/dist-server/graphql/types/reports/outbound-order-details-report.js +2 -0
  62. package/dist-server/graphql/types/reports/outbound-order-details-report.js.map +1 -1
  63. package/dist-server/graphql/types/warehouse-inventory-adjustment/index.js +9 -0
  64. package/dist-server/graphql/types/warehouse-inventory-adjustment/index.js.map +1 -0
  65. package/dist-server/index.js +2 -5
  66. package/dist-server/index.js.map +1 -1
  67. package/dist-server/opa-app-setting-constants.js +2 -1
  68. package/dist-server/opa-app-setting-constants.js.map +1 -1
  69. package/dist-server/utils/index.js +1 -5
  70. package/dist-server/utils/index.js.map +1 -1
  71. package/helps/release-note.ko.md +10 -8
  72. package/helps/release-note.md +10 -8
  73. package/helps/release-note.ms.md +10 -8
  74. package/helps/release-note.zh.md +10 -8
  75. package/package.json +51 -51
  76. package/server/entities/index.ts +2 -2
  77. package/server/entities/warehouse-bizplace-onhand-inventory.ts +141 -0
  78. package/server/graphql/resolvers/board-setting/board-settings.ts +4 -2
  79. package/server/graphql/resolvers/index.ts +3 -2
  80. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +6 -2
  81. package/server/graphql/resolvers/warehouse-inventory-adjustment/index.ts +5 -0
  82. package/server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.ts +68 -0
  83. package/server/graphql/types/index.ts +4 -4
  84. package/server/graphql/types/reports/outbound-order-details-report.ts +2 -0
  85. package/server/graphql/types/warehouse-inventory-adjustment/index.ts +5 -0
  86. package/server/index.ts +2 -1
  87. package/server/opa-app-setting-constants.ts +1 -0
  88. package/things-factory.config.js +13 -0
  89. package/translations/en.json +48 -8
  90. package/translations/ko.json +35 -1
  91. package/translations/ms.json +35 -1
  92. package/translations/zh.json +35 -1
  93. package/config.development.js +0 -73
  94. package/config.production.js +0 -113
@@ -5,6 +5,7 @@ import './picking-replacement-popup'
5
5
  import './show-my-worksheet-list-popup'
6
6
  import '../components/worksheet-information-popup'
7
7
  import './serial-number-popup'
8
+ import './tote-popup'
8
9
 
9
10
  import gql from 'graphql-tag'
10
11
  import { css, html } from 'lit-element'
@@ -49,7 +50,8 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
49
50
  refPickingType: String,
50
51
  releaseGoodNo: String,
51
52
  releaseGoodId: String,
52
- worksheetNo: String
53
+ worksheetNo: String,
54
+ toteNo: String
53
55
  }
54
56
  }
55
57
 
@@ -92,12 +94,12 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
92
94
  }
93
95
 
94
96
  get completed() {
95
- return this.data.records.every(record => record.completed)
97
+ return this.data.records.every(record => record?.completed)
96
98
  }
97
99
 
98
100
  get context() {
99
101
  var actions = []
100
- if (this._hasBinPicking && this.refPickingType === PICKING_TYPES.PICKING.value || PICKING_TYPES.BATCH_PICKING.value) {
102
+ if (this._hasBinPicking) {
101
103
  actions.push({
102
104
  title: i18next.t('button.get_task'),
103
105
  action: this.getTask.bind(this),
@@ -119,6 +121,14 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
119
121
  })
120
122
  }
121
123
 
124
+ if (this.refPickingType === PICKING_TYPES.PICKING.value && this.releaseGoodNo && this._enableToteScanning) {
125
+ actions.push({
126
+ title: i18next.t('button.tote'),
127
+ action: this.openTotePopup.bind(this),
128
+ ...CommonButtonStyles.activate
129
+ })
130
+ }
131
+
122
132
  if (this.releaseGoodNo) {
123
133
  actions.push({
124
134
  title: i18next.t('button.plastic_pallet'),
@@ -127,6 +137,19 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
127
137
  })
128
138
  }
129
139
 
140
+ if (
141
+ (this.releaseGoodId || this.taskNo) &&
142
+ this._selectedOrderInventory.status !== 'MISSING' &&
143
+ this._selectedOrderInventory.hasMissingInventoryChanges !== true &&
144
+ this._selectedOrderInventory.status !== 'DONE'
145
+ ) {
146
+ actions.push({
147
+ title: i18next.t('button.missing_stock'),
148
+ action: this.missingStock.bind(this),
149
+ ...CommonButtonStyles.submit
150
+ })
151
+ }
152
+
130
153
  if ((this.releaseGoodNo && this.completed) || (this.taskNo && this.completed)) {
131
154
  actions.push({
132
155
  title: i18next.t('button.complete'),
@@ -250,7 +273,6 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
250
273
  this.releaseGoodNo = ''
251
274
  this.releaseGoodId = ''
252
275
  this.taskNo = ''
253
-
254
276
  this._incompleteLocationName = false
255
277
  this._isCartonLabel = false
256
278
  /* A flag to indicate either PICKING process is executing */
@@ -326,7 +348,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
326
348
  ${this.scannable
327
349
  ? html`
328
350
  <fieldset>
329
- ${this._hasBinPicking
351
+ ${this._hasBinPicking && (!this.toteNo || this.tote !== '')
330
352
  ? html`
331
353
  <label>${i18next.t('label.bin_location')}</label>
332
354
  <barcode-scanable-input
@@ -588,6 +610,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
588
610
  async fetchInventories(pickingRefNo) {
589
611
  if (!pickingRefNo) return
590
612
 
613
+ const data = this._selectedOrderInventory
591
614
  let response
592
615
  switch (this.refPickingType) {
593
616
  case PICKING_TYPES.PICKING.value:
@@ -613,6 +636,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
613
636
  trackingNo
614
637
  }
615
638
  worksheetDetailInfos {
639
+ hasMissingInventoryChanges
616
640
  name
617
641
  palletId
618
642
  cartonId
@@ -684,13 +708,31 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
684
708
 
685
709
  if (
686
710
  this._selectedOrderInventory &&
687
- this._selectedOrderInventory.pickedQty != this._selectedOrderInventory.releaseQty
711
+ this._selectedOrderInventory.pickedQty != this._selectedOrderInventory.releaseQty &&
712
+ !this._selectedOrderInventory.hasMissingInventoryChanges &&
713
+ this._selectedOrderInventory.status !== 'MISSING'
688
714
  ) {
689
715
  this.scannable = true
690
716
  } else {
691
717
  this.scannable = false
692
718
  }
693
719
 
720
+ if (!this._isCartonLabel && data) {
721
+ const findPalletId = worksheetDetailInfos.find(res => res.palletId == data.palletId)
722
+
723
+ if (data && findPalletId.hasMissingInventoryChanges) {
724
+ this.scannable = false
725
+ }
726
+ }
727
+
728
+ if (this._isCartonLabel && data) {
729
+ const findCartonId = worksheetDetailInfos.find(res => res.cartonId == data.cartonId)
730
+
731
+ if (data && findCartonId.hasMissingInventoryChanges) {
732
+ this.scannable = false
733
+ }
734
+ }
735
+
694
736
  if (this._selectedOrderInventory) {
695
737
  const record = this.data.records.find(record => record.name === this._selectedOrderInventory.name)
696
738
  this._selectedOrderInventory = record
@@ -719,6 +761,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
719
761
  }
720
762
 
721
763
  this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
764
+ this._enableToteScanning = await fetchSettingRule('enable-tote-scanning', worksheetInfo.partnerDomainId)
722
765
  }
723
766
  break
724
767
 
@@ -733,6 +776,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
733
776
  startedAt
734
777
  }
735
778
  worksheetDetailInfos {
779
+ hasMissingInventoryChanges
736
780
  palletId
737
781
  cartonId
738
782
  batchId
@@ -791,13 +835,31 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
791
835
 
792
836
  if (
793
837
  this._selectedOrderInventory &&
794
- this._selectedOrderInventory.pickedQty != this._selectedOrderInventory.releaseQty
838
+ this._selectedOrderInventory.pickedQty != this._selectedOrderInventory.releaseQty &&
839
+ !this._selectedOrderInventory.hasMissingInventoryChanges &&
840
+ this._selectedOrderInventory.status !== 'MISSING'
795
841
  ) {
796
842
  this.scannable = true
797
843
  } else {
798
844
  this.scannable = false
799
845
  }
800
846
 
847
+ if (!this._isCartonLabel && data) {
848
+ const findPalletId = worksheetDetailInfos.find(res => res.palletId == data.palletId)
849
+
850
+ if (data && findPalletId.hasMissingInventoryChanges) {
851
+ this.scannable = false
852
+ }
853
+ }
854
+
855
+ if (this._isCartonLabel && data) {
856
+ const findCartonId = worksheetDetailInfos.find(res => res.cartonId == data.cartonId)
857
+
858
+ if (data && findCartonId.hasMissingInventoryChanges) {
859
+ this.scannable = false
860
+ }
861
+ }
862
+
801
863
  this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
802
864
 
803
865
  if (this._selectedOrderInventory) {
@@ -832,7 +894,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
832
894
  formatWorksheetDetailInfos(wsdInfos) {
833
895
  return wsdInfos
834
896
  .map(record => {
835
- if (record.pickedQty == record.releaseQty) {
897
+ if (record.pickedQty == record.releaseQty || record.status == 'MISSING') {
836
898
  record.completed = true
837
899
  } else {
838
900
  record.completed = false
@@ -858,6 +920,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
858
920
 
859
921
  return record
860
922
  })
923
+ .sort((a, b) => a.hasMissingInventoryChanges - b.hasMissingInventoryChanges)
861
924
  .sort((a, b) => a.completed - b.completed)
862
925
  }
863
926
 
@@ -908,6 +971,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
908
971
  this._incompleteLocationName = false
909
972
  this._isExecuting = false
910
973
  this._locationName = null
974
+ this.toteNo = ''
911
975
  }
912
976
 
913
977
  fillUpForm(form, data) {
@@ -1057,6 +1121,28 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1057
1121
  )
1058
1122
  }
1059
1123
 
1124
+ openTotePopup() {
1125
+ openPopup(
1126
+ html`
1127
+ <tote-popup
1128
+ .orderNo="${this.releaseGoodNo}"
1129
+ .toteNo="${this.toteNo}"
1130
+ .bizplace="${this._bizplaceName}"
1131
+ @completed="${async e => {
1132
+ this.toteNo = e.detail
1133
+ }}"
1134
+ ></tote-popup>
1135
+ `,
1136
+ {
1137
+ closable: false,
1138
+ backdrop: false,
1139
+ escapable: false,
1140
+ size: 'large',
1141
+ title: i18next.t('title.tote_scanning')
1142
+ }
1143
+ )
1144
+ }
1145
+
1060
1146
  _openWorksheetInformation() {
1061
1147
  openPopup(
1062
1148
  html`
@@ -1113,6 +1199,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1113
1199
  $releaseQty: Int!
1114
1200
  $binLocation: String
1115
1201
  $serialNumber: String
1202
+ $toteNo: String
1116
1203
  ) {
1117
1204
  picking(
1118
1205
  worksheetDetailName: $worksheetDetailName
@@ -1122,6 +1209,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1122
1209
  releaseQty: $releaseQty
1123
1210
  binLocation: $binLocation
1124
1211
  serialNumber: $serialNumber
1212
+ toteNo: $toteNo
1125
1213
  )
1126
1214
  }
1127
1215
  `,
@@ -1132,7 +1220,8 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1132
1220
  locationName: this._locationName ? this._locationName : this._selectedOrderInventory?.location.name,
1133
1221
  releaseQty: this._isRequireSerialNumberScanningOutbound ? 1 : parseInt(this.releaseQtyInput.value),
1134
1222
  binLocation: this._hasBinPicking ? this.binLocationInput.value : null,
1135
- serialNumber: this._isRequireSerialNumberScanningOutbound ? this.serialInput.value : null
1223
+ serialNumber: this._isRequireSerialNumberScanningOutbound ? this.serialInput.value : null,
1224
+ toteNo: this._enableToteScanning && this.toteNo !== '' ? this.toteNo : null
1136
1225
  }
1137
1226
  })
1138
1227
 
@@ -1191,6 +1280,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1191
1280
  $cartonId: String!
1192
1281
  $binLocation: String
1193
1282
  $serialNumber: String
1283
+ $toteNo: String
1194
1284
  ) {
1195
1285
  scanProductPicking(
1196
1286
  worksheetDetailName: $worksheetDetailName
@@ -1199,6 +1289,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1199
1289
  cartonId: $cartonId
1200
1290
  binLocation: $binLocation
1201
1291
  serialNumber: $serialNumber
1292
+ toteNo: $toteNo
1202
1293
  )
1203
1294
  }
1204
1295
  `,
@@ -1208,7 +1299,8 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1208
1299
  productBarcode: this.productBarcodeInput.value.trim(),
1209
1300
  cartonId: this.cartonInput.value.trim(),
1210
1301
  serialNumber: this._isRequireSerialNumberScanningOutbound ? this.serialInput.value : null,
1211
- binLocation: this._hasBinPicking ? this.binLocationInput.value : null
1302
+ binLocation: this._hasBinPicking ? this.binLocationInput.value : null,
1303
+ toteNo: this._enableToteScanning && this.toteNo !== '' ? this.toteNo : null
1212
1304
  }
1213
1305
  })
1214
1306
 
@@ -1545,6 +1637,45 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1545
1637
  }
1546
1638
  }
1547
1639
 
1640
+ async missingStock() {
1641
+ const selectOrderInventory = this._selectedOrderInventory
1642
+
1643
+ const patchesArr = [selectOrderInventory]
1644
+
1645
+ const patches = patchesArr.map(p => {
1646
+ return {
1647
+ palletId: p.palletId,
1648
+ transactionType: 'MISSING'
1649
+ }
1650
+ })
1651
+
1652
+ const result = await CustomAlert({
1653
+ title: i18next.t('title.are_you_sure'),
1654
+ text: i18next.t('text.do_you_want_to_mark_it_as_missing'),
1655
+ confirmButton: { text: i18next.t('button.confirm') },
1656
+ cancelButton: { text: i18next.t('button.cancel') }
1657
+ })
1658
+
1659
+ if (result.isConfirmed) {
1660
+ try {
1661
+ const response = await client.mutate({
1662
+ mutation: gql`
1663
+ mutation submitInventoryChanges($patches: [InventoryPatch!]!) {
1664
+ submitInventoryChanges(patches: $patches)
1665
+ }
1666
+ `,
1667
+ variables: { patches }
1668
+ })
1669
+
1670
+ if (!response.error) {
1671
+ await this.fetchInventories(this.releaseGoodNo)
1672
+ }
1673
+ } catch (error) {
1674
+ throw new Error(error)
1675
+ }
1676
+ }
1677
+ }
1678
+
1548
1679
  openPalletOutbound() {
1549
1680
  openPopup(
1550
1681
  html`
@@ -1650,6 +1781,7 @@ class PickingProduct extends connect(store)(localize(i18next)(PageView)) {
1650
1781
  this.data = { records: this.formatWorksheetDetailInfos(worksheetDetailInfos) }
1651
1782
 
1652
1783
  this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
1784
+ this._enableToteScanning = await fetchSettingRule('enable-tote-scanning', worksheetInfo.partnerDomainId)
1653
1785
 
1654
1786
  if (this._selectedOrderInventory) {
1655
1787
  const record = this.data.records.find(record => record.name === this._selectedOrderInventory.name)
@@ -66,13 +66,7 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
66
66
  }
67
67
 
68
68
  get context() {
69
- var actions = [
70
- {
71
- title: i18next.t('button.assign_picker'),
72
- action: this._assignPicker.bind(this),
73
- ...CommonButtonStyles.activate
74
- }
75
- ]
69
+ var actions = []
76
70
 
77
71
  if (this._routeLabelSetting) {
78
72
  actions.push({
@@ -82,6 +76,12 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
82
76
  })
83
77
  }
84
78
 
79
+ actions.push({
80
+ title: i18next.t('button.assign_picker'),
81
+ action: this._assignPicker.bind(this),
82
+ ...CommonButtonStyles.activate
83
+ })
84
+
85
85
  return {
86
86
  title: i18next.t('title.outbound_worksheet'),
87
87
  actions,
@@ -192,7 +192,7 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
192
192
  },
193
193
  {
194
194
  label: i18next.t('field.cross_docking'),
195
- name: 'crossDocking',
195
+ name: 'crossDocking',
196
196
  type: 'checkbox',
197
197
  props: { searchOper: 'eq' },
198
198
  attrs: ['indeterminate']
@@ -438,9 +438,8 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
438
438
  if (!response.errors) {
439
439
  let domain = response.data.worksheets.items[0]?.domain
440
440
 
441
- if (domain)
442
- this._routeLabelSetting = await fetchSettingRule('enable-print-route-label', domain.id)
443
-
441
+ if (domain) this._routeLabelSetting = await fetchSettingRule('enable-print-route-label', domain.id)
442
+
444
443
  this.updateContext()
445
444
  return {
446
445
  total: response.data.worksheets.total || 0,
@@ -631,17 +630,6 @@ class SingleOutboundWorksheet extends localize(i18next)(PageView) {
631
630
  return { header: headerSetting, data: data }
632
631
  }
633
632
 
634
- _showToast({ type, message }) {
635
- document.dispatchEvent(
636
- new CustomEvent('notify', {
637
- detail: {
638
- type,
639
- message
640
- }
641
- })
642
- )
643
- }
644
-
645
633
  navigatePickingRelatedPages(record) {
646
634
  if (this.assigneeId) {
647
635
  const searchParams = new URLSearchParams()
@@ -2,6 +2,7 @@ import '@things-factory/barcode-ui'
2
2
  import '@things-factory/grist-ui'
3
3
  import './show-ro-list-popup'
4
4
  import '../components/worksheet-information-popup'
5
+ import './tote-popup'
5
6
 
6
7
  import gql from 'graphql-tag'
7
8
  import { css, html } from 'lit-element'
@@ -25,10 +26,13 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
25
26
  _selectedTaskStatus: String,
26
27
  _worksheetInfo: Object,
27
28
  _selectedReleaseGood: Object,
29
+ _enableToteScanning: Boolean,
30
+ bizplaceName: String,
28
31
  config: Object,
29
32
  data: Object,
30
33
  releaseOrders: Array,
31
- taskNo: String
34
+ taskNo: String,
35
+ toteNo: String
32
36
  }
33
37
  }
34
38
 
@@ -73,19 +77,34 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
73
77
  var actions = []
74
78
 
75
79
  if (this.taskNo) {
80
+ if (this._enableToteScanning) {
81
+ actions.push({
82
+ title: i18next.t('button.tote'),
83
+ action: this._openTotePopup.bind(this),
84
+ ...CommonButtonStyles.activate
85
+ })
86
+ }
76
87
  actions.push({
77
88
  title: i18next.t('button.release_orders'),
78
89
  action: this._openSelectReleaseOrderPopup.bind(this),
79
90
  ...CommonButtonStyles.inspect
80
91
  })
81
92
 
82
- if (this.completed && this.releaseGoodNoInput?.value) {
93
+ if (this.completed) {
83
94
  actions.push({
84
95
  title: i18next.t('button.order_sorted'),
85
96
  action: this._completeOrderSorting.bind(this),
86
97
  ...CommonButtonStyles.submit
87
98
  })
88
99
  }
100
+
101
+ if (this.releaseOrders?.length == 0) {
102
+ actions.push({
103
+ title: i18next.t('button.complete'),
104
+ action: this._completeSortingWorksheet.bind(this),
105
+ ...CommonButtonStyles.submit
106
+ })
107
+ }
89
108
  }
90
109
 
91
110
  return {
@@ -376,6 +395,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
376
395
  @ro-selected=${e => {
377
396
  this._selectedReleaseGood = e.detail.ro
378
397
  this._fetchItemList(this._selectedReleaseGood?.name)
398
+ this.toteNo = ''
379
399
  }}
380
400
  ></show-ro-list-popup>
381
401
  `,
@@ -400,6 +420,28 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
400
420
  )
401
421
  }
402
422
 
423
+ _openTotePopup() {
424
+ openPopup(
425
+ html`
426
+ <tote-popup
427
+ .orderNo="${this._selectedReleaseGood?.name}"
428
+ .toteNo="${this.toteNo}"
429
+ .bizplace="${this.bizplaceName}"
430
+ @completed="${async e => {
431
+ this.toteNo = e.detail
432
+ }}"
433
+ ></tote-popup>
434
+ `,
435
+ {
436
+ closable: false,
437
+ backdrop: false,
438
+ escapable: false,
439
+ size: 'large',
440
+ title: i18next.t('title.tote_scanning')
441
+ }
442
+ )
443
+ }
444
+
403
445
  async _fetchItemList(releaseOrderNo) {
404
446
  const response = await client.query({
405
447
  query: gql`
@@ -445,21 +487,26 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
445
487
  if (!response.errors) {
446
488
  const { worksheetInfo, worksheetDetailInfos } = response.data.sortingWorksheet
447
489
  this._worksheetInfo = worksheetInfo
490
+ this.bizplaceName = worksheetInfo.bizplaceName
448
491
 
449
492
  this.data = { records: this.formatWorksheetDetailInfos(worksheetDetailInfos) }
450
493
  if (!this._selectedOrderInventory) {
451
494
  this._selectedOrderInventory = worksheetDetailInfos[0]
452
495
  this._isRequireSerialNumberScanningOutbound = worksheetDetailInfos[0].isRequireSerialNumberScanningOutbound
453
496
  }
497
+ this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
498
+ this._enableToteScanning = await fetchSettingRule('enable-tote-scanning', worksheetInfo.partnerDomainId)
499
+
454
500
  this.updateContext()
455
501
  this._completeHandler()
456
502
 
457
- this._enableProductScanning = await fetchSettingRule('enable-product-scanning', worksheetInfo.partnerDomainId)
458
-
459
- if (this._isRequireSerialNumberScanningOutbound) this._focusOnSerialInput()
460
- else if (this._enableProductScanning && !this._isRequireSerialNumberScanningOutbound)
461
- this._focusOnProductBarcodeInput()
462
- else this._focusOnSortingQtyInput()
503
+ if (this._isRequireSerialNumberScanningOutbound) {
504
+ if (this._enableProductScanning) {
505
+ this._focusOnProductBarcodeInput
506
+ } else {
507
+ this._focusOnSerialInput()
508
+ }
509
+ } else this._focusOnSortingQtyInput()
463
510
  }
464
511
  }
465
512
 
@@ -480,6 +527,12 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
480
527
  this.serialInput.value = ''
481
528
  }
482
529
 
530
+ if (this._enableProductScanning) {
531
+ this.productBarcodeInput.value = ''
532
+ } else if (!this._enableProductScanning && !this._isRequireSerialNumberScanningOutbound) {
533
+ this.sortingQtyInput.value = ''
534
+ }
535
+
483
536
  if (!response.errors) {
484
537
  this._fetchItemList(this._selectedReleaseGood?.name)
485
538
  }
@@ -497,6 +550,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
497
550
  $productId: String!
498
551
  $sortingQty: Float!
499
552
  $serialNumber: String
553
+ $toteNo: String
500
554
  ) {
501
555
  sortingProduct(
502
556
  taskNo: $taskNo
@@ -504,6 +558,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
504
558
  productId: $productId
505
559
  sortingQty: $sortingQty
506
560
  serialNumber: $serialNumber
561
+ toteNo: $toteNo
507
562
  )
508
563
  }
509
564
  `,
@@ -512,7 +567,8 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
512
567
  releaseGoodNo: this._selectedReleaseGood?.name,
513
568
  productId: this._selectedOrderInventory?.product.id,
514
569
  sortingQty: this._isRequireSerialNumberScanningOutbound ? 1 : parseFloat(this.sortingQtyInput.value),
515
- serialNumber: this._isRequireSerialNumberScanningOutbound ? this.serialInput.value.trim() : null
570
+ serialNumber: this._isRequireSerialNumberScanningOutbound ? this.serialInput.value.trim() : null,
571
+ toteNo: this._enableToteScanning && this.toteNo !== '' ? this.toteNo : null
516
572
  }
517
573
  })
518
574
  }
@@ -525,12 +581,14 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
525
581
  $releaseGoodNo: String!
526
582
  $productBarcode: String!
527
583
  $serialNumber: String
584
+ $toteNo: String
528
585
  ) {
529
586
  scanProductSorting(
530
587
  taskNo: $taskNo
531
588
  releaseGoodNo: $releaseGoodNo
532
589
  productBarcode: $productBarcode
533
590
  serialNumber: $serialNumber
591
+ toteNo: $toteNo
534
592
  )
535
593
  }
536
594
  `,
@@ -538,7 +596,8 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
538
596
  taskNo: this.taskNo,
539
597
  releaseGoodNo: this._selectedReleaseGood?.name,
540
598
  productBarcode: this.productBarcodeInput.value.trim(),
541
- serialNumber: this._isRequireSerialNumberScanningOutbound ? this.serialInput.value.trim() : null
599
+ serialNumber: this._isRequireSerialNumberScanningOutbound ? this.serialInput.value.trim() : null,
600
+ toteNo: this._enableToteScanning && this.toteNo !== '' ? this.toteNo : null
542
601
  }
543
602
  })
544
603
  }
@@ -576,6 +635,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
576
635
  this._showToast({ message: i18next.t('text.current_release_order_sorting_completed') })
577
636
  this._selectedOrderInventory = null
578
637
  await this._fetchReleaseOrderList(this.taskNo)
638
+ this.updateContext()
579
639
  }
580
640
  } catch (e) {
581
641
  this._showToast
@@ -598,8 +658,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
598
658
  await CustomAlert({
599
659
  title: i18next.t('title.sorting'),
600
660
  text: i18next.t('text.sorting_is_completed'),
601
- confirmButton: { text: i18next.t('button.complete') },
602
- cancelButton: { text: i18next.t('button.cancel') }
661
+ confirmButton: { text: i18next.t('button.complete') }
603
662
  })
604
663
  this._clearView()
605
664
  }
@@ -670,6 +729,7 @@ class SortingProduct extends connect(store)(localize(i18next)(PageView)) {
670
729
  this._selectedOrderInventory = null
671
730
  this._selectedTaskStatus = null
672
731
  this.serialInput.value = ''
732
+ this.toteNo = ''
673
733
  }
674
734
 
675
735
  _showToast({ type, message }) {