@things-factory/operato-wms 4.0.30 → 4.0.31

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 (33) hide show
  1. package/client/pages/bulk-operation/bulk-operation.js +25 -14
  2. package/client/pages/bulk-operation/validate-gan-popup.js +5 -4
  3. package/client/pages/bulk-operation/validate-ro-popup.js +7 -39
  4. package/client/pages/components/popup-reusable-pallet.js +145 -0
  5. package/client/pages/components/worksheet-information-popup.js +4 -1
  6. package/client/pages/inbound/unload-product.js +116 -91
  7. package/client/pages/inventory/onhand-inventory.js +1 -0
  8. package/client/pages/order/arrival-notice/arrival-notice-detail.js +16 -0
  9. package/client/pages/order/release-order/batch-picking-popup.js +1 -1
  10. package/client/pages/order/release-order/create-release-order.js +1 -1
  11. package/client/pages/order/release-order/release-extra-product-popup.js +3 -0
  12. package/client/pages/order/release-order/release-order-detail.js +4 -4
  13. package/client/pages/order/return-order/create-return-order.js +41 -52
  14. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-detail.js +2 -2
  15. package/client/pages/order/transport-order/create-delivery-order.js +4 -2
  16. package/client/pages/outbound/picking-product.js +3 -2
  17. package/client/pages/report/custom-elccl/elccl-inventory-summary-report.js +5 -1
  18. package/client/pages/report/inbound-order-details-report.js +3 -5
  19. package/client/pages/vas/reverse-kitting/execute-reverse-kitting.js +3 -3
  20. package/client/pages/vas/reverse-kitting/popup-combination-sets.js +3 -3
  21. package/client/pages/vas/reverse-kitting/popup-reverse-kitting-template.js +1 -1
  22. package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js +2 -4
  23. package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js.map +1 -1
  24. package/dist-server/graphql/types/reports/inbound-order-details-report.js +2 -1
  25. package/dist-server/graphql/types/reports/inbound-order-details-report.js.map +1 -1
  26. package/package.json +64 -64
  27. package/server/graphql/resolvers/reports/inbound-order-details-report.ts +2 -4
  28. package/server/graphql/types/reports/inbound-order-details-report.ts +2 -1
  29. package/translations/en.json +14 -1
  30. package/translations/ko.json +19 -7
  31. package/translations/ms.json +20 -8
  32. package/translations/zh.json +20 -8
  33. package/client/pages/components/popup-unloading.js +0 -610
@@ -2,17 +2,11 @@ import '@things-factory/biz-ui'
2
2
  import './validate-gan-popup'
3
3
  import './validate-ro-popup'
4
4
 
5
- import {
6
- css,
7
- html
8
- } from 'lit-element'
5
+ import { css, html } from 'lit-element'
9
6
  import XLSX from 'xlsx'
10
7
 
11
8
  import { MultiColumnFormStyles } from '@things-factory/form-ui'
12
- import {
13
- i18next,
14
- localize
15
- } from '@things-factory/i18n-base'
9
+ import { i18next, localize } from '@things-factory/i18n-base'
16
10
  import { openPopup } from '@things-factory/layout-base'
17
11
  import { PageView } from '@things-factory/shell'
18
12
 
