@things-factory/operato-wms 4.0.11 → 4.0.12

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 (159) hide show
  1. package/client/pages/adjustment/transfer-inventory.js +368 -165
  2. package/client/pages/bulk-operation/bulk-operation.js +316 -0
  3. package/client/pages/bulk-operation/validate-ro-popup.js +445 -0
  4. package/client/pages/components/select-product-popup.js +15 -2
  5. package/client/pages/constants/inventory.js +1 -0
  6. package/client/pages/constants/location.js +33 -6
  7. package/client/pages/constants/order.js +10 -0
  8. package/client/pages/constants/worksheet.js +2 -2
  9. package/client/pages/inbound/inbound-worksheet.js +78 -9
  10. package/client/pages/inbound/putaway-product.js +214 -139
  11. package/client/pages/inbound/putaway-worksheet-generate-popup.js +24 -2
  12. package/client/pages/inbound/unload-product.js +153 -61
  13. package/client/pages/inbound/worksheet-putaway-return.js +22 -5
  14. package/client/pages/inbound/worksheet-putaway.js +21 -8
  15. package/client/pages/inbound/worksheet-unloading-return.js +22 -5
  16. package/client/pages/inbound/worksheet-unloading.js +8 -0
  17. package/client/pages/inventory/inventory-adjustment-approval.js +11 -19
  18. package/client/pages/inventory/inventory-adjustment.js +88 -73
  19. package/client/pages/inventory/inventory-by-product-detail.js +3 -5
  20. package/client/pages/inventory/inventory-by-product.js +8 -0
  21. package/client/pages/inventory/inventory-history-by-pallet.js +12 -5
  22. package/client/pages/inventory/inventory-history.js +10 -0
  23. package/client/pages/inventory/onhand-inventory.js +11 -2
  24. package/client/pages/inventory-check/create-cycle-count.js +12 -6
  25. package/client/pages/inventory-check/cycle-count-report.js +8 -0
  26. package/client/pages/inventory-check/inspecting-product.js +146 -80
  27. package/client/pages/inventory-check/worksheet-cycle-count.js +14 -0
  28. package/client/pages/manifest/create-loading-manifest.js +314 -0
  29. package/client/pages/manifest/dispatcher-verification-popup.js +86 -0
  30. package/client/pages/manifest/loading-manifest-detail.js +345 -0
  31. package/client/pages/manifest/loading-manifest-list.js +305 -0
  32. package/client/pages/master/location-list.js +58 -17
  33. package/client/pages/master/product/product-detail-bizplace-setting-popup.js +2 -2
  34. package/client/pages/master/product/product-details-popup.js +2 -2
  35. package/client/pages/master/product/product-list.js +5 -5
  36. package/client/pages/order/arrival-notice/arrival-notice-detail.js +134 -115
  37. package/client/pages/order/arrival-notice/arrival-notice-list.js +87 -6
  38. package/client/pages/order/arrival-notice/arrival-notice-requests.js +83 -6
  39. package/client/pages/order/arrival-notice/assign-buffer-location.js +8 -1
  40. package/client/pages/order/arrival-notice/check-arrived-notice.js +9 -1
  41. package/client/pages/order/arrival-notice/create-arrival-notice.js +38 -3
  42. package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +290 -25
  43. package/client/pages/order/arrival-notice/edit-product-popup.js +36 -5
  44. package/client/pages/order/arrival-notice/receive-arrival-notice.js +8 -1
  45. package/client/pages/order/goods-received-note/received-note-list.js +138 -6
  46. package/client/pages/order/release-order/b2b/b2b-order-list.js +45 -5
  47. package/client/pages/order/release-order/b2b/b2b-order-requests.js +52 -12
  48. package/client/pages/order/release-order/b2c/b2c-order-requests.js +244 -24
  49. package/client/pages/order/release-order/bulk-print-packing-list.js +23 -0
  50. package/client/pages/order/release-order/create-release-order.js +55 -8
  51. package/client/pages/order/release-order/receive-release-order-request.js +35 -24
  52. package/client/pages/order/release-order/release-extra-product-popup.js +204 -63
  53. package/client/pages/order/release-order/release-order-detail.js +301 -74
  54. package/client/pages/order/return-order/check-return-order.js +9 -1
  55. package/client/pages/order/return-order/create-return-order.js +14 -2
  56. package/client/pages/order/return-order/receive-return-order-requests.js +9 -1
  57. package/client/pages/order/return-order/return-order-detail.js +15 -6
  58. package/client/pages/order/return-order/return-order-inventory-popup.js +7 -0
  59. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-detail.js +115 -50
  60. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-list.js +1 -6
  61. package/client/pages/order/reverse-kitting-order/reverse-kitting-pallet-label-popup.js +239 -0
  62. package/client/pages/order/transport-order/delivery-order-list.js +102 -59
  63. package/client/pages/outbound/inventory-assign-popup.js +23 -6
  64. package/client/pages/outbound/inventory-auto-assign-popup.js +22 -6
  65. package/client/pages/outbound/loading-product.js +4 -1
  66. package/client/pages/outbound/merged-outbound-worksheet.js +43 -1
  67. package/client/pages/outbound/packing-product.js +4 -1
  68. package/client/pages/outbound/packing-worksheet-list.js +39 -1
  69. package/client/pages/outbound/picking-product.js +803 -431
  70. package/client/pages/outbound/picking-replacement-popup.js +1 -1
  71. package/client/pages/outbound/serial-number-popup.js +280 -0
  72. package/client/pages/outbound/single-outbound-worksheet.js +47 -1
  73. package/client/pages/outbound/worksheet-batch-picking.js +22 -8
  74. package/client/pages/outbound/worksheet-loading.js +22 -5
  75. package/client/pages/outbound/worksheet-packing.js +8 -0
  76. package/client/pages/outbound/worksheet-picking.js +62 -8
  77. package/client/pages/outbound/worksheet-return.js +9 -1
  78. package/client/pages/outbound/worksheet-sorting.js +9 -1
  79. package/client/pages/report/custom-elccl/elccl-inventory-report.js +31 -30
  80. package/client/pages/report/custom-elccl/elccl-inventory-summary-report.js +23 -26
  81. package/client/pages/report/inventory-pallet-storage-report.js +11 -10
  82. package/client/pages/report/inventory-report.js +41 -43
  83. package/client/pages/report/inventory-summary-report.js +25 -28
  84. package/client/pages/report/product-label-report.js +401 -0
  85. package/client/pages/support/inventory-comparison.js +296 -0
  86. package/client/pages/vas/print-product-label.js +298 -132
  87. package/client/pages/vas/reverse-kitting/execute-reverse-kitting.js +32 -12
  88. package/client/pages/vas/reverse-kitting/popup-combination-sets.js +106 -10
  89. package/client/pages/vas/reverse-kitting/popup-reverse-kitting-template.js +130 -19
  90. package/client/pages/vas/vas-pallet-label-popup.js +5 -8
  91. package/client/route.js +28 -0
  92. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js +1 -1
  93. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js.map +1 -1
  94. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js +64 -54
  95. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js.map +1 -1
  96. package/dist-server/graphql/resolvers/extra/add-release-good-products.js +34 -9
  97. package/dist-server/graphql/resolvers/extra/add-release-good-products.js.map +1 -1
  98. package/dist-server/graphql/resolvers/index.js +5 -1
  99. package/dist-server/graphql/resolvers/index.js.map +1 -1
  100. package/dist-server/graphql/resolvers/inventory-comparison/index.js +6 -0
  101. package/dist-server/graphql/resolvers/inventory-comparison/index.js.map +1 -0
  102. package/dist-server/graphql/resolvers/inventory-comparison/inventory-comparison-list.js +78 -0
  103. package/dist-server/graphql/resolvers/inventory-comparison/inventory-comparison-list.js.map +1 -0
  104. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  105. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  106. package/dist-server/graphql/resolvers/reports/product-label-report.js +56 -0
  107. package/dist-server/graphql/resolvers/reports/product-label-report.js.map +1 -0
  108. package/dist-server/graphql/resolvers/shipping-provider/index.js +6 -0
  109. package/dist-server/graphql/resolvers/shipping-provider/index.js.map +1 -0
  110. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js +20 -0
  111. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js.map +1 -0
  112. package/dist-server/graphql/types/custom/elccl/elccl-inventory-report.js +1 -1
  113. package/dist-server/graphql/types/index.js +8 -2
  114. package/dist-server/graphql/types/index.js.map +1 -1
  115. package/dist-server/graphql/types/inventory-comparison/index.js +13 -0
  116. package/dist-server/graphql/types/inventory-comparison/index.js.map +1 -0
  117. package/dist-server/graphql/types/inventory-comparison/inventory-comparison-list.js +14 -0
  118. package/dist-server/graphql/types/inventory-comparison/inventory-comparison-list.js.map +1 -0
  119. package/dist-server/graphql/types/inventory-comparison/inventory-comparison.js +18 -0
  120. package/dist-server/graphql/types/inventory-comparison/inventory-comparison.js.map +1 -0
  121. package/dist-server/graphql/types/reports/index.js +6 -1
  122. package/dist-server/graphql/types/reports/index.js.map +1 -1
  123. package/dist-server/graphql/types/reports/product-label-report-list.js +14 -0
  124. package/dist-server/graphql/types/reports/product-label-report-list.js.map +1 -0
  125. package/dist-server/graphql/types/reports/product-label-report.js +16 -0
  126. package/dist-server/graphql/types/reports/product-label-report.js.map +1 -0
  127. package/dist-server/graphql/types/shipping-provider/index.js +10 -0
  128. package/dist-server/graphql/types/shipping-provider/index.js.map +1 -0
  129. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js +13 -0
  130. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js.map +1 -0
  131. package/dist-server/graphql/types/shipping-provider/shipping-provider.js +13 -0
  132. package/dist-server/graphql/types/shipping-provider/shipping-provider.js.map +1 -0
  133. package/package.json +65 -65
  134. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.ts +4 -2
  135. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.ts +75 -65
  136. package/server/graphql/resolvers/extra/add-release-good-products.ts +57 -15
  137. package/server/graphql/resolvers/index.ts +5 -1
  138. package/server/graphql/resolvers/inventory-comparison/index.ts +5 -0
  139. package/server/graphql/resolvers/inventory-comparison/inventory-comparison-list.ts +99 -0
  140. package/server/graphql/resolvers/reports/index.ts +3 -1
  141. package/server/graphql/resolvers/reports/product-label-report.ts +56 -0
  142. package/server/graphql/resolvers/shipping-provider/index.ts +5 -0
  143. package/server/graphql/resolvers/shipping-provider/shipping-providers.ts +20 -0
  144. package/server/graphql/types/custom/elccl/elccl-inventory-report.ts +1 -1
  145. package/server/graphql/types/index.ts +8 -2
  146. package/server/graphql/types/inventory-comparison/index.ts +11 -0
  147. package/server/graphql/types/inventory-comparison/inventory-comparison-list.ts +8 -0
  148. package/server/graphql/types/inventory-comparison/inventory-comparison.ts +12 -0
  149. package/server/graphql/types/reports/index.ts +6 -1
  150. package/server/graphql/types/reports/product-label-report-list.ts +8 -0
  151. package/server/graphql/types/reports/product-label-report.ts +10 -0
  152. package/server/graphql/types/shipping-provider/index.ts +8 -0
  153. package/server/graphql/types/shipping-provider/shipping-provider-list.ts +7 -0
  154. package/server/graphql/types/shipping-provider/shipping-provider.ts +7 -0
  155. package/things-factory.config.js +30 -0
  156. package/translations/en.json +91 -11
  157. package/translations/ko.json +109 -11
  158. package/translations/ms.json +111 -12
  159. package/translations/zh.json +123 -26
