@things-factory/operato-wms 4.3.362 → 4.3.363

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.
@@ -267,6 +267,7 @@ class CycleCountRecheckPopup extends localize(i18next)(LitElement) {
267
267
  originUomValue
268
268
  inspectedUomValue
269
269
  status
270
+ countNo
270
271
  product {
271
272
  sku
272
273
  name
@@ -305,7 +306,8 @@ class CycleCountRecheckPopup extends localize(i18next)(LitElement) {
305
306
  uomValue: targetInv.originUomValue,
306
307
  uom: targetInv?.inventory && targetInv.inventory?.uom,
307
308
  inspectedUomValue: targetInv.inspectedUomValue,
308
- status: targetInv.status
309
+ status: targetInv.status,
310
+ countNo: targetInv.countNo
309
311
  }
310
312
  })
311
313
 
@@ -365,6 +367,7 @@ class CycleCountRecheckPopup extends localize(i18next)(LitElement) {
365
367
  variables.batchIds = this.grist.selected.map(record => record.batchId)
366
368
  variables.productDetailIds = this.grist.selected.map(record => record.productDetail.id)
367
369
  variables.locationNames = this.grist.selected.map(record => record.location.name)
370
+ variables.countNos = this.grist.selected.map(record => record.countNo)
368
371
 
369
372
  mutation = gql`
370
373
  mutation generateCycleCountWorksheetCarton(
@@ -375,6 +378,7 @@ class CycleCountRecheckPopup extends localize(i18next)(LitElement) {
375
378
  $batchIds: [String]
376
379
  $productDetailIds: [String]
377
380
  $locationNames: [String]
381
+ $countNos: [Int]
378
382
  ) {
379
383
  generateCycleCountWorksheetCarton(
380
384
  executionDate: $executionDate
@@ -384,6 +388,7 @@ class CycleCountRecheckPopup extends localize(i18next)(LitElement) {
384
388
  batchIds: $batchIds
385
389
  productDetailIds: $productDetailIds
386
390
  locationNames: $locationNames
391
+ countNos: $countNos
387
392
  ) {
388
393
  name
389
394
  }
@@ -329,8 +329,12 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
329
329
  sku
330
330
  name
331
331
  brand
332
+ }
333
+ productDetail {
332
334
  packingType
333
335
  }
336
+ originLocationId
337
+ inspectedLocationId
334
338
  countData
335
339
  batchNoVariance
336
340
  locationVariance
@@ -369,13 +373,14 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
369
373
  inventory,
370
374
  inventoryCheck: { name: inventoryCheckName },
371
375
  inventoryCheckItem,
372
- product: { sku, name: productName, brand, packingType }
376
+ product: { sku, name: productName, brand },
377
+ productDetail: { packingType }
373
378
  } = item
374
379
 
375
380
  // Parsing countData from string to object & convert to int or replace with "-"
376
381
  let countData = JSON.parse(item.countData)
377
382
  Object.keys(countData).forEach(key => {
378
- if (key.startsWith('count_')) {
383
+ if (key.startsWith('count ')) {
379
384
  countData[key] =
380
385
  !isNaN(parseFloat(countData[key])) && isFinite(countData[key]) ? parseInt(countData[key], 10) : '-'
381
386
  }
@@ -383,7 +388,7 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
383
388
 
384
389
  // Calculate the latest count key and finalCount
385
390
  const latestCountKey = [...Object.keys(countData)]
386
- .filter(key => key.startsWith('count_') && countData[key] !== '-')
391
+ .filter(key => key.startsWith('count ') && countData[key] !== '-')
387
392
  .pop()
388
393
 
389
394
  // Calculate finalCount based on the latest count
@@ -394,37 +399,15 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
394
399
 
395
400
  // Calculate countStatus
396
401
  let countStatus
397
- const {
398
- inspectedBatchNo,
399
- inspectedQty,
400
- inspectedUomValue,
401
- inspectedLocationId,
402
- originBatchNo,
403
- originQty,
404
- originUomValue,
405
- originLocationId
406
- } = inventoryCheckItem
402
+ const { inspectedBatchNo, inspectedQty, inspectedUomValue, originBatchNo, originQty, originUomValue } =
403
+ inventoryCheckItem
407
404
  const { id: inventoryId, cartonId, palletId } = inventory
408
405
 
409
- if (
410
- inspectedBatchNo === null &&
411
- inspectedQty === 0 &&
412
- inspectedUomValue === null &&
413
- inspectedLocationId === null
414
- ) {
415
- countStatus = 'MISSING'
416
- } else if (
417
- originBatchNo === null &&
418
- originQty === null &&
419
- originUomValue === null &&
420
- originLocationId === null
421
- ) {
422
- countStatus = 'NEW'
423
- } else if (finalCount === originQty) {
406
+ if (finalCount === originQty) {
424
407
  countStatus = 'HIT'
425
408
  } else if (finalCount < originQty) {
426
409
  countStatus = 'SHORT'
427
- } else {
410
+ } else if (finalCount > originQty) {
428
411
  countStatus = 'EXCESS'
429
412
  }
430
413
 
@@ -441,6 +424,8 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
441
424
  inspectedUomValue,
442
425
  originQty,
443
426
  inspectedQty,
427
+ originLocationId: item.originLocationId,
428
+ inspectedLocationId: item.inspectedLocationId,
444
429
  sku,
445
430
  productName,
446
431
  brand,
@@ -473,13 +458,15 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
473
458
  if (this._enableCartonLabel) {
474
459
  const groupedRecords = {}
475
460
  records.forEach(record => {
476
- const groupKey = `${record.cartonId || ''}-${record.sku || ''}-${record.originBatchNo || ''}`
461
+ const groupKey = `${record.cartonId || ''}-${record.sku || ''}-${record.originBatchNo || ''}-${
462
+ record.originLocationId || ''
463
+ }`
477
464
  if (!groupedRecords[groupKey]) {
478
465
  groupedRecords[groupKey] = { ...record, count: 1, originQty: record.originQty }
479
466
  } else {
480
467
  groupedRecords[groupKey].originQty += record.originQty
481
468
  Object.keys(record).forEach(key => {
482
- if (key.startsWith('count_') && record[key] !== '-') {
469
+ if (key.startsWith('count ') && record[key] !== '-') {
483
470
  groupedRecords[groupKey][key] =
484
471
  (groupedRecords[groupKey][key] || 0) + (parseInt(record[key], 10) || 0)
485
472
  }
@@ -490,7 +477,7 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
490
477
 
491
478
  records = Object.values(groupedRecords).map(groupedRecord => {
492
479
  const latestCountKey = [...Object.keys(groupedRecord)]
493
- .filter(key => key.startsWith('count_') && groupedRecord[key] !== '-')
480
+ .filter(key => key.startsWith('count ') && groupedRecord[key] !== '-')
494
481
  .pop()
495
482
 
496
483
  const finalCount = latestCountKey ? groupedRecord[latestCountKey] : groupedRecord['originQty']
@@ -501,7 +488,7 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
501
488
  countStatus = 'HIT'
502
489
  } else if (finalCount < groupedRecord.originQty) {
503
490
  countStatus = 'SHORT'
504
- } else if (finalCount < groupedRecord.originQty) {
491
+ } else if (finalCount > groupedRecord.originQty) {
505
492
  countStatus = 'EXCESS'
506
493
  }
507
494
 
@@ -534,7 +521,7 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
534
521
  return
535
522
  }
536
523
 
537
- const countColumns = Object.keys(records[0]).filter(key => key.startsWith('count_'))
524
+ const countColumns = Object.keys(records[0]).filter(key => key.startsWith('count '))
538
525
  if (!countColumns.length) {
539
526
  console.error('No count columns found in exampleRecord')
540
527
  return
@@ -564,7 +551,7 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
564
551
  if (originQtyColumnIndex !== -1 && finalCountColumnIndex !== -1) {
565
552
  this.config.columns.splice(originQtyColumnIndex + 1, 0, ...dynamicColumns)
566
553
  } else {
567
- console.warn('originQty or finalCount columns not found. Appending count_ columns at the end.')
554
+ console.warn('originQty or finalCount columns not found. Appending count columns at the end.')
568
555
  this.config.columns.push(...dynamicColumns)
569
556
  }
570
557
 
@@ -697,7 +684,7 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
697
684
  }
698
685
 
699
686
  if (data.length > 0) {
700
- const dynamicColumns = Object.keys(data[0]).filter(key => key.startsWith('count_'))
687
+ const dynamicColumns = Object.keys(data[0]).filter(key => key.startsWith('count '))
701
688
  const dynamicHeaders = dynamicColumns.map(column => {
702
689
  return {
703
690
  header: column,
@@ -957,7 +957,7 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
957
957
  async undoInventoryCheck() {
958
958
  await sleep(1010)
959
959
  try {
960
- const { name, cartonId, productDetailId, batchId, locationId } = this._currentCard
960
+ const { name, cartonId, productDetailId, batchId, locationId, countNo } = this._currentCard
961
961
 
962
962
  const result = await CustomAlert({
963
963
  title: i18next.t('title.are_you_sure'),
@@ -985,16 +985,27 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
985
985
  $cartonId: String!
986
986
  $batchId: String!
987
987
  $locationId: String!
988
+ $inventoryCheckNo: String!
989
+ $countNo: Int!
988
990
  ) {
989
991
  undoInspectionCarton(
990
992
  productDetailId: $productDetailId
991
993
  cartonId: $cartonId
992
994
  batchId: $batchId
993
995
  locationId: $locationId
996
+ inventoryCheckNo: $inventoryCheckNo
997
+ countNo: $countNo
994
998
  )
995
999
  }
996
1000
  `,
997
- variables: { productDetailId, cartonId, batchId, locationId }
1001
+ variables: {
1002
+ productDetailId,
1003
+ cartonId,
1004
+ batchId,
1005
+ locationId,
1006
+ inventoryCheckNo: this.cycleCountNo,
1007
+ countNo
1008
+ }
998
1009
  })
