@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
@@ -1,20 +1,24 @@
1
+ import '@things-factory/barcode-base'
2
+ import '@things-factory/notification'
3
+
4
+ import gql from 'graphql-tag'
5
+ import { html } from 'lit-element'
6
+
7
+ import { registerDefaultGroups } from '@operato/board/dist/src/component/register-default-groups'
1
8
  import { APPEND_APP_TOOL } from '@things-factory/apptool-base'
2
9
  import { auth } from '@things-factory/auth-base'
3
- import '@things-factory/barcode-base'
4
10
  import { setAuthManagementMenus } from '@things-factory/auth-ui'
5
- import { TOOL_POSITION, VIEWPART_POSITION, appendViewpart, toggleOverlay } from '@things-factory/layout-base'
11
+ import { appendViewpart, toggleOverlay, TOOL_POSITION, VIEWPART_POSITION } from '@things-factory/layout-base'
6
12
  import { updateMenuProvider } from '@things-factory/menu-base'
13
+ import { USE_ROLE_BY_MENUS_MANAGEMENT } from '@things-factory/menu-base/client/actions/menu'
7
14
  import { ADD_MORENDA } from '@things-factory/more-base'
8
15
  import { ADD_REFRESH_HANDLER, ADD_SETTING } from '@things-factory/setting-base'
9
16
  import { client, navigate, store, UPDATE_BASE_URL } from '@things-factory/shell'
10
17
  import { isMobileDevice } from '@things-factory/utils'
11
- import '@things-factory/notification'
12
- import gql from 'graphql-tag'
13
- import { html } from 'lit-element'
18
+
14
19
  import { UPDATE_DASHBOARD_SETTINGS } from './actions/dashboard-settings'
15
20
  import { fetchBoardSettings } from './fetch-board-settings'
16
21
  import dashboard from './reducers/dashboard-settings'
17
- import { USE_ROLE_BY_MENUS_MANAGEMENT } from '@things-factory/menu-base/client/actions/menu'
18
22
 
