@things-factory/operato-wms 4.3.59 → 4.3.62

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 (65) hide show
  1. package/client/pages/components/select-inventory-popup.js +626 -0
  2. package/client/pages/inbound/select-product-batch.js +7 -1
  3. package/client/pages/inbound/unload-product.js +75 -25
  4. package/client/pages/inventory/inventory-adjustment.js +1 -1
  5. package/client/pages/inventory/inventory-by-product-detail.js +99 -92
  6. package/client/pages/inventory/inventory-by-product.js +170 -68
  7. package/client/pages/inventory-check/inspecting-product.js +1 -1
  8. package/client/pages/order/release-order/b2b/b2b-order-list.js +76 -80
  9. package/client/pages/order/release-order/b2c/b2c-order-requests.js +93 -81
  10. package/client/pages/order/release-order/batch-picking-popup.js +11 -0
  11. package/client/pages/order/release-order/create-release-order.js +258 -252
  12. package/client/pages/order/release-order/release-extra-product-popup.js +10 -3
  13. package/client/pages/order/release-order/release-order-detail.js +202 -63
  14. package/client/pages/order/transport-order/delivery-note-popup.js +12 -17
  15. package/client/pages/order/transport-order/upload-delivery-note.js +6 -4
  16. package/client/pages/order/transport-order/view-delivery-note.js +0 -1
  17. package/client/pages/outbound/generate-worksheet-popup.js +337 -0
  18. package/client/pages/outbound/inventory-reassign-popup.js +1097 -0
  19. package/client/pages/outbound/loading-product.js +2 -2
  20. package/client/pages/outbound/picking-product.js +174 -100
  21. package/client/pages/outbound/sorting-product.js +5 -5
  22. package/client/pages/outbound/worksheet-batch-picking.js +39 -5
  23. package/client/pages/outbound/worksheet-picking.js +45 -6
  24. package/client/pages/report/outbound-order-details-report.js +181 -49
  25. package/client/pages/report/release-inventory-report.js +503 -0
  26. package/client/route.js +5 -0
  27. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js +3 -3
  28. package/dist-server/graphql/resolvers/extra/add-release-good-products.js +54 -3
  29. package/dist-server/graphql/resolvers/extra/add-release-good-products.js.map +1 -1
  30. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  31. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  32. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +63 -28
  33. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
  34. package/dist-server/graphql/resolvers/reports/release-inventory-report.js +180 -0
  35. package/dist-server/graphql/resolvers/reports/release-inventory-report.js.map +1 -0
  36. package/dist-server/graphql/types/reports/index.js +6 -1
  37. package/dist-server/graphql/types/reports/index.js.map +1 -1
  38. package/dist-server/graphql/types/reports/outbound-order-details-report.js +14 -1
  39. package/dist-server/graphql/types/reports/outbound-order-details-report.js.map +1 -1
  40. package/dist-server/graphql/types/reports/release-inventory-report-list.js +14 -0
  41. package/dist-server/graphql/types/reports/release-inventory-report-list.js.map +1 -0
  42. package/dist-server/graphql/types/reports/release-inventory-report.js +29 -0
  43. package/dist-server/graphql/types/reports/release-inventory-report.js.map +1 -0
  44. package/dist-server/utils/report-query-util.js +4 -2
  45. package/dist-server/utils/report-query-util.js.map +1 -1
  46. package/helps/release-note.ko.md +13 -7
  47. package/helps/release-note.md +13 -7
  48. package/helps/release-note.ms.md +13 -7
  49. package/helps/release-note.zh.md +13 -7
  50. package/package.json +10 -10
  51. package/server/graphql/resolvers/dashboard/outbound-order-by-status.ts +3 -3
  52. package/server/graphql/resolvers/extra/add-release-good-products.ts +66 -3
  53. package/server/graphql/resolvers/reports/index.ts +3 -1
  54. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +66 -29
  55. package/server/graphql/resolvers/reports/release-inventory-report.ts +202 -0
  56. package/server/graphql/types/reports/index.ts +6 -1
  57. package/server/graphql/types/reports/outbound-order-details-report.ts +14 -1
  58. package/server/graphql/types/reports/release-inventory-report-list.ts +8 -0
  59. package/server/graphql/types/reports/release-inventory-report.ts +23 -0
  60. package/server/utils/report-query-util.ts +4 -2
  61. package/things-factory.config.js +4 -0
  62. package/translations/en.json +73 -16
  63. package/translations/ko.json +157 -110
  64. package/translations/ms.json +65 -16
  65. package/translations/zh.json +79 -29
