@things-factory/operato-wms 4.3.301 → 4.3.303

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 (27) hide show
  1. package/client/pages/inventory/onhand-inventory.js +23 -19
  2. package/client/pages/order/release-order/release-order-detail.js +57 -14
  3. package/client/pages/outbound/route-label-popup.js +56 -3
  4. package/client/pages/report/outbound-order-details-report.js +1 -0
  5. package/client/pages/report/shortage-report.js +475 -0
  6. package/client/route.js +4 -0
  7. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  8. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  9. package/dist-server/graphql/resolvers/reports/shortage-report.js +115 -0
  10. package/dist-server/graphql/resolvers/reports/shortage-report.js.map +1 -0
  11. package/dist-server/graphql/types/reports/index.js +5 -0
  12. package/dist-server/graphql/types/reports/index.js.map +1 -1
  13. package/dist-server/graphql/types/reports/shortage-report-list.js +14 -0
  14. package/dist-server/graphql/types/reports/shortage-report-list.js.map +1 -0
  15. package/dist-server/graphql/types/reports/shortage-report-type.js +25 -0
  16. package/dist-server/graphql/types/reports/shortage-report-type.js.map +1 -0
  17. package/package.json +5 -5
  18. package/server/graphql/resolvers/reports/index.ts +6 -1
  19. package/server/graphql/resolvers/reports/shortage-report.ts +132 -0
  20. package/server/graphql/types/reports/index.ts +13 -2
  21. package/server/graphql/types/reports/shortage-report-list.ts +8 -0
  22. package/server/graphql/types/reports/shortage-report-type.ts +19 -0
  23. package/things-factory.config.js +6 -0
  24. package/translations/en.json +2 -0
  25. package/translations/ko.json +2 -0
  26. package/translations/ms.json +2 -0
  27. package/translations/zh.json +2 -0
@@ -2,14 +2,27 @@ import '@things-factory/form-ui'
2
2
  import '@things-factory/grist-ui'
3
3
 
4
4
  import gql from 'graphql-tag'
5
- import { css, html } from 'lit-element'
5
+ import {
6
+ css,
7
+ html
8
+ } from 'lit-element'
6
9
  import { connect } from 'pwa-helpers/connect-mixin'
7
10
 
8
11
  import { getCodeByName } from '@things-factory/code-base'
9
- import { i18next, localize } from '@things-factory/i18n-base'
10
- import { client, PageView, store } from '@things-factory/shell'
12
+ import {
13
+ i18next,
14
+ localize
15
+ } from '@things-factory/i18n-base'
16
+ import {
17
+ client,
18
+ PageView,
19
+ store
20
+ } from '@things-factory/shell'
11
21
  import { ScrollbarStyles } from '@things-factory/styles'
12
- import { flattenObject, isMobileDevice } from '@things-factory/utils'
22
+ import {
23
+ flattenObject,
24
+ isMobileDevice
25
+ } from '@things-factory/utils'
13
26
 
