@things-factory/operato-hub 4.3.324 → 4.3.327

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.
@@ -16,6 +16,7 @@ exports.inboundOrderDetailsReport = {
16
16
  let grnNo = params.filters.find(data => data.name === 'grnNo');
17
17
  let poNo = params.filters.find(data => data.name === 'poNo');
18
18
  let doNo = params.filters.find(data => data.name === 'doNo');
19
+ let lotId = params.filters.find(data => data.name == 'palletId');
19
20
  if (userFilter) {
20
21
  const user = await tx.getRepository(auth_base_1.User).findOne({
21
22
  where: { id: userFilter.value },
@@ -48,77 +49,65 @@ exports.inboundOrderDetailsReport = {
48
49
  if (doNo) {
49
50
  extraQueryFilters = `${extraQueryFilters} and delivery_order_no like '%${doNo.value}%' `;
50
51
  }
52
+ if (lotId) {
53
+ extraQueryFilters = `${extraQueryFilters} and pallet_id like '%${lotId.value}%' `;
54
+ }
51
55
  await tx.query(`
52
56
  create temp table temp_inbound_order_report on commit drop as (
53
- select * from (
54
- select b2.id as "bizplace_id", b2.name as "bizplace_name", b2.description as "bizplace_description",
55
- grn.name as "grn_no",
56
- an.name as "gan_no", an.ref_no as "ref_no_1", an.ref_no_2 as "ref_no_2", an.ref_no_3 as "ref_no_3",
57
- an.loose_item, an.import_cargo, an.container_no, an.container_size, an.own_transport,
58
- u.name as "accepted_by", an.accepted_at,
59
- an.created_at as "order_created_at",
60
- w.started_at as "unload_start", w.ended_at as "unload_complete",
61
- w2.started_at as "putaway_start", w2.ended_at as "putaway_complete",
62
- an.delivery_order_no,
63
- cp.id as "supplier_id",
64
- cp.company_name as "supplier_name",
65
- po.id as "purchase_order_id",
66
- po.name as "purchase_order_name",
67
- row_number() over(partition by an.name order by an.name, p.sku, ih.batch_id) as "order_line_item",
68
- p.id as "product_id", p.sku as "product_sku", p.name as "product_name", p.description as "product_description", p.type as "product_type",
69
- ih.packing_type as "pack_type", op.packing_size as "pack_size",
70
- ih.qty, ih.uom_value, ih.uom, ih.pallet_id, ih.carton_id, ih.batch_id, ih.batch_id_ref,
71
- i.expiration_date, i.manufacture_date,
72
- ih.unit_cost,
73
- ih.created_at as "unloaded_at",u2.name as "unloaded_by",
74
- ih2.created_at as "putaway_at", u3.name as "putaway_by",
75
- coalesce((select volume from product_details pd where pd.id = i.product_detail_id
76
- order by created_at desc
77
- fetch first 1 rows only),0) as unit_volume,
78
- coalesce((select nett_weight from product_details pd where pd.id = i.product_detail_id
79
- order by created_at desc
80
- fetch first 1 rows only),0) as unit_nett_weight,
81
- coalesce((select gross_weight from product_details pd where pd.id = i.product_detail_id
82
- order by created_at desc
83
- fetch first 1 rows only),0) as unit_gross_weight,
84
- coalesce((select weight_unit from product_details pd where pd.id = i.product_detail_id
85
- order by created_at desc
86
- fetch first 1 rows only),'') as weight_unit
87
- from (
88
- select * from arrival_notices
89
- where domain_id = $1 and bizplace_id = $2 and status ='DONE'
90
- and created_at >= $3 and created_at <= $4) an
91
- left join goods_receival_notes grn on grn.arrival_notice_id = an.id
92
- left join purchase_orders po on po.id = an.purchase_order_id
93
- left join contact_points cp on cp.id = po.supplier_id
94
- inner join bizplaces b2 on b2.id = an.bizplace_id
95
- left join users u on u.id = an.accepted_by_id
96
- inner join order_inventories oi on oi.arrival_notice_id = an.id
97
- inner join inventories i on i.id = oi.inventory_id
98
- left join worksheets w on w.arrival_notice_id = an.id and w."type" ='UNLOADING'
99
- inner join reduced_inventory_histories ih on ih.inventory_id = oi.inventory_id and ih.transaction_type ='UNLOADING' and ih.ref_order_id = an.id::varchar
100
- left join users u2 on u2.id = ih.creator_id
101
- left join worksheets w2 on w2.arrival_notice_id = an.id and w2."type" ='PUTAWAY'
102
- inner join reduced_inventory_histories ih2 on ih2.inventory_id = oi.inventory_id and ih2.transaction_type ='PUTAWAY' and ih2.ref_order_id = an.id::varchar
103
- left join users u3 on u3.id = ih2.creator_id
104
- inner join temp_products p on p.id = ih.product_id
105
- inner join order_products op on op.arrival_notice_id = an.id and op.actual_pack_qty is not null and op.product_detail_id = ih.product_detail_id and
106
- op.batch_id = ih.batch_id
107
- order by an.name, p.sku, ih.batch_id
108
- ) src
109
- where 1=1
110
- ${extraQueryFilters}
57
+ select src2.*,
58
+ w.started_at as "unload_start", w.ended_at as "unload_complete",
59
+ w2.started_at as "putaway_start", w2.ended_at as "putaway_complete",
60
+ cp.id as "supplier_id", cp.company_name as "supplier_name",
61
+ u.name as "accepted_by", u2.name as "unloaded_by", u3.name as "putaway_by"
62
+ from (
63
+ select * from (
64
+ select an.id, an.accepted_by_id, an.name as "gan_no", an.ref_no as "ref_no_1", an.ref_no_2 as "ref_no_2", an.ref_no_3 as "ref_no_3",
65
+ an.loose_item, an.import_cargo, an.container_no, an.container_size, an.own_transport,
66
+ an.accepted_at, an.created_at as "order_created_at", an.delivery_order_no,
67
+ b2.id as "bizplace_id", b2.name as "bizplace_name", b2.description as "bizplace_description",
68
+ grn.name as "grn_no",
69
+ po.id as "purchase_order_id", po.name as "purchase_order_name", po.supplier_id as "po_supplier_id",
70
+ row_number() over(partition by an.name order by an.name, p.sku, oi.batch_id) as "order_line_item",
71
+ p.id as "product_id", p.sku as "product_sku", p.name as "product_name", p.description as "product_description", p.type as "product_type",
72
+ oi.packing_size as "pack_size", oi.packing_type as "pack_type", oi.actual_pack_qty, oi.actual_pack_uom_value, oi.uom, oi.batch_id, oi.batch_id_ref,
73
+ oi.unloaded_at as "unloaded_at", oi.putaway_at as "putaway_at", oi.unloaded_by_id as "oi_unloaded_by_id", oi.putaway_by_id as "oi_putaway_by_id",
74
+ i.pallet_id, i.carton_id, i.expiration_date, i.manufacture_date, i.unit_cost,
75
+ pd.volume as "unit_volume", pd.nett_weight as "unit_nett_weight", pd.gross_weight as "unit_gross_weight", pd.weight_unit as "weight_unit"
76
+ from (
77
+ select * from arrival_notices
78
+ where domain_id = $1 and bizplace_id = $2 and status ='DONE'
79
+ and created_at >= $3 and created_at <= $4
80
+ ) an
81
+ left join purchase_orders po on po.id = an.purchase_order_id
82
+ left join goods_receival_notes grn on grn.arrival_notice_id = an.id
83
+ left join order_inventories oi on oi.arrival_notice_id = an.id
84
+ inner join bizplaces b2 on b2.id = an.bizplace_id
85
+ inner join inventories i on i.id = oi.inventory_id
86
+ inner join temp_products p on p.id = oi.product_id
87
+ inner join product_details pd on pd.id = oi.product_detail_id
88
+ inner join order_products op on op.arrival_notice_id = an.id and op.actual_pack_qty is not null and op.product_detail_id = oi.product_detail_id and op.batch_id = oi.batch_id
89
+ order by an.name, p.sku, oi.batch_id
90
+ ) src
91
+ where 1=1
92
+ ${extraQueryFilters}
93
+ ) src2
94
+ left join contact_points cp on cp.id = src2.po_supplier_id
95
+ left join users u on u.id = src2.accepted_by_id
96
+ left join users u2 on u2.id = src2.oi_unloaded_by_id
97
+ left join users u3 on u3.id = src2.oi_putaway_by_id
98
+ left join worksheets w on w.arrival_notice_id = src2.id and w."type" ='UNLOADING'
99
+ left join worksheets w2 on w2.arrival_notice_id = src2.id and w2."type" ='PUTAWAY'
111
100
  )
112
101
  `, [context.state.domain.id, bizplace.id, fromDate.value, toDate.value]);
113
102
  const total = await tx.query(`
114
103
  select count(*) from temp_inbound_order_report
115
104
  `);
116
105
  const result = await tx.query(`
117
- select *,
118
- round((qty * unit_volume)::numeric ,4) as total_volume,
119
- round((qty * unit_nett_weight)::numeric ,4) as total_unit_nett_weight,
120
- round((qty * unit_gross_weight)::numeric ,4) as total_unit_gross_weight
121
- from temp_inbound_order_report
106
+ select src2.*,
107
+ round((src2.actual_pack_qty * src2.unit_volume)::numeric ,4) as total_volume,
108
+ round((src2.actual_pack_qty * src2.unit_nett_weight)::numeric ,4) as total_unit_nett_weight,
109
+ round((src2.actual_pack_qty * src2.unit_gross_weight)::numeric ,4) as total_unit_gross_weight
110
+ from temp_inbound_order_report src2
122
111
  offset $1 limit $2
123
112
  `, [(params.pagination.page - 1) * params.pagination.limit, params.pagination.limit]);
124
113
  let items = result.map(itm => {
@@ -157,8 +146,8 @@ exports.inboundOrderDetailsReport = {
157
146
  purchaseOrderNo: itm.purchase_order_name,
158
147
  packType: itm.pack_type,
159
148
  packSize: itm.pack_size,
160
- qty: itm.qty,
161
- uomValue: itm.uom_value,
149
+ actualPackQty: itm.actual_pack_qty,
150
+ actualPackUomValue: itm.actual_pack_uom_value,
162
151
  uom: itm.uom,
163
152
  unitVolume: itm.unit_volume,
164
153
  unitCost: itm.unit_cost,
@@ -1 +1 @@
1
- {"version":3,"file":"inbound-order-details-report.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/inbound-order-details-report.ts"],"names":[],"mappings":";;;AAEA,yDAAgD;AAChD,uDAAmD;AAGnD,0CAAiD;AAEpC,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,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,MAAM,CAAC,CAAA;YAClE,IAAI,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,CAAA;YACpE,IAAI,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAA;YAChE,IAAI,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAA;YAC9D,IAAI,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,C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,CAAC,WAAW;oBAC3B,QAAQ,EAAE,GAAG,CAAC,SAAS;oBACvB,WAAW,EAAE,GAAG,CAAC,YAAY;oBAC7B,cAAc,EAAE,GAAG,CAAC,gBAAgB;oBACpC,mBAAmB,EAAE,GAAG,CAAC,sBAAsB;oBAC/C,eAAe,EAAE,GAAG,CAAC,iBAAiB;oBACtC,oBAAoB,EAAE,GAAG,CAAC,uBAAuB;oBACjD,UAAU,EAAE,GAAG,CAAC,WAAW;oBAC3B,QAAQ,EAAE,GAAG,CAAC,SAAS;oBACvB,QAAQ,EAAE,GAAG,CAAC,SAAS;oBACvB,OAAO,EAAE,GAAG,CAAC,QAAQ;oBACrB,UAAU,EAAE,GAAG,CAAC,YAAY;oBAC5B,cAAc,EAAE,GAAG,CAAC,eAAe;oBACnC,eAAe,EAAE,GAAG,CAAC,gBAAgB;oBACrC,UAAU,EAAE,GAAG,CAAC,WAAW;oBAC3B,UAAU,EAAE,GAAG,CAAC,WAAW;oBAC3B,SAAS,EAAE,GAAG,CAAC,UAAU;oBACzB,SAAS,EAAE,GAAG,CAAC,UAAU;iBAC1B,CAAA;gBAED,IAAI,GAAG,CAAC,WAAW,EAAE;oBACnB,IAAI,CAAC,UAAU,CAAC,GAAG;wBACjB,EAAE,EAAE,GAAG,CAAC,WAAW;wBACnB,IAAI,EAAE,GAAG,CAAC,aAAa;qBACxB,CAAA;iBACF;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"}
1
+ {"version":3,"file":"inbound-order-details-report.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/reports/inbound-order-details-report.ts"],"names":[],"mappings":";;;AAEA,yDAAgD;AAChD,uDAAmD;AAGnD,0CAAiD;AAEpC,Q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,EAAE,GAAG,CAAC,iBAAiB;oBACtC,oBAAoB,EAAE,GAAG,CAAC,uBAAuB;oBACjD,UAAU,EAAE,GAAG,CAAC,WAAW;oBAC3B,QAAQ,EAAE,GAAG,CAAC,SAAS;oBACvB,QAAQ,EAAE,GAAG,CAAC,SAAS;oBACvB,OAAO,EAAE,GAAG,CAAC,QAAQ;oBACrB,UAAU,EAAE,GAAG,CAAC,YAAY;oBAC5B,cAAc,EAAE,GAAG,CAAC,eAAe;oBACnC,eAAe,EAAE,GAAG,CAAC,gBAAgB;oBACrC,UAAU,EAAE,GAAG,CAAC,WAAW;oBAC3B,UAAU,EAAE,GAAG,CAAC,WAAW;oBAC3B,SAAS,EAAE,GAAG,CAAC,UAAU;oBACzB,SAAS,EAAE,GAAG,CAAC,UAAU;iBAC1B,CAAA;gBAED,IAAI,GAAG,CAAC,WAAW,EAAE;oBACnB,IAAI,CAAC,UAAU,CAAC,GAAG;wBACjB,EAAE,EAAE,GAAG,CAAC,WAAW;wBACnB,IAAI,EAAE,GAAG,CAAC,aAAa;qBACxB,CAAA;iBACF;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"}
@@ -16,7 +16,7 @@ exports.InboundOrderDetailsReport = (0, graphql_tag_1.default) `
16
16
  refNo3: String
17
17
  looseItem: Boolean
18
18
  importCargo: Boolean
19
- containerNo: String
19
+ containerNo: String
20
20
  containerSize: String
21
21
  ownTransport: Boolean
22
22
  acceptedBy: String
@@ -33,8 +33,8 @@ exports.InboundOrderDetailsReport = (0, graphql_tag_1.default) `
33
33
  contactPoint: ContactPoint
34
34
  packType: String
35
35
  packSize: Int
36
- qty: Int
37
- uomValue: Float
36
+ actualPackQty: Int
37
+ actualPackUomValue: Float
38
38
  uom: String
39
39
  unitCost: Float
40
40
  unitVolume: Float
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-hub",
3
- "version": "4.3.324",
3
+ "version": "4.3.327",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -90,9 +90,9 @@
90
90
  "@things-factory/more-ui": "^4.3.281",
91
91
  "@things-factory/notification": "^4.3.281",
92
92
  "@things-factory/pdf": "^4.3.281",
93
- "@things-factory/product-ui": "^4.3.318",
93
+ "@things-factory/product-ui": "^4.3.326",
94
94
  "@things-factory/resource-ui": "^4.3.281",
95
- "@things-factory/sales-base": "^4.3.323",
95
+ "@things-factory/sales-base": "^4.3.327",
96
96
  "@things-factory/scene-data-transform": "^4.3.281",
97
97
  "@things-factory/scene-excel": "^4.3.281",
98
98
  "@things-factory/scene-firebase": "^4.3.281",
@@ -107,8 +107,8 @@
107
107
  "@things-factory/setting-ui": "^4.3.281",
108
108
  "@things-factory/shell": "^4.3.281",
109
109
  "@things-factory/system-ui": "^4.3.281",
110
- "@things-factory/warehouse-base": "^4.3.318",
111
- "@things-factory/worksheet-base": "^4.3.324",
110
+ "@things-factory/warehouse-base": "^4.3.327",
111
+ "@things-factory/worksheet-base": "^4.3.327",
112
112
  "cron-parser": "^4.7.0",
113
113
  "koa2-swagger-ui": "^5.0.2",
114
114
  "swagger-jsdoc": "^5.0.0",
@@ -120,5 +120,5 @@
120
120
  "resolutions": {
121
121
  "core-js": "^3.16.0"
122
122
  },
123
- "gitHead": "6b3dafe2e4c4fff0de3081f4f44134c218364718"
123
+ "gitHead": "966193b943f8afd8160da603f857f9d61a917ee3"
124
124
  }
@@ -18,6 +18,7 @@ export const inboundOrderDetailsReport = {
18
18
  let grnNo = params.filters.find(data => data.name === 'grnNo')
19
19
  let poNo = params.filters.find(data => data.name === 'poNo')
20
20
  let doNo = params.filters.find(data => data.name === 'doNo')
21
+ let lotId = params.filters.find(data => data.name == 'palletId')
21
22
 
22
23
  if (userFilter) {
23
24
  const user: User = await tx.getRepository(User).findOne({
@@ -55,68 +56,56 @@ export const inboundOrderDetailsReport = {
55
56
  if (doNo) {
56
57
  extraQueryFilters = `${extraQueryFilters} and delivery_order_no like '%${doNo.value}%' `
57
58
  }
59
+ if(lotId) {
60
+ extraQueryFilters = `${extraQueryFilters} and pallet_id like '%${lotId.value}%' `
61
+ }
58
62
 
59
63
  await tx.query(
60
64
  `
61
65
  create temp table temp_inbound_order_report on commit drop as (
62
- select * from (
63
- select b2.id as "bizplace_id", b2.name as "bizplace_name", b2.description as "bizplace_description",
64
- grn.name as "grn_no",
65
- an.name as "gan_no", an.ref_no as "ref_no_1", an.ref_no_2 as "ref_no_2", an.ref_no_3 as "ref_no_3",
66
- an.loose_item, an.import_cargo, an.container_no, an.container_size, an.own_transport,
67
- u.name as "accepted_by", an.accepted_at,
68
- an.created_at as "order_created_at",
69
- w.started_at as "unload_start", w.ended_at as "unload_complete",
70
- w2.started_at as "putaway_start", w2.ended_at as "putaway_complete",
71
- an.delivery_order_no,
72
- cp.id as "supplier_id",
73
- cp.company_name as "supplier_name",
74
- po.id as "purchase_order_id",
75
- po.name as "purchase_order_name",
76
- row_number() over(partition by an.name order by an.name, p.sku, ih.batch_id) as "order_line_item",
77
- p.id as "product_id", p.sku as "product_sku", p.name as "product_name", p.description as "product_description", p.type as "product_type",
78
- ih.packing_type as "pack_type", op.packing_size as "pack_size",
79
- ih.qty, ih.uom_value, ih.uom, ih.pallet_id, ih.carton_id, ih.batch_id, ih.batch_id_ref,
80
- i.expiration_date, i.manufacture_date,
81
- ih.unit_cost,
82
- ih.created_at as "unloaded_at",u2.name as "unloaded_by",
83
- ih2.created_at as "putaway_at", u3.name as "putaway_by",
84
- coalesce((select volume from product_details pd where pd.id = i.product_detail_id
85
- order by created_at desc
86
- fetch first 1 rows only),0) as unit_volume,
87
- coalesce((select nett_weight from product_details pd where pd.id = i.product_detail_id
88
- order by created_at desc
89
- fetch first 1 rows only),0) as unit_nett_weight,
90
- coalesce((select gross_weight from product_details pd where pd.id = i.product_detail_id
91
- order by created_at desc
92
- fetch first 1 rows only),0) as unit_gross_weight,
93
- coalesce((select weight_unit from product_details pd where pd.id = i.product_detail_id
94
- order by created_at desc
95
- fetch first 1 rows only),'') as weight_unit
96
- from (
97
- select * from arrival_notices
98
- where domain_id = $1 and bizplace_id = $2 and status ='DONE'
99
- and created_at >= $3 and created_at <= $4) an
100
- left join goods_receival_notes grn on grn.arrival_notice_id = an.id
101
- left join purchase_orders po on po.id = an.purchase_order_id
102
- left join contact_points cp on cp.id = po.supplier_id
103
- inner join bizplaces b2 on b2.id = an.bizplace_id
104
- left join users u on u.id = an.accepted_by_id
105
- inner join order_inventories oi on oi.arrival_notice_id = an.id
106
- inner join inventories i on i.id = oi.inventory_id
107
- left join worksheets w on w.arrival_notice_id = an.id and w."type" ='UNLOADING'
108
- inner join reduced_inventory_histories ih on ih.inventory_id = oi.inventory_id and ih.transaction_type ='UNLOADING' and ih.ref_order_id = an.id::varchar
109
- left join users u2 on u2.id = ih.creator_id
110
- left join worksheets w2 on w2.arrival_notice_id = an.id and w2."type" ='PUTAWAY'
111
- inner join reduced_inventory_histories ih2 on ih2.inventory_id = oi.inventory_id and ih2.transaction_type ='PUTAWAY' and ih2.ref_order_id = an.id::varchar
112
- left join users u3 on u3.id = ih2.creator_id
113
- inner join temp_products p on p.id = ih.product_id
114
- inner join order_products op on op.arrival_notice_id = an.id and op.actual_pack_qty is not null and op.product_detail_id = ih.product_detail_id and
115
- op.batch_id = ih.batch_id
116
- order by an.name, p.sku, ih.batch_id
117
- ) src
118
- where 1=1
119
- ${extraQueryFilters}
66
+ select src2.*,
67
+ w.started_at as "unload_start", w.ended_at as "unload_complete",
68
+ w2.started_at as "putaway_start", w2.ended_at as "putaway_complete",
69
+ cp.id as "supplier_id", cp.company_name as "supplier_name",
70
+ u.name as "accepted_by", u2.name as "unloaded_by", u3.name as "putaway_by"
71
+ from (
72
+ select * from (
73
+ select an.id, an.accepted_by_id, an.name as "gan_no", an.ref_no as "ref_no_1", an.ref_no_2 as "ref_no_2", an.ref_no_3 as "ref_no_3",
74
+ an.loose_item, an.import_cargo, an.container_no, an.container_size, an.own_transport,
75
+ an.accepted_at, an.created_at as "order_created_at", an.delivery_order_no,
76
+ b2.id as "bizplace_id", b2.name as "bizplace_name", b2.description as "bizplace_description",
77
+ grn.name as "grn_no",
78
+ po.id as "purchase_order_id", po.name as "purchase_order_name", po.supplier_id as "po_supplier_id",
79
+ row_number() over(partition by an.name order by an.name, p.sku, oi.batch_id) as "order_line_item",
80
+ p.id as "product_id", p.sku as "product_sku", p.name as "product_name", p.description as "product_description", p.type as "product_type",
81
+ oi.packing_size as "pack_size", oi.packing_type as "pack_type", oi.actual_pack_qty, oi.actual_pack_uom_value, oi.uom, oi.batch_id, oi.batch_id_ref,
82
+ oi.unloaded_at as "unloaded_at", oi.putaway_at as "putaway_at", oi.unloaded_by_id as "oi_unloaded_by_id", oi.putaway_by_id as "oi_putaway_by_id",
83
+ i.pallet_id, i.carton_id, i.expiration_date, i.manufacture_date, i.unit_cost,
84
+ pd.volume as "unit_volume", pd.nett_weight as "unit_nett_weight", pd.gross_weight as "unit_gross_weight", pd.weight_unit as "weight_unit"
85
+ from (
86
+ select * from arrival_notices
87
+ where domain_id = $1 and bizplace_id = $2 and status ='DONE'
88
+ and created_at >= $3 and created_at <= $4
89
+ ) an
90
+ left join purchase_orders po on po.id = an.purchase_order_id
91
+ left join goods_receival_notes grn on grn.arrival_notice_id = an.id
92
+ left join order_inventories oi on oi.arrival_notice_id = an.id
93
+ inner join bizplaces b2 on b2.id = an.bizplace_id
94
+ inner join inventories i on i.id = oi.inventory_id
95
+ inner join temp_products p on p.id = oi.product_id
96
+ inner join product_details pd on pd.id = oi.product_detail_id
97
+ inner join order_products op on op.arrival_notice_id = an.id and op.actual_pack_qty is not null and op.product_detail_id = oi.product_detail_id and op.batch_id = oi.batch_id
98
+ order by an.name, p.sku, oi.batch_id
99
+ ) src
100
+ where 1=1
101
+ ${extraQueryFilters}
102
+ ) src2
103
+ left join contact_points cp on cp.id = src2.po_supplier_id
104
+ left join users u on u.id = src2.accepted_by_id
105
+ left join users u2 on u2.id = src2.oi_unloaded_by_id
106
+ left join users u3 on u3.id = src2.oi_putaway_by_id
107
+ left join worksheets w on w.arrival_notice_id = src2.id and w."type" ='UNLOADING'
108
+ left join worksheets w2 on w2.arrival_notice_id = src2.id and w2."type" ='PUTAWAY'
120
109
  )
121
110
  `,
122
111
  [context.state.domain.id, bizplace.id, fromDate.value, toDate.value]
@@ -126,13 +115,13 @@ export const inboundOrderDetailsReport = {
126
115
  select count(*) from temp_inbound_order_report
127
116
  `)
128
117
 
129
- const result: any = await tx.query(
130
- `
131
- select *,
132
- round((qty * unit_volume)::numeric ,4) as total_volume,
133
- round((qty * unit_nett_weight)::numeric ,4) as total_unit_nett_weight,
134
- round((qty * unit_gross_weight)::numeric ,4) as total_unit_gross_weight
135
- from temp_inbound_order_report
118
+ const result: any = await tx.query(
119
+ `
120
+ select src2.*,
121
+ round((src2.actual_pack_qty * src2.unit_volume)::numeric ,4) as total_volume,
122
+ round((src2.actual_pack_qty * src2.unit_nett_weight)::numeric ,4) as total_unit_nett_weight,
123
+ round((src2.actual_pack_qty * src2.unit_gross_weight)::numeric ,4) as total_unit_gross_weight
124
+ from temp_inbound_order_report src2
136
125
  offset $1 limit $2
137
126
  `,
138
127
  [(params.pagination.page - 1) * params.pagination.limit, params.pagination.limit]
@@ -174,8 +163,8 @@ export const inboundOrderDetailsReport = {
174
163
  purchaseOrderNo: itm.purchase_order_name,
175
164
  packType: itm.pack_type,
176
165
  packSize: itm.pack_size,
177
- qty: itm.qty,
178
- uomValue: itm.uom_value,
166
+ actualPackQty: itm.actual_pack_qty,
167
+ actualPackUomValue: itm.actual_pack_uom_value,
179
168
  uom: itm.uom,
180
169
  unitVolume: itm.unit_volume,
181
170
  unitCost: itm.unit_cost,
@@ -11,7 +11,7 @@ export const InboundOrderDetailsReport = gql`
11
11
  refNo3: String
12
12
  looseItem: Boolean
13
13
  importCargo: Boolean
14
- containerNo: String
14
+ containerNo: String
15
15
  containerSize: String
16
16
  ownTransport: Boolean
17
17
  acceptedBy: String
@@ -28,8 +28,8 @@ export const InboundOrderDetailsReport = gql`
28
28
  contactPoint: ContactPoint
29
29
  packType: String
30
30
  packSize: Int
31
- qty: Int
32
- uomValue: Float
31
+ actualPackQty: Int
32
+ actualPackUomValue: Float
33
33
  uom: String
34
34
  unitCost: Float
35
35
  unitVolume: Float