@@ -0,0 +1,202 @@
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 releaseInventoryReport = {
10
+ async releaseInventoryReport(_: 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 order = params.filters.find(data => data.name === 'order')
16
+ let orderDate = params.filters.find(data => data.name === 'orderDate')
17
+ let product = params.filters.find(data => data.name === 'product')
18
+ let bizplace = params.filters.find(data => data.name === 'bizplace')
19
+ let palletId = params.filters.find(data => data.name === 'palletId')
20
+ let cartonId = params.filters.find(data => data.name === 'cartonId')
21
+
22
+ // if (userFilter) {
23
+ // const user: User = await tx.getRepository(User).findOne({
24
+ // where: { id: userFilter.value },
25
+ // relations: ['bizplaces']
26
+ // })
27
+
28
+ // const bizplace: Bizplace = user.bizplaces[0]
29
+
30
+ if (!bizplace) throw 'Invalid input'
31
+
32
+ // bizplaceFilter = { name: 'bizplace', operator: 'eq', value: bizplace.id }
33
+ // } else {
34
+ // bizplaceFilter = params.filters.find(data => data.name === 'bizplace')
35
+ // }
36
+
37
+ // if (!bizplaceFilter) throw 'Invalid input'
38
+ let roFilter = '', ccFilter = '', queryFilter = ''
39
+ if (order) {
40
+ let orderValue = order.value
41
+ .toLowerCase()
42
+ .split(',')
43
+ .map(prod => {
44
+ return "'%" + prod.trim().replace(/'/g, "''") + "%'"
45
+ })
46
+ .join(',')
47
+ roFilter += `AND (
48
+ Lower(od.name) LIKE ANY(ARRAY[${orderValue}])
49
+ OR Lower(od.ref_no) LIKE ANY(ARRAY[${orderValue}])
50
+ OR Lower(od.ref_no_2) LIKE ANY(ARRAY[${orderValue}])
51
+ OR Lower(od.ref_no_3) LIKE ANY(ARRAY[${orderValue}])
52
+ )`
53
+ ccFilter += `AND (
54
+ Lower(od.name) LIKE ANY(ARRAY[${orderValue}])
55
+ )`
56
+ }
57
+ if (orderDate) {
58
+ queryFilter += ` AND od.created_at between '${orderDate.value}'::timestamp and '${orderDate.value}'::timestamp + INTERVAL '1 day'`
59
+ }
60
+
61
+ if (palletId) {
62
+ queryFilter += ` AND lower(i.pallet_id) like '%${palletId.value.toLowerCase()}%'`
63
+ }
64
+
65
+ if (cartonId) {
66
+ queryFilter += ` AND lower(i.carton_id) like '%${cartonId.value.toLowerCase()}%'`
67
+ }
68
+
69
+ if (bizplace) {
70
+ queryFilter += ` AND od.bizplace_id = '${bizplace.value}'`
71
+ }
72
+
73
+ const bizplaceObj: Bizplace = await tx.getRepository(Bizplace).findOne({
74
+ id: bizplace.value
75
+ })
76
+ await rawProductsQuery(tx, params, bizplaceObj)
77
+
78
+ // let productQuery = ''
79
+ // if (product) {
80
+ // let productValue = product.value
81
+ // .toLowerCase()
82
+ // .split(',')
83
+ // .map(prod => {
84
+ // return "'%" + prod.trim().replace(/'/g, "''") + "%'"
85
+ // })
86
+ // .join(',')
87
+ // queryFilter = `AND (
88
+ // Lower(p.name) LIKE ANY(ARRAY[${productValue}])
89
+ // OR Lower(p.sku) LIKE ANY(ARRAY[${productValue}])
90
+ // OR Lower(p.description) LIKE ANY(ARRAY[${productValue}])
91
+ // OR Lower(p.brand_sku) LIKE ANY(ARRAY[${productValue}])
92
+ // OR Lower(p.brand) LIKE ANY(ARRAY[${productValue}])
93
+ // )`
94
+ // }
95
+
96
+ await tx.query(
97
+ `
98
+ create temp table data_src on commit drop as (
99
+ select * from (
100
+ select p.sku as product_sku, p.name as product_name, p.description as product_description, p.brand as product_brand,
101
+ b.id as bizplace_id, b.name as bizplace_name, b.description as bizplace_description, i.packing_type,
102
+ oi.release_qty as assigned_qty, oi.release_uom_value as uom_value, i.uom,
103
+ od.name as order_no, od.type::varchar as "type", od.status, od.created_at as order_at, od.release_date,
104
+ i.pallet_id, i.carton_id, i.batch_id, i.batch_id_ref, i.expiration_date, i.manufacture_date, l.name as location_name
105
+ from (
106
+ select inventory_id, release_good_id, sum(release_qty) as release_qty, sum(release_uom_value) as release_uom_value from order_inventories oi
107
+ inner join release_goods od on od.id = oi.release_good_id
108
+ where release_good_id is not null
109
+ and od.status in ('PENDING', 'PENDING_RECEIVE', 'PENDING_CANCEL', 'PENDING_WORKSHEET', 'READY_TO_PICK', 'PICKING')
110
+ and od.domain_id = $1
111
+ and oi.status != 'REPLACED'
112
+ group by inventory_id, release_good_id
113
+ ) oi
114
+ inner join release_goods od on od.id = oi.release_good_id
115
+ inner join bizplaces b on b.id = od.bizplace_id
116
+ inner join inventories i on i.id = oi.inventory_id
117
+ inner join locations l on l.id = i.location_id
118
+ inner join temp_products p on p.id = i.product_id
119
+ where 1 = 1
120
+ ${roFilter}
121
+ ${queryFilter}
122
+ union all
123
+ select p.sku as product_sku, p.name as product_name, p.description as product_description, p.brand as product_brand,
124
+ b.id as bizplace_id, b.name as bizplace_name, b.description as bizplace_description, i.packing_type,
125
+ oi.release_qty as assigned_qty, oi.release_uom_value as uom_value, i.uom,
126
+ od.name as order_no, 'cc' as "type", od.status, od.created_at as order_at, od.execution_date,
127
+ i.pallet_id, i.carton_id, i.batch_id, i.batch_id_ref, i.expiration_date, i.manufacture_date, l.name as location_name
128
+ from order_inventories oi
129
+ inner join bizplaces b on b.id = oi.bizplace_id
130
+ inner join inventory_checks od on od.id = oi.inventory_check_id
131
+ inner join inventories i on i.id = oi.inventory_id
132
+ inner join locations l on l.id = i.location_id
133
+ inner join temp_products p on p.id = i.product_id
134
+ where od.status <> 'DONE'
135
+ and od.domain_id = $1
136
+ ${ccFilter}
137
+ ${queryFilter}
138
+ ) src
139
+ order by product_sku, packing_type, order_no
140
+ );
141
+ `,
142
+ [context.state.domain.id]
143
+ )
144
+
145
+ const total: any = await tx.query(`
146
+ select count(*) from data_src
147
+ `)
148
+
149
+ const result: any = await tx.query(
150
+ `
151
+ select * from data_src
152
+ offset $1 limit $2
153
+ `,
154
+ [(params.pagination.page - 1) * params.pagination.limit, params.pagination.limit]
155
+ )
156
+
157
+ let items = result.map(itm => {
158
+ let data = {
159
+ bizplace: {
160
+ id: itm.bizplace_id,
161
+ name: itm.bizplace_name,
162
+ description: itm.bizplace_description
163
+ },
164
+ product: {
165
+ id: itm.product_id,
166
+ sku: itm.product_sku,
167
+ name: itm.product_name,
168
+ description: itm.product_description,
169
+ brand: itm.product_brand,
170
+ },
171
+ location: {
172
+ name: itm.location_name,
173
+ },
174
+ packingType: itm.packing_type,
175
+ assignedQty: itm.assigned_qty,
176
+ assignedUomValue: itm.uom_value,
177
+ assignedUom: itm.uom,
178
+ orderNo: itm.order_no,
179
+ type: itm.type,
180
+ status: itm.status,
181
+ orderAt: itm.order_at,
182
+ releaseDate: itm.release_date,
183
+ palletId: itm.pallet_id,
184
+ cartonId: itm.carton_id,
185
+ batchId: itm.batch_id,
186
+ batchIdRef: itm.batch_id_ref,
187
+ expirationDate: itm.expiration_date,
188
+ manufactureDate: itm.manufacture_date
189
+ }
190
+
191
+ return data
192
+ })
193
+
194
+ return {
195
+ items,
196
+ total: total[0].count
197
+ }
198
+ } catch (error) {
199
+ throw error
200
+ }
201
+ }
202
+ }
@@ -12,6 +12,8 @@ import { ProductLabelReportList } from './product-label-report-list'
12
12
 