@@ -368,9 +362,9 @@ class BulkOperation extends localize(i18next)(PageView) {
368
362
  containerSize: String(raw.containerSize || ''),
369
363
  sku: String(raw.sku || ''),
370
364
  batchId: String(raw.batchId || ''),
371
- packingType: String(raw.packingType || ''),
372
- packingSize: Number(raw.packingSize || 0),
373
- uom: String(raw.uom || ''),
365
+ packingType: raw.packingType && raw.packingType != '' ? String(raw.packingType) : null,
366
+ packingSize: !isNaN(Number(raw.packingSize || 'x')) ? Number(raw.packingSize) : null,
367
+ uom: raw.uom && raw.uom != '' ? String(raw.uom) : null,
374
368
  packQty: parseInt(raw.packQty || 0),
375
369
  palletQty: parseInt(raw.palletQty || 0),
376
370
  unitPrice: Number(raw.unitPrice || 0),
@@ -399,10 +393,27 @@ class BulkOperation extends localize(i18next)(PageView) {
399
393
  let releaseDate = new Date(String(record.releaseDate || ''))
400
394
 
401
395
  return {
402
- ...record,
403
- packingSize: Number(record.packingSize),
396
+ refNo: String(record.refNo || ''),
397
+ refNo2: String(record.refNo2 || ''),
398
+ refNo3: String(record.refNo3 || ''),
399
+ releaseDate: this._getStdDateStr(releaseDate),
400
+ deliveryAddress1: String(record.deliveryAddress1 || ''),
401
+ deliveryAddress2: String(record.deliveryAddress2 || ''),
402
+ deliveryAddress3: String(record.deliveryAddress3 || ''),
403
+ deliveryAddress4: String(record.deliveryAddress4 || ''),
404
+ attentionTo: String(record.attentionTo || ''),
405
+ city: String(record.city || ''),
406
+ state: String(record.state || ''),
407
+ country: String(record.country || ''),
408
+ sku: String(record.sku || ''),
409
+ productId: String(record.productId || ''),
410
+ packingType: record.packingType && record.packingType != '' ? String(record.packingType) : null,
411
+ packingSize: !isNaN(Number(record.packingSize || 'x')) ? Number(record.packingSize) : null,
412
+ uom: record.uom && record.uom != '' ? String(record.uom) : null,
404
413
  releaseQty: Number(record.releaseQty),
405
- releaseDate: this._getStdDateStr(releaseDate)
414
+ postalCode: String(record.postalCode),
415
+ phone1: String(record.phone1),
416
+ exportOption: false
406
417
  }
407
418
  })}
408
419
  .bizplaceId=${this._roBizplaceId}
@@ -83,7 +83,8 @@ class ValidateGanPopup extends localize(i18next)(LitElement) {
83
83
  icon: 'close',
84
84
  handlers: {
85
85
  click: (columns, data, column, record, rowIndex) => {
86
- this.records = [...data.records.filter((_, idx) => idx !== rowIndex)]
86
+ data.records.splice(rowIndex, 1)
87
+ this.records = data.records
87
88
  }
88
89
  }
89
90
  },
@@ -205,8 +206,8 @@ class ValidateGanPopup extends localize(i18next)(LitElement) {
205
206
  },
206
207
  {
207
208
  type: 'string',
208
- name: 'remark',
209
- header: i18next.t('field.remark'),
209
+ name: 'errorMsg',
210
+ header: i18next.t('field.error_message'),
210
211
  width: 350
211
212
  }
212
213
  ]
@@ -284,7 +285,7 @@ class ValidateGanPopup extends localize(i18next)(LitElement) {
284
285
  palletQty
285
286
  unitPrice
286
287
  manufactureYear
287
- remark
288
+ errorMsg
288
289
  }
289
290
  }
290
291
  `,
@@ -12,15 +12,9 @@ import { isMobileDevice } from '@things-factory/utils'
12
12
  class ValidateRoPopup extends localize(i18next)(LitElement) {
13
13
  static get properties() {
14
14
  return {
15
- _oiConfig: Object,
16
15
  _roConfig: Object,
17
- _selectedRoIndex: Number,
18
- _selectedRoRecord: Object,
19
16
  bizplaceId: String,
20
- importHandler: Object,
21
- oiConfig: Object,
22
- records: Array,
23
- roConfig: Object
17
+ records: Array
24
18
  }
25
19
  }
26
20
 
@@ -89,7 +83,8 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
89
83
  icon: 'close',
90
84
  handlers: {
91
85
  click: (columns, data, column, record, rowIndex) => {
92
- this.records = [...data.records.filter((_, idx) => idx !== rowIndex)]
86
+ data.records.splice(rowIndex, 1)
87
+ this.records = data.records
93
88
  }
94
89
  }
95
90
  },
@@ -270,7 +265,7 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
270
265
 
271
266
  async firstUpdated() {
272
267
  this._roConfig = this._config
273
- await this._getAvailableItems(this.records)
268
+ await this._getAvailableItems(this.records, this.bizplaceId)
274
269
  }
275
270
 
276
271
  updated(changedProps) {
@@ -282,7 +277,7 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
282
277
  }
283
278
  }
284
279
 
285
- async _getAvailableItems(rawData) {
280
+ async _getAvailableItems(rawReleaseGoods, bizplaceId) {
286
281
  const response = await client.query({
287
282
  query: gql`
