@things-factory/operato-hub 4.3.563 → 4.3.564

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.
@@ -8,5 +8,6 @@ const custom_elccl_fn_dispatch_report_1 = require("./custom-elccl-fn-dispatch-re
8
8
  const aging_report_1 = require("./aging-report");
9
9
  const asn_report_1 = require("./asn-report");
10
10
  const admiral_asn_report_1 = require("./admiral-asn-report");
11
- exports.Query = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, inbound_order_details_report_1.inboundOrderDetailsReport), outbound_order_details_report_1.outboundOrderDetailsReport), shortage_report_1.shortageReport), custom_elccl_fn_dispatch_report_1.customElcclDispatchReport), aging_report_1.agingReport), asn_report_1.asnReport), admiral_asn_report_1.admiralAsnReport);
11
+ const receiving_report_1 = require("./receiving-report");
12
+ exports.Query = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, inbound_order_details_report_1.inboundOrderDetailsReport), outbound_order_details_report_1.outboundOrderDetailsReport), shortage_report_1.shortageReport), custom_elccl_fn_dispatch_report_1.customElcclDispatchReport), aging_report_1.agingReport), asn_report_1.asnReport), admiral_asn_report_1.admiralAsnReport), custom_elccl_fn_dispatch_report_1.customElcclDispatchReport), receiving_report_1.receivingReport);
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/index.ts"],"names":[],"mappings":";;;AAAA,iFAA0E;AAC1E,mFAA4E;AAC5E,uDAAkD;AAClD,uFAA6E;AAC7E,iDAA4C;AAC5C,6CAAwC;AACxC,6DAAuD;AAE1C,QAAA,KAAK,yGACb,wDAAyB,GACzB,0DAA0B,GAC1B,gCAAc,GACd,2DAAyB,GACzB,0BAAW,GACX,sBAAS,GACT,qCAAgB,EACpB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/index.ts"],"names":[],"mappings":";;;AAAA,iFAA0E;AAC1E,mFAA4E;AAC5E,uDAAkD;AAClD,uFAA6E;AAC7E,iDAA4C;AAC5C,6CAAwC;AACxC,6DAAuD;AACvD,yDAAoD;AAEvC,QAAA,KAAK,qIACb,wDAAyB,GACzB,0DAA0B,GAC1B,gCAAc,GACd,2DAAyB,GACzB,0BAAW,GACX,sBAAS,GACT,qCAAgB,GAChB,2DAAyB,GACzB,kCAAe,EACnB"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.receivingReport = void 0;
4
+ exports.receivingReport = {
5
+ async receivingReport(_, params, context) {
6
+ try {
7
+ const { tx } = context.state;
8
+ // Create temporary table for report
9
+ await tx.query(`
10
+ create temp table temp_inbound_order_report on commit drop as (
11
+ select "arrived_date", "receipt_id", "receipt_id_type", "batch", "mfg_date", "exp_date", "item", "item_desc", sum(quantity) as quantity, "qty_um" from(
12
+ select
13
+ to_char(grn.created_at + interval '8 hours','dd/mm/yyyy') as "arrived_date",
14
+ COALESCE(an.container_no,'') as "receipt_id",
15
+ 'DO' as "receipt_id_type",
16
+ i.batch_id as "batch",
17
+ to_char(i.manufacture_date,'dd/mm/yyyy') as "mfg_date",
18
+ to_char(i.expiration_date,'dd/mm/yyyy') as "exp_date",
19
+ p.sku as "item",
20
+ p.name as "item_desc",
21
+ round(oi.actual_pack_qty,2) as "quantity",
22
+ oi.packing_type as "qty_um"
23
+ from arrival_notices an
24
+ inner join goods_receival_notes grn ON an.id = grn.arrival_notice_id
25
+ inner join order_products op on an.id = op.arrival_notice_id
26
+ inner join order_inventories oi on (op.arrival_notice_id = oi.arrival_notice_id and op.product_id = oi.product_id and oi.batch_id = op.batch_id)
27
+ inner join products p on p.id = op.product_id
28
+ inner join inventories i on i.id = oi.inventory_id
29
+ where an.bizplace_id in('f0848540-9d8f-4835-b744-2407db36a14e','226c9c9d-9685-403d-8f05-89b7d3b8691e','157a9653-9f2b-4568-b245-ab8791db98ce')
30
+ and grn.created_at::date = (NOW()::date - interval '1 day')
31
+ UNION ALL
32
+ select
33
+ to_char(ro.created_at,'dd/mm/yyyy') as "arrived_date",
34
+ COALESCE(ro.delivery_order_no ,'') as "receipt_id",
35
+ 'Return' as "receipt_id_type",
36
+ i.batch_id as "batch",
37
+ to_char(i.manufacture_date,'dd/mm/yyyy') as "mfg_date",
38
+ to_char(i.expiration_date,'dd/mm/yyyy') as "exp_date",
39
+ p.sku as "item",
40
+ p.name as "item_desc",
41
+ round(oi.actual_pack_qty,2) as "quantity",
42
+ oi.packing_type as "qty_um"
43
+ from return_orders ro
44
+ inner join order_inventories oi on ro.id = oi.return_order_id
45
+ inner join inventories i on i.id = oi.inventory_id
46
+ inner join products p on p.id = oi.product_id
47
+ where ro.bizplace_id in('f0848540-9d8f-4835-b744-2407db36a14e','226c9c9d-9685-403d-8f05-89b7d3b8691e','157a9653-9f2b-4568-b245-ab8791db98ce')
48
+ and oi."type" = 'RETURN_ORDER'
49
+ and ro.created_at::date = (NOW()::date - interval '1 day')
50
+ order by arrived_date, batch, item desc
51
+ )foo group by "arrived_date", "receipt_id", "receipt_id_type", "batch", "mfg_date", "exp_date", "item", "item_desc", "qty_um"
52
+ )
53
+ `);
54
+ // Fetch detailed results
55
+ const result = await tx.query(`
56
+ select *
57
+ from temp_inbound_order_report
58
+ `);
59
+ // Map detailed results
60
+ let items = result.map(itm => ({
61
+ arrivedDate: itm.arrived_date,
62
+ receiptId: itm.receipt_id,
63
+ receiptIdType: itm.receipt_id_type,
64
+ batch: itm.batch,
65
+ mfgDate: itm.mfg_date,
66
+ expDate: itm.exp_date,
67
+ item: itm.item,
68
+ itemDesc: itm.item_desc,
69
+ quantity: itm.quantity,
70
+ qtyUm: itm.qty_um
71
+ }));
72
+ // Return the modified items with inserted totals
73
+ return {
74
+ items
75
+ };
76
+ }
77
+ catch (error) {
78
+ throw error;
79
+ }
80
+ }
81
+ };
82
+ //# sourceMappingURL=receiving-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receiving-report.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/receiving-report.ts"],"names":[],"mappings":";;;AAIa,QAAA,eAAe,GAAG;IAC7B,KAAK,CAAC,eAAe,CAAC,CAAM,EAAE,MAAiB,EAAE,OAAY;QAC3D,IAAI;YACF,MAAM,EAAE,EAAE,EAAE,GAA0B,OAAO,CAAC,KAAK,CAAA;YAEnD,oCAAoC;YACpC,MAAM,EAAE,CAAC,KAAK,CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA4CC,CACF,CAAA;YAED,yBAAyB;YACzB,MAAM,MAAM,GAAQ,MAAM,EAAE,CAAC,KAAK,CAAC;;;OAGlC,CAAC,CAAA;YAEF,uBAAuB;YACvB,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC7B,WAAW,EAAE,GAAG,CAAC,YAAY;gBAC7B,SAAS,EAAE,GAAG,CAAC,UAAU;gBACzB,aAAa,EAAE,GAAG,CAAC,eAAe;gBAClC,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,OAAO,EAAE,GAAG,CAAC,QAAQ;gBACrB,OAAO,EAAE,GAAG,CAAC,QAAQ;gBACrB,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,QAAQ,EAAE,GAAG,CAAC,SAAS;gBACvB,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,KAAK,EAAE,GAAG,CAAC,MAAM;aAClB,CAAC,CAAC,CAAA;YAEH,iDAAiD;YACjD,OAAO;gBACL,KAAK;aACN,CAAA;SACF;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CACF,CAAA"}
@@ -15,6 +15,8 @@ const asn_report_1 = require("./asn-report");
15
15
  const asn_report_list_1 = require("./asn-report-list");
