@things-factory/operato-wms 4.1.32 → 4.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/client/pages/inbound/serial-number-list-popup.js +342 -0
  2. package/client/pages/inbound/unload-product.js +218 -39
  3. package/client/pages/inbound/unloaded-inventories-popup.js +7 -0
  4. package/client/pages/inventory/non-loaded-inventory.js +293 -0
  5. package/client/pages/outbound/picking-product.js +61 -36
  6. package/client/pages/outbound/serial-number-popup.js +150 -64
  7. package/client/pages/report/inbound-serial-number-report.js +452 -0
  8. package/client/pages/report/outbound-serial-number-report.js +460 -0
  9. package/client/route.js +11 -0
  10. package/dist-server/graphql/resolvers/reports/inbound-serial-number-report.js +111 -0
  11. package/dist-server/graphql/resolvers/reports/inbound-serial-number-report.js.map +1 -0
  12. package/dist-server/graphql/resolvers/reports/index.js +3 -1
  13. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  14. package/dist-server/graphql/resolvers/reports/outbound-serial-number-report.js +116 -0
  15. package/dist-server/graphql/resolvers/reports/outbound-serial-number-report.js.map +1 -0
  16. package/dist-server/graphql/types/reports/inbound-serial-number-report-list.js +14 -0
  17. package/dist-server/graphql/types/reports/inbound-serial-number-report-list.js.map +1 -0
  18. package/dist-server/graphql/types/reports/inbound-serial-number-report.js +23 -0
  19. package/dist-server/graphql/types/reports/inbound-serial-number-report.js.map +1 -0
  20. package/dist-server/graphql/types/reports/index.js +10 -0
  21. package/dist-server/graphql/types/reports/index.js.map +1 -1
  22. package/dist-server/graphql/types/reports/outbound-serial-number-report-list.js +14 -0
  23. package/dist-server/graphql/types/reports/outbound-serial-number-report-list.js.map +1 -0
  24. package/dist-server/graphql/types/reports/outbound-serial-number-report.js +24 -0
  25. package/dist-server/graphql/types/reports/outbound-serial-number-report.js.map +1 -0
  26. package/package.json +6 -6
  27. package/server/graphql/resolvers/reports/inbound-serial-number-report.ts +128 -0
  28. package/server/graphql/resolvers/reports/index.ts +5 -0
  29. package/server/graphql/resolvers/reports/outbound-serial-number-report.ts +133 -0
  30. package/server/graphql/types/reports/inbound-serial-number-report-list.ts +8 -0
  31. package/server/graphql/types/reports/inbound-serial-number-report.ts +17 -0
  32. package/server/graphql/types/reports/index.ts +11 -0
  33. package/server/graphql/types/reports/outbound-serial-number-report-list.ts +8 -0
  34. package/server/graphql/types/reports/outbound-serial-number-report.ts +18 -0
  35. package/things-factory.config.js +12 -0
  36. package/translations/en.json +16 -2
  37. package/translations/ko.json +16 -3
  38. package/translations/ms.json +16 -3
  39. package/translations/zh.json +20 -7
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.outboundSerialNumberReport = void 0;
4
+ const auth_base_1 = require("@things-factory/auth-base");
5
+ const biz_base_1 = require("@things-factory/biz-base");
6
+ const utils_1 = require("../../../utils");
7
+ exports.outboundSerialNumberReport = {
8
+ async outboundSerialNumberReport(_, params, context) {
9
+ try {
10
+ const { tx } = context.state;
11
+ let bizplaceFilter = { name: '', operator: '', value: '' };
12
+ let userFilter = params.filters.find(data => data.name === 'user');
13
+ let fromDate = params.filters.find(data => data.name === 'fromDate');
14
+ let toDate = params.filters.find(data => data.name === 'toDate');
15
+ let ganNo = params.filters.find(data => data.name === 'ganNo');
16
+ if (userFilter) {
17
+ const user = await tx.getRepository(auth_base_1.User).findOne({
18
+ where: { id: userFilter.value },
19
+ relations: ['bizplaces']
20
+ });
21
+ const bizplace = user.bizplaces[0];
22
+ if (!bizplace)
23
+ throw 'Invalid input';
24
+ bizplaceFilter = { name: 'bizplace', operator: 'eq', value: bizplace.id };
25
+ }
26
+ else {
27
+ bizplaceFilter = params.filters.find(data => data.name === 'bizplace');
28
+ }
29
+ if (!bizplaceFilter || !fromDate || !toDate)
30
+ throw 'Invalid input';
31
+ const bizplace = await tx.getRepository(biz_base_1.Bizplace).findOne({
32
+ id: bizplaceFilter.value
33
+ });
34
+ await (0, utils_1.rawProductsQuery)(tx, params, bizplace);
35
+ let extraQueryFilters = '';
36
+ if (ganNo) {
37
+ extraQueryFilters = `${extraQueryFilters} and order_no like '%${ganNo.value}%' `;
38
+ }
39
+ await tx.query(`
40
+ create temp table temp_outbound_serial_number_report on commit drop as (
41
+ select * from (
42
+ select
43
+ row_number() over(partition by rg."name" order by coalesce(w.started_at, ii.created_at), p.sku ) as "no",
44
+ rg."name" as "order_no", coalesce(cp2.company_name, cp2.name, cp2.company_name, cp.name, rg.attention_company, rg.attention_to) as "deliver_to",
45
+ i.pallet_id, i.carton_id, rg.ref_no, rg.ref_no_2, rg.ref_no_3,
46
+ p.id as "product_id", p.sku as "product_sku", p.brand_sku as "product_brand_sku",
47
+ p.name as "product_name", p.description as "product_description", p."type" as "product_type",
48
+ coalesce(pd.volume, '0') as "product_volume",
49
+ ii.serial_number,
50
+ coalesce(w.started_at,ii.created_at) as "etd"
51
+ from inventory_items ii
52
+ inner join inventories i on i.id = ii.inventory_id
53
+ inner join products p on p.id = i.product_id
54
+ left join product_details pd on pd.product_id = p.id and pd.packing_type = i.packing_type and pd.packing_size = i.packing_size
55
+ inner join release_goods rg on rg.id = ii.outbound_order_id::uuid
56
+ left join contact_points cp on cp.id = rg.deliver_to_id
57
+ left join order_inventories oi on oi.release_good_id = rg.id and oi.inventory_id = i.id
58
+ left join delivery_orders do2 on do2.id = oi.delivery_order_id
59
+ left join contact_points cp2 on cp2.id = do2.contact_point_ref_id
60
+ left join worksheets w on w.arrival_notice_id = rg.id and w.type = 'PICKING'
61
+ where
62
+ i.domain_id = $1 and i.bizplace_id = $2
63
+ and coalesce(w.started_at, ii.created_at) between $3 and $4
64
+ order by coalesce(w.started_at, ii.created_at), p.sku
65
+ ) src
66
+ where 1=1
67
+ ${extraQueryFilters}
68
+ )
69
+ `, [context.state.domain.id, bizplace.id, fromDate.value, toDate.value]);
70
+ const total = await tx.query(`
71
+ select count(*) from temp_outbound_serial_number_report
72
+ `);
73
+ const result = await tx.query(`
74
+ select *
75
+ from temp_outbound_serial_number_report
76
+ offset $1 limit $2
77
+ `, [(params.pagination.page - 1) * params.pagination.limit, params.pagination.limit]);
78
+ let items = result.map(itm => {
79
+ let data = {
80
+ no: itm.no,
81
+ bizplace: {
82
+ description: bizplace.description,
83
+ name: bizplace.name
84
+ },
85
+ deliverTo: itm.deliver_to,
86
+ palletId: itm.pallet_id,
87
+ cartonId: itm.carton_id,
88
+ orderNo: itm.order_no,
89
+ refNo1: itm.ref_no,
90
+ refNo2: itm.ref_no_2,
91
+ refNo3: itm.ref_no_3,
92
+ product: {
93
+ id: itm.product_id,
94
+ sku: itm.product_sku,
95
+ brandSku: itm.product_brand_sku,
96
+ name: itm.product_name,
97
+ description: itm.product_description,
98
+ type: itm.product_type,
99
+ volume: itm.product_volume
100
+ },
101
+ serialNumber: itm.serial_number,
102
+ etd: itm.etd
103
+ };
104
+ return data;
105
+ });
106
+ return {
107
+ items,
108
+ total: total[0].count
109
+ };
110
+ }
111
+ catch (error) {
112
+ throw error;
113
+ }
114
+ }
115
+ };
116
+ //# sourceMappingURL=outbound-serial-number-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbound-serial-number-report.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/outbound-serial-number-report.ts"],"names":[],"mappings":";;;AAEA,yDAAgD;AAChD,uDAAmD;AAGnD,0CAAiD;AAEpC,QAAA,0BAA0B,GAAG;IACxC,KAAK,CAAC,0BAA0B,CAAC,CAAM,EAAE,MAAiB,EAAE,OAAY;QACtE,IAAI;YACF,MAAM,EAAE,EAAE,EAAE,GAA0B,OAAO,CAAC,KAAK,CAAA;YACnD,IAAI,cAAc,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;YAC1D,IAAI,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAA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AAG,CAAC,QAAQ;oBACpB,OAAO,EAAE;wBACP,EAAE,EAAE,GAAG,CAAC,UAAU;wBAClB,GAAG,EAAE,GAAG,CAAC,WAAW;wBACpB,QAAQ,EAAE,GAAG,CAAC,iBAAiB;wBAC/B,IAAI,EAAE,GAAG,CAAC,YAAY;wBACtB,WAAW,EAAE,GAAG,CAAC,mBAAmB;wBACpC,IAAI,EAAE,GAAG,CAAC,YAAY;wBACtB,MAAM,EAAE,GAAG,CAAC,cAAc;qBAC3B;oBACD,YAAY,EAAE,GAAG,CAAC,aAAa;oBAC/B,GAAG,EAAE,GAAG,CAAC,GAAG;iBACb,CAAA;gBAED,OAAO,IAAI,CAAA;YACb,CAAC,CAAC,CAAA;YAEF,OAAO;gBACL,KAAK;gBACL,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK;aACtB,CAAA;SACF;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CACF,CAAA"}
@@ -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.InboundSerialNumberReportList = void 0;
7
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
+ exports.InboundSerialNumberReportList = (0, graphql_tag_1.default) `
9
+ type InboundSerialNumberReportList {
10
+ items: [InboundSerialNumberReport]
11
+ total: Int
12
+ }
13
+ `;
14
+ //# sourceMappingURL=inbound-serial-number-report-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound-serial-number-report-list.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/inbound-serial-number-report-list.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,6BAA6B,GAAG,IAAA,qBAAG,EAAA;;;;;CAK/C,CAAA"}
@@ -0,0 +1,23 @@
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.InboundSerialNumberReport = void 0;
7
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
+ exports.InboundSerialNumberReport = (0, graphql_tag_1.default) `
9
+ type InboundSerialNumberReport {
10
+ no: Int
11
+ bizplace: Bizplace
12
+ palletId: String
13
+ cartonId: String
14
+ orderNo: String
15
+ refNo1: String
16
+ refNo2: String
17
+ refNo3: String
18
+ product: Product
19
+ serialNumber: String
20
+ etd: String
21
+ }
22
+ `;
23
+ //# sourceMappingURL=inbound-serial-number-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound-serial-number-report.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/inbound-serial-number-report.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,yBAAyB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;CAc3C,CAAA"}
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Types = exports.Query = void 0;
4
+ const inbound_serial_number_report_1 = require("./inbound-serial-number-report");
5
+ const inbound_serial_number_report_list_1 = require("./inbound-serial-number-report-list");
6
+ const outbound_serial_number_report_1 = require("./outbound-serial-number-report");
7
+ const outbound_serial_number_report_list_1 = require("./outbound-serial-number-report-list");
4
8
  const inbound_order_details_report_1 = require("./inbound-order-details-report");
