@things-factory/operato-wms 4.1.18 → 4.1.22

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.
@@ -66,11 +66,10 @@ class InventoryHistory extends localize(i18next)(PageView) {
66
66
  return {
67
67
  title: i18next.t('title.inventory_histories'),
68
68
  actions: [],
69
- /* TEMPORARILY DISABLED UNTIL EXPORT ISSUE RESOLVED */
70
- // exportable: {
71
- // name: i18next.t('title.inventory_histories'),
72
- // data: this._exportableData.bind(this)
73
- // },
69
+ exportable: {
70
+ name: i18next.t('title.inventory_histories'),
71
+ data: this._exportableData.bind(this)
72
+ },
74
73
  help: 'operato-wms/inventory/inventory-history'
75
74
  }
76
75
  }
@@ -523,6 +522,84 @@ class InventoryHistory extends localize(i18next)(PageView) {
523
522
  }
524
523
  }
525
524
 
525
+ async _fetchInventoryHistoriesForExport() {
526
+ try {
527
+ this._validate()
528
+ let inventoryHistory = {}
529
+ let filters = []
530
+ const _customFields = this.searchForm.formFields
531
+ .filter(field => field.hasAttribute('custom'))
532
+ .map(field => field.name)
533
+
534
+ var queryFilter = await this.searchForm.getQueryFilters()
535
+
536
+ queryFilter.forEach(filter => {
537
+ if (_customFields.includes(filter.name)) {
538
+ switch (filter.name) {
539
+ case 'bizplace':
540
+ inventoryHistory[filter.name] = { id: filter.value }
541
+ break
542
+ case 'fromDate':
543
+ let fromDt = new Date(filter.value)
544
+ fromDt.setHours(0)
545
+ inventoryHistory[filter.name] = fromDt.toISOString()
546
+ break
547
+ case 'toDate':
548
+ let toDt = new Date(filter.value)
549
+ toDt.setHours(23, 59, 59)
550
+ inventoryHistory[filter.name] = toDt.toISOString()
551
+ break
552
+ default:
553
+ inventoryHistory[filter.name] = filter.value
554
+ break
555
+ }
556
+ } else {
557
+ filters.push(filter)
558
+ }
559
+ })
560
+
561
+ const response = await client.query({
562
+ query: gql`
563
+ query bizplaceInventoryHistoriesForExport($inventoryHistory: InventoryHistoryPatch, $filters: [Filter!]) {
564
+ bizplaceInventoryHistoriesForExport(inventoryHistory: $inventoryHistory, filters: $filters) {
565
+ items {
566
+ sku
567
+ productName
568
+ productDescription
569
+ brand
570
+ seq
571
+ palletId
572
+ cartonId
573
+ batchId
574
+ batchIdRef
575
+ openingQty
576
+ qty
577
+ openingUomValue
578
+ uomValue
579
+ uom
580
+ zone
581
+ orderNo
582
+ refNo
583
+ status
584
+ transactionType
585
+ bizplace
586
+ warehouse
587
+ location
588
+ createdAt
589
+ updatedAt
590
+ updater
591
+ }
592
+ total
593
+ }
594
+ }
595
+ `,
596
+ variables: { inventoryHistory, filters }
597
+ })
598
+
599
+ if (!response.errors) return response.data.bizplaceInventoryHistoriesForExport.items
600
+ } catch (error) {}
601
+ }
602
+
526
603
  _validate() {
527
604
  if (!this.searchForm.shadowRoot.querySelector('form').checkValidity())
528
605
  throw new Error(i18next.t('text.invalid_form_value'))
@@ -573,8 +650,9 @@ class InventoryHistory extends localize(i18next)(PageView) {
573
650
  let data = []
574
651
 
575
652
  var headerSetting = [
576
- { header: i18next.t('field.sku'), key: 'productSku', width: 75, type: 'string' },
577
- { header: i18next.t('field.product'), key: 'productName', width: 75, type: 'string' },
653
+ { header: i18next.t('field.sku'), key: 'sku', width: 75, type: 'string' },
654
+ { header: i18next.t('field.product_name'), key: 'productName', width: 75, type: 'string' },
655
+ { header: i18next.t('field.product_description'), key: 'productDescription', width: 75, type: 'string' },
578
656
  { header: i18next.t('field.seq'), key: 'seq', width: 75, type: 'number' },
579
657
  { header: i18next.t('field.lot_id'), key: 'palletId', width: 75, type: 'string' },
580
658
  { header: i18next.t('field.carton_id'), key: 'cartonId', width: 75, type: 'string' },
@@ -583,22 +661,22 @@ class InventoryHistory extends localize(i18next)(PageView) {
583
661
  { header: i18next.t('field.opening_uom_value'), key: 'openingUomValue', width: 75, type: 'number' },
584
662
  { header: i18next.t('field.uom_value'), key: 'uomValue', width: 75, type: 'number' },
585
663
  { header: i18next.t('field.uom'), key: 'uom', width: 75, type: 'string' },
586
- { header: i18next.t('field.location'), key: 'locationName', width: 75, type: 'string' },
664
+ { header: i18next.t('field.location'), key: 'location', width: 75, type: 'string' },
587
665
  { header: i18next.t('field.batch_no_ref'), key: 'batchIdRef', width: 75, type: 'string' },
588
666
  { header: i18next.t('field.order_no'), key: 'orderNo', width: 75, type: 'string' },
589
- { header: i18next.t('field.ref_no'), key: 'orderRefNo', width: 75, type: 'string' },
667
+ { header: i18next.t('field.ref_no'), key: 'refNo', width: 75, type: 'string' },
590
668
  { header: i18next.t('field.status'), key: 'status', width: 75, type: 'string' },
591
669
  { header: i18next.t('field.transaction_type'), key: 'transactionType', width: 75, type: 'string' },
592
670
  { header: i18next.t('field.created_at'), key: 'createdAt', width: 75, type: 'date' },
593
671
  { header: i18next.t('field.updated_at'), key: 'updatedAt', width: 75, type: 'date' },
594
- { header: i18next.t('field.updater'), key: 'updaterName', width: 75, type: 'string' }
672
+ { header: i18next.t('field.updater'), key: 'updater', width: 75, type: 'string' }
595
673
  ]
596
674
 
597
675
  const bizplaceFilters = (await this.searchForm.getQueryFilters()).filter(x => x.name === 'bizplace')
598
676
  if (bizplaceFilters.length == 0) {
599
677
  throw new Error(`Please select a customer for export.`)
600
678
  }
601
- data = (await this.fetchHandler({ page: 1, limit: 9999999 })).records
679
+ data = await this._fetchInventoryHistoriesForExport()
602
680
 
603
681
  return { header: headerSetting, data }
604
682
  } catch (e) {
@@ -1592,6 +1592,20 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1592
1592
  imex: { header: i18next.t('field.packing_type'), key: 'packingType', width: 25, type: 'string' },
1593
1593
  width: 100
1594
1594
  },
1595
+ {
1596
+ type: 'string',
1597
+ name: 'uom',
1598
+ header: i18next.t('field.uom'),
1599
+ imex: { header: i18next.t('field.uom'), key: 'uom', width: 25, type: 'string' },
1600
+ width: 100
1601
+ },
1602
+ {
1603
+ type: 'float',
1604
+ name: 'uomValue',
1605
+ header: i18next.t('field.uom_value'),
1606
+ imex: { header: i18next.t('field.uom_value'), key: 'uomValue', width: 25, type: 'float' },
1607
+ width: 100
1608
+ },
1595
1609
  {
1596
1610
  type: 'integer',
1597
1611
  name: 'packQty',
@@ -1675,6 +1689,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1675
1689
  remark
1676
1690
  productSKU
1677
1691
  productName
1692
+ productBrand
1678
1693
  isError
1679
1694
  product {
1680
1695
  id
@@ -1682,6 +1697,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1682
1697
  sku
1683
1698
  description
1684
1699
  type
1700
+ brand
1685
1701
  primaryUnit
1686
1702
  primaryValue
1687
1703
  }
@@ -1721,6 +1737,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1721
1737
  async importHandler(patches) {
1722
1738
  patches.map(itm => {
1723
1739
  itm.unitPrice = parseFloat(itm.unitPrice) || ''
1740
+ itm.uomValue = parseFloat(itm.uomValue) || ''
1724
1741
  itm.manufactureYear = parseFloat(itm.manufactureYear) || ''
1725
1742
  itm.packQty = parseFloat(itm.packQty) || ''
1726
1743
  itm.palletQty = parseFloat(itm.palletQty) || ''
@@ -1735,6 +1752,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1735
1752
  return {
1736
1753
  ...patch,
1737
1754
  unitPrice: parseFloat(patch.unitPrice) || 0,
1755
+ uomValue: parseFloat(patch.uomValue) || 0,
1738
1756
  manufactureYear: parseFloat(patch.manufactureYear) || 0,
1739
1757
  packQty: parseFloat(patch.packQty) || 0,
1740
1758
  palletQty: parseFloat(patch.palletQty) || 0
@@ -9,7 +9,7 @@ import { i18next, localize } from '@things-factory/i18n-base'
9
9
  import { client, CustomAlert } from '@things-factory/shell'
10
10
  import { isMobileDevice } from '@things-factory/utils'
11
11
 
12
- import { ORDER_TYPES, PICKING_STRATEGY, WORKSHEET_TYPE } from '../constants'
12
+ import { PICKING_STRATEGY, WORKSHEET_TYPE } from '../constants'
13
13
 
14
14
  class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
15
15
  static get properties() {
@@ -204,21 +204,12 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
204
204
  allowOutsideClick: true,
205
205
  allowEscapeKey: true
206
206
  })
207
- //// Note: Batch picking has been moved to server side processing.
207
+ //// Note: Picking and Batch picking has been moved to server side processing.
208
208
  switch (this.worksheetType) {
209
209
  case WORKSHEET_TYPE.PICKING.value:
210
- await Promise.all(
211
- selectedItems.map(async selectedItem => {
212
- const inventories = await this.fetchInventoriesByStrategy(
213
- selectedItem,
214
- this.selectedStrategy,
215
- bizplaceId[0]
216
- )
217
- const worksheetDetails = this._composeWorksheetDetails(selectedItem, inventories)
218
- await this.submitPickedItems(this.worksheetNo, selectedItem, worksheetDetails)
219
- })
220
- )
210
+ await this._pickingAssignItem(this.worksheetNo, bizplaceId[0], selectedItems, this.selectedStrategy)
221
211
  break
212
+
222
213
  case WORKSHEET_TYPE.BATCH_PICKING.value:
223
214
  await this._batchPickingAssignItem(this.worksheetId, bizplaceId[0], selectedItems, this.selectedStrategy)
224
215
  break
@@ -237,150 +228,40 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
237
228
  }
238
229
  }
239
230
 
240
- async fetchInventoriesByStrategy({ batchId, product, packingType, packingSize, uom }, pickingStrategy, bizplaceId) {
241
- const productName = product.name
242
- const productSku = product.sku
243
- const productBrand = product.brand
244
- const response = await client.query({
245
- query: gql`
246
- query inventoriesByStrategy(
247
- $worksheetId: String!
248
- $bizplaceId: String
249
- $batchId: String!
250
- $productName: String!
251
- $productSku: String!
252
- $packingType: String!
253
- $packingSize: Float!
254
- $uom: String!
231
+ async _pickingAssignItem(worksheetNo, bizplaceId, selectedItems, pickingStrategy) {
232
+ await client.mutate({
233
+ mutation: gql`
234
+ mutation generatePickingWorksheetDetails(
235
+ $bizplaceId: String!
236
+ $selectedItems: [OrderInventoryPatch]!
255
237
  $pickingStrategy: String!
238
+ $worksheetNo: String!
256
239
  ) {
257
- inventoriesByStrategy(
258
- worksheetId: $worksheetId
240
+ generatePickingWorksheetDetails(
259
241
  bizplaceId: $bizplaceId
260
- batchId: $batchId
261
- productName: $productName
262
- productSku: $productSku
263
- packingType: $packingType
264
- packingSize: $packingSize
265
- uom: $uom
242
+ selectedItems: $selectedItems
266
243
  pickingStrategy: $pickingStrategy
267
- ) {
268
- items {
269
- id
270
- qty
271
- uomValue
272
- uom
273
- product {
274
- id
275
- name
276
- description
277
- sku
278
- brand
279
- }
280
- }
281
- }
244
+ worksheetNo: $worksheetNo
245
+ )
282
246
  }
283
247
  `,
284
248
  variables: {
285
- worksheetId: this.worksheetId,
249
+ worksheetNo,
286
250
  bizplaceId,
287
- batchId,
288
- productName,
289
- productSku,
290
- packingType,
291
- packingSize,
292
- uom,
251
+ selectedItems: selectedItems.map(item => {
252
+ return {
253
+ batchId: item.batchId,
254
+ packingType: item.packingType,
255
+ packingSize: item.packingSize,
256
+ productId: item.product.id,
257
+ uom: item.uom,
258
+ releaseQty: item.releaseQty,
259
+ releaseUomValue: item.releaseUomValue
260
+ }
261
+ }),
293
262
  pickingStrategy
294
263
  }
295
264
  })
296
-
297
- if (!response.errors) {
298
- return response.data.inventoriesByStrategy.items.map(item => {
299
- return {
300
- ...item,
301
- ...item.location,
302
- productSku: item.product.sku,
303
- productBrand: item.product.brand,
304
- releaseUomValue: item.uomValue + ' ' + item.uom
305
- }
306
- })
307
- }
308
- }
309
-
310
- _composeWorksheetDetails(record, inventories) {
311
- let leftReleaseQty = record.releaseQty
312
- let leftReleaseUomValue = record.releaseUomValue
313
- let compReleaseQty = 0
314
- let compReleaseUomValue = 0
315
-
316
- let worksheetDetails = []
317
- let idx = 0
318
- while (compReleaseQty < record.releaseQty) {
319
- const inv = inventories[idx]
320
-
321
- if (inv.qty > leftReleaseQty) {
322
- compReleaseQty += leftReleaseQty
323
- compReleaseUomValue += leftReleaseUomValue
324
-
325
- worksheetDetails.push({
326
- targetInventory: {
327
- inventory: { id: inv.id },
328
- releaseQty: leftReleaseQty,
329
- releaseUomValue: leftReleaseUomValue,
330
- product: { id: record.product.id },
331
- type: ORDER_TYPES.RELEASE_OF_GOODS.value
332
- }
333
- })
334
- } else {
335
- compReleaseQty += inv.qty
336
- compReleaseUomValue += inv.uomValue
337
- leftReleaseQty -= inv.qty
338
- leftReleaseUomValue -= inv.uomValue
339
-
340
- worksheetDetails.push({
341
- targetInventory: {
342
- inventory: { id: inv.id },
343
- releaseQty: inv.qty,
344
- releaseUomValue: inv.uomValue,
345
- product: { id: record.product.id },
346
- type: ORDER_TYPES.RELEASE_OF_GOODS.value
347
- }
348
- })
349
- }
350
-
351
- idx++
352
- }
353
-
354
- return worksheetDetails
355
- }
356
-
357
- async submitPickedItems(worksheetNo, { batchId, product, packingType, packingSize }, worksheetDetails) {
358
- try {
359
- await client.mutate({
360
- mutation: gql`
361
- mutation generateReleaseGoodWorksheetDetails(
362
- $worksheetNo: String!
363
- $batchId: String!
364
- $productId: String!
365
- $packingType: String!
366
- $packingSize: Float!
367
- $worksheetDetails: [NewWorksheetDetail]
368
- ) {
369
- generateReleaseGoodWorksheetDetails(
370
- worksheetNo: $worksheetNo
371
- batchId: $batchId
372
- productId: $productId
373
- packingType: $packingType
374
- packingSize: $packingSize
375
- worksheetDetails: $worksheetDetails
376
- )
377
- }
378
- `,
379
- variables: { worksheetNo, batchId, productId: product.id, packingType, packingSize, worksheetDetails }
380
- })
381
- } catch (e) {
382
- this._showToast(e)
383
- }
384
265
  }
385
266
 
386
267
  // (this.worksheetId, selectedItems, this.selectedStrategy, bizplaceId[0])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-wms",
3
- "version": "4.1.18",
3
+ "version": "4.1.22",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -57,56 +57,56 @@
57
57
  "@operato/scene-tab": "^0.1.5",
58
58
  "@operato/scene-table": "^0.1.5",
59
59
  "@operato/scene-wheel-sorter": "^0.1.5",
60
- "@things-factory/apptool-ui": "^4.1.18",
61
- "@things-factory/attachment-ui": "^4.1.18",
62
- "@things-factory/auth-ui": "^4.1.18",
63
- "@things-factory/barcode-ui": "^4.1.18",
64
- "@things-factory/biz-ui": "^4.1.18",
65
- "@things-factory/board-service": "^4.1.18",
66
- "@things-factory/board-ui": "^4.1.18",
67
- "@things-factory/code-ui": "^4.1.18",
68
- "@things-factory/context-ui": "^4.1.18",
69
- "@things-factory/export-ui": "^4.1.18",
70
- "@things-factory/export-ui-csv": "^4.1.18",
71
- "@things-factory/export-ui-excel": "^4.1.18",
72
- "@things-factory/fav-base": "^4.1.18",
73
- "@things-factory/form-ui": "^4.1.18",
74
- "@things-factory/grist-ui": "^4.1.18",
75
- "@things-factory/help": "^4.1.18",
76
- "@things-factory/i18n-base": "^4.1.18",
77
- "@things-factory/id-rule-base": "^4.1.18",
78
- "@things-factory/import-ui": "^4.1.18",
79
- "@things-factory/import-ui-excel": "^4.1.18",
80
- "@things-factory/menu-ui": "^4.1.18",
81
- "@things-factory/more-ui": "^4.1.18",
82
- "@things-factory/notification": "^4.1.18",
83
- "@things-factory/pdf": "^4.1.18",
84
- "@things-factory/print-proxy-service": "^4.1.18",
85
- "@things-factory/print-service": "^4.1.18",
86
- "@things-factory/print-ui": "^4.1.18",
87
- "@things-factory/product-base": "^4.1.18",
88
- "@things-factory/resource-ui": "^4.1.18",
89
- "@things-factory/sales-ui": "^4.1.18",
90
- "@things-factory/scene-data-transform": "^4.1.18",
91
- "@things-factory/scene-excel": "^4.1.18",
92
- "@things-factory/scene-firebase": "^4.1.18",
93
- "@things-factory/scene-form": "^4.1.18",
94
- "@things-factory/scene-google-map": "^4.1.18",
95
- "@things-factory/scene-graphql": "^4.1.18",
96
- "@things-factory/scene-label": "^4.1.18",
97
- "@things-factory/scene-marker": "^4.1.18",
98
- "@things-factory/scene-mqtt": "^4.1.18",
99
- "@things-factory/scene-restful": "^4.1.18",
100
- "@things-factory/scene-visualizer": "^4.1.18",
101
- "@things-factory/setting-ui": "^4.1.18",
102
- "@things-factory/system-ui": "^4.1.18",
103
- "@things-factory/transport-base": "^4.1.18",
104
- "@things-factory/tutorial-ui": "^4.1.18",
105
- "@things-factory/warehouse-base": "^4.1.18",
106
- "@things-factory/worksheet-base": "^4.1.18"
60
+ "@things-factory/apptool-ui": "^4.1.22",
61
+ "@things-factory/attachment-ui": "^4.1.22",
62
+ "@things-factory/auth-ui": "^4.1.22",
63
+ "@things-factory/barcode-ui": "^4.1.22",
64
+ "@things-factory/biz-ui": "^4.1.22",
65
+ "@things-factory/board-service": "^4.1.22",
66
+ "@things-factory/board-ui": "^4.1.22",
67
+ "@things-factory/code-ui": "^4.1.22",
68
+ "@things-factory/context-ui": "^4.1.22",
69
+ "@things-factory/export-ui": "^4.1.22",
70
+ "@things-factory/export-ui-csv": "^4.1.22",
71
+ "@things-factory/export-ui-excel": "^4.1.22",
72
+ "@things-factory/fav-base": "^4.1.22",
73
+ "@things-factory/form-ui": "^4.1.22",
74
+ "@things-factory/grist-ui": "^4.1.22",
75
+ "@things-factory/help": "^4.1.22",
76
+ "@things-factory/i18n-base": "^4.1.22",
77
+ "@things-factory/id-rule-base": "^4.1.22",
78
+ "@things-factory/import-ui": "^4.1.22",
79
+ "@things-factory/import-ui-excel": "^4.1.22",
80
+ "@things-factory/menu-ui": "^4.1.22",
81
+ "@things-factory/more-ui": "^4.1.22",
82
+ "@things-factory/notification": "^4.1.22",
83
+ "@things-factory/pdf": "^4.1.19",
84
+ "@things-factory/print-proxy-service": "^4.1.22",
85
+ "@things-factory/print-service": "^4.1.22",
86
+ "@things-factory/print-ui": "^4.1.22",
87
+ "@things-factory/product-base": "^4.1.22",
88
+ "@things-factory/resource-ui": "^4.1.22",
89
+ "@things-factory/sales-ui": "^4.1.22",
90
+ "@things-factory/scene-data-transform": "^4.1.19",
91
+ "@things-factory/scene-excel": "^4.1.19",
92
+ "@things-factory/scene-firebase": "^4.1.19",
93
+ "@things-factory/scene-form": "^4.1.19",
94
+ "@things-factory/scene-google-map": "^4.1.19",
95
+ "@things-factory/scene-graphql": "^4.1.19",
96
+ "@things-factory/scene-label": "^4.1.22",
97
+ "@things-factory/scene-marker": "^4.1.19",
98
+ "@things-factory/scene-mqtt": "^4.1.19",
99
+ "@things-factory/scene-restful": "^4.1.19",
100
+ "@things-factory/scene-visualizer": "^4.1.19",
101
+ "@things-factory/setting-ui": "^4.1.22",
102
+ "@things-factory/system-ui": "^4.1.22",
103
+ "@things-factory/transport-base": "^4.1.22",
104
+ "@things-factory/tutorial-ui": "^4.1.22",
105
+ "@things-factory/warehouse-base": "^4.1.22",
106
+ "@things-factory/worksheet-base": "^4.1.22"
107
107
  },
108
108
  "devDependencies": {
109
- "@things-factory/builder": "^4.1.18"
109
+ "@things-factory/builder": "^4.1.19"
110
110
  },
111
- "gitHead": "64b0a3a1ddc1556e2c7bb93e195f6aca610ae823"
111
+ "gitHead": "e40b890d9a573562872298a6b79b26f600f607bf"
112
112
  }