16
16
  const admiral_asn_report_1 = require("./admiral-asn-report");
17
17
  const admiral_asn_report_list_1 = require("./admiral-asn-report-list");
18
+ const receiving_report_1 = require("./receiving-report");
19
+ const receiving_report_list_1 = require("./receiving-report-list");
18
20
  exports.Query = `
19
21
  inboundOrderDetailsReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): InboundOrderDetailsReportList @transaction
20
22
  outboundOrderDetailsReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): OutboundOrderDetailsReportList @transaction
@@ -23,6 +25,7 @@ exports.Query = `
23
25
  agingReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): AgingReportList @transaction
24
26
  asnReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): AsnReportList @transaction
25
27
  admiralAsnReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): AdmiralAsnReportList @transaction
28
+ receivingReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): ReceivingReportList @transaction
26
29
  `;
27
30
  exports.Types = [
28
31
  inbound_order_details_report_1.InboundOrderDetailsReport,
@@ -33,6 +36,8 @@ exports.Types = [
33
36
  shortage_report_list_1.ShortageReportList,
34
37
  custom_elccl_fn_dispatch_report_1.CustomElcclDispatchReport,
35
38
  custom_elccl_fn_dispatch_report_list_1.CustomElcclDispatchReportList,
39
+ receiving_report_1.ReceivingReport,
40
+ receiving_report_list_1.ReceivingReportList,
36
41
  aging_report_1.AgingReport,
37
42
  aging_report_list_1.AgingReportList,
38
43
  asn_report_1.AsnReport,
@@ -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,iEAAuD;AACvD,uFAA6E;AAC7E,iGAAsF;AACtF,iDAA4C;AAC5C,2DAAqD;AACrD,6CAAwC;AACxC,uDAAiD;AACjD,6DAAuD;AACvD,uEAAgE;AAEnD,QAAA,KAAK,GAAG;;;;;;;;CAQpB,CAAA;AAEY,QAAA,KAAK,GAAG;IACnB,wDAAyB;IACzB,iEAA6B;IAC7B,0DAA0B;IAC1B,mEAA8B;IAC9B,qCAAc;IACd,yCAAkB;IAClB,2DAAyB;IACzB,oEAA6B;IAC7B,0BAAW;IACX,mCAAe;IACf,sBAAS;IACT,+BAAa;IACb,qCAAgB;IAChB,8CAAoB;CACrB,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;AACrF,iEAA2D;AAC3D,iEAAuD;AACvD,uFAA6E;AAC7E,iGAAsF;AACtF,iDAA4C;AAC5C,2DAAqD;AACrD,6CAAwC;AACxC,uDAAiD;AACjD,6DAAuD;AACvD,uEAAgE;AAChE,yDAAoD;AACpD,mEAA6D;AAEhD,QAAA,KAAK,GAAG;;;;;;;;;CASpB,CAAA;AAEY,QAAA,KAAK,GAAG;IACnB,wDAAyB;IACzB,iEAA6B;IAC7B,0DAA0B;IAC1B,mEAA8B;IAC9B,qCAAc;IACd,yCAAkB;IAClB,2DAAyB;IACzB,oEAA6B;IAC7B,kCAAe;IACf,2CAAmB;IACnB,0BAAW;IACX,mCAAe;IACf,sBAAS;IACT,+BAAa;IACb,qCAAgB;IAChB,8CAAoB;CACrB,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.ReceivingReportList = void 0;
7
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
+ exports.ReceivingReportList = (0, graphql_tag_1.default) `
9
+ type ReceivingReportList {
10
+ items: [ReceivingReport]
11
+ total: Int
12
+ }
13
+ `;
14
+ //# sourceMappingURL=receiving-report-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receiving-report-list.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/receiving-report-list.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,mBAAmB,GAAG,IAAA,qBAAG,EAAA;;;;;CAKrC,CAAA"}
@@ -0,0 +1,22 @@
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.ReceivingReport = void 0;
7
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
+ exports.ReceivingReport = (0, graphql_tag_1.default) `
9
+ type ReceivingReport {
10
+ arrivedDate: String
11
+ receiptId: String
12
+ receiptIdType: String
13
+ batch: String
14
+ mfgDate: String
15
+ expDate: String
16
+ item: String
17
+ itemDesc: String
18
+ quantity: String
19
+ qtyUm: String
20
+ }
21
+ `;
22
+ //# sourceMappingURL=receiving-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receiving-report.js","sourceRoot":"","sources":["../../../../server/graphql/types/reports/receiving-report.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAEhB,QAAA,eAAe,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;CAajC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-hub",
3
- "version": "4.3.563",
3
+ "version": "4.3.564",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -122,5 +122,5 @@
122
122
  "resolutions": {
123
123
  "core-js": "^3.16.0"
124
124
  },
125
- "gitHead": "6d56d68332b0b0b9ce496bbfda1c10e837e61e5b"
125
+ "gitHead": "603113d785b5ad7930d8c34a73fa7e3aa2a91d37"
126
126
  }
@@ -5,6 +5,7 @@ import { customElcclDispatchReport } from './custom-elccl-fn-dispatch-report'
5
5
  import { agingReport } from './aging-report'
6
6
  import { asnReport } from './asn-report'
7
7
  import { admiralAsnReport } from './admiral-asn-report'
8
+ import { receivingReport } from './receiving-report'
8
9
 
9
10
  export const Query = {
10
11
  ...inboundOrderDetailsReport,
@@ -13,5 +14,7 @@ export const Query = {
13
14
  ...customElcclDispatchReport,
14
15
  ...agingReport,
15
16
  ...asnReport,
16
- ...admiralAsnReport
17
+ ...admiralAsnReport,
18
+ ...customElcclDispatchReport,
19
+ ...receivingReport
17
20
  }
@@ -0,0 +1,87 @@
1
+ import { EntityManager } from 'typeorm'
2
+ import { Bizplace } from '@things-factory/biz-base'
3
+ import { ListParam } from '@things-factory/shell'
4
+
5
+ export const receivingReport = {
6
+ async receivingReport(_: any, params: ListParam, context: any) {
7
+ try {
8
+ const { tx }: { tx: EntityManager } = context.state
9
+
10
+ // Create temporary table for report
11
+ await tx.query(
12
+ `
13
+ create temp table temp_inbound_order_report on commit drop as (
14
+ select "arrived_date", "receipt_id", "receipt_id_type", "batch", "mfg_date", "exp_date", "item", "item_desc", sum(quantity) as quantity, "qty_um" from(
15
+ select
16
+ to_char(grn.created_at + interval '8 hours','dd/mm/yyyy') as "arrived_date",
17
+ COALESCE(an.container_no,'') as "receipt_id",
18
+ 'DO' as "receipt_id_type",
19
+ i.batch_id as "batch",
20
+ to_char(i.manufacture_date,'dd/mm/yyyy') as "mfg_date",
21
+ to_char(i.expiration_date,'dd/mm/yyyy') as "exp_date",
22
+ p.sku as "item",
23
+ p.name as "item_desc",
24
+ round(oi.actual_pack_qty,2) as "quantity",
25
+ oi.packing_type as "qty_um"
26
+ from arrival_notices an
27
+ inner join goods_receival_notes grn ON an.id = grn.arrival_notice_id
28
+ inner join order_products op on an.id = op.arrival_notice_id
29
+ inner join order_inventories oi on (op.arrival_notice_id = oi.arrival_notice_id and op.product_id = oi.product_id and oi.batch_id = op.batch_id)
30
+ inner join products p on p.id = op.product_id
31
+ inner join inventories i on i.id = oi.inventory_id
32
+ where an.bizplace_id in('f0848540-9d8f-4835-b744-2407db36a14e','226c9c9d-9685-403d-8f05-89b7d3b8691e','157a9653-9f2b-4568-b245-ab8791db98ce')
33
+ and grn.created_at::date = (NOW()::date - interval '1 day')
34
+ UNION ALL
35
+ select
36
+ to_char(ro.created_at,'dd/mm/yyyy') as "arrived_date",
37
+ COALESCE(ro.delivery_order_no ,'') as "receipt_id",
38
+ 'Return' as "receipt_id_type",
39
+ i.batch_id as "batch",
40
+ to_char(i.manufacture_date,'dd/mm/yyyy') as "mfg_date",
41
+ to_char(i.expiration_date,'dd/mm/yyyy') as "exp_date",
42
+ p.sku as "item",
43
+ p.name as "item_desc",
44
+ round(oi.actual_pack_qty,2) as "quantity",
45
+ oi.packing_type as "qty_um"
46
+ from return_orders ro
47
+ inner join order_inventories oi on ro.id = oi.return_order_id
48
+ inner join inventories i on i.id = oi.inventory_id
49
+ inner join products p on p.id = oi.product_id
50
+ where ro.bizplace_id in('f0848540-9d8f-4835-b744-2407db36a14e','226c9c9d-9685-403d-8f05-89b7d3b8691e','157a9653-9f2b-4568-b245-ab8791db98ce')
51
+ and oi."type" = 'RETURN_ORDER'
52
+ and ro.created_at::date = (NOW()::date - interval '1 day')
53
+ order by arrived_date, batch, item desc
54
+ )foo group by "arrived_date", "receipt_id", "receipt_id_type", "batch", "mfg_date", "exp_date", "item", "item_desc", "qty_um"
55
+ )
56
+ `
57
+ )
58
+
59
+ // Fetch detailed results
60
+ const result: any = await tx.query(`
61
+ select *
62
+ from temp_inbound_order_report
63
+ `)
64
+
65
+ // Map detailed results
66
+ let items = result.map(itm => ({
67
+ arrivedDate: itm.arrived_date,
68
+ receiptId: itm.receipt_id,
69
+ receiptIdType: itm.receipt_id_type,
70
+ batch: itm.batch,
71
+ mfgDate: itm.mfg_date,
72
+ expDate: itm.exp_date,
73
+ item: itm.item,
74
+ itemDesc: itm.item_desc,
75
+ quantity: itm.quantity,
76
+ qtyUm: itm.qty_um
77
+ }))
78
+
79
+ // Return the modified items with inserted totals
80
+ return {
81
+ items
82
+ }
83
+ } catch (error) {
84
+ throw error
85
+ }
86
+ }
87
+ }
@@ -12,6 +12,8 @@ import { AsnReport } from './asn-report'
12
12
  import { AsnReportList } from './asn-report-list'
13
13
  import { AdmiralAsnReport } from './admiral-asn-report'
14
14
  import { AdmiralAsnReportList } from './admiral-asn-report-list'
15
+ import { ReceivingReport } from './receiving-report'
16
+ import { ReceivingReportList } from './receiving-report-list'
15
17
 
16
18
  export const Query = `
