@things-factory/operato-wms 4.3.356 → 4.3.357
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/components/select-cc-product-popup.js +321 -0
- package/client/pages/constants/order.js +15 -0
- package/client/pages/inventory-check/add-extra-inventory-popup.js +306 -0
- package/client/pages/inventory-check/check-inventory-popup.js +183 -167
- package/client/pages/inventory-check/create-cycle-count.js +292 -141
- package/client/pages/inventory-check/cycle-count-inventory-details-popup.js +282 -0
- package/client/pages/inventory-check/cycle-count-recheck-popup.js +129 -31
- package/client/pages/inventory-check/cycle-count-report.js +425 -306
- package/client/pages/inventory-check/cycle-count-review.js +742 -0
- package/client/pages/inventory-check/cycle-count-worksheet-list.js +476 -0
- package/client/pages/inventory-check/inspecting-product.js +954 -1029
- package/client/pages/inventory-check/inventory-check-detail.js +378 -0
- package/client/pages/inventory-check/inventory-check-list.js +35 -109
- package/client/pages/inventory-check/relocate-inventory-popup.js +222 -0
- package/client/pages/inventory-check/search-popup.js +1 -1
- package/client/pages/inventory-check/select-cc-location-popup.js +230 -0
- package/client/pages/inventory-check/worksheet-cycle-count.js +112 -90
- package/client/pages/outbound/route-label-popup.js +16 -0
- package/client/route.js +8 -0
- package/dist-server/graphql/resolvers/reports/cycle-count-report.js +244 -0
- package/dist-server/graphql/resolvers/reports/cycle-count-report.js.map +1 -0
- package/dist-server/graphql/resolvers/reports/index.js +2 -1
- package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
- package/dist-server/graphql/types/reports/cycle-count-report-list.js +14 -0
- package/dist-server/graphql/types/reports/cycle-count-report-list.js.map +1 -0
- package/dist-server/graphql/types/reports/cycle-count-report.js +25 -0
- package/dist-server/graphql/types/reports/cycle-count-report.js.map +1 -0
- package/dist-server/graphql/types/reports/index.js +5 -0
- package/dist-server/graphql/types/reports/index.js.map +1 -1
- package/package.json +6 -6
- package/server/graphql/resolvers/reports/cycle-count-report.ts +267 -0
- package/server/graphql/resolvers/reports/index.ts +3 -4
- package/server/graphql/types/reports/cycle-count-report-list.ts +8 -0
- package/server/graphql/types/reports/cycle-count-report.ts +19 -0
- package/server/graphql/types/reports/index.ts +7 -8
- package/things-factory.config.js +8 -0
- package/translations/en.json +34 -0
- package/translations/ko.json +34 -0
- package/translations/ms.json +35 -1
- package/translations/zh.json +37 -3
|
@@ -13,5 +13,6 @@ const release_inventory_report_1 = require("./release-inventory-report");
|
|
|
13
13
|
const shortage_report_1 = require("./shortage-report");
|
|
14
14
|
const tote_loading_qc_report_1 = require("./tote-loading-qc-report");
|
|
15
15
|
const vas_report_1 = require("./vas-report");
|
|
16
|
-
|
|
16
|
+
const cycle_count_report_1 = require("./cycle-count-report");
|
|
17
|
+
exports.Query = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, inbound_serial_number_report_1.inboundSerialNumberReport), outbound_serial_number_report_1.outboundSerialNumberReport), costing_report_1.costingReport), inbound_order_details_report_1.inboundOrderDetailsReport), outbound_order_details_report_1.outboundOrderDetailsReport), product_label_report_1.productLabelReport), release_inventory_report_1.releaseInventoryReport), shortage_report_1.shortageReport), tote_loading_qc_report_1.loadingQcReport), vas_report_1.orderVasReport), vas_report_1.vasReport), analysis_picking_packing_report_1.analysisPickingPackingReport), cycle_count_report_1.cycleCountReport), non_loaded_inventory_report_1.nonLoadedOrderInventoriesReport);
|
|
17
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/index.ts"],"names":[],"mappings":";;;AAAA,uFAAgF;AAChF,qDAAgD;AAChD,iFAA0E;AAC1E,iFAA0E;AAC1E,+EAA+E;AAC/E,mFAA4E;AAC5E,mFAA4E;AAC5E,iEAA2D;AAC3D,yEAAmE;AACnE,uDAAkD;AAClD,qEAA0D;AAC1D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/index.ts"],"names":[],"mappings":";;;AAAA,uFAAgF;AAChF,qDAAgD;AAChD,iFAA0E;AAC1E,iFAA0E;AAC1E,+EAA+E;AAC/E,mFAA4E;AAC5E,mFAA4E;AAC5E,iEAA2D;AAC3D,yEAAmE;AACnE,uDAAkD;AAClD,qEAA0D;AAC1D,6CAAwD;AACxD,6DAAuD;AAE1C,QAAA,KAAK,2MACb,wDAAyB,GACzB,0DAA0B,GAC1B,8BAAa,GACb,wDAAyB,GACzB,0DAA0B,GAC1B,yCAAkB,GAClB,iDAAsB,GACtB,gCAAc,GACd,wCAAe,GACf,2BAAc,GACd,sBAAS,GACT,8DAA4B,GAC5B,qCAAgB,GAChB,6DAA+B,EACnC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CycleCountReportList = void 0;
|
|
7
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
|
+
exports.CycleCountReportList = (0, graphql_tag_1.default) `
|
|
9
|
+
type CycleCountReportList {
|
|
10
|
+
items: [CycleCountReport]
|
|
11
|
+
total: Int
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
//# sourceMappingURL=cycle-count-report-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cycle-count-report-list.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/cycle-count-report-list.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,oBAAoB,GAAG,IAAA,qBAAG,EAAA;;;;;CAKtC,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CycleCountReport = void 0;
|
|
7
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
|
+
exports.CycleCountReport = (0, graphql_tag_1.default) `
|
|
9
|
+
type CycleCountReport {
|
|
10
|
+
inventoryCheck: InventoryCheck!
|
|
11
|
+
inventoryCheckItem: InventoryCheckItem
|
|
12
|
+
inventory: Inventory!
|
|
13
|
+
product: Product!
|
|
14
|
+
countData: String
|
|
15
|
+
batchNoVariance: Boolean
|
|
16
|
+
locationVariance: Boolean
|
|
17
|
+
uomValueVariance: Boolean
|
|
18
|
+
finalCount: String
|
|
19
|
+
countVariance: String
|
|
20
|
+
countStatus: String
|
|
21
|
+
company: String
|
|
22
|
+
partnerDomainId: String
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
//# sourceMappingURL=cycle-count-report.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -25,6 +25,8 @@ const shortage_report_list_1 = require("./shortage-report-list");
|
|
|
25
25
|
const shortage_report_type_1 = require("./shortage-report-type");
|
|
26
26
|
const vas_report_1 = require("./vas-report");
|
|
27
27
|
const vas_report_list_1 = require("./vas-report-list");
|
|
28
|
+
const cycle_count_report_1 = require("./cycle-count-report");
|
|
29
|
+
const cycle_count_report_list_1 = require("./cycle-count-report-list");
|
|
28
30
|
exports.Query = `
|
|
29
31
|
inboundSerialNumberReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): InboundSerialNumberReportList @transaction
|
|
30
32
|
outboundSerialNumberReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): OutboundSerialNumberReportList @transaction
|
|
@@ -38,6 +40,7 @@ exports.Query = `
|
|
|
38
40
|
orderVasReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): OrderVasReportList @transaction
|
|
39
41
|
vasReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): OrderVasReportList @transaction
|
|
40
42
|
analysisPickingPackingReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): AnalysisPickingPackingReportList @transaction
|
|
43
|
+
cycleCountReport(name: String!): CycleCountReportList @transaction
|
|
41
44
|
nonLoadedOrderInventories(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): NonLoadedOrderInventoryReportList @transaction
|
|
42
45
|
`;
|
|
43
46
|
exports.Types = [
|
|
@@ -65,6 +68,8 @@ exports.Types = [
|
|
|
65
68
|
vas_report_list_1.VasReportList,
|
|
66
69
|
analysis_picking_packing_report_1.AnalysisPickingPackingReport,
|
|
67
70
|
analysis_picking_packing_report_list_1.AnalysisPickingPackingReportList,
|
|
71
|
+
cycle_count_report_1.CycleCountReport,
|
|
72
|
+
cycle_count_report_list_1.CycleCountReportList,
|
|
68
73
|
non_loaded_inventory_report_1.NonLoadedOrderInventoryReport,
|
|
69
74
|
non_loaded_inventory_report_list_1.NonLoadedOrderInventoryReportList
|
|
70
75
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/index.ts"],"names":[],"mappings":";;;AAAA,uFAAgF;AAChF,iGAAyF;AACzF,qDAAgD;AAChD,+DAAyD;AACzD,iFAA0E;AAC1E,2FAAmF;AACnF,iFAA0E;AAC1E,2FAAmF;AACnF,2DAAqD;AACrD,qEAA8D;AAC9D,+EAA6E;AAC7E,yFAAsF;AACtF,mFAA4E;AAC5E,6FAAqF;AACrF,mFAA4E;AAC5E,6FAAqF;AACrF,iEAA2D;AAC3D,2EAAoE;AACpE,yEAAmE;AACnE,mFAA4E;AAC5E,iEAA2D;AAC3D,iEAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/index.ts"],"names":[],"mappings":";;;AAAA,uFAAgF;AAChF,iGAAyF;AACzF,qDAAgD;AAChD,+DAAyD;AACzD,iFAA0E;AAC1E,2FAAmF;AACnF,iFAA0E;AAC1E,2FAAmF;AACnF,2DAAqD;AACrD,qEAA8D;AAC9D,+EAA6E;AAC7E,yFAAsF;AACtF,mFAA4E;AAC5E,6FAAqF;AACrF,mFAA4E;AAC5E,6FAAqF;AACrF,iEAA2D;AAC3D,2EAAoE;AACpE,yEAAmE;AACnE,mFAA4E;AAC5E,iEAA2D;AAC3D,iEAAuD;AACvD,6CAAwD;AACxD,uDAAqE;AACrE,6DAAuD;AACvD,uEAAgE;AAEnD,QAAA,KAAK,GAAG;;;;;;;;;;;;;;;CAepB,CAAA;AAEY,QAAA,KAAK,GAAG;IACnB,wDAAyB;IACzB,iEAA6B;IAC7B,0DAA0B;IAC1B,mEAA8B;IAC9B,wDAAyB;IACzB,iEAA6B;IAC7B,0DAA0B;IAC1B,mEAA8B;IAC9B,yCAAkB;IAClB,kDAAsB;IACtB,8BAAa;IACb,uCAAiB;IACjB,iDAAsB;IACtB,0DAA0B;IAC1B,qCAAc;IACd,yCAAkB;IAClB,mCAAe;IACf,4CAAmB;IACnB,2BAAc;IACd,oCAAkB;IAClB,sBAAS;IACT,+BAAa;IACb,8DAA4B;IAC5B,uEAAgC;IAChC,qCAAgB;IAChB,8CAAoB;IACpB,2DAA6B;IAC7B,oEAAiC;CAClC,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.357",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
"@things-factory/pdf": "^4.3.281",
|
|
90
90
|
"@things-factory/print-proxy-service": "^4.3.281",
|
|
91
91
|
"@things-factory/print-ui": "^4.3.281",
|
|
92
|
-
"@things-factory/product-base": "^4.3.
|
|
92
|
+
"@things-factory/product-base": "^4.3.357",
|
|
93
93
|
"@things-factory/resource-ui": "^4.3.281",
|
|
94
|
-
"@things-factory/sales-ui": "^4.3.
|
|
94
|
+
"@things-factory/sales-ui": "^4.3.357",
|
|
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.
|
|
111
|
-
"@things-factory/worksheet-base": "^4.3.
|
|
110
|
+
"@things-factory/warehouse-base": "^4.3.357",
|
|
111
|
+
"@things-factory/worksheet-base": "^4.3.357"
|
|
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": "
|
|
120
|
+
"gitHead": "b3e5c3df67198d03dd9d038d860b993423a07f04"
|
|
121
121
|
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { EntityManager } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
import { User } from '@things-factory/auth-base'
|
|
4
|
+
import { InventoryCheck } from '@things-factory/sales-base'
|
|
5
|
+
import { ListParam, Domain } from '@things-factory/shell'
|
|
6
|
+
|
|
7
|
+
export const cycleCountReport = {
|
|
8
|
+
async cycleCountReport(_: any, { name }: { name: string }, context: any) {
|
|
9
|
+
try {
|
|
10
|
+
const { domain, tx }: { domain: Domain; tx: EntityManager } = context.state
|
|
11
|
+
|
|
12
|
+
const cycleCount: InventoryCheck = await tx.getRepository(InventoryCheck).findOne({
|
|
13
|
+
where: { domain, name },
|
|
14
|
+
relations: ['domain']
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
await tx.query(`CREATE EXTENSION IF NOT EXISTS tablefunc`)
|
|
18
|
+
|
|
19
|
+
// Step 1: Create the temp_fixed_columns table
|
|
20
|
+
await tx.query(
|
|
21
|
+
`
|
|
22
|
+
CREATE TEMP TABLE temp_fixed_columns ON COMMIT DROP AS (
|
|
23
|
+
SELECT
|
|
24
|
+
d.id as "partner_domain_id",
|
|
25
|
+
w.check_count as "check_count",
|
|
26
|
+
ic.id as "inventory_check_id",
|
|
27
|
+
ici.inventory_id as "inventory_id",
|
|
28
|
+
ic.name as "name",
|
|
29
|
+
ici.product_id as "product_id",
|
|
30
|
+
ici.count_no as "count_no",
|
|
31
|
+
ici.product_detail_id as "product_detail_id",
|
|
32
|
+
ici.status as "invCheckItemStatus",
|
|
33
|
+
b.name as "company",
|
|
34
|
+
ic.name as "cycle_count_no",
|
|
35
|
+
ic.execution_date as "execution_date",
|
|
36
|
+
ic.status as "status",
|
|
37
|
+
i.carton_id as "carton_id",
|
|
38
|
+
i.pallet_id as "pallet_id",
|
|
39
|
+
p.sku as "product_sku",
|
|
40
|
+
p.name as "product_name",
|
|
41
|
+
p.brand as "product_brand",
|
|
42
|
+
p.packing_type as "product_packing_type",
|
|
43
|
+
ici.origin_batch_no as "origin_batch_no",
|
|
44
|
+
ici.inspected_batch_no as "inspected_batch_no",
|
|
45
|
+
ici.origin_location_id as "origin_location_id",
|
|
46
|
+
ici.inspected_location_id as "inspected_location_id",
|
|
47
|
+
ici.origin_uom_value as "origin_uom_value",
|
|
48
|
+
ici.inspected_uom_value as "inspected_uom_value",
|
|
49
|
+
COALESCE(ici_first_count.origin_qty, ici.origin_qty, 0) as "origin_qty",
|
|
50
|
+
COALESCE(ici.inspected_qty, 0) as "inspected_qty"
|
|
51
|
+
FROM
|
|
52
|
+
inventory_checks ic
|
|
53
|
+
inner join
|
|
54
|
+
inventory_check_items ici on ici.inventory_check_id = ic.id
|
|
55
|
+
left join
|
|
56
|
+
inventories i on i.id = ici.inventory_id
|
|
57
|
+
left join
|
|
58
|
+
inventory_check_items ici_first_count on ici_first_count.inventory_id = ici.inventory_id AND ici_first_count.count_no = 1
|
|
59
|
+
inner join
|
|
60
|
+
products p ON p.id = ici.product_id
|
|
61
|
+
inner join
|
|
62
|
+
product_details pd ON pd.id = ici.product_detail_id
|
|
63
|
+
inner join
|
|
64
|
+
worksheets w on w.inventory_check_id = ic.id
|
|
65
|
+
inner join
|
|
66
|
+
worksheet_details wd on wd.worksheet_id = w.id and wd.target_inventory_check_item_id = ici.id
|
|
67
|
+
inner join
|
|
68
|
+
bizplaces b on b.id = ic.bizplace_id
|
|
69
|
+
inner join
|
|
70
|
+
domains d on d.id = b.domain_id
|
|
71
|
+
WHERE
|
|
72
|
+
ic.id = $1
|
|
73
|
+
|
|
74
|
+
)`,
|
|
75
|
+
[cycleCount.id]
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
// Step 2: Create the temp_dynamic_columns table
|
|
79
|
+
await tx.query(
|
|
80
|
+
`
|
|
81
|
+
CREATE TEMP TABLE temp_dynamic_columns ON COMMIT DROP AS (
|
|
82
|
+
SELECT ic.id as "inventory_check_id",
|
|
83
|
+
w.check_count as "check_count"
|
|
84
|
+
FROM inventory_checks ic
|
|
85
|
+
INNER JOIN worksheets w ON ic.id = w.inventory_check_id
|
|
86
|
+
WHERE ic.id = $1
|
|
87
|
+
)`,
|
|
88
|
+
[cycleCount.id]
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
// Step 3: Generate definedCrossColumn for dynamic columns
|
|
92
|
+
let definedCrossColumn = await tx.query(`
|
|
93
|
+
SELECT string_agg(DISTINCT concat('count_', check_count), ',') as columns
|
|
94
|
+
FROM temp_dynamic_columns`)
|
|
95
|
+
|
|
96
|
+
// Step 4: Pivot data and create the pivot table
|
|
97
|
+
await tx.query(`
|
|
98
|
+
CREATE TEMP TABLE temp_pivoted_data ON COMMIT DROP AS (
|
|
99
|
+
SELECT *
|
|
100
|
+
FROM crosstab(
|
|
101
|
+
$$
|
|
102
|
+
SELECT inventory_id, check_count, inspected_qty
|
|
103
|
+
FROM temp_fixed_columns ORDER BY 1,2,3
|
|
104
|
+
$$,
|
|
105
|
+
$$
|
|
106
|
+
SELECT DISTINCT check_count FROM temp_dynamic_columns ORDER BY 1
|
|
107
|
+
$$
|
|
108
|
+
) AS ct (inventory_id varchar, ${definedCrossColumn[0].columns
|
|
109
|
+
.split(',')
|
|
110
|
+
.map(itm => {
|
|
111
|
+
return itm + ' varchar'
|
|
112
|
+
})
|
|
113
|
+
.join(',')} )
|
|
114
|
+
)`)
|
|
115
|
+
|
|
116
|
+
// Step 5: Create the temp_final_count table
|
|
117
|
+
await tx.query(
|
|
118
|
+
`
|
|
119
|
+
CREATE TEMP TABLE temp_final_count ON COMMIT DROP AS (
|
|
120
|
+
SELECT
|
|
121
|
+
inventory_id,
|
|
122
|
+
MAX(inspected_qty) as "final_count"
|
|
123
|
+
FROM
|
|
124
|
+
inventory_check_items ici
|
|
125
|
+
WHERE
|
|
126
|
+
(inventory_id, count_no) IN (
|
|
127
|
+
SELECT
|
|
128
|
+
inventory_id,
|
|
129
|
+
MAX(count_no)
|
|
130
|
+
FROM
|
|
131
|
+
inventory_check_items
|
|
132
|
+
GROUP BY
|
|
133
|
+
inventory_id
|
|
134
|
+
)
|
|
135
|
+
AND inventory_check_id = $1
|
|
136
|
+
GROUP BY inventory_id
|
|
137
|
+
)`,
|
|
138
|
+
[cycleCount.id]
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
// Step 6: Create the final temp table with combined data
|
|
142
|
+
await tx.query(`
|
|
143
|
+
CREATE TEMP TABLE temp_final_data ON COMMIT DROP AS (
|
|
144
|
+
SELECT
|
|
145
|
+
f.*,
|
|
146
|
+
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",
|
|
153
|
+
CASE
|
|
154
|
+
WHEN f.count_no = latest_counts.latest_count_no
|
|
155
|
+
THEN (f.origin_batch_no <> f.inspected_batch_no)
|
|
156
|
+
ELSE false
|
|
157
|
+
END AS "BatchNoVariance",
|
|
158
|
+
CASE
|
|
159
|
+
WHEN f.count_no = latest_counts.latest_count_no
|
|
160
|
+
THEN (f.origin_location_id <> f.inspected_location_id)
|
|
161
|
+
ELSE false
|
|
162
|
+
END AS "LocationVariance",
|
|
163
|
+
CASE
|
|
164
|
+
WHEN f.count_no = latest_counts.latest_count_no
|
|
165
|
+
THEN (f.origin_uom_value <> f.inspected_uom_value)
|
|
166
|
+
ELSE false
|
|
167
|
+
END AS "UomValueVariance"
|
|
168
|
+
FROM temp_fixed_columns f
|
|
169
|
+
LEFT JOIN temp_pivoted_data p ON f.inventory_id::uuid = p.inventory_id::uuid
|
|
170
|
+
LEFT JOIN temp_final_count fc ON f.inventory_id = fc.inventory_id
|
|
171
|
+
LEFT JOIN (
|
|
172
|
+
SELECT inventory_id, MAX(count_no) as latest_count_no
|
|
173
|
+
FROM temp_fixed_columns
|
|
174
|
+
GROUP BY inventory_id
|
|
175
|
+
) latest_counts ON f.inventory_id = latest_counts.inventory_id
|
|
176
|
+
)`)
|
|
177
|
+
|
|
178
|
+
// Step 7: Select final result
|
|
179
|
+
const result: any = await tx.query(`
|
|
180
|
+
SELECT * FROM temp_final_data`)
|
|
181
|
+
|
|
182
|
+
// groupinh inventory id
|
|
183
|
+
let inventoryIds = new Set()
|
|
184
|
+
let items = []
|
|
185
|
+
result.forEach(itm => {
|
|
186
|
+
if (!inventoryIds.has(itm.inventory_id)) {
|
|
187
|
+
inventoryIds.add(itm.inventory_id)
|
|
188
|
+
|
|
189
|
+
let countStatus
|
|
190
|
+
|
|
191
|
+
if (
|
|
192
|
+
itm.inspected_batch_no === null &&
|
|
193
|
+
itm.inspected_qty === null &&
|
|
194
|
+
itm.inspected_uom_value === null &&
|
|
195
|
+
itm.inspected_location_id === null
|
|
196
|
+
) {
|
|
197
|
+
countStatus = 'MISSING'
|
|
198
|
+
} else if (
|
|
199
|
+
itm.origin_batch_no === null &&
|
|
200
|
+
itm.origin_qty === null &&
|
|
201
|
+
itm.origin_uom_value === null &&
|
|
202
|
+
itm.origin_location_id === null
|
|
203
|
+
) {
|
|
204
|
+
countStatus = 'NEW'
|
|
205
|
+
} else {
|
|
206
|
+
if (itm.final_count === itm.origin_qty) {
|
|
207
|
+
countStatus = 'HIT'
|
|
208
|
+
} else if (itm.final_count < itm.origin_qty) {
|
|
209
|
+
countStatus = 'SHORT'
|
|
210
|
+
} else {
|
|
211
|
+
countStatus = 'EXCESS'
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
let data = {
|
|
216
|
+
inventoryCheck: {
|
|
217
|
+
name: itm.name,
|
|
218
|
+
executionDate: itm.execution_date,
|
|
219
|
+
status: itm.status
|
|
220
|
+
},
|
|
221
|
+
inventoryCheckItem: {
|
|
222
|
+
status: itm.invCheckItemStatus,
|
|
223
|
+
originBatchNo: itm.origin_batch_no,
|
|
224
|
+
inspectedBatchNo: itm.inspected_batch_no,
|
|
225
|
+
originLocation: itm.origin_location_id,
|
|
226
|
+
inspectedLocation: itm.inspected_location_id,
|
|
227
|
+
originUomValue: itm.origin_uom_value,
|
|
228
|
+
inspectedUomValue: itm.inspected_uom_value,
|
|
229
|
+
originQty: itm.origin_qty,
|
|
230
|
+
inspectedQty: itm.inspected_qty
|
|
231
|
+
},
|
|
232
|
+
inventory: {
|
|
233
|
+
id: itm.inventory_id,
|
|
234
|
+
cartonId: itm.carton_id,
|
|
235
|
+
palletId: itm.pallet_id
|
|
236
|
+
},
|
|
237
|
+
product: {
|
|
238
|
+
sku: itm.product_sku,
|
|
239
|
+
name: itm.product_name,
|
|
240
|
+
brand: itm.product_brand,
|
|
241
|
+
packingType: itm.product_packing_type
|
|
242
|
+
},
|
|
243
|
+
countData: itm.count_data,
|
|
244
|
+
batchNoVariance: itm.BatchNoVariance,
|
|
245
|
+
locationVariance: itm.LocationVariance,
|
|
246
|
+
uomValueVariance: itm.UomValueVariance,
|
|
247
|
+
finalCount: itm.final_count,
|
|
248
|
+
countVariance: itm.final_count - itm.origin_qty,
|
|
249
|
+
countStatus,
|
|
250
|
+
company: itm.company,
|
|
251
|
+
partnerDomainId: itm.partner_domain_id
|
|
252
|
+
}
|
|
253
|
+
items.push(data)
|
|
254
|
+
}
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
// Step 8: Count total and return the final object
|
|
258
|
+
const finalTotal = inventoryIds.size
|
|
259
|
+
return {
|
|
260
|
+
items,
|
|
261
|
+
total: finalTotal
|
|
262
|
+
}
|
|
263
|
+
} catch (error) {
|
|
264
|
+
throw error
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
@@ -9,10 +9,8 @@ import { productLabelReport } from './product-label-report'
|
|
|
9
9
|
import { releaseInventoryReport } from './release-inventory-report'
|
|
10
10
|
import { shortageReport } from './shortage-report'
|
|
11
11
|
import { loadingQcReport } from './tote-loading-qc-report'
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
vasReport
|
|
15
|
-
} from './vas-report'
|
|
12
|
+
import { orderVasReport, vasReport } from './vas-report'
|
|
13
|
+
import { cycleCountReport } from './cycle-count-report'
|
|
16
14
|
|
|
17
15
|
export const Query = {
|
|
18
16
|
...inboundSerialNumberReport,
|
|
@@ -27,5 +25,6 @@ export const Query = {
|
|
|
27
25
|
...orderVasReport,
|
|
28
26
|
...vasReport,
|
|
29
27
|
...analysisPickingPackingReport,
|
|
28
|
+
...cycleCountReport,
|
|
30
29
|
...nonLoadedOrderInventoriesReport
|
|
31
30
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import gql from 'graphql-tag'
|
|
2
|
+
|
|
3
|
+
export const CycleCountReport = gql`
|
|
4
|
+
type CycleCountReport {
|
|
5
|
+
inventoryCheck: InventoryCheck!
|
|
6
|
+
inventoryCheckItem: InventoryCheckItem
|
|
7
|
+
inventory: Inventory!
|
|
8
|
+
product: Product!
|
|
9
|
+
countData: String
|
|
10
|
+
batchNoVariance: Boolean
|
|
11
|
+
locationVariance: Boolean
|
|
12
|
+
uomValueVariance: Boolean
|
|
13
|
+
finalCount: String
|
|
14
|
+
countVariance: String
|
|
15
|
+
countStatus: String
|
|
16
|
+
company: String
|
|
17
|
+
partnerDomainId: String
|
|
18
|
+
}
|
|
19
|
+
`
|
|
@@ -20,14 +20,10 @@ import { ReleaseInventoryReport } from './release-inventory-report'
|
|
|
20
20
|
import { ReleaseInventoryReportList } from './release-inventory-report-list'
|
|
21
21
|
import { ShortageReportList } from './shortage-report-list'
|
|
22
22
|
import { ShortageReport } from './shortage-report-type'
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} from './
|
|
27
|
-
import {
|
|
28
|
-
OrderVasReportList,
|
|
29
|
-
VasReportList
|
|
30
|
-
} from './vas-report-list'
|
|
23
|
+
import { OrderVasReport, VasReport } from './vas-report'
|
|
24
|
+
import { OrderVasReportList, VasReportList } from './vas-report-list'
|
|
25
|
+
import { CycleCountReport } from './cycle-count-report'
|
|
26
|
+
import { CycleCountReportList } from './cycle-count-report-list'
|
|
31
27
|
|
|
32
28
|
export const Query = `
|
|
33
29
|
inboundSerialNumberReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): InboundSerialNumberReportList @transaction
|
|
@@ -42,6 +38,7 @@ export const Query = `
|
|
|
42
38
|
orderVasReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): OrderVasReportList @transaction
|
|
43
39
|
vasReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): OrderVasReportList @transaction
|
|
44
40
|
analysisPickingPackingReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): AnalysisPickingPackingReportList @transaction
|
|
41
|
+
cycleCountReport(name: String!): CycleCountReportList @transaction
|
|
45
42
|
nonLoadedOrderInventories(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): NonLoadedOrderInventoryReportList @transaction
|
|
46
43
|
`
|
|
47
44
|
|
|
@@ -70,6 +67,8 @@ export const Types = [
|
|
|
70
67
|
VasReportList,
|
|
71
68
|
AnalysisPickingPackingReport,
|
|
72
69
|
AnalysisPickingPackingReportList,
|
|
70
|
+
CycleCountReport,
|
|
71
|
+
CycleCountReportList,
|
|
73
72
|
NonLoadedOrderInventoryReport,
|
|
74
73
|
NonLoadedOrderInventoryReportList
|
|
75
74
|
]
|
package/things-factory.config.js
CHANGED
|
@@ -290,6 +290,10 @@ export default {
|
|
|
290
290
|
tagname: 'inventory-check-list',
|
|
291
291
|
page: 'inventory_check_list'
|
|
292
292
|
},
|
|
293
|
+
{
|
|
294
|
+
tagname: 'cycle-count-worksheet-list',
|
|
295
|
+
page: 'cycle_count_worksheet_list'
|
|
296
|
+
},
|
|
293
297
|
{
|
|
294
298
|
tagname: 'worksheet-cycle-count',
|
|
295
299
|
page: 'worksheet_cycle_count'
|
|
@@ -302,6 +306,10 @@ export default {
|
|
|
302
306
|
tagname: 'cycle-count-report',
|
|
303
307
|
page: 'cycle_count_report'
|
|
304
308
|
},
|
|
309
|
+
{
|
|
310
|
+
tagname: 'cycle-count-review',
|
|
311
|
+
page: 'cycle_count_review'
|
|
312
|
+
},
|
|
305
313
|
{
|
|
306
314
|
tagname: 'job-sheet-list',
|
|
307
315
|
page: 'job_sheets'
|