5
9
  const inbound_order_details_report_list_1 = require("./inbound-order-details-report-list");
6
10
  const outbound_order_details_report_1 = require("./outbound-order-details-report");
@@ -8,11 +12,17 @@ const outbound_order_details_report_list_1 = require("./outbound-order-details-r
8
12
  const product_label_report_1 = require("./product-label-report");
9
13
  const product_label_report_list_1 = require("./product-label-report-list");
10
14
  exports.Query = `
15
+ inboundSerialNumberReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): InboundSerialNumberReportList @transaction
16
+ outboundSerialNumberReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): OutboundSerialNumberReportList @transaction
11
17
  inboundOrderDetailsReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): InboundOrderDetailsReportList @transaction
12
18
  outboundOrderDetailsReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): OutboundOrderDetailsReportList @transaction
13
19
  productLabelReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): ProductLabelReportList @transaction
14
20
  `;
15
21
  exports.Types = [
22
+ inbound_serial_number_report_1.InboundSerialNumberReport,
23
+ inbound_serial_number_report_list_1.InboundSerialNumberReportList,
24
+ outbound_serial_number_report_1.OutboundSerialNumberReport,
25
+ outbound_serial_number_report_list_1.OutboundSerialNumberReportList,
16
26
  inbound_order_details_report_1.InboundOrderDetailsReport,
17
27
  inbound_order_details_report_list_1.InboundOrderDetailsReportList,
18
28
  outbound_order_details_report_1.OutboundOrderDetailsReport,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/index.ts"],"names":[],"mappings":";;;AAAA,iFAA0E;AAC1E,2FAAmF;AACnF,mFAA4E;AAC5E,6FAAqF;AACrF,iEAA2D;AAC3D,2EAAoE;AAEvD,QAAA,KAAK,GAAG;;;;CAIpB,CAAA;AAEY,QAAA,KAAK,GAAG;IACnB,wDAAyB;IACzB,iEAA6B;IAC7B,0DAA0B;IAC1B,mEAA8B;IAC9B,yCAAkB;IAClB,kDAAsB;CACvB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/index.ts"],"names":[],"mappings":";;;AAAA,iFAA0E;AAC1E,2FAAmF;AACnF,mFAA4E;AAC5E,6FAAqF;AAErF,iFAA0E;AAC1E,2FAAmF;AACnF,mFAA4E;AAC5E,6FAAqF;AACrF,iEAA2D;AAC3D,2EAAoE;AAEvD,QAAA,KAAK,GAAG;;;;;;CAMpB,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;CACvB,CAAA"}
@@ -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.OutboundSerialNumberReportList = void 0;
7
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
+ exports.OutboundSerialNumberReportList = (0, graphql_tag_1.default) `
9
+ type OutboundSerialNumberReportList {
10
+ items: [OutboundSerialNumberReport]
11
+ total: Int
12
+ }
13
+ `;
14
+ //# sourceMappingURL=outbound-serial-number-report-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbound-serial-number-report-list.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/outbound-serial-number-report-list.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,8BAA8B,GAAG,IAAA,qBAAG,EAAA;;;;;CAKhD,CAAA"}
@@ -0,0 +1,24 @@
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.OutboundSerialNumberReport = void 0;
7
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
+ exports.OutboundSerialNumberReport = (0, graphql_tag_1.default) `
9
+ type OutboundSerialNumberReport {
10
+ no: Int
11
+ bizplace: Bizplace
12
+ deliverTo: String
13
+ palletId: String
14
+ cartonId: String
15
+ orderNo: String
16
+ refNo1: String
17
+ refNo2: String
18
+ refNo3: String
19
+ product: Product
20
+ serialNumber: String
21
+ etd: String
22
+ }
23
+ `;
24
+ //# sourceMappingURL=outbound-serial-number-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbound-serial-number-report.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/outbound-serial-number-report.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,0BAA0B,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;CAe5C,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-wms",
3
- "version": "4.1.32",
3
+ "version": "4.1.35",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -84,9 +84,9 @@
84
84
  "@things-factory/print-proxy-service": "^4.1.28",
85
85
  "@things-factory/print-service": "^4.1.28",
86
86
  "@things-factory/print-ui": "^4.1.28",
87
- "@things-factory/product-base": "^4.1.28",
87
+ "@things-factory/product-base": "^4.1.34",
88
88
  "@things-factory/resource-ui": "^4.1.28",
89
- "@things-factory/sales-ui": "^4.1.31",
89
+ "@things-factory/sales-ui": "^4.1.35",
90
90
  "@things-factory/scene-data-transform": "^4.1.28",
91
91
  "@things-factory/scene-excel": "^4.1.28",
92
92
  "@things-factory/scene-firebase": "^4.1.28",
@@ -102,11 +102,11 @@
102
102
  "@things-factory/system-ui": "^4.1.28",
103
103
  "@things-factory/transport-base": "^4.1.28",
104
104
  "@things-factory/tutorial-ui": "^4.1.28",
105
- "@things-factory/warehouse-base": "^4.1.31",
106
- "@things-factory/worksheet-base": "^4.1.31"
105
+ "@things-factory/warehouse-base": "^4.1.35",
106
+ "@things-factory/worksheet-base": "^4.1.35"
107
107
  },
108
108
  "devDependencies": {
109
109
  "@things-factory/builder": "^4.1.28"
110
110
  },
111
- "gitHead": "b7a603b009e2835b4f48861f8b1eaf2103805294"
111
+ "gitHead": "a7e4a62c6ab05d18879ab945ac0f10be440a5f34"
112
112
  }