@@ -277,6 +277,12 @@ class ReceiveReturnOrderRequests extends connect(store)(localize(i18next)(PageVi
277
277
  header: i18next.t('field.product'),
278
278
  width: 150
279
279
  },
280
+ {
281
+ type: 'string',
282
+ name: 'brand',
283
+ header: i18next.t('field.brand'),
284
+ width: 150
285
+ },
280
286
  {
281
287
  type: 'string',
282
288
  name: 'packingType',
@@ -349,6 +355,7 @@ class ReceiveReturnOrderRequests extends connect(store)(localize(i18next)(PageVi
349
355
  name
350
356
  description
351
357
  sku
358
+ brand
352
359
  }
353
360
  productName
354
361
  packingType
@@ -381,7 +388,8 @@ class ReceiveReturnOrderRequests extends connect(store)(localize(i18next)(PageVi
381
388
  records: orderInventories.map(orderInventory => {
382
389
  return {
383
390
  ...orderInventory,
384
- sku: orderInventory.product.sku
391
+ sku: orderInventory.product.sku,
392
+ brand: orderInventory.product.brand
385
393
  }
386
394
  })
387
395
  }
@@ -227,11 +227,12 @@ class ReturnOrderDetail extends connect(store)(localize(i18next)(PageView)) {
227
227
  ]
228
228
  if (this._status === ORDER_STATUS.PENDING.value) {
229
229
  actions.push(
230
- {
231
- title: i18next.t('button.delete'),
232
- action: this._deleteReturnOrder.bind(this),
233
- ...CommonButtonStyles.delete
234
- },
230
+ // Issue with deletion, temporarily disable this feature
231
+ // {
232
+ // title: i18next.t('button.delete'),
233
+ // action: this._deleteReturnOrder.bind(this),
234
+ // ...CommonButtonStyles.delete
235
+ // },
235
236
  {
236
237
  title: i18next.t('button.confirm'),
237
238
  action: this._confirmReturnOrder.bind(this),
@@ -312,6 +313,12 @@ class ReturnOrderDetail extends connect(store)(localize(i18next)(PageView)) {
312
313
  header: i18next.t('field.product'),
313
314
  width: 150
314
315
  },
316
+ {
317
+ type: 'string',
318
+ name: 'brand',
319
+ header: i18next.t('field.brand'),
320
+ width: 150
321
+ },
315
322
  {
316
323
  type: 'string',
317
324
  name: 'packingType',
@@ -384,6 +391,7 @@ class ReturnOrderDetail extends connect(store)(localize(i18next)(PageView)) {
384
391
  name
385
392
  description
386
393
  sku
394
+ brand
387
395
  }
388
396
  productName
389
397
  packingType
@@ -417,7 +425,8 @@ class ReturnOrderDetail extends connect(store)(localize(i18next)(PageView)) {
417
425
  records: orderInventories.map(orderInventory => {
418
426
  return {
419
427
  ...orderInventory,
420
- sku: orderInventory.product.sku
428
+ sku: orderInventory.product.sku,
429
+ brand: orderInventory.product.brand
421
430
  }
422
431
  })
423
432
  }
@@ -154,6 +154,12 @@ class ReturnOrderInventoryPopup extends localize(i18next)(LitElement) {
154
154
  header: i18next.t('field.product_name'),
155
155
  width: 220
156
156
  },
157
+ {
158
+ type: 'string',
159
+ name: 'productBrand',
160
+ header: i18next.t('field.brand'),
161
+ width: 120
162
+ },
157
163
  {
158
164
  type: 'code',
159
165
  name: 'packingType',
@@ -233,6 +239,7 @@ class ReturnOrderInventoryPopup extends localize(i18next)(LitElement) {
233
239
  id
234
240
  }
235
241
  productName
242
+ productBrand
236
243
  packingType
237
244
  packingSize
238
245
  releaseUomValueWithUom
@@ -1,6 +1,8 @@
1
1
  import '@things-factory/biz-ui'
2
+ import '@things-factory/barcode-ui'
2
3
  import '@things-factory/grist-ui'
3
4
  import '@things-factory/product-ui'
5
+ import '../../order/reverse-kitting-order/reverse-kitting-pallet-label-popup'
4
6
 
5
7
  import gql from 'graphql-tag'
6
8
  import { css, html } from 'lit-element'
@@ -26,6 +28,12 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
26
28
  flex-direction: column;
27
29
  overflow-x: auto;
28
30
  }
31
+ .form-container {
32
+ display: flex;
33
+ }
34
+ .form-container > form {
35
+ flex: 1;
36
+ }
29
37
  .container {
30
38
  flex: 1;
31
39
  display: flex;
@@ -80,6 +88,7 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
80
88
  inventoryGristConfig: Object,
81
89
  inventoryData: Object,
82
90
  _bizplaces: Object,
91
+ _bizplace: Object,
83
92
  _bizplaceId: String,
84
93
  _bizplaceName: String,
85
94
  locationSortingRules: Object,
@@ -99,24 +108,28 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
99
108
 
100
109
  render() {
101
110
  return html`
102
- <form name="reverseKittingOrder" class="multi-column-form" autocomplete="off">
103
- <fieldset>
104
- <legend>${i18next.t('title.reverse_kitting_no')}: ${this._reverseKittingNo}</legend>
105
- <label>${i18next.t('label.company')}</label>
106
- <input type="hidden" name="bizplaceId" value="${this._bizplaceId}" />
107
- <input
108
- readonly
109
- type="text"
110
- name="bizplaceName"
111
- value="${this._bizplaceName}"
112
- @click="${this._openBizplacesSelector.bind(this)}"
113
- />
114
-
115
- ${this._reverseKittingNo != 'new'
116
- ? html`<label>${i18next.t('label.status')}</label><input readonly type="text" name="status" />`
117
- : ''}
118
- </fieldset>
119
- </form>
111
+ <div class="form-container">
112
+ <form name="reverseKittingOrder" class="multi-column-form" autocomplete="off">
113
+ <fieldset>
114
+ <legend>${i18next.t('title.reverse_kitting_no')}: ${this._reverseKittingNo}</legend>
115
+ <label>${i18next.t('label.company')}</label>
116
+ <input type="hidden" name="bizplaceId" value="${this._bizplaceId}" />
117
+ <input
118
+ readonly
119
+ type="text"
120
+ name="bizplaceName"
121
+ value="${this._bizplaceName}"
122
+ @click="${this._openBizplacesSelector.bind(this)}"
123
+ />
124
+
125
+ ${!this._newOrder
126
+ ? html`<label>${i18next.t('label.status')}</label><input readonly type="text" name="status" />`
127
+ : ''}
128
+ </fieldset>
129
+ </form>
130
+
131
+ ${!this._newOrder ? html`<barcode-tag bcid="qrcode" .value=${this._reverseKittingNo}></barcode-tag>` : ''}
132
+ </div>
120
133
  <div class="container">
121
134
  <div class="grist">
122
135
  <h2><mwc-icon>list_alt</mwc-icon>${i18next.t('title.target_products')}</h2>
@@ -188,12 +201,19 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
188
201
  ...CommonButtonStyles.activate
189
202
  }
190
203
  ]
204
+ } else if (this._status === ORDER_STATUS.EXECUTING.value) {
205
+ actions.push({
206
+ title: i18next.t('button.lot_label_print'),
207
+ action: this._openLotLabelPrintPopup.bind(this),
208
+ ...CommonButtonStyles.label
209
+ })
191
210
  }
192
211
  }
193
212
 
194
213
  return {
195
214
  title: i18next.t('title.reverse_kitting_order_detail'),
196
215
  actions,
216
+ printable: { accept: ['preview'], content: this },
197
217
  help: 'operato-wms/reverse-kitting-order/reverse-kitting-order-detail'
198
218
  }
199
219
  }
@@ -203,6 +223,8 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
203
223
  if (this.active) {
204
224
  if (changes.resourceId) {
205
225
  this._reverseKittingNo = changes.resourceId
226
+ } else {
227
+ this._reverseKittingNo = 'new'
206
228
  }
207
229
 
208
230
  this._newOrder = this._reverseKittingNo == 'new' ? true : false
@@ -226,7 +248,7 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
226
248
  }
227
249
 
228
250
  _configureInventoryGrist() {
229
- let editable = this._bizplaceId ? true : false
251
+ let editable = this._bizplaceId ? (this._newOrder ? true : false) : false
230
252
 
231
253
  this.inventoryGristConfig = {
232
254
  pagination: { infinite: true },
@@ -304,6 +326,7 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
304
326
  },
305
327
  width: 250
306
328
  },
329
+ { name: 'batchId', hidden: true },
307
330
  {
308
331
  type: 'string',
309
332
  name: 'productSKU',
@@ -452,9 +475,11 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
452
475
  if (!response.errors) {
453
476
  const bizplaces = response.data.partnersBizplaces.items
454
477
  if (bizplaces.length == 1) {
478
+ this._bizplace = bizplaces[0]
455
479
  this._bizplaceId = bizplaces[0].id
456
480
  this._bizplaceName = bizplaces[0].name
457
481
  } else {
482
+ this._bizplace = null
458
483
  this._bizplaceId = ''
459
484
  this._bizplaceName = ''
460
485
  }
@@ -481,6 +506,8 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
481
506
  description
482
507
  }
483
508
  orderReverseKittings {
509
+ id
510
+ name
484
511
  set
485
512
  targetType
486
513
  targetBatchId
@@ -535,6 +562,7 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
535
562
  return {
536
563
  ...orderReverseKitting,
537
564
  ...orderReverseKitting.inventory,
565
+ orderReverseKittingId: orderReverseKitting.id,
538
566
  productSKU: orderReverseKitting.inventory.product.sku,
539
567
  productName: orderReverseKitting.inventory.product.name,
540
568
  productCombination: this.displayProductCombination(JSON.parse(orderReverseKitting.operationGuide))
@@ -838,40 +866,77 @@ class ReverseKittingOrderDetail extends connect(store)(localize(i18next)(PageVie
838
866
  )
839
867
  }
840
868
 
869
+ _openLotLabelPrintPopup() {
870
+ const _pallets = {
871
+ records: this.inventoryData.records.map(record => {
872
+ const operationGuide = JSON.parse(record.operationGuide)
873
+ let qty = operationGuide.data.productCombinationSets?.length || 0
874
+
875
+ return {
876
+ id: record.orderReverseKittingId,
877
+ palletId: record.palletId,
878
+ batchId: record.batchId,
879
+ product: record.product,
880
+ qty,
881
+ printQty: qty,
882
+ packingType: record.packingType,
883
+ bizplace: this._bizplace
884
+ }
885
+ })
886
+ }
887
+ openPopup(
888
+ html` <reverse-kitting-pallet-label-popup .pallets="${_pallets}"></reverse-kitting-pallet-label-popup> `,
889
+ {
890
+ backdrop: true,
891
+ size: 'large',
892
+ title: i18next.t('title.lot_label')
893
+ }
894
+ )
895
+ }
896
+
841
897
  _openProductCombinations(columns, data, column, record, rowIndex) {
842
- if (record.inventory.product.id) {
843
- openPopup(
844
- html`
845
- <product-combination-selection-popup
846
- .productId="${record.inventory.product.id}"
847
- .packingType="${record.packingType}"
848
- .packingSize="${record.packingSize}"
849
- .bizplaceId="${this._bizplaceId}"
850
- @selected="${e => {
851
- const operationGuide = { data: { ...e.detail } }
852
-
853
- this.inventoryGrist.dirtyData.records = this.inventoryGrist.dirtyData.records.map(item => {
854
- if (item.id == record.id) {
855
- item.operationGuide = operationGuide
856
- item.productCombination = this.displayProductCombination(operationGuide)
857
- }
898
+ if (this._newOrder) {
899
+ if (record.inventory.product.id) {
900
+ openPopup(
901
+ html`
902
+ <product-combination-selection-popup
903
+ .productId="${record.inventory.product.id}"
904
+ .packingType="${record.packingType}"
905
+ .packingSize="${record.packingSize}"
906
+ .bizplaceId="${this._bizplaceId}"
907
+ @selected="${e => {
908
+ let operationGuide = { data: { ...e.detail } }
909
+ let productCombinationSets = operationGuide.data.productCombinationSets.map(item => {
910
+ return {
911
+ ...item,
912
+ qty: item.qty * record.qty
913
+ }
914
+ })
915
+ operationGuide.data.productCombinationSets = productCombinationSets
916
+
917
+ this.inventoryGrist.dirtyData.records = this.inventoryGrist.dirtyData.records.map(item => {
918
+ if (item.id == record.id) {
919
+ item.operationGuide = operationGuide
920
+ item.productCombination = this.displayProductCombination(operationGuide)
921
+ }
858
922
 
859
- return item
860
- })
923
+ return item
924
+ })
861
925
 
862
- this.inventoryData = {
863
- ...this.inventoryData,
864
- records: [...this.inventoryGrist.dirtyData.records]
865
- }
866
- }}"
867
- ></product-combination-selection-popup>
868
- `,
869
- {
870
- backdrop: true,
871
- size: 'large',
872
- title: `${record.productSKU}`
873
- }
874
- )
926
+ this.inventoryData = {
927
+ ...this.inventoryData,
928
+ records: [...this.inventoryGrist.dirtyData.records]
929
+ }
930
+ }}"
931
+ ></product-combination-selection-popup>
932
+ `,
933
+ {
934
+ backdrop: true,
935
+ size: 'large',
936
+ title: `${record.productSKU}`
937
+ }
938
+ )
939
+ }
875
940
  }
876
941
  }
877
942
 
@@ -122,12 +122,7 @@ class ReverseKittingOrderList extends localize(i18next)(PageView) {
122
122
  icon: 'reorder',
123
123
  handlers: {
124
124
  click: (columns, data, column, record, rowIndex) => {
125
- const status = record.status
126
- if (status === ORDER_STATUS.REJECTED.value) {
127
- navigate(`rejected_vas_order/${record.name}`) // 1. move to rejected detail page
128
- } else {
129
- navigate(`reverse_kitting_order_detail/${record.name}`)
130
- }
125
+ navigate(`reverse_kitting_order_detail/${record.name}`)
131
126
  }
132
127
  }
133
128
  },
@@ -0,0 +1,239 @@
1
+ import '@things-factory/grist-ui'
2
+
3
+ import gql from 'graphql-tag'
4
+ import { css, html, LitElement } from 'lit-element'
5
+ import { connect } from 'pwa-helpers/connect-mixin'
6
+
7
+ import { DirectPrinter } from '@things-factory/barcode-base'
8
+ import { i18next, localize } from '@things-factory/i18n-base'
9
+ import { client, store } from '@things-factory/shell'
10
+ import { isMobileDevice } from '@things-factory/utils'
11
+
12
+ import { PALLET_LABEL_SETTING_KEY } from '../../constants'
13
+
14
+ class ReverseKittingPalletLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
15
+ static get properties() {
16
+ return {
17
+ config: Object,
18
+ data: Object,
19
+ pallets: Object,
20
+ _palletLabel: Object
21
+ }
22
+ }
23
+
24
+ static get styles() {
25
+ return [
26
+ css`
27
+ :host {
28
+ padding: 10px;
29
+ display: flex;
30
+ flex-direction: column;
31
+ overflow-x: overlay;
32
+ background-color: var(--main-section-background-color);
33
+ }
34
+ .grist {
35
+ background-color: var(--main-section-background-color);
36
+ display: flex;
37
+ flex-direction: column;
38
+ flex: 1;
39
+ overflow-y: auto;
40
+ }
41
+ data-grist {
42
+ overflow-y: hidden;
43
+ flex: 1;
44
+ }
45
+ .button-container {
46
+ padding: var(--button-container-padding);
47
+ margin: var(--button-container-margin);
48
+ text-align: var(--button-container-align);
49
+ background-color: var(--button-container-background);
50
+ height: var(--button-container-height);
51
+ }
52
+ `
53
+ ]
54
+ }
55
+
56
+ firstUpdated() {
57
+ this.config = {
58
+ pagination: { infinite: true },
59
+ rows: { selectable: { multiple: true }, appendable: false },
60
+ list: { fields: ['batchId', 'palletQty', 'printQty'] },
61
+ columns: [
62
+ { type: 'gutter', gutterName: 'sequence' },
63
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
64
+ {
65
+ type: 'string',
66
+ name: 'batchId',
67
+ header: i18next.t('field.batch_id'),
68
+ width: 150
69
+ },
70
+ {
71
+ type: 'object',
72
+ name: 'product',
73
+ header: i18next.t('field.product'),
74
+ width: 250
75
+ },
76
+ {
77
+ type: 'integer',
78
+ name: 'qty',
79
+ header: i18next.t('field.qty'),
80
+ width: 80
81
+ },
82
+ {
83
+ type: 'integer',
84
+ name: 'printQty',
85
+ header: i18next.t('field.print_qty'),
86
+ record: { editable: true },
87
+ width: 80
88
+ }
89
+ ]
90
+ }
91
+ }
92
+
93
+ get dataGrist() {
94
+ return this.shadowRoot.querySelector('data-grist')
95
+ }
96
+
97
+ render() {
98
+ return html`
99
+ <div class="grist">
100
+ <data-grist
101
+ id="grist"
102
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
103
+ .config=${this.config}
104
+ .data="${this.data}"
105
+ ></data-grist>
106
+ </div>
107
+
108
+ <div class="button-container">
109
+ <mwc-button raised @click="${this._printLabel.bind(this)}" label="${i18next.t('button.print')}"></mwc-button>
110
+ </div>
111
+ `
112
+ }
113
+
114
+ updated(changeProps) {
115
+ if (changeProps.has('pallets')) {
116
+ if (this.pallets && this.pallets.records && this.pallets.records.length) {
117
+ this.data = {
118
+ records: this.pallets.records.map(record => {
119
+ return {
120
+ ...record,
121
+ startSeq: 1
122
+ }
123
+ })
124
+ }
125
+ }
126
+ }
127
+ }
128
+
129
+ async _printLabel() {
130
+ try {
131
+ let labelId = this._palletLabel && this._palletLabel.id
132
+ let dateStr = new Date().toJSON().slice(0, 10).replace(/-/g, '/')
133
+ let _targetRows = this._validate()
134
+ const palletRuleType = 'vas_pallet_id' // pallet id rule type
135
+ const targets = _targetRows.map(target => {
136
+ return {
137
+ id: target.id,
138
+ printQty: target.printQty
139
+ }
140
+ })
141
+
142
+ const response = await client.query({
143
+ query: gql`
144
+ query generateReverseKittingPalletId($targets: [PalletInfo], $type: String!) {
145
+ generateReverseKittingPalletId(targets: $targets, type: $type) {
146
+ product {
147
+ sku
148
+ name
149
+ type
150
+ description
151
+ movement
152
+ auxUnit1
153
+ auxValue1
154
+ }
155
+ bizplace {
156
+ name
157
+ }
158
+ batchId
159
+ batchIdRef
160
+ packingType
161
+ palletId
162
+ remark
163
+ }
164
+ }
165
+ `,
166
+ variables: { targets, type: palletRuleType }
167
+ })
168
+
169
+ if (!response.errors) {
170
+ const results = response.data.generateReverseKittingPalletId
171
+
172
+ for (let i = 0; i < results.length; i++) {
173
+ let searchParams = new URLSearchParams()
174
+
175
+ searchParams.append('pallet', results[i].palletId)
176
+ searchParams.append('batch', results[i].batchId)
177
+ searchParams.append('product', results[i].product?.name)
178
+ searchParams.append('sku', results[i].product?.sku)
179
+ searchParams.append('auxUnit1', results[i].product?.auxUnit1)
180
+ searchParams.append('auxValue1', results[i].product?.auxValue1)
181
+ searchParams.append('type', results[i].product?.type)
182
+ searchParams.append('description', results[i].product?.description)
183
+ searchParams.append('packing', results[i].packingType)
184
+ searchParams.append('customer', results[i].bizplace?.name)
185
+ searchParams.append('date', dateStr)
186
+ searchParams.append('remark', results[i].remark)
187
+ searchParams.append('batchRef', results[i].batchIdRef)
188
+ searchParams.append('expirationDate', '')
189
+ try {
190
+ const response = await fetch(`label-command/${labelId}?${searchParams.toString()}`, {
191
+ method: 'GET'
192
+ })
193
+
194
+ if (response.status !== 200) {
195
+ throw `Error : Can't get label command from server (response: ${response.status})`
196
+ }
197
+
198
+ let command = await response.text()
199
+
200
+ if (!this.printer) {
201
+ this.printer = new DirectPrinter()
202
+ }
203
+
204
+ await this.printer.print(command)
205
+ } catch (ex) {
206
+ delete this.printer
207
+ throw ex
208
+ }
209
+ }
210
+ }
211
+ } catch (e) {
212
+ this._showToast(e)
213
+ }
214
+ }
215
+
216
+ _validate() {
217
+ let _targetRows = this.dataGrist.selected.length > 0 ? this.dataGrist.selected : this.dataGrist.dirtyData.records
218
+ if (!_targetRows.every(row => row.printQty)) throw new Error(i18next.t('text.print_qty_is_empty'))
219
+ return _targetRows
220
+ }
221
+
222
+ stateChanged(state) {
223
+ let palletLabelSetting = state.dashboard[PALLET_LABEL_SETTING_KEY]
224
+ this._palletLabel = (palletLabelSetting && palletLabelSetting.board) || {}
225
+ }
226
+
227
+ _showToast({ type, message }) {
228
+ document.dispatchEvent(
229
+ new CustomEvent('notify', {
230
+ detail: {
231
+ type,
232
+ message
233
+ }
234
+ })
235
+ )
236
+ }
237
+ }
238
+
239
+ window.customElements.define('reverse-kitting-pallet-label-popup', ReverseKittingPalletLabelPopup)