288
283
  query bulkReleaseGoodsAvailableItems($rawReleaseGoods: [NewReleaseGood!], $bizplaceId: String!) {
@@ -315,34 +310,7 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
315
310
  }
316
311
  }
317
312
  `,
318
- variables: {
319
- rawReleaseGoods: rawData.map(raw => {
320
- return {
321
- refNo: raw.refNo,
322
- refNo2: raw.refNo2,
323
- refNo3: raw.refNo3,
324
- releaseDate: String(raw.releaseDate),
325
- deliveryAddress1: raw.deliveryAddress1,
326
- deliveryAddress2: raw.deliveryAddress2,
327
- deliveryAddress3: raw.deliveryAddress3,
328
- deliveryAddress4: raw.deliveryAddress4,
329
- attentionTo: raw.attentionTo,
330
- city: raw.city,
331
- state: raw.state,
332
- country: raw.country,
333
- sku: raw.sku,
334
- productId: raw.productId,
335
- packingType: raw.packingType,
336
- packingSize: raw.packingSize,
337
- uom: raw.uom,
338
- releaseQty: raw.releaseQty,
339
- postalCode: String(raw.postalCode),
340
- phone1: String(raw.phone1),
341
- exportOption: false
342
- }
343
- }),
344
- bizplaceId: this.bizplaceId
345
- }
313
+ variables: { rawReleaseGoods, bizplaceId }
346
314
  })
347
315
 
348
316
  if (!response.errors) {
@@ -403,7 +371,7 @@ class ValidateRoPopup extends localize(i18next)(LitElement) {
403
371
  if (insufficientStockError) {
404
372
  // if system suddenly found that any item is insufficient,
405
373
  // display the available items again.
406
- await this._getAvailableItems(this.records)
374
+ await this._getAvailableItems(this.records, this.bizplaceId)
407
375
  this._showToast({ message: i18next.t('text.please_recheck_your_request_data') })
408
376
  }
409
377
  }
@@ -0,0 +1,145 @@
1
+ import { i18next, localize } from '@things-factory/i18n-base'
2
+ import { css, html, LitElement } from 'lit-element'
3
+ import { SingleColumnFormStyles } from '@things-factory/form-ui'
4
+ import { client } from '@things-factory/shell'
5
+ import { PALLET_STATUS } from '../constants'
6
+ import gql from 'graphql-tag'
7
+
8
+ class PopupReusablePallet extends localize(i18next)(LitElement) {
9
+ static get properties() {
10
+ return {
11
+ label: String,
12
+ value: String,
13
+ reusablePalletInput: String,
14
+ _reusablePallet: Object
15
+ }
16
+ }
17
+
18
+ static get styles() {
19
+ return [
20
+ SingleColumnFormStyles,
21
+ css`
22
+ :host {
23
+ display: flex;
24
+ flex-direction: column;
25
+ overflow-x: overlay;
26
+ background-color: var(--main-section-background-color);
27
+ }
28
+ .container {
29
+ display: flex;
30
+ flex-direction: column;
31
+ flex: 1;
32
+ }
33
+ .container > barcode-scannable-input {
34
+ flex: 1;
35
+ resize: none;
36
+ border-color: var(--primary-color);
37
+ padding: 5px;
38
+ margin: 10px;
39
+ outline: none;
40
+ }
41
+ .button-container {
42
+ padding: var(--button-container-padding);
43
+ margin: var(--button-container-margin);
44
+ text-align: var(--button-container-align);
45
+ background-color: var(--button-container-background);
46
+ height: var(--button-container-height);
47
+ }
48
+ `
49
+ ]
50
+ }
51
+
52
+ get reusablePalletInput() {
53
+ return this.shadowRoot
54
+ .querySelector('barcode-scanable-input[name=reusablePalletId]')
55
+ .shadowRoot.querySelector('input')
56
+ }
57
+
58
+ firstUpdated() {}
59
+
60
+ updated(changedProps) {}
61
+
62
+ render() {
63
+ return html`
64
+ <div class="container">
65
+ <form id="input-form" class="single-column-form">
66
+ <fieldset>
67
+ <label>${this.label}</label>
68
+ <barcode-scanable-input
69
+ name="reusablePalletId"
70
+ custom-input
71
+ without-enter
72
+ @keypress="${async e => {
73
+ if (e.keyCode !== 13) return
74
+ e.preventDefault()
75
+ await this._verifyInput()
76
+ }}"
77
+ ></barcode-scanable-input>
78
+ </fieldset>
79
+ </form>
80
+ </div>
81
+ <div class="button-container">
82
+ <mwc-button
83
+ raised
84
+ @click="${async () => await this._verifyInput()}"
85
+ label="${i18next.t('button.confirm')}"
86
+ ></mwc-button>
87
+ </div>
88
+ }
89
+ `
90
+ }
91
+
92
+ async _verifyInput() {
93
+ if (!this.reusablePalletInput.value) return this._showToast({ message: i18next.t('text.reusable_pallet_id_empty') })
94
+
95
+ if (!(await this._isReusablePallet())) return this._showToast({ message: i18next.t('text.not_a_reusable_pallet') })
96
+
97
+ this._showToast({
98
+ message: `${i18next.t('text.now_using_reusable_pallet')} ${this.reusablePalletInput.value}`
99
+ })
100
+ this.dispatchEvent(
101
+ new CustomEvent('submit', {
102
+ detail: { reusablePallet: this._reusablePallet }
103
+ })
104
+ )
105
+ history.back()
106
+ }
107
+
108
+ async _isReusablePallet() {
109
+ try {
110
+ const response = await client.query({
111
+ query: gql`
112
+ query palletByStatus($name: String!, $status: String!) {
113
+ palletByStatus(name: $name, status: $status) {
114
+ id
115
+ name
116
+ }
117
+ }
118
+ `,
119
+ variables: { name: this.reusablePalletInput.value, status: PALLET_STATUS.ACTIVE.value }
120
+ })
121
+
122
+ if (response.data.palletByStatus) {
123
+ this._reusablePallet = response.data.palletByStatus
124
+ return true
125
+ }
126
+
127
+ return false
128
+ } catch (e) {
129
+ this._showToast(e)
130
+ }
131
+ }
132
+
133
+ _showToast({ type, message }) {
134
+ document.dispatchEvent(
135
+ new CustomEvent('notify', {
136
+ detail: {
137
+ type,
138
+ message
139
+ }
140
+ })
141
+ )
142
+ }
143
+ }
144
+
145
+ window.customElements.define('popup-reusable-pallet', PopupReusablePallet)
@@ -66,6 +66,9 @@ class WorksheetInformationPopup extends connect(store)(localize(i18next)(LitElem
66
66
 
67
67
  <label>${i18next.t('label.started_at')}</label>
68
68
  <input name="startedAt" type="datetime-local" readonly />
69
+
70
+ <label>${i18next.t('label.plastic_pallet')}</label>
71
+ <input name="plasticPallet" readonly />
69
72
  </fieldset>
70
73
  </form>
71
74
  `