13
13
  import { CostingReport } from './costing-report'
14
14
  import { CostingReportList } from './costing-report-list'
15
+ import { ReleaseInventoryReport } from './release-inventory-report'
16
+ import { ReleaseInventoryReportList } from './release-inventory-report-list'
15
17
 
16
18
  export const Query = `
17
19
  inboundSerialNumberReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): InboundSerialNumberReportList @transaction
@@ -20,6 +22,7 @@ export const Query = `
20
22
  outboundOrderDetailsReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): OutboundOrderDetailsReportList @transaction
21
23
  productLabelReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): ProductLabelReportList @transaction
22
24
  costingReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): CostingReportList @transaction
25
+ releaseInventoryReport(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): ReleaseInventoryReportList @transaction
23
26
  `
24
27
 
25
28
  export const Types = [
@@ -34,5 +37,7 @@ export const Types = [
34
37
  ProductLabelReport,
35
38
  ProductLabelReportList,
36
39
  CostingReport,
37
- CostingReportList
40
+ CostingReportList,
41
+ ReleaseInventoryReport,
42
+ ReleaseInventoryReportList
38
43
  ]
@@ -6,6 +6,7 @@ export const OutboundOrderDetailsReport = gql`
6
6
  doNo: String
7
7
  doDeliveryDate: String