@@ -0,0 +1,128 @@
1
+ import { EntityManager } from 'typeorm'
2
+
3
+ import { User } from '@things-factory/auth-base'
4
+ import { Bizplace } from '@things-factory/biz-base'
5
+ import { ListParam } from '@things-factory/shell'
6
+
7
+ import { rawProductsQuery } from '../../../utils'
8
+
9
+ export const inboundSerialNumberReport = {
10
+ async inboundSerialNumberReport(_: any, params: ListParam, context: any) {
11
+ try {
12
+ const { tx }: { tx: EntityManager } = context.state
13
+ let bizplaceFilter = { name: '', operator: '', value: '' }
14
+ let userFilter = params.filters.find(data => data.name === 'user')
15
+ let fromDate = params.filters.find(data => data.name === 'fromDate')
16
+ let toDate = params.filters.find(data => data.name === 'toDate')
17
+ let ganNo = params.filters.find(data => data.name === 'ganNo')
18
+
19
+ if (userFilter) {
20
+ const user: User = await tx.getRepository(User).findOne({
21
+ where: { id: userFilter.value },
22
+ relations: ['bizplaces']
23
+ })
24
+
25
+ const bizplace: Bizplace = user.bizplaces[0]
26
+
27
+ if (!bizplace) throw 'Invalid input'
28
+
29
+ bizplaceFilter = { name: 'bizplace', operator: 'eq', value: bizplace.id }
30
+ } else {
31
+ bizplaceFilter = params.filters.find(data => data.name === 'bizplace')
32
+ }
33
+
34
+ if (!bizplaceFilter || !fromDate || !toDate) throw 'Invalid input'
35
+
36
+ const bizplace: Bizplace = await tx.getRepository(Bizplace).findOne({
37
+ id: bizplaceFilter.value
38
+ })
39
+
40
+ await rawProductsQuery(tx, params, bizplace)
41
+
42
+ let extraQueryFilters = ''
43
+ if (ganNo) {
44
+ extraQueryFilters = `${extraQueryFilters} and order_no like '%${ganNo.value}%' `
45
+ }
46
+
47
+ await tx.query(
48
+ `
49
+ create temp table temp_inbound_serial_number_report on commit drop as (
50
+ select * from (
51
+ select
52
+ row_number() over(partition by an."name" order by coalesce(w.started_at, ii.created_at), p.sku ) as "no",
53
+ case when "source" = 'ADJUSTMENT' then 'adjustment' else an."name" end as "order_no",
54
+ i.pallet_id, i.carton_id,an.ref_no, an.ref_no_2, an.ref_no_3,
55
+ p.id as "product_id", p.sku as "product_sku", p.brand_sku as "product_brand_sku",
56
+ p.name as "product_name", p.description as "product_description", p."type" as "product_type",
57
+ coalesce(pd.volume, '0') as "product_volume",
58
+ ii.serial_number,
59
+ coalesce(w.started_at,ii.created_at) as "etd"
60
+ from inventory_items ii
61
+ inner join inventories i on i.id = ii.inventory_id
62
+ inner join products p on p.id = i.product_id
63
+ left join product_details pd on pd.product_id = p.id and pd.packing_type = i.packing_type and pd.packing_size = i.packing_size
64
+ left join arrival_notices an on an.id = ii.inbound_order_id::uuid
65
+ left join worksheets w on w.arrival_notice_id = an.id and w.type = 'UNLOADING'
66
+ where
67
+ i.domain_id = $1 and i.bizplace_id = $2
68
+ and coalesce(w.started_at, ii.created_at) between $3 and $4
69
+ order by coalesce(w.started_at, ii.created_at), p.sku
70
+ ) src
71
+ where 1=1
72
+ ${extraQueryFilters}
73
+ )
74
+ `,
75
+ [context.state.domain.id, bizplace.id, fromDate.value, toDate.value]
76
+ )
77
+
78
+ const total: any = await tx.query(`
79
+ select count(*) from temp_inbound_serial_number_report
80
+ `)
81
+
82
+ const result: any = await tx.query(
83
+ `
84
+ select *
85
+ from temp_inbound_serial_number_report
86
+ offset $1 limit $2
87
+ `,
88
+ [(params.pagination.page - 1) * params.pagination.limit, params.pagination.limit]
89
+ )
90
+
91
+ let items = result.map(itm => {
92
+ let data = {
93
+ no: itm.no,
94
+ bizplace: {
95
+ description: bizplace.description,
96
+ name: bizplace.name
97
+ },
98
+ palletId: itm.pallet_id,
99
+ cartonId: itm.carton_id,
100
+ orderNo: itm.order_no,
101
+ refNo1: itm.ref_no,
102
+ refNo2: itm.ref_no_2,
103
+ refNo3: itm.ref_no_3,
104
+ product: {
105
+ id: itm.product_id,
106
+ sku: itm.product_sku,
107
+ brandSku: itm.product_brand_sku,
108
+ name: itm.product_name,
109
+ description: itm.product_description,
110
+ type: itm.product_type,
111
+ volume: itm.product_volume
112
+ },
113
+ serialNumber: itm.serial_number,
114
+ etd: itm.etd
115
+ }
116
+
117
+ return data
118
+ })
119
+
120
+ return {
121
+ items,
122
+ total: total[0].count
123
+ }
124
+ } catch (error) {
125
+ throw error
126
+ }
127
+ }
128
+ }
@@ -1,8 +1,13 @@
1
+ import { inboundSerialNumberReport } from './inbound-serial-number-report'
2
+ import { outboundSerialNumberReport } from './outbound-serial-number-report'
3
+
1
4
  import { inboundOrderDetailsReport } from './inbound-order-details-report'