19
23
  console.log(`
20
24
  ▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄ ▄▄▄ ▄▄
@@ -29,6 +33,9 @@ export default function bootstrap() {
29
33
  dashboard
30
34
  })
31
35
 
36
+ /* set board-modeller group and default templates */
37
+ registerDefaultGroups()
38
+
32
39
  /* setting app-tools */
33
40
  store.dispatch({
34
41
  type: APPEND_APP_TOOL,
@@ -280,7 +280,13 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
280
280
  <label class="content">${this?._selectedInventory?.packingType || '-'}</label>
281
281
 
282
282
  <label class="content-title">${i18next.t('label.qty')}</label>
283
- <label class="content">${this?._selectedInventory?.qty || '-'}</label>
283
+ <label class="content">${(this?._selectedInventory?.qty || 0).toString()}</label>
284
+
285
+ <label class="content-title">${i18next.t('label.reserve_qty')}</label>
286
+ <label class="content">${(this?._selectedInventory?.lockedQty || 0).toString()}</label>
287
+
288
+ <label class="content-title">${i18next.t('label.available_qty')}</label>
289
+ <label class="content">${(this?._selectedInventory?.availableQty || 0).toString()}</label>
284
290
 
285
291
  <!-- <input name="fromLocationName" readonly /> -->
286
292
  </fieldset>
@@ -299,11 +305,11 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
299
305
  this.qtyInput.value = 0
300
306
  }
301
307
  if (this._selectedInventory) {
302
- if (this._selectedInventory.qty > parseInt(this.qtyInput.value)) {
308
+ if (this._selectedInventory.availableQty > parseInt(this.qtyInput.value)) {
303
309
  this._requireNewId = true
304
310
  } else {
305
- if (parseInt(this.qtyInput.value) > this._selectedInventory.qty) {
306
- this.qtyInput.value = this._selectedInventory.qty
311
+ if (parseInt(this.qtyInput.value) > this._selectedInventory.availableQty) {
312
+ this.qtyInput.value = this._selectedInventory.availableQty
307
313
  }
308
314
  this._requireNewId = false
309
315
  }
@@ -396,6 +402,8 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
396
402
  'packingType',
397
403
  'packingSize',
398
404
  'qty',
405
+ 'lockedQty',
406
+ 'availableQty',
399
407
  'expirationDate'
400
408
  ]
401
409
  },
@@ -480,6 +488,20 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
480
488
  header: i18next.t('field.qty'),
481
489
  width: 60
482
490
  },
491
+ {
492
+ type: 'integer',
493
+ name: 'lockedQty',
494
+ label: true,
495
+ header: i18next.t('field.reserve_qty'),
496
+ width: 60
497
+ },
498
+ {
499
+ type: 'integer',
500
+ name: 'availableQty',
501
+ label: true,
502
+ header: i18next.t('field.available_qty'),
503
+ width: 60
504
+ },
483
505
  {
484
506
  type: 'date',
485
507
  name: 'expirationDate',
@@ -568,7 +590,7 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
568
590
  return {
569
591
  ...record,
570
592
  sku: record.product.sku,
571
- qty: record.qty - record.lockedQty > 0 ? record.qty - record.lockedQty : 0
593
+ availableQty: record.qty - (record.lockedQty > 0 ? record.lockedQty : 0)
572
594
  }
573
595
  })
574
596
  }
@@ -654,7 +676,11 @@ class TransferInventory extends connect(store)(localize(i18next)(PageView)) {
654
676
  throw new Error(i18next.t('text.please_select_an_inventory'))
655
677
  }
656
678
 
657
- if (!this.qtyInput.value > 0) {
679
+ if (!(this._selectedInventory.availableQty > 0)) {
680
+ throw new Error(i18next.t('text.not_enough_available_qty'))
681
+ }
682
+
683
+ if (!parseInt(this.qtyInput?.value || 0) > 0) {
658
684
  throw new Error(i18next.t('text.please_enter_transfer_qty'))
659
685
  }
660
686
 
@@ -1,4 +1,5 @@
1
1
  import '@things-factory/biz-ui'
2
+ import './validate-gan-popup'
2
3
  import './validate-ro-popup'
3
4
 
4
5
  import { css, html } from 'lit-element'
@@ -134,19 +135,16 @@ class BulkOperation extends localize(i18next)(PageView) {
134
135
 
135
136
  static get properties() {
136
137
  return {
137
- _files: Array,
138
- _releaseOrders: Array,
139
- _bizplaceId: String,
140
- _bizplaceName: String
138
+ _ganBizplaceId: String,
139
+ _ganBizplaceName: String,
140
+ _ganDocument: Object,
141
+ _roDocument: Object,
142
+ _rawData: Array,
143
+ _roBizplaceId: String,
144
+ _roBizplaceName: String
141
145
  }
142
146
  }
143
147
 
144
- constructor() {
145
- super()
146
- // initially act as placeholder
147
- this._bizplaceName = i18next.t('label.company')
148
- }
149
-
150
148
  firstUpdated() {}
151
149
 
152
150
  get context() {
@@ -155,37 +153,112 @@ class BulkOperation extends localize(i18next)(PageView) {
155
153
  }
156
154
  }
157
155
 
158
- get _document() {
159
- return this.shadowRoot.querySelector('#upload-document')
156
+ get _ganDocument() {
157
+ return this.shadowRoot.querySelector('#upload-gan-document')
160
158
  }
161
159
 
162
- get _dummyData() {
163
- return this._releaseOrders.map(x => {
164
- x.orderInventories = x.orderInventories.map(y => {
165
- return {
166
- ...y,
167
- availableQty: Math.floor(Math.random() * 50) + 30
168
- }
169
- })
170
- return {
171
- ...x,
172
- releaseDate: new Date().toISOString().split('T')
160
+ get _roDocument() {
161
+ return this.shadowRoot.querySelector('#upload-ro-document')
162
+ }
163
+
164
+ get _ganData() {
165
+ return [
166
+ {
167
+ refNo: '',
168
+ refNo2: '',
169
+ refNo3: '',
170
+ etaDate: '',
171
+ truckNo: '',
172
+ containerNo: '',
173
+ containerSize: '',
174
+ looseItem: false,
175
+ importCargo: false,
176
+ sku: '',
177
+ batchId: '',
178
+ batchRefNo: '',
179
+ packingType: '',
180
+ packingSize: 0,
181
+ uom: '',
182
+ packQty: 0,
183
+ palletQty: 0,
184
+ manufactureYear: 0,
185
+ unitPrice: ''
173
186
  }
174
- })
187
+ ]
175
188
  }
176
189
 
177
- render() {
178
- let subtitle = 'Release Order'
179
- let attachment = {
180
- path: ''
181
- }
190
+ get _roData() {
191
+ return [
192
+ {
193
+ refNo: '',
194
+ refNo2: '',
195
+ refNo3: '',
196
+ releaseDate: '',
197
+ attentionTo: '',
198
+ deliveryAddress1: '',
199
+ deliveryAddress2: '',
200
+ deliveryAddress3: '',
201
+ deliveryAddress4: '',
202
+ postalCode: '',
203
+ city: '',
204
+ state: '',
205
+ country: '',
206
+ phone1: '',
207
+ sku: '',
208
+ packingType: '',
209
+ packingSize: 0,
210
+ uom: '',
211
+ releaseQty: 0
212
+ }
213
+ ]
214
+ }
182
215
 
216
+ render() {
183
217
  return html`
184
218
  <ul export-form>
185
219
  <li>
186
220
  <div subtitle>
187
- ${subtitle} &nbsp;
188
- <a href="${location.origin}/attachment/${attachment.path}" download>
221
+ Arrival Notice &nbsp;
222
+ <a @click=${async () => await this._downloadOrderTemplate(this._ganData, 'Bulk Arrival Notices')} download>
223
+ <mwc-icon>file_download</mwc-icon>
224
+ </a>
225
+ </div>
226
+ <form name="input-form" class="multi-column-form" autocomplete="off">
227
+ <fieldset>
228
+ <div attachment-wrap>
229
+ <input type="hidden" name="bizplaceId" value="${this._ganBizplaceId}" />
230
+ <input
231
+ type="text"
232
+ name="ganBizplaceName"
233
+ placeholder="${i18next.t('label.company')}"
234
+ value="${this._ganBizplaceName}"
235
+ @click="${() => {
236
+ this._openBizplacesSelector('GAN')
237
+ }}"
238
+ />
239
+ </div>
240
+ <div attachment-wrap>
241
+ <file-uploader
242
+ name="attachments"
243
+ id="upload-gan-document"
244
+ label="${i18next.t('label.select_file')}"
245
+ accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
246
+ custom-input
247
+ ></file-uploader>
248
+ </div>
249
+ </fieldset>
250
+ </form>
251
+ <div class="button-container">
252
+ <mwc-button raised @click=${async () => await this._extractRawDataFromExcel(this._ganDocument, 'GAN')}
253
+ >${i18next.t('button.validate')}</mwc-button
254
+ >
255
+ </div>
256
+ </li>
257
+
258
+ <li>
259
+ <div subtitle>
260
+ Release Order &nbsp;
261
+ <a @click=${async () => await this._downloadOrderTemplate(this._roData, 'Bulk Release Orders')} download>
189
262
  <mwc-icon>file_download</mwc-icon>