8
8
  deliveryAddress: String
9
+ manifestNo: String
9
10
  roNo: String
10
11
  roType: String
11
12
  status: String
@@ -14,12 +15,22 @@ export const OutboundOrderDetailsReport = gql`
14
15
  refNo3: String
15
16
  exportOption: Boolean
16
17
  containerNo: String
18
+ containerSize: String
19
+ transportOption: String
20
+ vehicleNo: String
21
+ driverName: String
17
22
  palletQty: Int
18
23
  acceptedBy: String
19
24
  acceptedAt: String
20
25
  orderCreatedAt: String
21
26
  pickingStart: String
22
27
  pickingComplete: String
28
+ packingStart: String
29
+ packingComplete: String
30
+ sortingStart: String
31
+ sortingComplete: String
32
+ loadingStart: String
33
+ loadingComplete: String
23
34
  orderLineItem: Int
24
35
  product: Product
25
36
  packType: String
@@ -51,6 +62,8 @@ export const OutboundOrderDetailsReport = gql`
51
62
  checkedRemarkAt: String
52
63
  loadedAt: String
53
64
  loadedBy: String
54
- shippedAt: String
65
+ manifestedAt: String
66
+ manifestedBy: String
67
+ dispatchedAt: String
55
68
  }
56
69
  `
@@ -0,0 +1,8 @@
1
+ import gql from 'graphql-tag'
2
+
3
+ export const ReleaseInventoryReportList = gql`
4
+ type ReleaseInventoryReportList {
5
+ items: [ReleaseInventoryReport]
6
+ total: Int
7
+ }
8
+ `
@@ -0,0 +1,23 @@
1
+ import gql from 'graphql-tag'
2
+
3
+ export const ReleaseInventoryReport = gql`
4
+ type ReleaseInventoryReport {
5
+ bizplace: Bizplace
6
+ product: Product
7
+ packingType: String
8
+ assignedQty: Float
9
+ assignedUomValue: Float
10
+ assignedUom: String
11
+ orderNo: String
12
+ type: String
13
+ orderAt: String
14
+ releaseDate: String
15
+ palletId: String
16
+ cartonId: String
17
+ batchId: String
18
+ batchIdRef: String
19
+ expirationDate: String
20
+ manufactureDate: String
21
+ location: Location
22
+ }
23
+ `
@@ -19,6 +19,7 @@ export async function rawProductsQuery(tx: EntityManager, params: ListParam, biz
19
19
  Lower(prd.name) LIKE ANY(ARRAY[${productValue}])
20
20
  OR Lower(prd.sku) LIKE ANY(ARRAY[${productValue}])
21
21
  OR Lower(prd.description) LIKE ANY(ARRAY[${productValue}])
22
+ OR Lower(prd.brand) LIKE ANY(ARRAY[${productValue}])
22
23
  OR Lower(prd.brand_sku) LIKE ANY(ARRAY[${productValue}])
23
24
  )`
24
25
  }
@@ -32,13 +33,14 @@ export async function rawProductsQuery(tx: EntityManager, params: ListParam, biz
32
33
  `
33
34
  create temp table temp_products on commit drop AS
34
35
  (
35
- select prd.id, prd.sku, prd.name, prd.description, prd.type, prd.id::varchar as product_id, prd.brand_sku from products prd
36
+ select prd.id, prd.sku, prd.name, prd.description, prd.type, prd.id::varchar as product_id, prd.brand, prd.brand_sku
37
+ from products prd
36
38
  inner join bizplaces b on b.id = prd.bizplace_id
37
39
  inner join companies c on c.domain_id = b.domain_id
38
40
  inner join bizplaces b2 on b2.company_id = c.id
39
41
  where b2.id = $1
40
42
  ${productQuery}
41
- GROUP BY prd.id, prd.sku, prd.name, prd.description, prd.brand_sku
43
+ GROUP BY prd.id, prd.sku, prd.name, prd.description, prd.brand, prd.brand_sku
42
44
  )`,
43
45
  [bizplace.id]
44
46
  )
@@ -489,6 +489,10 @@ export default {
489
489
  tagname: 'costing-report',
490
490
  page: 'costing_report'
491
491
  },
492
+ {
493
+ tagname: 'release-inventory-report',
494
+ page: 'release_inventory_report'
495
+ },
492
496
 
493
497
  /**
494
498
  * Custom ELCCL Menus Section