14
27
  class OnhandInventory extends connect(store)(localize(i18next)(PageView)) {
15
28
  static get styles() {
@@ -423,6 +436,7 @@ class OnhandInventory extends connect(store)(localize(i18next)(PageView)) {
423
436
  packingType
424
437
  uom
425
438
  uomValue
439
+ expiry
426
440
  bizplace {
427
441
  id
428
442
  name
@@ -435,6 +449,8 @@ class OnhandInventory extends connect(store)(localize(i18next)(PageView)) {
435
449
  brand
436
450
  description
437
451
  volume
452
+ outboundAlert
453
+ minOutboundShelfLife
438
454
  }
439
455
  qty
440
456
  remainQty
@@ -481,6 +497,9 @@ class OnhandInventory extends connect(store)(localize(i18next)(PageView)) {
481
497
  }
482
498
  })
483
499
 
500
+ // Logging response for debugging
501
+ console.log(response);
502
+
484
503
  return {
485
504
  total: response.data.onhandInventories.total || 0,
486
505
  records:
@@ -496,7 +515,6 @@ class OnhandInventory extends connect(store)(localize(i18next)(PageView)) {
496
515
  volume: parseFloat(item.product.volume * item.remainQty).toFixed(2),
497
516
  // Need to move to serverside processing and fetch with db query for consistent performance
498
517
  condition: this.getCondition(item.location.type),
499
- expiry: this.getStatus(item.expirationDate)
500
518
  // Need to move to serverside processing and fetch with db query for consistent performance
501
519
  },
502
520
  '_'
@@ -520,23 +538,9 @@ class OnhandInventory extends connect(store)(localize(i18next)(PageView)) {
520
538
  return 'Damage'
521
539
  case 'QUARANTINE':
522
540
  return 'Quarantine'
523
- default:
524
- return ''
525
541
  }
526
542
  }
527
543
 
528
- getStatus(exp_date, outbound_alert, min_outbound_shelf_life) {
529
- const now = new Date()
530
- if (exp_date < now) {
531
- return 'Expired'
532
- } else if (exp_date > outbound_alert) {
533
- return 'Expiring'
534
- } else if (exp_date >= outbound_alert && exp_date <= min_outbound_shelf_life) {
535
- return 'Risky'
536
- } else {
537
- return 'Normal'
538
- }
539
- }
540
544
  // Need to move to serverside processing and fetch with db query for consistent performance
541
545
 
542
546
  async _fetchPartners() {
@@ -12,14 +12,26 @@ import '../../order/vas-order/popup/vas-target-product-popup'
12
12
  import '../../order/vas-order/popup/select-vas-popup'
13
13
 
14
14
  import gql from 'graphql-tag'
15
- import { css, html } from 'lit-element'
15
+ import {
16
+ css,
17
+ html
18
+ } from 'lit-element'
16
19
  import { connect } from 'pwa-helpers/connect-mixin'
17
20
 
18
21
  import { getCodeByName } from '@things-factory/code-base'
19
22
  import { MultiColumnFormStyles } from '@things-factory/form-ui'
20
- import { i18next, localize } from '@things-factory/i18n-base'
23
+ import {
24
+ i18next,
25
+ localize
26
+ } from '@things-factory/i18n-base'
21
27
  import { openPopup } from '@things-factory/layout-base'
22
- import { client, CustomAlert, navigate, PageView, store } from '@things-factory/shell'
28
+ import {
29
+ client,
30
+ CustomAlert,
31
+ navigate,
32
+ PageView,
33
+ store
34
+ } from '@things-factory/shell'
23
35
  import { CommonButtonStyles } from '@things-factory/styles'
24
36
  import { isMobileDevice } from '@things-factory/utils'
25
37
 
@@ -463,10 +475,11 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
463
475
 
464
476
  <label ?hidden="${this.roType === 'b2b'}">${i18next.t('label.tracking_no')}</label>
465
477
  <textarea
466
- name="trackingNos"
478
+ name="trackingNo"
467
479
  ?hidden="${this.roType === 'b2b'}"
468
480
  rows="5"
469
- ?readonly="${!this?._editable}"
481
+ ?disabled="${!(this._roInfo?.orderPackages?.length === 1) || this._source !== 'OTHERS'}"
482
+ ?readonly="${!this?._editable || this._manifestedAt == true}"
470
483
  ></textarea>
471
484
 
472
485
  ${this._crossDocking
@@ -503,12 +516,18 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
503
516
  <legend>${i18next.t('title.shipping_information')} (${this._releaseOrderNo})</legend>
504
517
 
505
518
  <label>${i18next.t('label.company')}</label>
506
- <input name="attentionCompany" .value="${this._releaseOrder.attentionCompany}" />
519
+ <input
520
+ name="attentionCompany"
521
+ .value="${this._releaseOrder.attentionCompany}"
522
+ ?readonly="${!this?._editable}"
523
+ />
507
524
 
508
525
  <label>${i18next.t('label.attention_to')}</label>
509
- <input name="attentionTo" .value="${this._releaseOrder.attentionTo}" />
526
+ <input name="attentionTo" .value="${this._releaseOrder.attentionTo}" ?readonly="${!this?._editable}" />
510
527
 
511
- <button type="button" @click="${this._openContactPointSelector.bind(this)}">import</button>
528
+ <button type="button" ?disabled=${!this?._editable} @click="${this._openContactPointSelector.bind(this)}">
529
+ import
530
+ </button>
512
531
 
513
532
  <!-- delivery -->
514
533
 
@@ -570,7 +589,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
570
589
 
571
590
  <select
572
591
  name="billingCountry"
573
- ?disabled=${this._disableBillingAddress}
592
+ ?disabled="${this._disableBillingAddress}"
574
593
  @change=${e => {
575
594
  this._validateBillingCountry(e)
576
595
  }}
@@ -597,7 +616,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
597
616
  />
598
617
  `
599
618
  : html`<select
600
- ?disabled=${this._disableBillingAddress}
619
+ ?disabled="${this._disableBillingAddress}"
601
620
  name="billingPostalCode"
602
621
  @change=${e => {
603
622
  this._getStateAndCityByPostCode(e.target.value, e.target.name)
@@ -769,6 +788,8 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
769
788
  this._showReleasedOrderInfo = false
770
789
  this._showShippingInfo = true
771
790
  this._attentionTo = ''
791
+ this._source = ''
792
+ this._manifestedAt = false
772
793
  this._companyName = ''
773
794
  this._deliveryPostCode = []
774
795
  this._deliveryState = ''
@@ -1354,6 +1375,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1354
1375
  postalCode
1355
1376
  country
1356
1377
  remark
1378
+ source
1357
1379
  bizplace {
1358
1380
  id
1359
1381
  name
@@ -1391,6 +1413,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1391
1413
  id
1392
1414
  name
1393
1415
  trackingNo
1416
+ manifestedAt
1394
1417
  }
1395
1418
  orderProducts {
1396
1419
  id
@@ -1535,6 +1558,8 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1535
1558
  this._roInfo = releaseOrder
1536
1559
  this.roType = releaseOrder.type
1537
1560
  this._orderMethod = releaseOrder.orderMethod
1561
+ this._source = releaseOrder.source
1562
+ this._manifestedAt = orderPackages.some(op => op.manifestedAt)
1538
1563
  this._isInBatchPicking = releaseOrder.inventoryInfos.some(inventoryInfo => inventoryInfo.refWorksheetId)
1539
1564
  const orderInventories = releaseOrder.inventoryInfos.map(inventoryInfo => {
1540
1565
  let roundedUomValue = parseFloat(inventoryInfo.releaseUomValue.toFixed(2))
@@ -1608,7 +1633,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1608
1633
  this._fillupRGForm({
1609
1634
  ...releaseOrder,
1610
1635
  bizplaceName: releaseOrder.bizplace?.name,
1611
- trackingNos: orderPackages.length > 0 ? orderPackages.map(op => op.trackingNo).join(', ') : ''
1636
+ trackingNo: orderPackages.length > 0 ? orderPackages.map(op => op.trackingNo).join(', ') : ''
1612
1637
  })
1613
1638
 
1614
1639
  if (shippingOrder) {
@@ -1926,7 +1951,8 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1926
1951
  this._showReleasedOrderInfo = false
1927
1952
  this._showShippingInfo = true
1928
1953
  this._showExportInfo = true
1929
-
1954
+ this._source = ''
1955
+ this._manifestedAt = false
1930
1956
  this._releaseOrder = {}
1931
1957
  this._status = null
1932
1958
  this.roType = 'b2b'
@@ -2684,14 +2710,31 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
2684
2710
  delete releaseOrder.status
2685
2711
  delete releaseOrder.ganNo
2686
2712
  delete releaseOrder.recall
2713
+ let oldResorder = this._releaseOrder
2687
2714
 
2688
2715
  let formChanged
2689
2716
  for (const key in releaseOrder) {
2690
- if (releaseOrder.hasOwnProperty(key) && releaseOrder[key] !== this._releaseOrder[key]) {
2717
+ if (oldResorder.orderPackages.length > 0) {
2718
+ if (key == 'trackingNo' && releaseOrder[key] !== oldResorder.orderPackages[0].trackingNo) {
2719
+ if (
2720
+ !(
2721
+ (releaseOrder[key] == '' || releaseOrder[key] == null) &&
2722
+ (oldResorder.orderPackages[0].trackingNo == '' || oldResorder.orderPackages[0].trackingNo == null)
2723
+ )
2724
+ ) {
2725
+ if (this._roInfo?.orderPackages.length === 1) {
2726
+ formChanged = true
2727
+ break
2728
+ } else {
2729
+ throw new Error(i18next.t('text.does_not_support_multi_package'))
2730
+ }
2731
+ }
2732
+ }
2733
+ } else if (releaseOrder.hasOwnProperty(key) && releaseOrder[key] !== oldResorder[key]) {
2691
2734
  if (
2692
2735
  !(
2693
2736
  (releaseOrder[key] == '' || releaseOrder[key] == null) &&
2694
- (this._releaseOrder[key] == '' || this._releaseOrder[key] == null)
2737
+ (oldResorder[key] == '' || oldResorder[key] == null)
2695
2738
  )
2696
2739
  ) {
2697
2740
  formChanged = true
@@ -178,6 +178,7 @@ class RouteLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
178
178
  .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
179
179
  .config=${this.config}
180
180
  .fetchHandler=${this.fetchHandler.bind(this)}
181
+ @field-change="${this._packingSizeChange.bind(this)}"
181
182
  ></data-grist>
182
183
  </div>
183
184
 
@@ -241,6 +242,38 @@ class RouteLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
241
242
  sortable: true,
242
243
  width: 150
243
244
  },
245
+ {
246
+ type: 'select',
247
+ name: 'packingType',
248
+ header: i18next.t('field.packing_type'),
249
+ record: {
250
+ options: [''],
251
+ editable: true
252
+ },
253
+ handlers: {
254
+ click: (columns, data, column, record, rowIndex) => {
255
+ if (
256
+ !record ||
257
+ JSON.stringify(this.dataGrist._config.columns.find(c => c.name === 'packingType').record.options) ===
258
+ JSON.stringify(record.productDetails.map(item => item.packingType))
259
+ ) {
260
+ return
261
+ }
262
+ this.dataGrist._config.columns
263
+ .filter(c => c.name === 'packingType')
264
+ .map(items => (items.record.options = record.productDetails.map(pd => pd.packingType)))
265
+ this.dataGrist.render()
266
+ }
267
+ },
268
+ sortable: true,
269
+ width: 150
270
+ },
271
+ {
272
+ type: 'integer',
273
+ name: 'packingSize',
274
+ header: i18next.t('field.packing_size'),
275
+ width: 150
276
+ },
244
277
  {
245
278
  type: 'integer',
246
279
  name: 'releaseQty',
@@ -322,6 +355,14 @@ class RouteLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
322
355
  productName
323
356
  releaseQty
324
357
  releaseGoodName
358
+ productDetails {
359
+ packingType
360
+ packingSize
361
+ }
362
+ productDetail {
363
+ packingType
364
+ packingSize
365
+ }
325
366
  routeId
326
367
  storeId
327
368
  storeName
@@ -354,7 +395,9 @@ class RouteLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
354
395
  ...itm,
355
396
  roName: itm.releaseGoodName,
356
397
  productSku: itm.productSKU,
357
- createdAt: createdAt
398
+ createdAt: createdAt,
399
+ packingType: itm.productDetail.packingType,
400
+ packingSize: itm.productDetail.packingSize
358
401
  }
359
402
  }) || {}
360
403
  })
@@ -364,6 +407,16 @@ class RouteLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
364
407
  }
365
408
  }
366
409
 
410
+ async _packingSizeChange(e) {
411
+ const selectedColumn = e.detail.column.name
412
+
413
+ if (selectedColumn === 'packingType') {
414
+ this.dataGrist._data.records[e.detail.row].packingSize = e.detail.record.productDetails.find(
415
+ item => item.packingType == e.detail.after
416
+ ).packingSize
417
+ }
418
+ }
419
+
367
420
  async _printRouteLabel() {
368
421
  const records = this.dataGrist.selected
369
422
  let labelId = this._routeLabel && this._routeLabel.id
@@ -379,7 +432,7 @@ class RouteLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
379
432
  } else {
380
433
  let index = 1
381
434
  for (var record of records) {
382
- let max = record.releaseQty ? record.releaseQty : 1
435
+ let max = record.releaseQty ? record.releaseQty / record.packingSize : 1
383
436
  for (let qty = 1; qty <= max; qty++) {
384
437
  var searchParams = new URLSearchParams()
385
438
 
@@ -391,7 +444,7 @@ class RouteLabelPopup extends connect(store)(localize(i18next)(LitElement)) {
391
444
  if (!record?.toteNumber) {
392
445
  searchParams.append('qty', record.qty)
393
446
  searchParams.append('releaseQty', record.releaseQty)
394
- searchParams.append('counter', `${qty} of ${record.releaseQty}`)
447
+ searchParams.append('counter', `${qty} of ${max}`)
395
448
  searchParams.append('productSku', record.productSku)
396
449
  searchParams.append('productName', record.productName)
397
450
  } else {
@@ -963,6 +963,7 @@ class OutboundOrderDetailsReport extends connect(store)(localize(i18next)(PageVi
963
963
  { header: i18next.t('field.remark_checked_at'), key: 'checkedRemarkAt', width: 15, type: 'string' },
964
964
  { header: i18next.t('field.loaded_by'), key: 'loadedBy', width: 15, type: 'string' },
965
965
  { header: i18next.t('field.loaded_at'), key: 'loadedAt', width: 15, type: 'string' },
966
+ { header: i18next.t('field.picking_bin'), key: 'binLocation', width: 15, type: 'string' },
966
967
  { header: i18next.t('field.manifested_by'), key: 'manifestedBy', width: 15, type: 'string' },
967
968
  { header: i18next.t('field.manifested_at'), key: 'manifestedAt', width: 15, type: 'string' },
968
969
  { header: i18next.t('field.dispatched_at'), key: 'dispatchedAt', width: 15, type: 'string' }