190
263
  </a>
191
264
  </div>
@@ -193,18 +266,21 @@ class BulkOperation extends localize(i18next)(PageView) {
193
266
  <form name="input-form" class="multi-column-form" autocomplete="off">
194
267
  <fieldset>
195
268
  <div attachment-wrap>
196
- <input type="hidden" name="bizplaceId" value="${this._bizplaceId}" />
269
+ <input type="hidden" name="bizplaceId" value="${this._roBizplaceId}" />
197
270
  <input
198
271
  type="text"
199
- name="bizplaceName"
200
- value="${this._bizplaceName}"
201
- @click="${this._openBizplacesSelector.bind(this)}"
272
+ name="roBizplaceName"
273
+ placeholder="${i18next.t('label.company')}"
274
+ value="${this._roBizplaceName}"
275
+ @click="${() => {
276
+ this._openBizplacesSelector('RO')
277
+ }}"
202
278
  />
203
279
  </div>
204
280
  <div attachment-wrap>
205
281
  <file-uploader
206
282
  name="attachments"
207
- id="upload-document"
283
+ id="upload-ro-document"
208
284
  label="${i18next.t('label.select_file')}"
209
285
  accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
210
286
  custom-input
@@ -214,7 +290,7 @@ class BulkOperation extends localize(i18next)(PageView) {
214
290
  </form>
215
291
 
216
292
  <div class="button-container">
217
- <mwc-button raised @click="${this._extractRawDataFromExcel.bind(this)}"
293
+ <mwc-button raised @click=${async () => await this._extractRawDataFromExcel(this._roDocument, 'RO')}
218
294
  >${i18next.t('button.validate')}</mwc-button
219
295
  >
220
296
  </div>
@@ -223,27 +299,19 @@ class BulkOperation extends localize(i18next)(PageView) {
223
299
  `
224
300
  }
225
301
 
226
- updated(changeProps) {
227
- if (changeProps.has('_rawROData')) {
228
- if (this._releaseOrders.length) {
229
- // this._validateReleaseOrder(this._releaseOrders)
230
- this._validateReleaseOrder(this._rawROData)
231
- }
232
- }
233
- }
234
-
235
- _getReleaseOrderTemplate() {
236
- /* download excel template for Create RO */
302
+ async _downloadOrderTemplate(data, fileName) {
303
+ const ws = XLSX.utils.json_to_sheet(data)
304
+ const wb = XLSX.utils.book_new()
305
+ XLSX.utils.book_append_sheet(wb, ws)
306
+ XLSX.writeFile(wb, `${fileName}.xlsx`)
237
307
  }
238
308
 
239
- async _extractRawDataFromExcel() {
240
- if (!this._bizplaceId) {
309
+ async _extractRawDataFromExcel(_docs, sourceFn) {
310
+ if ((sourceFn == 'GAN' && !this._ganBizplaceId) || (sourceFn == 'RO' && !this._roBizplaceId)) {
241
311
  this._showToast({ level: 'error', message: `${i18next.t('text.please_select_the_company')}` })
242
312
  return
243
313
  }
244
314
 
245
- const _docs = this._document
246
-
247
315
  if (_docs && _docs.files) {
248
316
  if (_docs.files.length == 1) {
249
317
  const file = _docs.files[0]
@@ -259,37 +327,86 @@ class BulkOperation extends localize(i18next)(PageView) {
259
327
  const worksheet = workbook.Sheets[firstWorksheetName]
260
328
 
261
329
  let rawData = XLSX.utils.sheet_to_json(worksheet)
330
+
262
331
  rawData = rawData.map(raw => {
263
- if (!raw.releaseDate || raw.releaseDate.constructor !== String) raw.releaseDate = ''
264
- else new Date(raw.releaseDate)
265
- return raw
332
+ //return entries without empty strings
333
+ return Object.fromEntries(Object.entries(raw).filter(([_, val]) => !/^\s*$/.test(val)))
266
334
  })
267
- /* return rawData to validate with inventory stocks */
268
- this._validateReleaseOrder(rawData)
335
+
336
+ if (sourceFn == 'GAN') this._validateArrivalNotice(rawData)
337
+ else if (sourceFn == 'RO') this._validateReleaseOrder(rawData)
269
338
  }
270
339
  } else if (_docs.files.length > 1)
271
- this._showToast({ level: 'error', message: i18next.t('text.you_can_only_upload_maximum_one_file') })
340
+ this._showToast({ level: 'error', message: i18next.t('text.you_can_only_upload_one_file_max') })
272
341
  else this._showToast({ level: 'error', message: i18next.t('text.please_attach_the_file') })
273
342
  } else this._showToast({ level: 'error', message: i18next.t('text.please_attach_the_file') })
274
343
  }
275
344
 
276
- async _validateReleaseOrder(records) {
345
+ _validateArrivalNotice(records) {
346
+ /* validate excel that user uploaded */
347
+ openPopup(
348
+ html`
349
+ <validate-gan-popup
350
+ .records=${records.map(raw => {
351
+ let etaDate = new Date(String(raw.etaDate || ''))
352
+
353
+ return {
354
+ refNo: String(raw.refNo || ''),
355
+ refNo2: String(raw.refNo2 || ''),
356
+ refNo3: String(raw.refNo3 || ''),
357
+ truckNo: String(raw.truckNo || ''),
358
+ ownTransport: !!raw.truckNo,
359
+ looseItem: !!raw.looseItem,
360
+ importCargo: !!raw.importCargo,
361
+ containerNo: String(raw.containerNo || ''),
362
+ containerSize: String(raw.containerSize || ''),
363
+ sku: String(raw.sku || ''),
364
+ batchId: String(raw.batchId || ''),
365
+ packingType: String(raw.packingType || ''),
366
+ packingSize: raw.packingSize,
367
+ uom: String(raw.uom || ''),
368
+ packQty: parseInt(raw.packQty || 0),
369
+ palletQty: parseInt(raw.palletQty || 0),
370
+ unitPrice: Number(raw.unitPrice || 0),
371
+ manufactureYear: parseInt(raw.manufactureYear || 0),
372
+ etaDate: this._getStdDateStr(etaDate)
373
+ }
374
+ })}
375
+ .bizplaceId=${this._ganBizplaceId}
376
+ ></validate-gan-popup>
377
+ `,
378
+ {
379
+ backdrop: true,
380
+ escapable: false,
381
+ size: 'large',
382
+ title: i18next.t('title.bulk_arrival_notices')
383
+ }
384
+ )
385
+ }
386
+
387
+ _validateReleaseOrder(records) {
277
388
  /* validate excel that user uploaded */
278
- openPopup(html` <validate-ro-popup .records=${records} .bizplaceId=${this._bizplaceId}></validate-ro-popup> `, {
389
+ openPopup(html` <validate-ro-popup .records=${records} .bizplaceId=${this._roBizplaceId}></validate-ro-popup> `, {
279
390
  backdrop: true,
280
391
  escapable: false,
281
392
  size: 'large',
282
- title: i18next.t('title.import')
393
+ title: i18next.t('title.bulk_release_orders')
283
394
  })
284
395
  }
285
396
 
286
- _openBizplacesSelector() {
397
+ _openBizplacesSelector(source) {
287
398
  openPopup(
288
399
  html`
289
400
  <popup-partner-bizplaces-selector
290
401
  @selected="${e => {
291
- this._bizplaceId = e.detail.id
292
- this._bizplaceName = e.detail.name
402
+ let { id, name } = e.detail
403
+ if (source == 'GAN') {
404
+ this._ganBizplaceId = id
405
+ this._ganBizplaceName = name
406
+ } else if (source == 'RO') {
407
+ this._roBizplaceId = id
408
+ this._roBizplaceName = name
409
+ }
293
410
  }}"
294
411
  ></popup-partner-bizplaces-selector>
295
412
  `,
@@ -301,6 +418,14 @@ class BulkOperation extends localize(i18next)(PageView) {
301
418
  )
302
419
  }
303
420
 
421
+ _getStdDateStr(date) {
422
+ if (isNaN(date.getFullYear())) return ''
423
+ else {
424
+ date.setHours(date.getHours() + 8)
425
+ return date.toISOString().split('T')[0]
426
+ }
427
+ }
428
+
304
429
  _showToast({ level, message }) {
305
430
  document.dispatchEvent(
306
431
  new CustomEvent('notify', {