@things-factory/operato-wms 4.0.21 → 4.0.25

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 (44) hide show
  1. package/client/bootstrap.js +13 -6
  2. package/client/pages/adjustment/transfer-inventory.js +32 -6
  3. package/client/pages/bulk-operation/bulk-operation.js +189 -64
  4. package/client/pages/bulk-operation/validate-gan-popup.js +391 -0
  5. package/client/pages/bulk-operation/validate-ro-popup.js +52 -22
  6. package/client/pages/components/popup-unloading.js +47 -34
  7. package/client/pages/components/select-product-popup.js +74 -27
  8. package/client/pages/components/worksheet-information-popup.js +100 -0
  9. package/client/pages/inbound/putaway-product.js +184 -231
  10. package/client/pages/inbound/undo-unload-popup.js +295 -0
  11. package/client/pages/inbound/unload-product.js +229 -567
  12. package/client/pages/inbound/unloaded-inventories-popup.js +129 -0
  13. package/client/pages/inbound/worksheet-unloading.js +15 -11
  14. package/client/pages/inventory/inventory-adjustment.js +9 -10
  15. package/client/pages/master/product/product-list.js +1 -1
  16. package/client/pages/order/arrival-notice/arrival-notice-detail.js +409 -21
  17. package/client/pages/order/arrival-notice/create-arrival-notice.js +89 -13
  18. package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +90 -10
  19. package/client/pages/order/arrival-notice/edit-product-popup.js +2 -2
  20. package/client/pages/order/release-order/b2b/b2b-order-list.js +78 -2
  21. package/client/pages/order/release-order/b2b/b2b-order-requests.js +32 -16
  22. package/client/pages/order/release-order/b2c/b2c-order-requests.js +49 -5
  23. package/client/pages/order/release-order/batch-generate-single-picking-worksheet-popup.js +314 -0
  24. package/client/pages/order/release-order/batch-picking-popup.js +19 -2
  25. package/client/pages/order/release-order/create-release-order.js +194 -89
  26. package/client/pages/order/release-order/release-order-detail.js +390 -107
  27. package/client/pages/order/return-order/create-return-order.js +3 -3
  28. package/client/pages/order/transport-order/create-delivery-order.js +1 -1
  29. package/client/pages/order/transport-order/delivery-order-list.js +1 -1
  30. package/client/pages/outbound/packing-product.js +111 -236
  31. package/client/pages/outbound/picking-product.js +287 -380
  32. package/client/pages/outbound/sorting-product.js +66 -63
  33. package/client/pages/outbound/worksheet-loading.js +7 -3
  34. package/client/pages/outbound/worksheet-packing.js +3 -3
  35. package/client/pages/outbound/worksheet-picking.js +22 -18
  36. package/client/pages/vas/print-product-label.js +17 -9
  37. package/dist-server/graphql/resolvers/reports/product-label-report.js +1 -0
  38. package/dist-server/graphql/resolvers/reports/product-label-report.js.map +1 -1
  39. package/package.json +65 -65
  40. package/server/graphql/resolvers/reports/product-label-report.ts +1 -0
  41. package/translations/en.json +31 -2
  42. package/translations/ko.json +32 -3
  43. package/translations/ms.json +32 -3
  44. package/translations/zh.json +32 -3