17
19
  inboundOrderDetailsReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): InboundOrderDetailsReportList @transaction
@@ -21,6 +23,7 @@ export const Query = `
21
23
  agingReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): AgingReportList @transaction
22
24
  asnReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): AsnReportList @transaction
23
25
  admiralAsnReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): AdmiralAsnReportList @transaction
26
+ receivingReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): ReceivingReportList @transaction
24
27
  `
25
28
 
26
29
  export const Types = [
@@ -32,6 +35,8 @@ export const Types = [
32
35
  ShortageReportList,
33
36
  CustomElcclDispatchReport,
34
37
  CustomElcclDispatchReportList,
38
+ ReceivingReport,
39
+ ReceivingReportList,
35
40
  AgingReport,
36
41
  AgingReportList,
37
42
  AsnReport,
@@ -0,0 +1,8 @@
1
+ import gql from 'graphql-tag'
2
+
3
+ export const ReceivingReportList = gql`
4
+ type ReceivingReportList {
5
+ items: [ReceivingReport]
6
+ total: Int
7
+ }
8
+ `
@@ -0,0 +1,16 @@
1
+ import gql from 'graphql-tag'
2
+
3
+ export const ReceivingReport = gql`
4
+ type ReceivingReport {
5
+ arrivedDate: String
6
+ receiptId: String
7
+ receiptIdType: String
8
+ batch: String
9
+ mfgDate: String
10
+ expDate: String
11
+ item: String
12
+ itemDesc: String
13
+ quantity: String
14
+ qtyUm: String
15
+ }
16
+ `