2
5
  import { outboundOrderDetailsReport } from './outbound-order-details-report'
3
6
  import { productLabelReport } from './product-label-report'
4
7
 
5
8
  export const Query = {
9
+ ...inboundSerialNumberReport,
10
+ ...outboundSerialNumberReport,
6
11
  ...inboundOrderDetailsReport,
7
12
  ...outboundOrderDetailsReport,
8
13
  ...productLabelReport
@@ -0,0 +1,133 @@
1
+ import { EntityManager } from 'typeorm'
2
+
3
+ import { User } from '@things-factory/auth-base'
4
+ import { Bizplace } from '@things-factory/biz-base'
5
+ import { ListParam } from '@things-factory/shell'
6
+
7
+ import { rawProductsQuery } from '../../../utils'
8
+
9
+ export const outboundSerialNumberReport = {
10
+ async outboundSerialNumberReport(_: any, params: ListParam, context: any) {
11
+ try {
12
+ const { tx }: { tx: EntityManager } = context.state
13
+ let bizplaceFilter = { name: '', operator: '', value: '' }
14
+ let userFilter = params.filters.find(data => data.name === 'user')
15
+ let fromDate = params.filters.find(data => data.name === 'fromDate')
16
+ let toDate = params.filters.find(data => data.name === 'toDate')
17
+ let ganNo = params.filters.find(data => data.name === 'ganNo')
18
+
19
+ if (userFilter) {
20
+ const user: User = await tx.getRepository(User).findOne({
21
+ where: { id: userFilter.value },
22
+ relations: ['bizplaces']
23
+ })
24
+
25
+ const bizplace: Bizplace = user.bizplaces[0]
26
+
27
+ if (!bizplace) throw 'Invalid input'
28
+
29
+ bizplaceFilter = { name: 'bizplace', operator: 'eq', value: bizplace.id }
30
+ } else {
31
+ bizplaceFilter = params.filters.find(data => data.name === 'bizplace')
32
+ }
33
+
34
+ if (!bizplaceFilter || !fromDate || !toDate) throw 'Invalid input'
35
+
36
+ const bizplace: Bizplace = await tx.getRepository(Bizplace).findOne({
37
+ id: bizplaceFilter.value
38
+ })
39
+
40
+ await rawProductsQuery(tx, params, bizplace)
41
+
42
+ let extraQueryFilters = ''
43
+ if (ganNo) {
44
+ extraQueryFilters = `${extraQueryFilters} and order_no like '%${ganNo.value}%' `
45
+ }
46
+
47
+ await tx.query(
48
+ `
49
+ create temp table temp_outbound_serial_number_report on commit drop as (
50
+ select * from (
51
+ select
52
+ row_number() over(partition by rg."name" order by coalesce(w.started_at, ii.created_at), p.sku ) as "no",
53
+ rg."name" as "order_no", coalesce(cp2.company_name, cp2.name, cp2.company_name, cp.name, rg.attention_company, rg.attention_to) as "deliver_to",
54
+ i.pallet_id, i.carton_id, rg.ref_no, rg.ref_no_2, rg.ref_no_3,
55
+ p.id as "product_id", p.sku as "product_sku", p.brand_sku as "product_brand_sku",
56
+ p.name as "product_name", p.description as "product_description", p."type" as "product_type",
57
+ coalesce(pd.volume, '0') as "product_volume",
58
+ ii.serial_number,
59
+ coalesce(w.started_at,ii.created_at) as "etd"
60
+ from inventory_items ii
61
+ inner join inventories i on i.id = ii.inventory_id
62
+ inner join products p on p.id = i.product_id
63
+ left join product_details pd on pd.product_id = p.id and pd.packing_type = i.packing_type and pd.packing_size = i.packing_size
64
+ inner join release_goods rg on rg.id = ii.outbound_order_id::uuid
65
+ left join contact_points cp on cp.id = rg.deliver_to_id
66
+ left join order_inventories oi on oi.release_good_id = rg.id and oi.inventory_id = i.id
67
+ left join delivery_orders do2 on do2.id = oi.delivery_order_id
68
+ left join contact_points cp2 on cp2.id = do2.contact_point_ref_id
69
+ left join worksheets w on w.arrival_notice_id = rg.id and w.type = 'PICKING'
70
+ where
71
+ i.domain_id = $1 and i.bizplace_id = $2
72
+ and coalesce(w.started_at, ii.created_at) between $3 and $4
73
+ order by coalesce(w.started_at, ii.created_at), p.sku
74
+ ) src
75
+ where 1=1
76
+ ${extraQueryFilters}
77
+ )
78
+ `,
79
+ [context.state.domain.id, bizplace.id, fromDate.value, toDate.value]
80
+ )
81
+
82
+ const total: any = await tx.query(`
83
+ select count(*) from temp_outbound_serial_number_report
84
+ `)
85
+
86
+ const result: any = await tx.query(
87
+ `
88
+ select *
89
+ from temp_outbound_serial_number_report
90
+ offset $1 limit $2
91
+ `,
92
+ [(params.pagination.page - 1) * params.pagination.limit, params.pagination.limit]
93
+ )
94
+
95
+ let items = result.map(itm => {
96
+ let data = {
97
+ no: itm.no,
98
+ bizplace: {
99
+ description: bizplace.description,
100
+ name: bizplace.name
101
+ },
102
+ deliverTo: itm.deliver_to,
103
+ palletId: itm.pallet_id,
104
+ cartonId: itm.carton_id,
105
+ orderNo: itm.order_no,
106
+ refNo1: itm.ref_no,
107
+ refNo2: itm.ref_no_2,
108
+ refNo3: itm.ref_no_3,
109
+ product: {
110
+ id: itm.product_id,
111
+ sku: itm.product_sku,
112
+ brandSku: itm.product_brand_sku,
113
+ name: itm.product_name,
114
+ description: itm.product_description,
115
+ type: itm.product_type,
116
+ volume: itm.product_volume
117
+ },
118
+ serialNumber: itm.serial_number,
119
+ etd: itm.etd
120
+ }
121
+
122
+ return data
123
+ })
124
+
125
+ return {
126
+ items,
127
+ total: total[0].count
128
+ }
129
+ } catch (error) {
130
+ throw error
131
+ }
132
+ }
133
+ }
@@ -0,0 +1,8 @@
1
+ import gql from 'graphql-tag'
2
+
3
+ export const InboundSerialNumberReportList = gql`
4
+ type InboundSerialNumberReportList {
5
+ items: [InboundSerialNumberReport]
6
+ total: Int
7
+ }
8
+ `
@@ -0,0 +1,17 @@
1
+ import gql from 'graphql-tag'
2
+
3
+ export const InboundSerialNumberReport = gql`
4
+ type InboundSerialNumberReport {
5
+ no: Int
6
+ bizplace: Bizplace
7
+ palletId: String
8
+ cartonId: String
9
+ orderNo: String
10
+ refNo1: String
11
+ refNo2: String
12
+ refNo3: String
13
+ product: Product
14
+ serialNumber: String
15
+ etd: String
16
+ }
17
+ `
@@ -1,3 +1,8 @@
1
+ import { InboundSerialNumberReport } from './inbound-serial-number-report'
2
+ import { InboundSerialNumberReportList } from './inbound-serial-number-report-list'
3
+ import { OutboundSerialNumberReport } from './outbound-serial-number-report'
4
+ import { OutboundSerialNumberReportList } from './outbound-serial-number-report-list'
5
+
1
6
  import { InboundOrderDetailsReport } from './inbound-order-details-report'
2
7
  import { InboundOrderDetailsReportList } from './inbound-order-details-report-list'
3
8
  import { OutboundOrderDetailsReport } from './outbound-order-details-report'
@@ -6,12 +11,18 @@ import { ProductLabelReport } from './product-label-report'
6
11
  import { ProductLabelReportList } from './product-label-report-list'
7
12
 
8
13
  export const Query = `
14
+ inboundSerialNumberReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): InboundSerialNumberReportList @transaction
15
+ outboundSerialNumberReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): OutboundSerialNumberReportList @transaction
9
16
  inboundOrderDetailsReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): InboundOrderDetailsReportList @transaction
10
17
  outboundOrderDetailsReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): OutboundOrderDetailsReportList @transaction
11
18
  productLabelReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): ProductLabelReportList @transaction
12
19
  `
13
20
 
14
21
  export const Types = [
22
+ InboundSerialNumberReport,
23
+ InboundSerialNumberReportList,
24
+ OutboundSerialNumberReport,
25
+ OutboundSerialNumberReportList,
15
26
  InboundOrderDetailsReport,
16
27
  InboundOrderDetailsReportList,
17
28
  OutboundOrderDetailsReport,
@@ -0,0 +1,8 @@
1
+ import gql from 'graphql-tag'
2
+
3
+ export const OutboundSerialNumberReportList = gql`
4
+ type OutboundSerialNumberReportList {
5
+ items: [OutboundSerialNumberReport]
6
+ total: Int
7
+ }
8
+ `
@@ -0,0 +1,18 @@
1
+ import gql from 'graphql-tag'
2
+
3
+ export const OutboundSerialNumberReport = gql`
4
+ type OutboundSerialNumberReport {
5
+ no: Int
6
+ bizplace: Bizplace
7
+ deliverTo: String
8
+ palletId: String
9
+ cartonId: String
10
+ orderNo: String
11
+ refNo1: String
12
+ refNo2: String
13
+ refNo3: String
14
+ product: Product
15
+ serialNumber: String
16
+ etd: String
17
+ }
18
+ `