@@ -83,7 +86,7 @@ class WorksheetInformationPopup extends connect(store)(localize(i18next)(LitElem
83
86
  } else if (field.name === key && field.type === 'datetime-local') {
84
87
  const datetime = Number(data[key])
85
88
  const timezoneOffset = new Date(datetime).getTimezoneOffset() * 60000
86
- field.value = new Date(datetime - timezoneOffset).toISOString().slice(0, -1)
89
+ field.value = new Date(datetime - timezoneOffset).toISOString().slice(0, -1).split('.')[0]
87
90
  } else if (field.name === key) {
88
91
  if (data[key] instanceof Object) {
89
92
  const objectData = data[key]
@@ -1,7 +1,7 @@
1
1
  import '@things-factory/barcode-ui'
2
2
  import '@things-factory/grist-ui'
3
3
  import '../components/popup-note'
4
- import '../components/popup-unloading'
4
+ import '../components/popup-reusable-pallet'
5
5
  import './palletizing-pallets-popup'
6
6
  import '../components/worksheet-information-popup'
7
7
  import './unloaded-inventories-popup'
@@ -21,12 +21,14 @@ import { CommonButtonStyles } from '@things-factory/styles'
21
21
  import { isMobileDevice } from '@things-factory/utils'
22
22
 
23
23
  import { fetchSettingRule } from '../../fetch-setting-value'
24
- import { ARRIVAL_NOTICE, PALLET_STATUS, RETURN_ORDER, VAS_TYPE } from '../constants'
24
+ import { ARRIVAL_NOTICE, RETURN_ORDER, VAS_TYPE } from '../constants'
25
25
 
26
26
  const AVAIL_ORDER_TYPES = { ARRIVAL_NOTICE, RETURN_ORDER }
27
27
  class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
28
28
  static get properties() {
29
29
  return {
30
+ _worksheetLoaded: Boolean,
31
+ _usingReusablePallet: Boolean,
30
32
  _bizplaceName: String,
31
33
  _cartonId: String,
32
34
  _enableProductScanning: Boolean,
@@ -36,11 +38,9 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
36
38
  _isLooseItem: Boolean,
37
39
  _isQtyChecked: Boolean,
38
40
  _isRequiredCheckExpiry: Boolean,
39
- _isReusablePallet: Boolean,
40
41
  _orderNo: String,
41
42
  _palletId: String,
42
- _reusablePalletId: Array,
43
- _reusablePalletIdData: Object,
43
+ _reusablePallet: Object,
44
44
  _scanning: Boolean,
45
45
  _selectedOrderProduct: Object,
46
46
  _selectedInventory: Object,
@@ -108,6 +108,22 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
108
108
 
109
109
  get context() {
110
110
  var actions = []
111
+ if (this._worksheetLoaded && !this._enableCartonLabel) {
112
+ if (this._usingReusablePallet) {
113
+ actions.push({
114
+ title: i18next.t('button.wooden_pallet'),
115
+ action: this._woodenPalletMode.bind(this),
116
+ ...CommonButtonStyles.activate
117
+ })
118
+ } else {
119
+ actions.push({
120
+ title: i18next.t('button.plastic_pallet'),
121
+ action: this._reusablePalletMode.bind(this),
122
+ ...CommonButtonStyles.activate
123
+ })
124
+ }
125
+ }
126
+
111
127
  if (this._isLooseItem) {
112
128
  actions.push({
113
129
  title: i18next.t('button.vas'),
@@ -290,6 +306,8 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
290
306
 
291
307
  constructor() {
292
308
  super()
309
+ this._worksheetLoaded = false
310
+ this._usingReusablePallet = false
293
311
  this._enableCartonLabel = false
294
312
  this._enableInputQty = true
295
313
  this._enableProductScanning = false
@@ -297,7 +315,6 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
297
315
  this._isLooseItem = false
298
316
  this._isQtyChecked = false
299
317
  this._isRequiredCheckExpiry = false
300
- this._isReusablePallet = false
301
318
  this._orderNo = ''
302
319
  this._scanning = false
303
320
  this.refOrderType = AVAIL_ORDER_TYPES.ARRIVAL_NOTICE.value
@@ -310,7 +327,8 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
310
327
  if (
311
328
  changedProps.has('_orderNo') ||
312
329
  changedProps.has('_selectedOrderProduct') ||
313
- changedProps.has('_unloadedInventories')
330
+ changedProps.has('_unloadedInventories') ||
331
+ changedProps.has('_usingReusablePallet')
314
332
  ) {
315
333
  this.updateContext()
316
334
  }
@@ -547,6 +565,7 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
547
565
  })
548
566
 
549
567
  if (!response.errors) {
568
+ this._worksheetLoaded = true
550
569
  const worksheetInfo = response.data.unloadingWorksheet.worksheetInfo
551
570
  const orderVasInfo = worksheetInfo.orderVas
552
571
 
@@ -648,7 +667,6 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
648
667
  if (!response.errors) {
649
668
  this._orderNo = orderNo
650
669
  const worksheetInfo = response.data.unloadingReturnWorksheet.worksheetInfo
651
- this._fillUpForm(this.infoForm, worksheetInfo)
652
670
 
653
671
  this.orderProductData = {
654
672
  records: orderBy(
@@ -766,22 +784,15 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
766
784
  }
767
785
 
768
786
  async _transactionHandler(e) {
769
- if (e.keyCode === 13) {
770
- e.preventDefault()
771
- try {
772
- if (this._enableCartonLabel) {
773
- await this._validateUnloading()
774
- if (this._enableProductScanning && !this._enableInputQty) {
775
- this._scanProductUnload()
776
- } else {
777
- this._qtyUnload()
778
- }
779
- } else {
780
- this._checkReusablePallet()
781
- }
782
- } catch (e) {
783
- this._showToast(e)
784
- }
787
+ if (e.keyCode !== 13) return
788
+ e.preventDefault()
789
+ try {
790
+ if (!this._enableCartonLabel) return this._unloadSelected()
791
+ await this._validateUnloading()
792
+ if (!(this._enableProductScanning && !this._enableInputQty)) return this._qtyUnload()
793
+ this._scanProductUnload()
794
+ } catch (e) {
795
+ this._showToast(e)
785
796
  }
786
797
  }
787
798
 
@@ -839,50 +850,48 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
839
850
  }
840
851
  }
841
852
 
842
- async _qtyUnload() {
843
- if (this._scanning === false) {
844
- this._scanning = true
845
- try {
846
- if (this._isRequiredCheckExpiry && this._expirationPeriod > 0) {
847
- let date = new Date()
848
- const acceptBefore = new Date(date.setDate(date.getDate() + this._expirationPeriod))
849
- let expiryDate = new Date(this.expDateInput.value)
850
- if (expiryDate < acceptBefore) {
851
- await CustomAlert({
852
- title: i18next.t('title.item_unloading_is_expiring_soon'),
853
- confirmButton: { text: i18next.t('button.confirm') }
854
- })
855
- }
856
- }
857
-
858
- const response = await client.mutate({
859
- mutation: gql`
860
- mutation unload($worksheetDetailName: String!, $inventory: InventoryPatch!, $productBarcode: String) {
861
- unload(worksheetDetailName: $worksheetDetailName, inventory: $inventory, productBarcode: $productBarcode)
862
- }
863
- `,
864
- variables: {
865
- worksheetDetailName: this._selectedOrderProduct.name,
866
- inventory: {
867
- palletId: this._enableCartonLabel ? null : this.lotInput.value.trim(),
868
- cartonId: this._enableCartonLabel ? this.cartonInput.value.trim() : null,
869
- qty: parseInt(this.actualQtyInput.value),
870
- expirationDate: this._isRequiredCheckExpiry ? this.expDateInput.value : null
871
- },
872
- productBarcode: this._enableProductScanning ? this.productBarcodeInput?.value : null
873
- }
853
+ async _checkExpiry() {
854
+ if (this._isRequiredCheckExpiry && this._expirationPeriod > 0) {
855
+ let date = new Date()
856
+ const acceptBefore = new Date(date.setDate(date.getDate() + this._expirationPeriod))
857
+ let expiryDate = new Date(this.expDateInput.value)
858
+ if (expiryDate < acceptBefore) {
859
+ await CustomAlert({
860
+ title: i18next.t('title.item_unloading_is_expiring_soon'),
861
+ confirmButton: { text: i18next.t('button.confirm') }
874
862
  })
875
- if (!response.errors) {
876
- await this._fetchProducts(this._orderNo)
877
- }
878
- } catch (e) {
879
- this._showToast(e)
880
863
  }
864
+ }
865
+ }
881
866
 
882
- this._scanning = false
883
- } else {
884
- this._showToast({ message: i18next.t('text.previous_scan_is_executing') })
867
+ async _qtyUnload() {
868
+ if (this._scanning) return this._showToast({ message: i18next.t('text.previous_scan_is_executing') })
869
+ this._scanning = true
870
+ await this._checkExpiry()
871
+ try {
872
+ const response = await client.mutate({
873
+ mutation: gql`
874
+ mutation unload($worksheetDetailName: String!, $inventory: InventoryPatch!, $productBarcode: String) {
875
+ unload(worksheetDetailName: $worksheetDetailName, inventory: $inventory, productBarcode: $productBarcode)
876
+ }
877
+ `,
878
+ variables: {
879
+ worksheetDetailName: this._selectedOrderProduct.name,
880
+ inventory: {
881
+ palletId: this._enableCartonLabel ? null : this.lotInput.value.trim(),
882
+ cartonId: this._enableCartonLabel ? this.cartonInput.value.trim() : null,
883
+ qty: parseInt(this.actualQtyInput.value),
884
+ expirationDate: this._isRequiredCheckExpiry ? this.expDateInput.value : null,
885
+ reusablePallet: this._usingReusablePallet ? this._reusablePallet : null
886
+ },
887
+ productBarcode: this._enableProductScanning ? this.productBarcodeInput?.value : null
888
+ }
889
+ })
890
+ if (!response.errors) await this._fetchProducts(this._orderNo)
891
+ } catch (e) {
892
+ this._showToast(e)
885
893
  }
894
+ this._scanning = false
886
895
  }
887
896
 
888
897
  async fetchProductDetail(gtin, productId) {
@@ -1017,7 +1026,7 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1017
1026
 
1018
1027
  if (this._isRequiredCheckExpiry) {
1019
1028
  if (!this.expDateInput.value) {
1020
- this._focusOnExipryDateInput()
1029
+ this._focusOnExpiryDateInput()
1021
1030
  throw new Error(i18next.t('text.expiry_date_is_empty'))
1022
1031
  }
1023
1032
  }
@@ -1045,7 +1054,7 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1045
1054
 
1046
1055
  if (this._isRequiredCheckExpiry) {
1047
1056
  if (!this.expDateInput.value) {
1048
- this._focusOnExipryDateInput()
1057
+ this._focusOnExpiryDateInput()
1049
1058
  throw new Error(i18next.t('text.expiry_date_is_empty'))
1050
1059
  }
1051
1060
  }
@@ -1248,33 +1257,13 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1248
1257
  }
1249
1258
  }
1250
1259
 
1251
- async _checkReusablePallet() {
1260
+ async _unloadSelected() {
1252
1261
  try {
1253
1262
  if (!this._selectedOrderProduct) throw new Error(i18next.t('text.target_is_not_selected'))
1254
1263
  if (!this.lotInput.value) return
1255
-
1256
- const response = await client.query({
1257
- query: gql`
1258
- query palletByStatus($name: String!, $status: String!) {
1259
- palletByStatus(name: $name, status: $status) {
1260
- id
1261
- name
1262
- }
1263
- }
1264
- `,
1265
- variables: { name: this.lotInput.value, status: PALLET_STATUS.ACTIVE.value }
1266
- })
1267
-
1268
- if (!response.errors) {
1269
- if (response.data.palletByStatus) {
1270
- this.reusablePalletIdData = response.data.palletByStatus
1271
- this._isReusablePallet = true
1272
- } else {
1273
- await this._validateUnloading()
1274
- await this._checkedLotScannedProduct()
1275
- this._qtyUnload()
1276
- }
1277
- }
1264
+ await this._validateUnloading()
1265
+ await this._checkedLotScannedProduct()
1266
+ this._qtyUnload()
1278
1267
  } catch (e) {
1279
1268
  this._showToast(e)
1280
1269
  }
@@ -1316,6 +1305,42 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1316
1305
  }
1317
1306
  )
1318
1307
  }
1308
+ _reusablePalletMode() {
1309
+ openPopup(
1310
+ html`
1311
+ <popup-reusable-pallet
1312
+ .label="${i18next.t('label.reusable_pallet_id')}"
1313
+ @submit=${async e => {
1314
+ this._usingReusablePallet = true
1315
+ this._reusablePallet = e.detail.reusablePallet
1316
+ this._worksheetInfo.plasticPallet = this._reusablePallet.name
1317
+ this.updateContext()
1318
+ }}
1319
+ ></popup-reusable-pallet>
1320
+ `,
1321
+ {
1322
+ backdrop: true,
1323
+ escapable: false,
1324
+ size: 'small',
1325
+ title: i18next.t('title.unloading_with_reusable_pallet')
1326
+ }
1327
+ )
1328
+ }
1329
+
1330
+ async _woodenPalletMode() {
1331
+ const result = await CustomAlert({
1332
+ title: i18next.t('title.are_you_sure'),
1333
+ text: i18next.t('text.use_wooden_pallet'),
1334
+ confirmButton: { text: i18next.t('button.confirm') },
1335
+ cancelButton: { text: i18next.t('button.cancel') }
1336
+ })
1337
+
1338
+ if (!result.value) return
1339
+ this._usingReusablePallet = false
1340
+ this._reusablePalletName = this._worksheetInfo.plasticPallet = ''
1341
+ this._showToast({ message: i18next.t('text.now_using_wooden_pallet') })
1342
+ this.updateContext()
1343
+ }
1319
1344
 
1320
1345
  _validateComplete() {
1321
1346
  if (this.refOrderType === AVAIL_ORDER_TYPES.ARRIVAL_NOTICE.value) {
@@ -1381,7 +1406,7 @@ class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
1381
1406
  setTimeout(() => this.actualQtyInput.focus(), 100)
1382
1407
  }
1383
1408
 
1384
- _focusOnExipryDateInput() {
1409
+ _focusOnExpiryDateInput() {
1385
1410
  setTimeout(() => this.expDateInput.focus(), 100)
1386
1411
  }
1387
1412
 
@@ -479,6 +479,7 @@ class OnhandInventory extends connect(store)(localize(i18next)(PageView)) {
479
479
  { header: i18next.t('field.company'), key: 'bizplace_name', width: 30, type: 'string' },
480
480
  { header: i18next.t('field.sku_code'), key: 'product_sku', width: 25, type: 'string' },
481
481
  { header: i18next.t('field.product'), key: 'product_name', width: 40, type: 'string' },
482
+ { header: i18next.t('field.brand'), key: 'product_brand', width: 25, type: 'string' },
482
483
  { header: i18next.t('field.product_description'), key: 'product_description', width: 50, type: 'string' },
483
484
  { header: i18next.t('field.packing_type'), key: 'packingType', width: 20, type: 'string' },
484
485
  { header: i18next.t('field.qty'), key: 'remainQty', width: 15, type: 'string' },