@@ -0,0 +1,391 @@
1
+ import '@material/mwc-button/mwc-button'
2
+ import '@things-factory/grist-ui'
3
+
4
+ import gql from 'graphql-tag'
5
+ import { css, html, LitElement } from 'lit-element'
6
+
7
+ import { i18next, localize } from '@things-factory/i18n-base'
8
+ import { client, CustomAlert } from '@things-factory/shell'
9
+ import { ScrollbarStyles } from '@things-factory/styles'
10
+ import { isMobileDevice, sleep } from '@things-factory/utils'
11
+
12
+ class ValidateGanPopup extends localize(i18next)(LitElement) {
13
+ static get properties() {
14
+ return {
15
+ _ganConfig: Object,
16
+ bizplaceId: String,
17
+ records: Array
18
+ }
19
+ }
20
+
21
+ static get styles() {
22
+ return [
23
+ ScrollbarStyles,
24
+ css`
25
+ :host {
26
+ display: flex;
27
+ flex-direction: column;
28
+ overflow: hidden;
29
+ background-color: white;
30
+
31
+ --grid-record-emphasized-background-color: #ffdbdb;
32
+ --grid-record-emphasized-color: #703f3f;
33
+ }
34
+
35
+ .grist {
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
+ h2 {
46
+ padding: var(--subtitle-padding);
47
+ font: var(--subtitle-font);
48
+ color: var(--subtitle-text-color);
49
+ border-bottom: var(--subtitle-border-bottom);
50
+ }
51
+ .button-container {
52
+ display: flex;
53
+ margin-left: auto;
54
+ }
55
+ .button-container > mwc-button {
56
+ padding: 10px;
57
+ }
58
+ `
59
+ ]
60
+ }
61
+
62
+ get dataGrist() {
63
+ return this.shadowRoot.querySelector('data-grist')
64
+ }
65
+
66
+ get _config() {
67
+ return {
68
+ list: {},
69
+ pagination: { infinite: true },
70
+ rows: {
71
+ appendable: false,
72
+ classifier: (record, rowIndex) => {
73
+ return {
74
+ emphasized: record.remark && record.remark != ''
75
+ }
76
+ }
77
+ },
78
+ columns: [
79
+ { type: 'gutter', gutterName: 'sequence' },
80
+ {
81
+ type: 'gutter',
82
+ gutterName: 'button',
83
+ icon: 'close',
84
+ handlers: {
85
+ click: (columns, data, column, record, rowIndex) => {
86
+ this.records = [...data.records.filter((_, idx) => idx !== rowIndex)]
87
+ }
88
+ }
89
+ },
90
+ { type: 'string', name: 'productId', hidden: true },
91
+ { type: 'string', name: 'productDetailId', hidden: true },
92
+ {
93
+ type: 'string',
94
+ name: 'refNo',
95
+ header: i18next.t('field.ref_no'),
96
+ width: 150
97
+ },
98
+ {
99
+ type: 'string',
100
+ name: 'refNo2',
101
+ header: i18next.t('field.ref_no_2'),
102
+ width: 150
103
+ },
104
+ {
105
+ type: 'string',
106
+ name: 'refNo3',
107
+ header: i18next.t('field.ref_no_3'),
108
+ width: 150
109
+ },
110
+ {
111
+ type: 'string',
112
+ name: 'etaDate',
113
+ header: i18next.t('field.eta_date'),
114
+ width: 150
115
+ },
116
+ {
117
+ type: 'string',
118
+ name: 'truckNo',
119
+ header: i18next.t('field.truck_no'),
120
+ width: 150
121
+ },
122
+ {
123
+ type: 'string',
124
+ name: 'containerNo',
125
+ header: i18next.t('field.container_no'),
126
+ width: 150
127
+ },
128
+ {
129
+ type: 'string',
130
+ name: 'containerSize',
131
+ header: i18next.t('field.container_size'),
132
+ width: 150
133
+ },
134
+ {
135
+ type: 'boolean',
136
+ name: 'looseItem',
137
+ header: i18next.t('field.loose_item'),
138
+ width: 150
139
+ },
140
+ {
141
+ type: 'boolean',
142
+ name: 'importCargo',
143
+ header: i18next.t('field.import_cargo'),
144
+ width: 150
145
+ },
146
+ {
147
+ type: 'string',
148
+ name: 'sku',
149
+ header: i18next.t('field.sku'),
150
+ width: 150
151
+ },
152
+ {
153
+ type: 'string',
154
+ name: 'productInfo',
155
+ header: i18next.t('field.product_info'),
156
+ width: 400
157
+ },
158
+ {
159
+ type: 'string',
160
+ name: 'batchId',
161
+ header: i18next.t('field.batch_no'),
162
+ width: 150
163
+ },
164
+ {
165
+ type: 'integer',
166
+ name: 'packQty',
167
+ header: i18next.t('field.pack_qty'),
168
+ width: 150
169
+ },
170
+ {
171
+ type: 'float',
172
+ name: 'uomValue',
173
+ header: i18next.t('field.uom_value'),
174
+ width: 150
175
+ },
176
+ {
177
+ type: 'string',
178
+ name: 'totalUomValue',
179
+ header: i18next.t('field.total_uom_value'),
180
+ width: 150
181
+ },
182
+ {
183
+ type: 'string',
184
+ name: 'uom',
185
+ header: i18next.t('field.uom'),
186
+ width: 100
187
+ },
188
+ {
189
+ type: 'integer',
190
+ name: 'palletQty',
191
+ header: i18next.t('field.pallet_qty'),
192
+ width: 100
193
+ },
194
+ {
195
+ type: 'float',
196
+ name: 'unitPrice',
197
+ header: i18next.t('field.unit_price'),
198
+ width: 100
199
+ },
200
+ {
201
+ type: 'integer',
202
+ name: 'manufactureYear',
203
+ header: i18next.t('field.manufacture_year'),
204
+ width: 100
205
+ },
206
+ {
207
+ type: 'string',
208
+ name: 'remark',
209
+ header: i18next.t('field.remark'),
210
+ width: 350
211
+ }
212
+ ]
213
+ }
214
+ }
215
+
216
+ render() {
217
+ return html`
218
+ <div class="grist">
219
+ <data-grist .mode=${isMobileDevice() ? 'LIST' : 'GRID'} .config=${this._ganConfig}></data-grist>
220
+ </div>
221
+
222
+ <div class="button-container">
223
+ <mwc-button
224
+ @click=${async () => {
225
+ const answer = await CustomAlert({
226
+ title: i18next.t('label.create_arrival_notices'),
227
+ text: i18next.t('text.are_you_sure'),
228
+ confirmButton: { text: i18next.t('button.confirm') },
229
+ cancelButton: { text: i18next.t('button.cancel') }
230
+ })
231
+
232
+ if (!answer.value) return
233
+ await this._generateArrivalNotices(this.records, this.bizplaceId)
234
+ }}
235
+ >${i18next.t('button.create_gan')}</mwc-button
236
+ >
237
+ <mwc-button @click=${e => history.back()}>${i18next.t('button.cancel')}</mwc-button>
238
+ </div>
239
+ `
240
+ }
241
+
242
+ async firstUpdated() {
243
+ this._ganConfig = this._config
244
+ await this._getValidatedArrivalNoticeItems(this.records, this.bizplaceId)
245
+ }
246
+
247
+ updated(changedProps) {
248
+ if (changedProps.has('records')) {
249
+ this.dataGrist.data = {
250
+ records: this.records,
251
+ total: this.records.length
252
+ }
253
+ }
254
+ }
255
+
256
+ async _getValidatedArrivalNoticeItems(rawArrivalNotices, bizplaceId) {
257
+ try {
258
+ const response = await client.query({
259
+ query: gql`
260
+ query validateBulkArrivalNotices($rawArrivalNotices: [NewArrivalNotice!], $bizplaceId: String!) {
261
+ validateBulkArrivalNotices(rawArrivalNotices: $rawArrivalNotices, bizplaceId: $bizplaceId) {
262
+ refNo
263
+ refNo2
264
+ refNo3
265
+ etaDate
266
+ truckNo
267
+ ownTransport
268
+ containerNo
269
+ containerSize
270
+ container
271
+ looseItem
272
+ importCargo
273
+ productId
274
+ productDetailId
275
+ sku
276
+ productInfo
277
+ batchId
278
+ packingType
279
+ packingSize
280
+ uom
281
+ packQty
282
+ uomValue
283
+ totalUomValue
284
+ palletQty
285
+ unitPrice
286
+ manufactureYear
287
+ remark
288
+ }
289
+ }
290
+ `,
291
+ variables: { rawArrivalNotices, bizplaceId }
292
+ })
293
+
294
+ if (!response.errors) {
295
+ this.records = response.data.validateBulkArrivalNotices
296
+ }
297
+ } catch (e) {
298
+ console.error(e)
299
+ }
300
+ }
301
+
302
+ async _generateArrivalNotices(rawArrivalNotices, bizplaceId) {
303
+ this.dataGrist.showSpinner()
304
+
305
+ try {
306
+ this._validateArrivalNotices()
307
+
308
+ const response = await client.mutate({
309
+ mutation: gql`
310
+ mutation bulkGenerateArrivalNotices($rawArrivalNotices: [NewArrivalNotice!], $bizplaceId: String!) {
311
+ bulkGenerateArrivalNotices(rawArrivalNotices: $rawArrivalNotices, bizplaceId: $bizplaceId) {
312
+ items {
313
+ name
314
+ }
315
+ }
316
+ }
317
+ `,
318
+ variables: {
319
+ rawArrivalNotices: rawArrivalNotices.map(raw => {
320
+ return {
321
+ refNo: raw.refNo,
322
+ refNo2: raw.refNo2,
323
+ refNo3: raw.refNo3,
324
+ etaDate: raw.etaDate,
325
+ truckNo: raw.truckNo,
326
+ ownTransport: !!raw.truckNo || false,
327
+ looseItem: !!raw.looseItem || false,
328
+ importCargo: !!raw.importCargo || false,
329
+ container: (!!raw.containerNo && !!raw.containerSize) || false,
330
+ containerNo: raw.containerNo,
331
+ containerSize: raw.containerSize,
332
+ sku: raw.sku,
333
+ batchId: raw.batchId,
334
+ packingType: raw.packingType,
335
+ packingSize: raw.packingSize,
336
+ uom: raw.uom,
337
+ packQty: raw.packQty,
338
+ palletQty: raw.palletQty,
339
+ unitPrice: raw.unitPrice,
340
+ manufactureYear: raw.manufactureYear
341
+ }
342
+ }),
343
+ bizplaceId
344
+ }
345
+ })
346
+
347
+ if (!response.errors) {
348
+ this._showToast({ message: i18next.t('text.arrival_notices_created') })
349
+ history.back()
350
+ } else {
351
+ let invalidDataError = response.errors.find(err => err.extensions.exception.errorCode == 'ivd1')
352
+ if (invalidDataError) {
353
+ this.records = JSON.parse(invalidDataError.extensions.exception.detail.data)
354
+ this._showToast({ message: i18next.t('text.please_recheck_your_request_data') })
355
+ }
356
+ }
357
+ } catch (e) {
358
+ this._showToast(e)
359
+ } finally {
360
+ this.dataGrist.hideSpinner()
361
+ await sleep(1)
362
+ }
363
+ }
364
+
365
+ _validateArrivalNotices() {
366
+ if (this.records.some(record => record.remark && record.remark != '')) {
367
+ throw new Error(i18next.t('text.please_recheck_your_request_data'))
368
+ }
369
+ }
370
+
371
+ _getStdDateStr(date) {
372
+ if (isNaN(date.getFullYear())) return ''
373
+ else {
374
+ date.setHours(date.getHours() + 8)
375
+ return date.toISOString().split('T')[0]
376
+ }
377
+ }
378
+
379
+ _showToast({ type, message }) {
380
+ document.dispatchEvent(
381
+ new CustomEvent('notify', {
382
+ detail: {
383
+ type,
384
+ message
385
+ }
386
+ })
387
+ )
388
+ }
389
+ }
390
+
391
+ window.customElements.define('validate-gan-popup', ValidateGanPopup)
@@ -7,7 +7,7 @@ import { css, html, LitElement } from 'lit-element'
7
7
  import { i18next, localize } from '@things-factory/i18n-base'