999
1010
  }
1000
1011
 
@@ -184,7 +184,7 @@ class WorksheetCycleCount extends localize(i18next)(PageView) {
184
184
  this.preConfig = {
185
185
  rows: { appendable: false },
186
186
  list: {
187
- fields: ['batchId', 'cartonId', 'palletId', 'product', 'location', 'status']
187
+ fields: ['batchId', 'cartonId', 'palletId', 'sku', 'product', 'location', 'status']
188
188
  },
189
189
  pagination: { infinite: true },
190
190
  columns: [
@@ -210,6 +210,13 @@ class WorksheetCycleCount extends localize(i18next)(PageView) {
210
210
  imex: { header: i18next.t('field.lot_id'), key: 'palletId', width: 150, type: 'string' },
211
211
  width: 150
212
212
  },
213
+ {
214
+ type: 'string',
215
+ name: 'sku',
216
+ header: i18next.t('field.sku'),
217
+ imex: { header: i18next.t('field.sku'), key: 'sku', width: 150, type: 'string' },
218
+ width: 150
219
+ },
213
220
  {
214
221
  type: 'object',
215
222
  name: 'product',
@@ -305,6 +312,7 @@ class WorksheetCycleCount extends localize(i18next)(PageView) {
305
312
  status
306
313
  targetInventoryCheckItem {
307
314
  product {
315
+ sku
308
316
  name
309
317
  brand
310
318
  description
@@ -367,6 +375,7 @@ class WorksheetCycleCount extends localize(i18next)(PageView) {
367
375
  const records = worksheetDetails.map(worksheetDetail => {
368
376
  const record = {
369
377
  ...worksheetDetail.targetInventoryCheckItem.inventory,
378
+ sku: worksheetDetail.targetInventoryCheckItem.product.sku,
370
379
  productDetailId: worksheetDetail.targetInventoryCheckItem.productDetail.id,
371
380
  locationId: worksheetDetail.targetInventoryCheckItem.inventory.location.id,
372
381
  brand: worksheetDetail.targetInventoryCheckItem.inventory.product.brand,
@@ -33,7 +33,7 @@ exports.cycleCountReport = {
33
33
  p.sku as "product_sku",
34
34
  p.name as "product_name",
35
35
  p.brand as "product_brand",
36
- p.packing_type as "product_packing_type",
36
+ pd.packing_type as "pd_packing_type",
37
37
  ici.origin_batch_no as "origin_batch_no",
38
38
  ici.inspected_batch_no as "inspected_batch_no",
39
39
  ici.origin_location_id as "origin_location_id",
@@ -77,8 +77,13 @@ exports.cycleCountReport = {
77
77
  )`, [cycleCount.id]);
78
78
  // Step 3: Generate definedCrossColumn for dynamic columns
79
79
  let definedCrossColumn = await tx.query(`
80
- SELECT string_agg(DISTINCT concat('count_', check_count), ',') as columns
81
- FROM temp_dynamic_columns`);
80
+ SELECT string_agg(DISTINCT 'count ' || check_count::text, ',') as columns
81
+ FROM temp_dynamic_columns
82
+ `);
83
+ let columnList = definedCrossColumn[0].columns
84
+ .split(',')
85
+ .map(column => `"${column.trim()}" varchar`)
86
+ .join(', ');
82
87
  // Step 4: Pivot data and create the pivot table
83
88
  await tx.query(`
84
89
  CREATE TEMP TABLE temp_pivoted_data ON COMMIT DROP AS (
@@ -91,12 +96,7 @@ exports.cycleCountReport = {
91
96
  $$
92
97
  SELECT DISTINCT check_count FROM temp_dynamic_columns ORDER BY 1
93
98
  $$
94
- ) AS ct (inventory_id varchar, ${definedCrossColumn[0].columns
95
- .split(',')
96
- .map(itm => {
97
- return itm + ' varchar';
98
- })
99
- .join(',')} )
99
+ ) AS ct (inventory_id varchar, ${columnList})
100
100
  )`);
101
101
  // Step 5: Create the temp_final_count table
102
102
  await tx.query(`
@@ -119,18 +119,19 @@ exports.cycleCountReport = {
119
119
  AND inventory_check_id = $1
120
120
  GROUP BY inventory_id
121
121
  )`, [cycleCount.id]);
122
+ let jsonColumnNames = definedCrossColumn[0].columns
123
+ .split(',')
124
+ .map(column => {
125
+ return `p."${column.trim()}" as "${column.trim()}"`;
126
+ })
127
+ .join(',');
122
128
  // Step 6: Create the final temp table with combined data
123
129
  await tx.query(`
124
130
  CREATE TEMP TABLE temp_final_data ON COMMIT DROP AS (
125
131
  SELECT
126
132
  f.*,
127
133
  fc.final_count,
128
- row_to_json((SELECT cn FROM (SELECT ${definedCrossColumn[0].columns
129
- .split(',')
130
- .map(itm => {
131
- return 'p.' + itm;
132
- })
133
- .join(',')}) cn))::varchar as "count_data",
134
+ row_to_json((SELECT cn FROM (SELECT ${jsonColumnNames}) cn))::varchar as "count_data",
134
135
  CASE
135
136
  WHEN f.count_no = latest_counts.latest_count_no
136
137
  THEN (f.origin_batch_no <> f.inspected_batch_no)
@@ -198,8 +199,6 @@ exports.cycleCountReport = {
198
199
  status: itm.invCheckItemStatus,
199
200
  originBatchNo: itm.origin_batch_no,
200
201
  inspectedBatchNo: itm.inspected_batch_no,
201
- originLocation: itm.origin_location_id,
202
- inspectedLocation: itm.inspected_location_id,
203
202
  originUomValue: itm.origin_uom_value,
204
203
  inspectedUomValue: itm.inspected_uom_value,
205
204
  originQty: itm.origin_qty,
@@ -213,9 +212,13 @@ exports.cycleCountReport = {
213
212
  product: {
214
213
  sku: itm.product_sku,
215
214
  name: itm.product_name,
216
- brand: itm.product_brand,
217
- packingType: itm.product_packing_type
215
+ brand: itm.product_brand
216
+ },
217
+ productDetail: {
218
+ packingType: itm.pd_packing_type
218
219
  },
220
+ originLocationId: itm.origin_location_id,
221
+ inspectedLocationId: itm.inspected_location_id,
219
222
  countData: itm.count_data,
220
223
  batchNoVariance: itm.BatchNoVariance,
221
224
  locationVariance: itm.LocationVariance,
@@ -1 +1 @@
1
- {"version":3,"file":"cycle-count-report.js","sourceR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,EAAE,GAAG,CAAC,WAAW;wBAC3B,aAAa,EAAE,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC,UAAU;wBAC/C,WAAW;wBACX,OAAO,EAAE,GAAG,CAAC,OAAO;wBACpB,eAAe,EAAE,GAAG,CAAC,iBAAiB;qBACvC,CAAA;oBACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;iBACjB;YACH,CAAC,CAAC,CAAA;YAEF,kDAAkD;YAClD,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAA;YACpC,OAAO;gBACL,KAAK;gBACL,KAAK,EAAE,UAAU;aAClB,CAAA;SACF;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"cycle-count-report.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/cycle-count-report.ts"],"names":[],"mappings":";;;AAGA,2DAA2D;AAG9C,QAAA,gBAAgB,GAAG;IAC9B,KAAK,CAAC,gBAAgB,CAAC,CAAM,EAAE,EAAE,IAAI,EAAoB,EAAE,OAAY;QACrE,IAAI;YACF,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAA0C,OAAO,CAAC,KAAK,CAAA;YAE3E,MAAM,UAAU,GAAmB,MAAM,EAAE,CAAC,aAAa,CAAC,2BAAc,CAAC,CAAC,OAAO,CAAC;gBAChF,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;gBACvB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACtB,CAAC,CAAA;YAEF,MAAM,EAAE,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAA;YAE1D,8CAA8C;YAC9C,MAAM,EAAE,CAAC,KAAK,CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqDA,EACA,CAAC,UAAU,CAAC,EAAE,CAAC,CAChB,CAAA;YAED,gDAAgD;YAChD,MAAM,EAAE,CAAC,K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AAG,CAAC,UAAU;4BACzB,YAAY,EAAE,GAAG,CAAC,aAAa;yBAChC;wBACD,SAAS,EAAE;4BACT,EAAE,EAAE,GAAG,CAAC,YAAY;4BACpB,QAAQ,EAAE,GAAG,CAAC,SAAS;4BACvB,QAAQ,EAAE,GAAG,CAAC,SAAS;yBACxB;wBACD,OAAO,EAAE;4BACP,GAAG,EAAE,GAAG,CAAC,WAAW;4BACpB,IAAI,EAAE,GAAG,CAAC,YAAY;4BACtB,KAAK,EAAE,GAAG,CAAC,aAAa;yBACzB;wBACD,aAAa,EAAE;4BACb,WAAW,EAAE,GAAG,CAAC,eAAe;yBACjC;wBACD,gBAAgB,EAAE,GAAG,CAAC,kBAAkB;wBACxC,mBAAmB,EAAE,GAAG,CAAC,qBAAqB;wBAC9C,SAAS,EAAE,GAAG,CAAC,UAAU;wBACzB,eAAe,EAAE,GAAG,CAAC,eAAe;wBACpC,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;wBACtC,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;wBACtC,UAAU,EAAE,GAAG,CAAC,WAAW;wBAC3B,aAAa,EAAE,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC,UAAU;wBAC/C,WAAW;wBACX,OAAO,EAAE,GAAG,CAAC,OAAO;wBACpB,eAAe,EAAE,GAAG,CAAC,iBAAiB;qBACvC,CAAA;oBACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;iBACjB;YACH,CAAC,CAAC,CAAA;YAEF,kDAAkD;YAClD,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAA;YACpC,OAAO;gBACL,KAAK;gBACL,KAAK,EAAE,UAAU;aAClB,CAAA;SACF;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CACF,CAAA"}
@@ -11,6 +11,9 @@ exports.CycleCountReport = (0, graphql_tag_1.default) `
11
11
  inventoryCheckItem: InventoryCheckItem
12
12
  inventory: Inventory!
13
13
  product: Product!
14
+ productDetail: ProductDetail!
15
+ originLocationId: String
16
+ inspectedLocationId: String
14
17
  countData: String
15
18
  batchNoVariance: Boolean
16
19
  locationVariance: Boolean
@@ -1 +1 @@
1
- {"version":3,"file":"cycle-count-report.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/cycle-count-report.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,gBAAgB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;CAgBlC,CAAA"}
1
+ {"version":3,"file":"cycle-count-report.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/cycle-count-report.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,gBAAgB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;CAmBlC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-wms",
3
- "version": "4.3.362",
3
+ "version": "4.3.363",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -91,7 +91,7 @@
91
91
  "@things-factory/print-ui": "^4.3.281",
92
92
  "@things-factory/product-base": "^4.3.357",
93
93
  "@things-factory/resource-ui": "^4.3.281",
94
- "@things-factory/sales-ui": "^4.3.362",
94
+ "@things-factory/sales-ui": "^4.3.363",
95
95
  "@things-factory/scene-data-transform": "^4.3.281",
96
96
  "@things-factory/scene-excel": "^4.3.281",
97
97
  "@things-factory/scene-firebase": "^4.3.281",
@@ -107,8 +107,8 @@
107
107
  "@things-factory/system-ui": "^4.3.281",
108
108
  "@things-factory/transport-base": "^4.3.344",
109
109
  "@things-factory/tutorial-ui": "^4.3.281",
110
- "@things-factory/warehouse-base": "^4.3.358",
111
- "@things-factory/worksheet-base": "^4.3.362"
110
+ "@things-factory/warehouse-base": "^4.3.363",
111
+ "@things-factory/worksheet-base": "^4.3.363"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@things-factory/builder": "^4.3.281",
@@ -117,5 +117,5 @@
117
117
  "cypress-localstorage-commands": "^1.6.1",
118
118
  "eslint-plugin-cypress": "^2.12.1"
119
119
  },
120
- "gitHead": "7ee78b7c4901c96c01209e579b8c4912c541e484"
120
+ "gitHead": "e857b2bf1329b34e2610a9891fdebf64a9f19353"
121
121
  }
@@ -39,7 +39,7 @@ export const cycleCountReport = {
39
39
  p.sku as "product_sku",
40
40
  p.name as "product_name",
41
41
  p.brand as "product_brand",
42
- p.packing_type as "product_packing_type",
42
+ pd.packing_type as "pd_packing_type",
43
43
  ici.origin_batch_no as "origin_batch_no",
44
44
  ici.inspected_batch_no as "inspected_batch_no",
45
45
  ici.origin_location_id as "origin_location_id",
@@ -90,8 +90,14 @@ export const cycleCountReport = {
90
90
 
91
91
  // Step 3: Generate definedCrossColumn for dynamic columns
92
92
  let definedCrossColumn = await tx.query(`
93
- SELECT string_agg(DISTINCT concat('count_', check_count), ',') as columns
94
- FROM temp_dynamic_columns`)
93
+ SELECT string_agg(DISTINCT 'count ' || check_count::text, ',') as columns
94
+ FROM temp_dynamic_columns
95
+ `)
96
+
97
+ let columnList = definedCrossColumn[0].columns
98
+ .split(',')
99
+ .map(column => `"${column.trim()}" varchar`)
100
+ .join(', ')
95
101
 
96
102
  // Step 4: Pivot data and create the pivot table
97
103
  await tx.query(`
@@ -105,12 +111,7 @@ export const cycleCountReport = {
105
111
  $$
106
112
  SELECT DISTINCT check_count FROM temp_dynamic_columns ORDER BY 1
107
113
  $$
108
- ) AS ct (inventory_id varchar, ${definedCrossColumn[0].columns
109
- .split(',')
110
- .map(itm => {
111
- return itm + ' varchar'
112
- })
113
- .join(',')} )
114
+ ) AS ct (inventory_id varchar, ${columnList})
114
115
  )`)
115
116
 
116
117
  // Step 5: Create the temp_final_count table
@@ -138,18 +139,20 @@ export const cycleCountReport = {
138
139
  [cycleCount.id]
139
140
  )
140
141
 
142
+ let jsonColumnNames = definedCrossColumn[0].columns
143
+ .split(',')
144
+ .map(column => {
145
+ return `p."${column.trim()}" as "${column.trim()}"`
146
+ })
147
+ .join(',')
148
+
141
149
  // Step 6: Create the final temp table with combined data
142
150
  await tx.query(`
143
151
  CREATE TEMP TABLE temp_final_data ON COMMIT DROP AS (
144
152
  SELECT
145
153
  f.*,
146
154
  fc.final_count,
147
- row_to_json((SELECT cn FROM (SELECT ${definedCrossColumn[0].columns
148
- .split(',')
149
- .map(itm => {
150
- return 'p.' + itm
151
- })
152
- .join(',')}) cn))::varchar as "count_data",
155
+ row_to_json((SELECT cn FROM (SELECT ${jsonColumnNames}) cn))::varchar as "count_data",
153
156
  CASE
154
157
  WHEN f.count_no = latest_counts.latest_count_no
155
158
  THEN (f.origin_batch_no <> f.inspected_batch_no)
@@ -222,8 +225,6 @@ export const cycleCountReport = {
222
225
  status: itm.invCheckItemStatus,
223
226
  originBatchNo: itm.origin_batch_no,
224
227
  inspectedBatchNo: itm.inspected_batch_no,
225
- originLocation: itm.origin_location_id,
226
- inspectedLocation: itm.inspected_location_id,
227
228
  originUomValue: itm.origin_uom_value,
228
229
  inspectedUomValue: itm.inspected_uom_value,
229
230
  originQty: itm.origin_qty,
@@ -237,9 +238,13 @@ export const cycleCountReport = {
237
238
  product: {
238
239
  sku: itm.product_sku,
239
240
  name: itm.product_name,
240
- brand: itm.product_brand,
241
- packingType: itm.product_packing_type
241
+ brand: itm.product_brand
242
+ },
243
+ productDetail: {
244
+ packingType: itm.pd_packing_type
242
245
  },
246
+ originLocationId: itm.origin_location_id,
247
+ inspectedLocationId: itm.inspected_location_id,
243
248
  countData: itm.count_data,
244
249
  batchNoVariance: itm.BatchNoVariance,
245
250
  locationVariance: itm.LocationVariance,
@@ -6,6 +6,9 @@ export const CycleCountReport = gql`
6
6
  inventoryCheckItem: InventoryCheckItem
7
7
  inventory: Inventory!
8
8
  product: Product!
9
+ productDetail: ProductDetail!
10
+ originLocationId: String
11
+ inspectedLocationId: String
9
12
  countData: String
10
13
  batchNoVariance: Boolean
11
14
  locationVariance: Boolean