@things-factory/operato-hub 4.3.556 → 4.3.558

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.
@@ -18,10 +18,11 @@ exports.customElcclDispatchReport = {
18
18
  // Create temporary table for report (execute in json)
19
19
  await tx.query(`
20
20
  create temp table temp_inbound_order_report on commit drop as (
21
+ select creation_date, planned_shipped_date, actual_shipped_date, shipment_id, ship_to, ship_to_name, item, description, sum(qty) as qty, qty_um, batch, exp_date, mfg_date from(
21
22
  select
22
23
  to_char(rg.release_date::timestamp,'dd/mm/yyyy') as "creation_date",
23
- to_char(do2.delivery_date::date,'dd/mm/yyyy') as "planned_shipped_date",
24
- to_char((do2.delivery_date_time + interval '8 hours')::date, 'DD/MM/YYYY') as "actual_shipped_date",
24
+ to_char(do2.delivery_date::timestamp,'dd/mm/yyyy') as "planned_shipped_date",
25
+ do2.delivery_date_time + interval '8 hours' as "actual_shipped_date",
25
26
  rg.ref_no_2 as "shipment_id",
26
27
  case when do2.contact_point_ref_id is not null then cp."name" else do2.attention_to end as "ship_to",
27
28
  case when do2.contact_point_ref_id is not null then cp.company_name else do2.attention_company end as "ship_to_name",
@@ -39,10 +40,10 @@ exports.customElcclDispatchReport = {
39
40
  left join delivery_orders do2 on rg.id = do2.release_good_id
40
41
  left join contact_points cp on cp.id = do2.contact_point_ref_id::uuid
41
42
  where rg.bizplace_id = ANY($1::uuid[]) and rg.status = $2
42
- and do2.delivery_date::date = (NOW()::date - interval '1 day')
43
- and do2.status in('DELIVERING','DONE')
44
43
  order by "creation_date" asc
45
- )
44
+ )foo
45
+ group by creation_date, planned_shipped_date, actual_shipped_date, shipment_id, ship_to, ship_to_name, item, description, qty_um, batch, exp_date, mfg_date
46
+ )
46
47
  `, [[bizplace.id], 'DONE']);
47
48
  // Count total records
48
49
  // const total: any = await tx.query(`
@@ -53,12 +54,21 @@ exports.customElcclDispatchReport = {
53
54
  select *
54
55
  from temp_inbound_order_report
55
56
  `);
57
+ const convertGmt = timestamp => {
58
+ const day = timestamp.getDate();
59
+ const month = timestamp.getMonth() + 1;
60
+ const year = timestamp.getFullYear();
61
+ const datePart = `${day}/${month}/${year}`;
62
+ const dateTime = `${datePart}`;
63
+ return dateTime;
64
+ };
56
65
  // Map results to required format
57
66
  let items = result.map(itm => {
67
+ const processedActualShippedDate = itm.actual_shipped_date ? convertGmt(itm.actual_shipped_date) : '';
58
68
  return {
59
69
  creationDate: itm.creation_date,
60
70
  plannedShippedDate: itm.planned_shipped_date,
61
- actualShippedDate: itm.actual_shipped_date,
71
+ actualShippedDate: processedActualShippedDate,
62
72
  shipmentId: itm.shipment_id,
63
73
  shipTo: itm.ship_to,
64
74
  shipToName: itm.ship_to_name,
@@ -1 +1 @@
1
- {"version":3,"file":"custom-elccl-fn-dispatch-report.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/custom-elccl-fn-dispatch-report.ts"],"names":[],"mappings":";;;AACA,uDAAmD;AAGtC,QAAA,yBAAyB,GAAG;IACvC,KAAK,CAAC,yBAAyB,CAAC,CAAM,EAAE,MAAiB,EAAE,OAAY;QACrE,IAAI;YACF,MAAM,EAAE,EAAE,EAAE,GAA0B,OAAO,CAAC,KAAK,CAAA;YACnD,IAAI,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,CAAA,CAAC,iCAAiC;YAE5G,6BAA6B;YAC7B,IAAI,CAAC,cAAc;gBAAE,MAAM,4CAA4C,CAAA;YAEvE,MAAM,QAAQ,GAAa,MAAM,EAAE,CAAC,aAAa,CAAC,mBAAQ,CAAC,CAAC,OAAO,CAAC;gBAClE,EAAE,EAAE,cAAc,CAAC,KAAK;aACzB,CAAC,CAAA;YAEF,IAAI,CAAC,QAAQ;gBAAE,MAAM,mCAAmC,CAAA;YAExD,sDAAsD;YACtD,MAAM,EAAE,CAAC,KAAK,CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BD,EACC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CACxB,CAAA;YAED,sBAAsB;YACtB,sCAAsC;YACtC,mDAAmD;YACnD,+CAA+C;YAE/C,0BAA0B;YAC1B,MAAM,MAAM,GAAQ,MAAM,EAAE,CAAC,KAAK,CAChC;;;OAGD,CACA,CAAA;YAED,iCAAiC;YACjC,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;gBAC3B,OAAO;oBACL,YAAY,EAAE,GAAG,CAAC,aAAa;oBAC/B,kBAAkB,EAAE,GAAG,CAAC,oBAAoB;oBAC5C,iBAAiB,EAAE,GAAG,CAAC,mBAAmB;oBAC1C,UAAU,EAAE,GAAG,CAAC,WAAW;oBAC3B,MAAM,EAAE,GAAG,CAAC,OAAO;oBACnB,UAAU,EAAE,GAAG,CAAC,YAAY;oBAC5B,UAAU,EAAE,GAAG,CAAC,IAAI;oBACpB,kBAAkB,EAAE,GAAG,CAAC,WAAW;oBACnC,GAAG,EAAE,GAAG,CAAC,GAAG;oBACZ,KAAK,EAAE,GAAG,CAAC,MAAM;oBACjB,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,OAAO,EAAE,GAAG,CAAC,QAAQ;oBACrB,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,mBAAmB;iBAC1C,CAAA;YACH,CAAC,CAAC,CAAA;YAEF,+BAA+B;YAC/B,OAAO;gBACL,KAAK;gBACL,wBAAwB;aACzB,CAAA;SACF;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"custom-elccl-fn-dispatch-report.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/custom-elccl-fn-dispatch-report.ts"],"names":[],"mappings":";;;AACA,uDAAmD;AAGtC,QAAA,yBAAyB,GAAG;IACvC,KAAK,CAAC,yBAAyB,CA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;YACjC,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;gBAC3B,MAAM,0BAA0B,GAAG,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;gBACrG,OAAO;oBACL,YAAY,EAAE,GAAG,CAAC,aAAa;oBAC/B,kBAAkB,EAAE,GAAG,CAAC,oBAAoB;oBAC5C,iBAAiB,EAAE,0BAA0B;oBAC7C,UAAU,EAAE,GAAG,CAAC,WAAW;oBAC3B,MAAM,EAAE,GAAG,CAAC,OAAO;oBACnB,UAAU,EAAE,GAAG,CAAC,YAAY;oBAC5B,UAAU,EAAE,GAAG,CAAC,IAAI;oBACpB,kBAAkB,EAAE,GAAG,CAAC,WAAW;oBACnC,GAAG,EAAE,GAAG,CAAC,GAAG;oBACZ,KAAK,EAAE,GAAG,CAAC,MAAM;oBACjB,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,OAAO,EAAE,GAAG,CAAC,QAAQ;oBACrB,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,mBAAmB;iBAC1C,CAAA;YACH,CAAC,CAAC,CAAA;YAEF,+BAA+B;YAC/B,OAAO;gBACL,KAAK;gBACL,wBAAwB;aACzB,CAAA;SACF;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,KAAK,CAAA;SACZ;IACH,CAAC;CACF,CAAA"}
@@ -7,9 +7,9 @@ exports.CustomElcclDispatchReport = void 0;
7
7
  const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
8
  exports.CustomElcclDispatchReport = (0, graphql_tag_1.default) `
9
9
  type CustomElcclDispatchReport {
10
- creationDate: Date
11
- plannedShippedDate: Date
12
- actualShippedDate: Date
10
+ creationDate: String
11
+ plannedShippedDate: String
12
+ actualShippedDate: String
13
13
  shipmentId: String
14
14
  shipTo: String
15
15
  shipToName: String
@@ -18,8 +18,8 @@ exports.CustomElcclDispatchReport = (0, graphql_tag_1.default) `
18
18
  qty: Int
19
19
  qtyUm: String
20
20
  batch: String
21
- expDate: Date
22
- mfgDate: Date
21
+ expDate: String
22
+ mfgDate: String
23
23
  }
24
24
  `;
25
25
  //# sourceMappingURL=custom-elccl-fn-dispatch-report.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-hub",
3
- "version": "4.3.556",
3
+ "version": "4.3.558",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -92,7 +92,7 @@
92
92
  "@things-factory/pdf": "^4.3.534",
93
93
  "@things-factory/product-ui": "^4.3.535",
94
94
  "@things-factory/resource-ui": "^4.3.535",
95
- "@things-factory/sales-base": "^4.3.554",
95
+ "@things-factory/sales-base": "^4.3.558",
96
96
  "@things-factory/scene-data-transform": "^4.3.534",
97
97
  "@things-factory/scene-excel": "^4.3.534",
98
98
  "@things-factory/scene-firebase": "^4.3.534",
@@ -108,8 +108,8 @@
108
108
  "@things-factory/shell": "^4.3.535",
109
109
  "@things-factory/system-ui": "^4.3.535",
110
110
  "@things-factory/transport-base": "^4.3.535",
111
- "@things-factory/warehouse-base": "^4.3.554",
112
- "@things-factory/worksheet-base": "^4.3.555",
111
+ "@things-factory/warehouse-base": "^4.3.558",
112
+ "@things-factory/worksheet-base": "^4.3.558",
113
113
  "cron-parser": "^4.7.0",
114
114
  "koa2-swagger-ui": "^5.0.2",
115
115
  "swagger-jsdoc": "^5.0.0",
@@ -122,5 +122,5 @@
122
122
  "resolutions": {
123
123
  "core-js": "^3.16.0"
124
124
  },
125
- "gitHead": "e79e9776c4d331d5c13c8b46cbeb82e07c9c08f9"
125
+ "gitHead": "f3e16d44d2e47c649418b6744d1f5994f4cf8e3b"
126
126
  }
@@ -21,10 +21,11 @@ export const customElcclDispatchReport = {
21
21
  await tx.query(
22
22
  `
23
23
  create temp table temp_inbound_order_report on commit drop as (
24
+ select creation_date, planned_shipped_date, actual_shipped_date, shipment_id, ship_to, ship_to_name, item, description, sum(qty) as qty, qty_um, batch, exp_date, mfg_date from(
24
25
  select
25
26
  to_char(rg.release_date::timestamp,'dd/mm/yyyy') as "creation_date",
26
- to_char(do2.delivery_date::date,'dd/mm/yyyy') as "planned_shipped_date",
27
- to_char((do2.delivery_date_time + interval '8 hours')::date, 'DD/MM/YYYY') as "actual_shipped_date",
27
+ to_char(do2.delivery_date::timestamp,'dd/mm/yyyy') as "planned_shipped_date",
28
+ do2.delivery_date_time + interval '8 hours' as "actual_shipped_date",
28
29
  rg.ref_no_2 as "shipment_id",
29
30
  case when do2.contact_point_ref_id is not null then cp."name" else do2.attention_to end as "ship_to",
30
31
  case when do2.contact_point_ref_id is not null then cp.company_name else do2.attention_company end as "ship_to_name",
@@ -42,10 +43,10 @@ export const customElcclDispatchReport = {
42
43
  left join delivery_orders do2 on rg.id = do2.release_good_id
43
44
  left join contact_points cp on cp.id = do2.contact_point_ref_id::uuid
44
45
  where rg.bizplace_id = ANY($1::uuid[]) and rg.status = $2
45
- and do2.delivery_date::date = (NOW()::date - interval '1 day')
46
- and do2.status in('DELIVERING','DONE')
47
46
  order by "creation_date" asc
48
- )
47
+ )foo
48
+ group by creation_date, planned_shipped_date, actual_shipped_date, shipment_id, ship_to, ship_to_name, item, description, qty_um, batch, exp_date, mfg_date
49
+ )
49
50
  `,
50
51
  [[bizplace.id], 'DONE']
51
52
  )
@@ -63,12 +64,23 @@ export const customElcclDispatchReport = {
63
64
  `
64
65
  )
65
66
 
67
+ const convertGmt = timestamp => {
68
+ const day = timestamp.getDate()
69
+ const month = timestamp.getMonth() + 1
70
+ const year = timestamp.getFullYear()
71
+ const datePart = `${day}/${month}/${year}`
72
+ const dateTime = `${datePart}`
73
+
74
+ return dateTime
75
+ }
76
+
66
77
  // Map results to required format
67
78
  let items = result.map(itm => {
79
+ const processedActualShippedDate = itm.actual_shipped_date ? convertGmt(itm.actual_shipped_date) : ''
68
80
  return {
69
81
  creationDate: itm.creation_date, // Correctly mapped
70
82
  plannedShippedDate: itm.planned_shipped_date, // Correctly mapped
71
- actualShippedDate: itm.actual_shipped_date, // Correctly mapped
83
+ actualShippedDate: processedActualShippedDate, // Correctly mapped
72
84
  shipmentId: itm.shipment_id, // Correctly mapped
73
85
  shipTo: itm.ship_to, // Correctly mapped
74
86
  shipToName: itm.ship_to_name, // Correctly mapped
@@ -2,9 +2,9 @@ import gql from 'graphql-tag'
2
2
 
3
3
  export const CustomElcclDispatchReport = gql`
4
4
  type CustomElcclDispatchReport {
5
- creationDate: Date
6
- plannedShippedDate: Date
7
- actualShippedDate: Date
5
+ creationDate: String
6
+ plannedShippedDate: String
7
+ actualShippedDate: String
8
8
  shipmentId: String
9
9
  shipTo: String
10
10
  shipToName: String
@@ -13,7 +13,7 @@ export const CustomElcclDispatchReport = gql`
13
13
  qty: Int
14
14
  qtyUm: String
15
15
  batch: String
16
- expDate: Date
17
- mfgDate: Date
16
+ expDate: String
17
+ mfgDate: String
18
18
  }
19
19
  `