8
8
  import { client, CustomAlert } from '@things-factory/shell'
9
9
  import { ScrollbarStyles } from '@things-factory/styles'
10
- import { isMobileDevice, sleep } from '@things-factory/utils'
10
+ import { isMobileDevice } from '@things-factory/utils'
11
11
 
12
12
  class ValidateRoPopup extends localize(i18next)(LitElement) {
13
13
  static get properties() {
@@ -79,11 +79,11 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
79
79
  return {
80
80
  // if the condition not met, the grist row will be red
81
81
  emphasized:
82
- record.assignedQty <= 0 ||
82
+ record.assignedQty < record.releaseQty ||
83
83
  !record.refNo ||
84
84
  record?.refNo == '' ||
85
- !record.releaseDate ||
86
- record?.releaseDate == ''
85
+ record?.releaseDate == '' ||
86
+ record?.releaseDate < this._getStdDateStr(new Date())
87
87
  }
88
88
  }
89
89
  },
@@ -192,8 +192,8 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
192
192
  },
193
193
  {
194
194
  type: 'string',
195
- name: 'name',
196
- header: i18next.t('field.name'),
195
+ name: 'productInfo',
196
+ header: i18next.t('field.product_info'),
197
197
  width: 400
198
198
  },
199
199
  {
@@ -226,6 +226,18 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
226
226
  header: i18next.t('field.uom'),
227
227
  width: 100
228
228
  },
