@things-factory/operato-wms 4.3.387 → 4.3.390
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.
- package/client/pages/inventory-check/cycle-count-inventory-details-popup.js +6 -6
- package/client/pages/inventory-check/cycle-count-report.js +27 -23
- package/client/pages/inventory-check/cycle-count-review.js +1 -1
- package/client/pages/inventory-check/inspecting-product.js +7 -1
- package/config.development.js +1 -1
- package/dist-server/graphql/resolvers/reports/cycle-count-report.js +36 -38
- package/dist-server/graphql/resolvers/reports/cycle-count-report.js.map +1 -1
- package/dist-server/graphql/types/reports/cycle-count-report.js +1 -0
- package/dist-server/graphql/types/reports/cycle-count-report.js.map +1 -1
- package/package.json +5 -5
- package/server/graphql/resolvers/reports/cycle-count-report.ts +36 -40
- package/server/graphql/types/reports/cycle-count-report.ts +1 -0
|
@@ -134,7 +134,7 @@ class CycleCountInventoryDetailsPopup extends localize(i18next)(LitElement) {
|
|
|
134
134
|
type: 'string',
|
|
135
135
|
name: 'countNo',
|
|
136
136
|
header: i18next.t('field.count_no'),
|
|
137
|
-
width:
|
|
137
|
+
width: 120
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
140
|
type: 'string',
|
|
@@ -146,31 +146,31 @@ class CycleCountInventoryDetailsPopup extends localize(i18next)(LitElement) {
|
|
|
146
146
|
type: 'string',
|
|
147
147
|
name: 'inspectedBatchNo',
|
|
148
148
|
header: i18next.t('field.inspected_batch_no'),
|
|
149
|
-
width:
|
|
149
|
+
width: 200
|
|
150
150
|
},
|
|
151
151
|
{
|
|
152
152
|
type: 'string',
|
|
153
153
|
name: 'originLocationName',
|
|
154
154
|
header: i18next.t('field.system_location'),
|
|
155
|
-
width:
|
|
155
|
+
width: 200
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
type: 'string',
|
|
159
159
|
name: 'inspectedLocationName',
|
|
160
160
|
header: i18next.t('field.inspected_location'),
|
|
161
|
-
width:
|
|
161
|
+
width: 200
|
|
162
162
|
},
|
|
163
163
|
{
|
|
164
164
|
type: 'string',
|
|
165
165
|
name: 'originUomValue',
|
|
166
166
|
header: i18next.t('field.system_uom_value'),
|
|
167
|
-
width:
|
|
167
|
+
width: 200
|
|
168
168
|
},
|
|
169
169
|
{
|
|
170
170
|
type: 'string',
|
|
171
171
|
name: 'inspectedUomValue',
|
|
172
172
|
header: i18next.t('field.inspected_uom_value'),
|
|
173
|
-
width:
|
|
173
|
+
width: 200
|
|
174
174
|
}
|
|
175
175
|
]
|
|
176
176
|
}
|
|
@@ -276,7 +276,7 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
276
276
|
},
|
|
277
277
|
{
|
|
278
278
|
type: 'integer',
|
|
279
|
-
name: '
|
|
279
|
+
name: 'systemQty',
|
|
280
280
|
header: i18next.t('field.system_qty'),
|
|
281
281
|
width: 100
|
|
282
282
|
},
|
|
@@ -342,6 +342,8 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
342
342
|
id
|
|
343
343
|
cartonId
|
|
344
344
|
palletId
|
|
345
|
+
packingType
|
|
346
|
+
uom
|
|
345
347
|
}
|
|
346
348
|
product {
|
|
347
349
|
sku
|
|
@@ -353,6 +355,7 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
353
355
|
packingType
|
|
354
356
|
uom
|
|
355
357
|
}
|
|
358
|
+
systemQty
|
|
356
359
|
originLocationId
|
|
357
360
|
inspectedLocationId
|
|
358
361
|
countData
|
|
@@ -394,7 +397,7 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
394
397
|
inventoryCheck: { name: inventoryCheckName },
|
|
395
398
|
inventoryCheckItem,
|
|
396
399
|
product: { sku, name: productName, brand, description },
|
|
397
|
-
productDetail: { packingType, uom }
|
|
400
|
+
productDetail: { packingType: pdPackingType, uom: pdUom }
|
|
398
401
|
} = item
|
|
399
402
|
|
|
400
403
|
// Parsing countData from string to object & convert to int or replace with "-"
|
|
@@ -412,10 +415,10 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
412
415
|
.pop()
|
|
413
416
|
|
|
414
417
|
// Calculate finalCount based on the latest count
|
|
415
|
-
const finalCount = latestCountKey ? countData[latestCountKey] :
|
|
418
|
+
const finalCount = latestCountKey ? countData[latestCountKey] : item.systemQty
|
|
416
419
|
|
|
417
420
|
// Calculate countVariance
|
|
418
|
-
const countVariance = finalCount -
|
|
421
|
+
const countVariance = finalCount - item.systemQty
|
|
419
422
|
|
|
420
423
|
// Calculate countStatus
|
|
421
424
|
let countStatus
|
|
@@ -431,13 +434,13 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
431
434
|
} = inventoryCheckItem
|
|
432
435
|
const originLocationName = originLocation.name
|
|
433
436
|
const inspectedLocationName = inspectedLocation.name
|
|
434
|
-
const { id: inventoryId, cartonId, palletId } = inventory
|
|
437
|
+
const { id: inventoryId, cartonId, palletId, packingType: invPackingType, uom: invUom } = inventory
|
|
435
438
|
|
|
436
|
-
if (finalCount ===
|
|
439
|
+
if (finalCount === item.systemQty) {
|
|
437
440
|
countStatus = 'HIT'
|
|
438
|
-
} else if (finalCount <
|
|
441
|
+
} else if (finalCount < item.systemQty) {
|
|
439
442
|
countStatus = 'SHORT'
|
|
440
|
-
} else if (finalCount >
|
|
443
|
+
} else if (finalCount > item.systemQty) {
|
|
441
444
|
countStatus = 'EXCESS'
|
|
442
445
|
}
|
|
443
446
|
|
|
@@ -454,6 +457,7 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
454
457
|
inspectedUomValue,
|
|
455
458
|
originQty,
|
|
456
459
|
inspectedQty,
|
|
460
|
+
systemQty: item.systemQty,
|
|
457
461
|
originLocationId: item.originLocationId,
|
|
458
462
|
originLocationName,
|
|
459
463
|
inspectedLocationId: item.inspectedLocationId,
|
|
@@ -462,8 +466,8 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
462
466
|
productName,
|
|
463
467
|
brand,
|
|
464
468
|
description,
|
|
465
|
-
packingType,
|
|
466
|
-
uom,
|
|
469
|
+
packingType: invPackingType || pdPackingType,
|
|
470
|
+
uom: invUom || pdUom,
|
|
467
471
|
runningNo: idx + 1,
|
|
468
472
|
batchNoVariance: item.batchNoVariance,
|
|
469
473
|
locationVariance: item.locationVariance,
|
|
@@ -496,9 +500,9 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
496
500
|
record.originLocationId || ''
|
|
497
501
|
}`
|
|
498
502
|
if (!groupedRecords[groupKey]) {
|
|
499
|
-
groupedRecords[groupKey] = { ...record, count: 1,
|
|
503
|
+
groupedRecords[groupKey] = { ...record, count: 1, systemQty: record.systemQty }
|
|
500
504
|
} else {
|
|
501
|
-
groupedRecords[groupKey].
|
|
505
|
+
groupedRecords[groupKey].systemQty += record.systemQty
|
|
502
506
|
Object.keys(record).forEach(key => {
|
|
503
507
|
if (key.startsWith('count ') && record[key] !== '-') {
|
|
504
508
|
groupedRecords[groupKey][key] =
|
|
@@ -514,15 +518,15 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
514
518
|
.filter(key => key.startsWith('count ') && groupedRecord[key] !== '-')
|
|
515
519
|
.pop()
|
|
516
520
|
|
|
517
|
-
const finalCount = latestCountKey ? groupedRecord[latestCountKey] : groupedRecord['
|
|
518
|
-
const countVariance = finalCount - groupedRecord['
|
|
521
|
+
const finalCount = latestCountKey ? groupedRecord[latestCountKey] : groupedRecord['systemQty']
|
|
522
|
+
const countVariance = finalCount - groupedRecord['systemQty']
|
|
519
523
|
|
|
520
524
|
let countStatus
|
|
521
|
-
if (finalCount === groupedRecord.
|
|
525
|
+
if (finalCount === groupedRecord.systemQty) {
|
|
522
526
|
countStatus = 'HIT'
|
|
523
|
-
} else if (finalCount < groupedRecord.
|
|
527
|
+
} else if (finalCount < groupedRecord.systemQty) {
|
|
524
528
|
countStatus = 'SHORT'
|
|
525
|
-
} else if (finalCount > groupedRecord.
|
|
529
|
+
} else if (finalCount > groupedRecord.systemQty) {
|
|
526
530
|
countStatus = 'EXCESS'
|
|
527
531
|
}
|
|
528
532
|
|
|
@@ -579,13 +583,13 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
579
583
|
}))
|
|
580
584
|
|
|
581
585
|
if (dynamicColumns.length > 0) {
|
|
582
|
-
const originQtyColumnIndex = this.config.columns.findIndex(col => col.name === '
|
|
586
|
+
const originQtyColumnIndex = this.config.columns.findIndex(col => col.name === 'systemQty')
|
|
583
587
|
const finalCountColumnIndex = this.config.columns.findIndex(col => col.name === 'finalCount')
|
|
584
588
|
|
|
585
589
|
if (originQtyColumnIndex !== -1 && finalCountColumnIndex !== -1) {
|
|
586
590
|
this.config.columns.splice(originQtyColumnIndex + 1, 0, ...dynamicColumns)
|
|
587
591
|
} else {
|
|
588
|
-
console.warn('
|
|
592
|
+
console.warn('systemQty or finalCount columns not found. Appending count columns at the end.')
|
|
589
593
|
this.config.columns.push(...dynamicColumns)
|
|
590
594
|
}
|
|
591
595
|
|
|
@@ -708,7 +712,7 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
708
712
|
{ header: i18next.t('field.system_uom_value'), key: 'originUomValue', width: 25, type: 'string' },
|
|
709
713
|
{ header: i18next.t('field.inspected_uom_value'), key: 'inspectedUomValue', width: 25, type: 'string' },
|
|
710
714
|
{ header: i18next.t('field.uom'), key: 'uom', width: 25, type: 'string' },
|
|
711
|
-
{ header: i18next.t('field.system_qty'), key: '
|
|
715
|
+
{ header: i18next.t('field.system_qty'), key: 'systemQty', width: 20, type: 'string' },
|
|
712
716
|
{ header: i18next.t('field.final_count'), key: 'finalCount', width: 20, type: 'string' },
|
|
713
717
|
{ header: i18next.t('field.count_variance'), key: 'countVariance', width: 20, type: 'string' },
|
|
714
718
|
{ header: i18next.t('field.count_status'), key: 'countStatus', width: 20, type: 'string' }
|
|
@@ -716,9 +720,9 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
716
720
|
|
|
717
721
|
data = (await this.fetchCycleCountReport({ page: 1, limit: 999999 })).records
|
|
718
722
|
|
|
719
|
-
const indexToInsert = headerSetting.findIndex(header => header.key === '
|
|
723
|
+
const indexToInsert = headerSetting.findIndex(header => header.key === 'systemQty')
|
|
720
724
|
if (indexToInsert === -1) {
|
|
721
|
-
console.error('
|
|
725
|
+
console.error('systemQty header not found in headerSetting')
|
|
722
726
|
return
|
|
723
727
|
}
|
|
724
728
|
|
|
@@ -748,7 +752,7 @@ class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
748
752
|
|
|
749
753
|
var headerSetting = [
|
|
750
754
|
{ header: i18next.t('field.sku'), key: 'sku', width: 20, type: 'string' },
|
|
751
|
-
{ header: i18next.t('field.system_qty'), key: '
|
|
755
|
+
{ header: i18next.t('field.system_qty'), key: 'systemQty', width: 20, type: 'string' },
|
|
752
756
|
{ header: i18next.t('field.final_count'), key: 'finalCount', width: 20, type: 'string' },
|
|
753
757
|
{ header: i18next.t('field.variance'), key: 'countVariance', width: 20, type: 'string' },
|
|
754
758
|
{ header: i18next.t('field.status'), key: 'countStatus', width: 20, type: 'string' }
|
|
@@ -190,7 +190,7 @@ class CycleCountReview extends localize(i18next)(PageView) {
|
|
|
190
190
|
classifier: (record, rowIndex) => {
|
|
191
191
|
return {
|
|
192
192
|
emphasized:
|
|
193
|
-
record.status === WORKSHEET_STATUS.NOT_TALLY.value
|
|
193
|
+
record.status === WORKSHEET_STATUS.NOT_TALLY.value
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
},
|
|
@@ -286,7 +286,7 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
286
286
|
<div product-card id="form">
|
|
287
287
|
<form id="input-form" class="single-column-form">
|
|
288
288
|
<label>${i18next.t('label.location')}</label><br />
|
|
289
|
-
<label class="input-font">${this._currentCard.
|
|
289
|
+
<label class="input-font">${this._currentCard.originLocation}</label><br />
|
|
290
290
|
<!-- validation lot id, carton id -->
|
|
291
291
|
${
|
|
292
292
|
this._enableCartonLabel
|
|
@@ -599,6 +599,10 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
599
599
|
uomValue
|
|
600
600
|
uom
|
|
601
601
|
status
|
|
602
|
+
originLocation {
|
|
603
|
+
id
|
|
604
|
+
name
|
|
605
|
+
}
|
|
602
606
|
inspectedBatchNo
|
|
603
607
|
inspectedQty
|
|
604
608
|
inspectedUomValue
|
|
@@ -735,6 +739,7 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
735
739
|
name,
|
|
736
740
|
product,
|
|
737
741
|
productDetail,
|
|
742
|
+
originLocation,
|
|
738
743
|
inspectedBatchNo,
|
|
739
744
|
inspectedUomValue,
|
|
740
745
|
inspectedLocation,
|
|
@@ -749,6 +754,7 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
|
|
|
749
754
|
productName: product?.name || '',
|
|
750
755
|
productSku: product?.sku || '',
|
|
751
756
|
productDetailId: productDetail?.id || '',
|
|
757
|
+
originLocation: originLocation?.name || null,
|
|
752
758
|
inspectedBatchNo: inspectedBatchNo || '',
|
|
753
759
|
inspectedUomValue: inspectedUomValue,
|
|
754
760
|
inspectedLocation: inspectedLocation?.name || null,
|
package/config.development.js
CHANGED
|
@@ -30,6 +30,8 @@ exports.cycleCountReport = {
|
|
|
30
30
|
ic.status as "status",
|
|
31
31
|
i.carton_id as "carton_id",
|
|
32
32
|
i.pallet_id as "pallet_id",
|
|
33
|
+
i.packing_type as "i_packing_type",
|
|
34
|
+
i.uom as "i_uom",
|
|
33
35
|
p.sku as "product_sku",
|
|
34
36
|
p.name as "product_name",
|
|
35
37
|
p.brand as "product_brand",
|
|
@@ -44,7 +46,7 @@ exports.cycleCountReport = {
|
|
|
44
46
|
l.name as "origin_location_name",
|
|
45
47
|
ici.inspected_location_id as "inspected_location_id",
|
|
46
48
|
l2.name as "inspected_location_name",
|
|
47
|
-
COALESCE(
|
|
49
|
+
COALESCE(ici.origin_qty, 0) as "origin_qty",
|
|
48
50
|
COALESCE(ici.inspected_qty, 0) as "inspected_qty"
|
|
49
51
|
FROM
|
|
50
52
|
inventory_checks ic
|
|
@@ -52,8 +54,6 @@ exports.cycleCountReport = {
|
|
|
52
54
|
inventory_check_items ici on ici.inventory_check_id = ic.id
|
|
53
55
|
left join
|
|
54
56
|
inventories i on i.id = ici.inventory_id
|
|
55
|
-
left join
|
|
56
|
-
inventory_check_items ici_first_count on ici_first_count.inventory_id = ici.inventory_id AND ici_first_count.count_no = 1
|
|
57
57
|
inner join
|
|
58
58
|
products p ON p.id = ici.product_id
|
|
59
59
|
inner join
|
|
@@ -111,6 +111,7 @@ exports.cycleCountReport = {
|
|
|
111
111
|
CREATE TEMP TABLE temp_final_count ON COMMIT DROP AS (
|
|
112
112
|
SELECT
|
|
113
113
|
inventory_id,
|
|
114
|
+
count_no,
|
|
114
115
|
MAX(inspected_qty) as "final_count"
|
|
115
116
|
FROM
|
|
116
117
|
inventory_check_items ici
|
|
@@ -121,11 +122,12 @@ exports.cycleCountReport = {
|
|
|
121
122
|
MAX(count_no)
|
|
122
123
|
FROM
|
|
123
124
|
inventory_check_items
|
|
125
|
+
WHERE inventory_check_id = $1
|
|
124
126
|
GROUP BY
|
|
125
127
|
inventory_id
|
|
126
128
|
)
|
|
127
129
|
AND inventory_check_id = $1
|
|
128
|
-
GROUP BY inventory_id
|
|
130
|
+
GROUP BY inventory_id, count_no
|
|
129
131
|
)`, [cycleCount.id]);
|
|
130
132
|
let jsonColumnNames = definedCrossColumn[0].columns
|
|
131
133
|
.split(',')
|
|
@@ -139,63 +141,56 @@ exports.cycleCountReport = {
|
|
|
139
141
|
SELECT
|
|
140
142
|
f.*,
|
|
141
143
|
fc.final_count,
|
|
144
|
+
first_count.origin_qty as "system_qty",
|
|
142
145
|
row_to_json((SELECT cn FROM (SELECT ${jsonColumnNames}) cn))::varchar as "count_data",
|
|
143
146
|
CASE
|
|
144
|
-
WHEN
|
|
145
|
-
THEN
|
|
147
|
+
WHEN (COALESCE(first_count.origin_batch_no, '') <> COALESCE(f.inspected_batch_no, ''))
|
|
148
|
+
THEN true
|
|
146
149
|
ELSE false
|
|
147
150
|
END AS "BatchNoVariance",
|
|
148
151
|
CASE
|
|
149
|
-
WHEN
|
|
150
|
-
THEN
|
|
152
|
+
WHEN (COALESCE(first_count.origin_location_id::text, '') <> COALESCE(f.inspected_location_id::text, ''))
|
|
153
|
+
THEN true
|
|
151
154
|
ELSE false
|
|
152
155
|
END AS "LocationVariance",
|
|
153
156
|
CASE
|
|
154
|
-
WHEN
|
|
155
|
-
THEN
|
|
157
|
+
WHEN (COALESCE(first_count.origin_uom_value, 0) <> COALESCE(f.inspected_uom_value, 0))
|
|
158
|
+
THEN true
|
|
156
159
|
ELSE false
|
|
157
160
|
END AS "UomValueVariance"
|
|
158
161
|
FROM temp_fixed_columns f
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
INNER JOIN (
|
|
163
|
+
SELECT
|
|
164
|
+
inventory_id,
|
|
165
|
+
count_no,
|
|
166
|
+
origin_qty,
|
|
167
|
+
origin_batch_no,
|
|
168
|
+
origin_location_id,
|
|
169
|
+
origin_uom_value
|
|
170
|
+
FROM temp_fixed_columns
|
|
171
|
+
WHERE count_no = 1
|
|
172
|
+
) first_count ON f.inventory_id = first_count.inventory_id
|
|
173
|
+
INNER JOIN temp_pivoted_data p ON f.inventory_id::uuid = p.inventory_id::uuid
|
|
174
|
+
INNER JOIN temp_final_count fc ON f.inventory_id = fc.inventory_id and f.count_no = fc.count_no
|
|
166
175
|
)`);
|
|
167
176
|
// Step 7: Select final result
|
|
168
177
|
const result = await tx.query(`
|
|
169
178
|
SELECT * FROM temp_final_data`);
|
|
170
|
-
//
|
|
179
|
+
// grouping inventory id
|
|
171
180
|
let inventoryIds = new Set();
|
|
172
181
|
let items = [];
|
|
173
182
|
result.forEach(itm => {
|
|
174
183
|
if (!inventoryIds.has(itm.inventory_id)) {
|
|
175
184
|
inventoryIds.add(itm.inventory_id);
|
|
176
185
|
let countStatus;
|
|
177
|
-
if (itm.
|
|
178
|
-
|
|
179
|
-
itm.inspected_uom_value === null &&
|
|
180
|
-
itm.inspected_location_id === null) {
|
|
181
|
-
countStatus = 'MISSING';
|
|
186
|
+
if (itm.final_count === itm.system_qty) {
|
|
187
|
+
countStatus = 'HIT';
|
|
182
188
|
}
|
|
183
|
-
else if (itm.
|
|
184
|
-
|
|
185
|
-
itm.origin_uom_value === null &&
|
|
186
|
-
itm.origin_location_id === null) {
|
|
187
|
-
countStatus = 'NEW';
|
|
189
|
+
else if (itm.final_count < itm.system_qty) {
|
|
190
|
+
countStatus = 'SHORT';
|
|
188
191
|
}
|
|
189
192
|
else {
|
|
190
|
-
|
|
191
|
-
countStatus = 'HIT';
|
|
192
|
-
}
|
|
193
|
-
else if (itm.final_count < itm.origin_qty) {
|
|
194
|
-
countStatus = 'SHORT';
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
countStatus = 'EXCESS';
|
|
198
|
-
}
|
|
193
|
+
countStatus = 'EXCESS';
|
|
199
194
|
}
|
|
200
195
|
let data = {
|
|
201
196
|
inventoryCheck: {
|
|
@@ -221,7 +216,9 @@ exports.cycleCountReport = {
|
|
|
221
216
|
inventory: {
|
|
222
217
|
id: itm.inventory_id,
|
|
223
218
|
cartonId: itm.carton_id,
|
|
224
|
-
palletId: itm.pallet_id
|
|
219
|
+
palletId: itm.pallet_id,
|
|
220
|
+
packingType: itm.i_packing_type,
|
|
221
|
+
uom: itm.i_uom
|
|
225
222
|
},
|
|
226
223
|
product: {
|
|
227
224
|
sku: itm.product_sku,
|
|
@@ -233,6 +230,7 @@ exports.cycleCountReport = {
|
|
|
233
230
|
packingType: itm.pd_packing_type,
|
|
234
231
|
uom: itm.pd_uom
|
|
235
232
|
},
|
|
233
|
+
systemQty: itm.system_qty,
|
|
236
234
|
originLocationId: itm.origin_location_id,
|
|
237
235
|
inspectedLocationId: itm.inspected_location_id,
|
|
238
236
|
countData: itm.count_data,
|
|
@@ -1 +1 @@
|
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA6DA,EACA,CAAC,UAAU,CAAC,EAAE,CAAC,CAChB,CAAA;YAED,gDAAgD;YAChD,MAAM,EAAE,CAAC,KAAK,CACZ;;;;;;;UAOE,EACF,CAAC,UAAU,CAAC,EAAE,CAAC,CAChB,CAAA;YAED,0DAA0D;YAC1D,IAAI,kBAAkB,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC;;;OAGvC,CAAC,CAAA;YAEF,IAAI,UAAU,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,OAAO;iBAC3C,KAAK,CAAC,GAAG,CAAC;iBACV,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;iBAC3C,IAAI,CAAC,IAAI,CAAC,CAAA;YAEb,gDAAgD;YAChD,MAAM,EAAE,CAAC,KAAK,CAAC;;;;;;;;;;;2CAWsB,UAAU;UAC3C,CAAC,CAAA;YAEL,4CAA4C;YAC5C,MAAM,EAAE,CAAC,KAAK,CACZ
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA6DA,EACA,CAAC,UAAU,CAAC,EAAE,CAAC,CAChB,CAAA;YAED,gDAAgD;YAChD,MAAM,EAAE,CAAC,KAAK,CACZ;;;;;;;UAOE,EACF,CAAC,UAAU,CAAC,EAAE,CAAC,CAChB,CAAA;YAED,0DAA0D;YAC1D,IAAI,kBAAkB,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC;;;OAGvC,CAAC,CAAA;YAEF,IAAI,UAAU,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,OAAO;iBAC3C,KAAK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AE,GAAG,CAAC,MAAM;yBAChB;wBACD,SAAS,EAAE,GAAG,CAAC,UAAU;wBACzB,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"}
|
|
@@ -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
|
|
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;;;;;;;;;;;;;;;;;;;;CAoBlC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/operato-wms",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.390",
|
|
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.381",
|
|
92
92
|
"@things-factory/product-base": "^4.3.383",
|
|
93
93
|
"@things-factory/resource-ui": "^4.3.381",
|
|
94
|
-
"@things-factory/sales-ui": "^4.3.
|
|
94
|
+
"@things-factory/sales-ui": "^4.3.390",
|
|
95
95
|
"@things-factory/scene-data-transform": "^4.3.381",
|
|
96
96
|
"@things-factory/scene-excel": "^4.3.381",
|
|
97
97
|
"@things-factory/scene-firebase": "^4.3.381",
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
"@things-factory/system-ui": "^4.3.381",
|
|
108
108
|
"@things-factory/transport-base": "^4.3.381",
|
|
109
109
|
"@things-factory/tutorial-ui": "^4.3.381",
|
|
110
|
-
"@things-factory/warehouse-base": "^4.3.
|
|
111
|
-
"@things-factory/worksheet-base": "^4.3.
|
|
110
|
+
"@things-factory/warehouse-base": "^4.3.390",
|
|
111
|
+
"@things-factory/worksheet-base": "^4.3.390"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
114
|
"@things-factory/builder": "^4.3.381",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"cypress-localstorage-commands": "^1.6.1",
|
|
118
118
|
"eslint-plugin-cypress": "^2.12.1"
|
|
119
119
|
},
|
|
120
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "6b9a443621a365d9e9562e21fed4182e4727f7a9"
|
|
121
121
|
}
|
|
@@ -36,6 +36,8 @@ export const cycleCountReport = {
|
|
|
36
36
|
ic.status as "status",
|
|
37
37
|
i.carton_id as "carton_id",
|
|
38
38
|
i.pallet_id as "pallet_id",
|
|
39
|
+
i.packing_type as "i_packing_type",
|
|
40
|
+
i.uom as "i_uom",
|
|
39
41
|
p.sku as "product_sku",
|
|
40
42
|
p.name as "product_name",
|
|
41
43
|
p.brand as "product_brand",
|
|
@@ -50,7 +52,7 @@ export const cycleCountReport = {
|
|
|
50
52
|
l.name as "origin_location_name",
|
|
51
53
|
ici.inspected_location_id as "inspected_location_id",
|
|
52
54
|
l2.name as "inspected_location_name",
|
|
53
|
-
COALESCE(
|
|
55
|
+
COALESCE(ici.origin_qty, 0) as "origin_qty",
|
|
54
56
|
COALESCE(ici.inspected_qty, 0) as "inspected_qty"
|
|
55
57
|
FROM
|
|
56
58
|
inventory_checks ic
|
|
@@ -58,8 +60,6 @@ export const cycleCountReport = {
|
|
|
58
60
|
inventory_check_items ici on ici.inventory_check_id = ic.id
|
|
59
61
|
left join
|
|
60
62
|
inventories i on i.id = ici.inventory_id
|
|
61
|
-
left join
|
|
62
|
-
inventory_check_items ici_first_count on ici_first_count.inventory_id = ici.inventory_id AND ici_first_count.count_no = 1
|
|
63
63
|
inner join
|
|
64
64
|
products p ON p.id = ici.product_id
|
|
65
65
|
inner join
|
|
@@ -128,6 +128,7 @@ export const cycleCountReport = {
|
|
|
128
128
|
CREATE TEMP TABLE temp_final_count ON COMMIT DROP AS (
|
|
129
129
|
SELECT
|
|
130
130
|
inventory_id,
|
|
131
|
+
count_no,
|
|
131
132
|
MAX(inspected_qty) as "final_count"
|
|
132
133
|
FROM
|
|
133
134
|
inventory_check_items ici
|
|
@@ -138,11 +139,12 @@ export const cycleCountReport = {
|
|
|
138
139
|
MAX(count_no)
|
|
139
140
|
FROM
|
|
140
141
|
inventory_check_items
|
|
142
|
+
WHERE inventory_check_id = $1
|
|
141
143
|
GROUP BY
|
|
142
144
|
inventory_id
|
|
143
145
|
)
|
|
144
146
|
AND inventory_check_id = $1
|
|
145
|
-
GROUP BY inventory_id
|
|
147
|
+
GROUP BY inventory_id, count_no
|
|
146
148
|
)`,
|
|
147
149
|
[cycleCount.id]
|
|
148
150
|
)
|
|
@@ -160,37 +162,44 @@ export const cycleCountReport = {
|
|
|
160
162
|
SELECT
|
|
161
163
|
f.*,
|
|
162
164
|
fc.final_count,
|
|
165
|
+
first_count.origin_qty as "system_qty",
|
|
163
166
|
row_to_json((SELECT cn FROM (SELECT ${jsonColumnNames}) cn))::varchar as "count_data",
|
|
164
167
|
CASE
|
|
165
|
-
WHEN
|
|
166
|
-
THEN
|
|
168
|
+
WHEN (COALESCE(first_count.origin_batch_no, '') <> COALESCE(f.inspected_batch_no, ''))
|
|
169
|
+
THEN true
|
|
167
170
|
ELSE false
|
|
168
171
|
END AS "BatchNoVariance",
|
|
169
172
|
CASE
|
|
170
|
-
WHEN
|
|
171
|
-
THEN
|
|
173
|
+
WHEN (COALESCE(first_count.origin_location_id::text, '') <> COALESCE(f.inspected_location_id::text, ''))
|
|
174
|
+
THEN true
|
|
172
175
|
ELSE false
|
|
173
176
|
END AS "LocationVariance",
|
|
174
177
|
CASE
|
|
175
|
-
WHEN
|
|
176
|
-
THEN
|
|
178
|
+
WHEN (COALESCE(first_count.origin_uom_value, 0) <> COALESCE(f.inspected_uom_value, 0))
|
|
179
|
+
THEN true
|
|
177
180
|
ELSE false
|
|
178
181
|
END AS "UomValueVariance"
|
|
179
182
|
FROM temp_fixed_columns f
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
INNER JOIN (
|
|
184
|
+
SELECT
|
|
185
|
+
inventory_id,
|
|
186
|
+
count_no,
|
|
187
|
+
origin_qty,
|
|
188
|
+
origin_batch_no,
|
|
189
|
+
origin_location_id,
|
|
190
|
+
origin_uom_value
|
|
191
|
+
FROM temp_fixed_columns
|
|
192
|
+
WHERE count_no = 1
|
|
193
|
+
) first_count ON f.inventory_id = first_count.inventory_id
|
|
194
|
+
INNER JOIN temp_pivoted_data p ON f.inventory_id::uuid = p.inventory_id::uuid
|
|
195
|
+
INNER JOIN temp_final_count fc ON f.inventory_id = fc.inventory_id and f.count_no = fc.count_no
|
|
187
196
|
)`)
|
|
188
197
|
|
|
189
198
|
// Step 7: Select final result
|
|
190
199
|
const result: any = await tx.query(`
|
|
191
200
|
SELECT * FROM temp_final_data`)
|
|
192
201
|
|
|
193
|
-
//
|
|
202
|
+
// grouping inventory id
|
|
194
203
|
let inventoryIds = new Set()
|
|
195
204
|
let items = []
|
|
196
205
|
result.forEach(itm => {
|
|
@@ -199,28 +208,12 @@ export const cycleCountReport = {
|
|
|
199
208
|
|
|
200
209
|
let countStatus
|
|
201
210
|
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
itm.inspected_location_id === null
|
|
207
|
-
) {
|
|
208
|
-
countStatus = 'MISSING'
|
|
209
|
-
} else if (
|
|
210
|
-
itm.origin_batch_no === null &&
|
|
211
|
-
itm.origin_qty === null &&
|
|
212
|
-
itm.origin_uom_value === null &&
|
|
213
|
-
itm.origin_location_id === null
|
|
214
|
-
) {
|
|
215
|
-
countStatus = 'NEW'
|
|
211
|
+
if (itm.final_count === itm.system_qty) {
|
|
212
|
+
countStatus = 'HIT'
|
|
213
|
+
} else if (itm.final_count < itm.system_qty) {
|
|
214
|
+
countStatus = 'SHORT'
|
|
216
215
|
} else {
|
|
217
|
-
|
|
218
|
-
countStatus = 'HIT'
|
|
219
|
-
} else if (itm.final_count < itm.origin_qty) {
|
|
220
|
-
countStatus = 'SHORT'
|
|
221
|
-
} else {
|
|
222
|
-
countStatus = 'EXCESS'
|
|
223
|
-
}
|
|
216
|
+
countStatus = 'EXCESS'
|
|
224
217
|
}
|
|
225
218
|
|
|
226
219
|
let data = {
|
|
@@ -247,7 +240,9 @@ export const cycleCountReport = {
|
|
|
247
240
|
inventory: {
|
|
248
241
|
id: itm.inventory_id,
|
|
249
242
|
cartonId: itm.carton_id,
|
|
250
|
-
palletId: itm.pallet_id
|
|
243
|
+
palletId: itm.pallet_id,
|
|
244
|
+
packingType: itm.i_packing_type,
|
|
245
|
+
uom: itm.i_uom
|
|
251
246
|
},
|
|
252
247
|
product: {
|
|
253
248
|
sku: itm.product_sku,
|
|
@@ -259,6 +254,7 @@ export const cycleCountReport = {
|
|
|
259
254
|
packingType: itm.pd_packing_type,
|
|
260
255
|
uom: itm.pd_uom
|
|
261
256
|
},
|
|
257
|
+
systemQty: itm.system_qty,
|
|
262
258
|
originLocationId: itm.origin_location_id,
|
|
263
259
|
inspectedLocationId: itm.inspected_location_id,
|
|
264
260
|
countData: itm.count_data,
|