229
+ {
230
+ type: 'string',
231
+ name: 'packingType',
232
+ header: i18next.t('field.packing_type'),
233
+ width: 100
234
+ },
235
+ {
236
+ type: 'string',
237
+ name: 'packingSize',
238
+ header: i18next.t('field.packing_size'),
239
+ width: 100
240
+ },
229
241
  {
230
242
  type: 'string',
231
243
  name: 'remark',
@@ -295,6 +307,7 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
295
307
  country
296
308
  sku
297
309
  productId
310
+ productInfo
298
311
  batchId
299
312
  packingType
300
313
  packingSize
@@ -338,16 +351,21 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
338
351
 
339
352
  if (!response.errors) {
340
353
  this.records = response.data.bulkReleaseGoodsAvailableItems.map(item => {
354
+ let releaseDate = this._getStdDateStr(new Date(item.releaseDate || ''))
355
+
341
356
  return {
342
357
  ...item,
358
+ releaseDate,
343
359
  remark: !item.productId
344
360
  ? i18next.t('text.product_not_found')
345
361
  : item.releaseQty <= 0
346
362
  ? i18next.t('text.invalid_release_qty')
347
- : item.assignedQty == 0
363
+ : item.assignedQty < item.releaseQty
348
364
  ? i18next.t('text.insufficient_stock')
349
- : !item.releaseDate
365
+ : releaseDate == ''
350
366
  ? i18next.t('text.release_date_is_empty')
367
+ : releaseDate < this._getStdDateStr(new Date())
368
+ ? i18next.t('text.backdate_is_not_allowed')
351
369
  : !item.refNo
352
370
  ? i18next.t('text.ref_no_is_empty')
353
371
  : ''
@@ -374,11 +392,12 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
374
392
  `,
375
393
  variables: {
376
394
  rawReleaseGoods: this.records.map(x => {
395
+ // list out all properties again to avoid additional props added by user in excel
377
396
  return {
378
397
  refNo: x.refNo,
379
398
  refNo2: x.refNo2,
380
399
  refNo3: x.refNo3,
381
- releaseDate: String(x.releaseDate),
400
+ releaseDate: x.releaseDate,
382
401
  deliveryAddress1: x.deliveryAddress1,
383
402
  deliveryAddress2: x.deliveryAddress2,
384
403
  deliveryAddress3: x.deliveryAddress3,
@@ -401,21 +420,22 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
401
420
  }
402
421
  })
403
422
 
404
- this.dataGrist.hideSpinner()
405
- await sleep(1)
406
-
407
423
  if (!response.errors) {
408
424
  this._showToast({ message: i18next.t('text.release_order_created') })
409
425
  history.back()
426
+ } else {
427
+ let insufficientStockError = response.errors.find(err => err.extensions.exception.errorCode == 'ins1')
428
+ if (insufficientStockError) {
429
+ // if system suddenly found that any item is insufficient,
430
+ // display the available items again.
431
+ await this._getAvailableItems(this.records)
432
+ this._showToast({ message: i18next.t('text.please_recheck_your_request_data') })
433
+ }
410
434
  }
411
435
  } catch (e) {
412
- let insufficientStockError = response.errors.find(err => err.extensions.exception.errorCode == 'ins1')
413
- if (insufficientStockError) {
414
- // if system suddenly found that any item is insufficient,
415
- // display the available items again.
416
- await this._getAvailableItems(this.records)
417
- this._showToast({ message: i18next.t('text.please_recheck_your_request_data') })
418
- } else this._showToast(e)
436
+ this._showToast(e)
437
+ } finally {
438
+ this.dataGrist.hideSpinner()
419
439
  }
420
440
  }
421
441
 
@@ -423,11 +443,21 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
423
443
  if (this.records.some(record => !record.refNo || record?.refNo == ''))
424
444
  throw new Error(i18next.t('text.ref_no_is_required'))
425
445
 
426
- if (this.records.some(record => !record.releaseDate || record?.releaseDate == ''))
427
- throw new Error(i18next.t('text.release_date_is_required'))
428
-
429
446
  if (this.records.some(record => !record.releaseQty || record.releaseQty > record.assignedQty))
430
447
  throw new Error(i18next.t('text.invalid_release_qty'))
448
+
449
+ if (this.records.some(record => record?.releaseDate == ''))
450
+ throw new Error(i18next.t('text.release_date_is_required'))
451
+ else if (this.records.some(record => record.releaseDate < this._getStdDateStr(new Date())))
452
+ throw new Error(i18next.t('text.backdate_is_not_allowed'))
453
+ }
454
+
455
+ _getStdDateStr(date) {
456
+ if (isNaN(date.getFullYear())) return ''
457
+ else {
458
+ date.setHours(date.getHours() + 8)
459
+ return date.toISOString().split('T')[0]
460
+ }
431
461
  }
432
462
 
433
463
  _showToast({ type, message }) {
@@ -2,7 +2,7 @@ import '@things-factory/barcode-ui'
2
2
  import { i18next, localize } from '@things-factory/i18n-base'
3
3
  import { css, html, LitElement } from 'lit-element'
4
4
  import '@things-factory/grist-ui'
5
- import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
5
+ import { isMobileDevice } from '@things-factory/utils'
6
6
  import { client, CustomAlert, store, UPDATE_CONTEXT } from '@things-factory/shell'
7
7
  import { MultiColumnFormStyles, SingleColumnFormStyles } from '@things-factory/form-ui'
8
8
  import gql from 'graphql-tag'
@@ -12,6 +12,8 @@ class PopupUnloading extends localize(i18next)(LitElement) {
12
12
  return {
13
13
  title: String,
14
14
  ganNo: String,
15
+ orderType: String,
16
+ orderNo: String,
15
17
  reusablePallet: String,
16
18
  _productName: String,
17
19
  _productSku: String,
@@ -118,6 +120,10 @@ class PopupUnloading extends localize(i18next)(LitElement) {
118
120
  return this.shadowRoot.querySelector('#unloading-grist')
119
121
  }
120
122
 
123
+ get unloadedGrist() {
124
+ return this.shadowRoot.querySelector('#unloaded-grist')
125
+ }
126
+
121
127
  get reusablePalletInput() {
122
128
  return this.shadowRoot.querySelector('input[name=reusablePalletID]')
123
129
  }
@@ -359,10 +365,8 @@ class PopupUnloading extends localize(i18next)(LitElement) {
359
365
  async _fetchProducts(arrivalNoticeNo) {
360
366
  const response = await client.query({
361
367
  query: gql`
362
- query {
363
- unloadingWorksheet(${gqlBuilder.buildArgs({
364
- arrivalNoticeNo
365
- })}) {
368
+ query unloadingWorksheet($arrivalNoticeNo: String!) {
369
+ unloadingWorksheet(arrivalNoticeNo: $arrivalNoticeNo) {
366
370
  worksheetInfo {
367
371
  bizplaceName
368
372
  containerNo
@@ -391,7 +395,8 @@ class PopupUnloading extends localize(i18next)(LitElement) {
391
395
  }
392
396
  }
393
397
  }
394
- `
398
+ `,
399
+ variables: { arrivalNoticeNo }
395
400
  })
396
401
 
397
402
  if (!response.errors) {
@@ -413,11 +418,12 @@ class PopupUnloading extends localize(i18next)(LitElement) {
413
418
 
414
419
  const response = await client.query({
415
420
  query: gql`
416
- query {
417
- unloadedInventoriesByReusablePallet(${gqlBuilder.buildArgs({
418
- reusablePalletId: this.reusablePallet,
419
- worksheetDetailName: this._selectedOrderProduct.name
420
- })}) {
421
+ query unloadedInventoriesByReusablePallet($reusablePalletId: String!, $worksheetDetailName: String!) {
422
+ unloadedInventoriesByReusablePallet(
423
+ reusablePalletId: $reusablePalletId
424
+ worksheetDetailName: $worksheetDetailName
425
+ ) {
426
+ id
421
427
  batchId
422
428
  palletId
423
429
  qty
@@ -432,7 +438,11 @@ class PopupUnloading extends localize(i18next)(LitElement) {
432
438
  }
433
439
  }
434
440
  }
435
- `
441
+ `,
442
+ variables: {
443
+ reusablePalletId: this.reusablePallet,
444
+ worksheetDetailName: this._selectedOrderProduct.name
445
+ }
436
446
  })
437
447
 
438
448
  if (!response.errors) {
@@ -461,20 +471,21 @@ class PopupUnloading extends localize(i18next)(LitElement) {
461
471
  if (e.keyCode === 13) {
462
472
  try {
463
473
  this._validateUnloading()
464
- const response = await client.query({
465
- query: gql`
466
- mutation {
467
- unload(${gqlBuilder.buildArgs({
468
- worksheetDetailName: this._selectedOrderProduct.name,
469
- inventory: {
470
- palletId: this.palletInput.value.trim(),
471
- qty: parseInt(this.actualQtyInput.value),
472
- reusablePallet: this.reusablePalletData,
473
- expirationDate: this.expDateInput.value
474
- }
475
- })})
474
+ const response = await client.mutate({
475
+ mutation: gql`
476
+ mutation unload($worksheetDetailName: String!, $inventory: InventoryPatch!) {
477
+ unload(worksheetDetailName: $worksheetDetailName, inventory: $inventory)
476
478
  }
477
- `
479
+ `,
480
+ variables: {
481
+ worksheetDetailName: this._selectedOrderProduct.name,
482
+ inventory: {
483
+ palletId: this.palletInput.value.trim(),
484
+ qty: parseInt(this.actualQtyInput.value),
485
+ reusablePallet: this.reusablePalletData,
486
+ expirationDate: this.expDateInput.value
487
+ }
488
+ }
478
489
  })
479
490
 
480
491
  if (!response.errors) {
@@ -546,15 +557,17 @@ class PopupUnloading extends localize(i18next)(LitElement) {
546
557
  return
547
558
  }
548
559
 
549
- const response = await client.query({
550
- query: gql`
551
- mutation {
552
- undoUnloading(${gqlBuilder.buildArgs({
553
- worksheetDetailName: this._selectedOrderProduct.name,
554
- palletId: this._selectedInventory.palletId
555
- })})
556
- }
557
- `
560
+ const response = await client.mutate({
561
+ mutation: gql`
562
+ mutation undoUnloading($orderType: String!, $worksheetDetailName: String!, $selectedId: [String]!) {
563
+ undoUnloading(orderType: $orderType, orderNo: $worksheetDetailName, inventoryIds: $selectedId)
564
+ }
565
+ `,
566
+ variables: {
567
+ orderType: this.orderType,
568
+ worksheetDetailName: this.orderNo,
569
+ selectedId: this._selectedInventory.id
570
+ }
558
571
  })
559
572
 
560
573
  if (!response.errors) {