@things-factory/operato-wms 4.1.35 → 4.1.38

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 (42) hide show
  1. package/client/pages/inbound/unload-product.js +2 -2
  2. package/client/pages/inventory/non-loaded-inventory.js +120 -48
  3. package/client/pages/order/release-order/b2c/b2c-order-requests.js +67 -13
  4. package/client/pages/outbound/packing-product.js +14 -11
  5. package/client/pages/outbound/picking-product.js +54 -16
  6. package/client/pages/report/outbound-serial-number-report.js +11 -4
  7. package/dist-server/graphql/resolvers/dashboard/index.js +3 -1
  8. package/dist-server/graphql/resolvers/dashboard/index.js.map +1 -1
  9. package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js +51 -0
  10. package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js.map +1 -0
  11. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js +58 -0
  12. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js.map +1 -0
  13. package/dist-server/graphql/resolvers/extra/add-release-good-products.js +5 -1
  14. package/dist-server/graphql/resolvers/extra/add-release-good-products.js.map +1 -1
  15. package/dist-server/graphql/resolvers/reports/outbound-serial-number-report.js +4 -2
  16. package/dist-server/graphql/resolvers/reports/outbound-serial-number-report.js.map +1 -1
  17. package/dist-server/graphql/types/dashboard/index.js +5 -1
  18. package/dist-server/graphql/types/dashboard/index.js.map +1 -1
  19. package/dist-server/graphql/types/dashboard/inventory-expiry-counter.js +16 -0
  20. package/dist-server/graphql/types/dashboard/inventory-expiry-counter.js.map +1 -0
  21. package/dist-server/graphql/types/dashboard/inventory-expiry-status.js +14 -0
  22. package/dist-server/graphql/types/dashboard/inventory-expiry-status.js.map +1 -0
  23. package/dist-server/graphql/types/reports/outbound-serial-number-report.js +2 -1
  24. package/dist-server/graphql/types/reports/outbound-serial-number-report.js.map +1 -1
  25. package/helps/release-note.ko.md +37 -2
  26. package/helps/release-note.md +12 -41
  27. package/helps/release-note.ms.md +36 -1
  28. package/helps/release-note.zh.md +36 -1
  29. package/package.json +7 -7
  30. package/server/graphql/resolvers/dashboard/index.ts +5 -1
  31. package/server/graphql/resolvers/dashboard/inventory-expiry-monitor.ts +49 -0
  32. package/server/graphql/resolvers/dashboard/outbound-order-by-status.ts +65 -0
  33. package/server/graphql/resolvers/extra/add-release-good-products.ts +7 -2
  34. package/server/graphql/resolvers/reports/outbound-serial-number-report.ts +4 -2
  35. package/server/graphql/types/dashboard/index.ts +5 -1
  36. package/server/graphql/types/dashboard/inventory-expiry-counter.ts +10 -0
  37. package/server/graphql/types/dashboard/inventory-expiry-status.ts +8 -0
  38. package/server/graphql/types/reports/outbound-serial-number-report.ts +2 -1
  39. package/translations/en.json +2 -0
  40. package/translations/ko.json +1 -0
  41. package/translations/ms.json +1 -0
  42. package/translations/zh.json +1 -0
@@ -0,0 +1,49 @@
1
+ import { EntityManager } from 'typeorm'
2
+
3
+ import { User } from '@things-factory/auth-base'
4
+ import { Domain, ListParam } from '@things-factory/shell'
5
+
6
+ export const inventoryExpiryMonitorResolver = {
7
+ async inventoryExpiryMonitor(_: any, params: ListParam, context: any) {
8
+ const { domain, tx }: { domain: Domain; user: User; tx: EntityManager } = context.state
9
+
10
+ const expInventories: {
11
+ location: string
12
+ expired: number
13
+ thirtyDays: number
14
+ fortyFiveDays: number
15
+ sixtyDays: number
16
+ }[] = await tx.query(
17
+ `
18
+ SELECT "location", sum("expired") AS "expired", sum("thirtyDays") AS "thirtyDays", sum("fortyFiveDays") AS "fortyFiveDays", sum("sixtyDays") AS "sixtyDays" FROM (
19
+ SELECT
20
+ CASE WHEN l.TYPE IN ('QUARANTINE','RESERVE') THEN 'QUARANTINED' ELSE 'IN SHELF' END AS "location",
21
+ CASE WHEN i.expiration_date - now()::date <= 0 THEN 1 ELSE 0 END AS "expired",
22
+ CASE WHEN i.expiration_date - now()::date > 0 AND i.expiration_date - now()::date <= 30 THEN 1 ELSE 0 END AS "thirtyDays",
23
+ CASE WHEN i.expiration_date - now()::date > 30 AND i.expiration_date - now()::date <= 45 THEN 1 ELSE 0 END AS "fortyFiveDays",
24
+ CASE WHEN i.expiration_date - now()::date > 45 AND i.expiration_date - now()::date <= 60 THEN 1 ELSE 0 END AS "sixtyDays"
25
+ FROM inventories i
26
+ INNER JOIN locations l ON i.location_id = l.id
27
+ WHERE i.expiration_date - now()::date <= 60
28
+ AND i.expiration_date NOTNULL
29
+ AND i.status = 'STORED'
30
+ AND i.domain_id = $1
31
+ ) AS foo
32
+ GROUP BY "location"
33
+ `,
34
+ [domain.id]
35
+ )
36
+
37
+ return {
38
+ quarantined: getExpiryCountByStatus(expInventories, 'QUARANTINED'),
39
+ inShelf: getExpiryCountByStatus(expInventories, 'IN SHELF')
40
+ }
41
+ }
42
+ }
43
+
44
+ function getExpiryCountByStatus(expInventories, location) {
45
+ let matchedInv: any = expInventories.find(inv => inv.location == location)
46
+
47
+ if (matchedInv) return (({ location, ...inv }) => inv)(matchedInv)
48
+ else return { expired: 0, thirtyDays: 0, fortyFiveDays: 0, sixtyDays: 0 }
49
+ }
@@ -0,0 +1,65 @@
1
+ import { EntityManager } from 'typeorm'
2
+
3
+ import { User } from '@things-factory/auth-base'
4
+ import { Domain, ListParam } from '@things-factory/shell'
5
+
6
+ export const outboundOrderByStatusResolver = {
7
+ async outboundOrderByStatus(_: any, params: ListParam, context: any) {
8
+ const { domain, user, tx }: { domain: Domain; user: User; tx: EntityManager } = context.state
9
+
10
+ const orderStatus: { status: string; count: number }[] = await tx.query(
11
+ `
12
+ (
13
+ SELECT "status", COUNT(*) AS "count" FROM (
14
+ SELECT
15
+ CASE WHEN "status" = 'DEACTIVATED' AND "assignee_id" ISNULL AND "type" = 'PICKING' THEN 'PICKING UNASSIGNED'
16
+ WHEN "status" = 'EXECUTING' AND "assignee_id" NOTNULL AND "type" = 'PICKING' THEN 'PICKING ASSIGNED'
17
+ WHEN "status" = 'EXECUTING' AND "type" = 'PACKING' THEN 'PACKING'
18
+ END AS "status" FROM worksheets ws
19
+ WHERE "domain_id" = $1
20
+ ) AS foo
21
+ WHERE status IN ('PICKING ASSIGNED', 'PICKING UNASSIGNED', 'PACKING')
22
+ GROUP BY "status"
23
+ ) UNION ALL (
24
+ SELECT "status", COUNT(id) AS "count" FROM release_goods rg
25
+ WHERE "status" IN ('DONE', 'CANCELLED')
26
+ AND "domain_id" = $1
27
+ GROUP BY "status"
28
+ ) UNION ALL (
29
+ SELECT "status", COUNT(*) AS "count" FROM (
30
+ SELECT
31
+ CASE WHEN mf."status"::VARCHAR = 'OPEN' THEN 'AWAITING DISPATCH'
32
+ WHEN mf."status"::VARCHAR = 'CLOSED' AND rg."status" != 'DONE' THEN 'OUT FROM WAREHOUSE'
33
+ END AS "status"
34
+ FROM manifests mf
35
+ LEFT JOIN release_goods rg ON mf."id" = rg."manifest_id"
36
+ WHERE mf."domain_id" = $1
37
+ ) AS foo
38
+ WHERE status IN ('AWAITING DISPATCH', 'OUT FROM WAREHOUSE')
39
+ GROUP BY "status"
40
+ )
41
+ `,
42
+ [domain.id]
43
+ )
44
+
45
+ const statusList: string[] = [
46
+ 'PICKING UNASSIGNED',
47
+ 'PICKING ASSIGNED',
48
+ 'PACKING',
49
+ 'AWAITING DISPATCH',
50
+ 'OUT FROM WAREHOUSE',
51
+ 'CANCELLED',
52
+ 'DONE',
53
+ 'OUT OF STOCK'
54
+ ]
55
+
56
+ return statusList.reduce((statusCounts: { status: string; count: number }[], status: string) => {
57
+ let foundItem = orderStatus.find(order => order.status == status)
58
+
59
+ if (foundItem) statusCounts.push({ status, count: foundItem.count })
60
+ else statusCounts.push({ status, count: 0 })
61
+
62
+ return statusCounts
63
+ }, [])
64
+ }
65
+ }
@@ -251,8 +251,13 @@ export const addReleaseGoodProducts = {
251
251
  // if found existing OrderInventory and worksheetDetail then qty, uomValue, and status are updated
252
252
  newOrderInv = {
253
253
  ...existingOrderInv,
254
- releaseQty: existingOrderInv.releaseQty + newOrderInv.releaseQty,
255
- releaseUomValue: existingOrderInv.releaseUomValue + newOrderInv.releaseUomValue,
254
+ releaseQty:
255
+ existingOrderInv.status === ORDER_INVENTORY_STATUS.REPLACED
256
+ ? newOrderInv.releaseQty
257
+ : existingOrderInv.releaseQty + newOrderInv.releaseQty,
258
+ releaseUomValue: ORDER_INVENTORY_STATUS.REPLACED
259
+ ? newOrderInv.releaseUomValue
260
+ : existingOrderInv.releaseUomValue + newOrderInv.releaseUomValue,
256
261
  status:
257
262
  existingOrderInv.status === ORDER_INVENTORY_STATUS.CANCELLED
258
263
  ? pickingWorksheet
@@ -50,7 +50,8 @@ export const outboundSerialNumberReport = {
50
50
  select * from (
51
51
  select
52
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",
53
+ rg."name" as "order_no", concat_ws(', ',rg.delivery_address_1,rg.delivery_address_2,rg.delivery_address_3,rg.delivery_address_4,rg.delivery_address_5,rg.postal_code,rg.city,rg.state) as "full_delivery_address",
54
+ rg."attention_to" as "attention_to",
54
55
  i.pallet_id, i.carton_id, rg.ref_no, rg.ref_no_2, rg.ref_no_3,
55
56
  p.id as "product_id", p.sku as "product_sku", p.brand_sku as "product_brand_sku",
56
57
  p.name as "product_name", p.description as "product_description", p."type" as "product_type",
@@ -99,7 +100,8 @@ export const outboundSerialNumberReport = {
99
100
  description: bizplace.description,
100
101
  name: bizplace.name
101
102
  },
102
- deliverTo: itm.deliver_to,
103
+ fullDeliveryAddress: itm.full_delivery_address,
104
+ attentionTo:itm.attention_to,
103
105
  palletId: itm.pallet_id,
104
106
  cartonId: itm.carton_id,
105
107
  orderNo: itm.order_no,
@@ -1,3 +1,5 @@
1
+ import { InventoryExpiryCounter } from './inventory-expiry-counter'
2
+ import { InventoryExpiryStatus } from './inventory-expiry-status'
1
3
  import { OrderStatusCounter } from './order-status-counter'
2
4
 
3
5
  export const Query = /* GraphQL */ `
@@ -5,5 +7,7 @@ export const Query = /* GraphQL */ `
5
7
  collectionOrdersByStatus(filters: [Filter]): [OrderStatusCounter] @transaction
6
8
  deliveryOrdersByStatus(filters: [Filter]): [OrderStatusCounter] @transaction
7
9
  releaseGoodsByStatus(filters: [Filter]): [OrderStatusCounter] @transaction
10
+ outboundOrderByStatus(filters: [Filter]): [OrderStatusCounter] @transaction
11
+ inventoryExpiryMonitor(filters: [Filter]): InventoryExpiryStatus @transaction
8
12
  `
9
- export const Types = [OrderStatusCounter]
13
+ export const Types = [InventoryExpiryCounter, InventoryExpiryStatus, OrderStatusCounter]
@@ -0,0 +1,10 @@
1
+ import gql from 'graphql-tag'
2
+
3
+ export const InventoryExpiryCounter = gql`
4
+ type InventoryExpiryCounter {
5
+ expired: Int
6
+ thirtyDays: Int
7
+ fortyFiveDays: Int
8
+ sixtyDays: Int
9
+ }
10
+ `
@@ -0,0 +1,8 @@
1
+ import gql from 'graphql-tag'
2
+
3
+ export const InventoryExpiryStatus = gql`
4
+ type InventoryExpiryStatus {
5
+ quarantined: InventoryExpiryCounter
6
+ inShelf: InventoryExpiryCounter
7
+ }
8
+ `
@@ -4,7 +4,8 @@ export const OutboundSerialNumberReport = gql`
4
4
  type OutboundSerialNumberReport {
5
5
  no: Int
6
6
  bizplace: Bizplace
7
- deliverTo: String
7
+ fullDeliveryAddress: String
8
+ attentionTo:String
8
9
  palletId: String
9
10
  cartonId: String
10
11
  orderNo: String
@@ -245,6 +245,7 @@
245
245
  "field.from_date": "from date",
246
246
  "field.from_pallet": "from pallet",
247
247
  "field.from": "from",
248
+ "field.full_delivery_address": "full delivery address",
248
249
  "field.gan_no": "GAN No.",
249
250
  "field.gan_status": "GAN status",
250
251
  "field.gan": "GAN",
@@ -1315,6 +1316,7 @@
1315
1316
  "text.there_is_additional_operation": "there is additional operation",
1316
1317
  "text.there_is_completed_item_already": "there is completed item already",
1317
1318
  "text.there_is_duplicated_products": "there is duplicated products",
1319
+ "text.there_is_no_airway_bill_for_this_ro": "there is no airway bill for this RO",
1318
1320
  "text.there_is_no_arrival_notice_no": "there is no arrival notice no",
1319
1321
  "text.there_is_no_from_location": "there is no from location",
1320
1322
  "text.there_is_no_inventory": "there is no inventory",
@@ -1400,6 +1400,7 @@
1400
1400
  "text.there_is_additional_operation": "추가작업이 있습니다",
1401
1401
  "text.there_is_completed_item_already": "이미 완료된 상품이 있습니다",
1402
1402
  "text.there_is_duplicated_products": "[ko]there is duplicated products",
1403
+ "text.there_is_no_airway_bill_for_this_ro": "[ko]there is no airway bill for this RO",
1403
1404
  "text.there_is_no_arrival_notice_no": "출고주문번호가 없습니다",
1404
1405
  "text.there_is_no_from_location": "from 로케이션이 없습니다",
1405
1406
  "text.there_is_no_input_for_truck_no": "there is no input for truck no",
@@ -1323,6 +1323,7 @@
1323
1323
  "text.there_is_additional_operation": "terdapat operasi tambahan",
1324
1324
  "text.there_is_completed_item_already": "there is completed item already",
1325
1325
  "text.there_is_duplicated_products": "[ms]there is duplicated products",
1326
+ "text.there_is_no_airway_bill_for_this_ro": "[ms]there is no airway bill for this RO",
1326
1327
  "text.there_is_no_arrival_notice_no": "pesanan ketibaan tidak dapat dicari",
1327
1328
  "text.there_is_no_from_location": "tiada dari lokasi",
1328
1329
  "text.there_is_no_inventory": "tiada inventori",
@@ -1290,6 +1290,7 @@
1290
1290
  "text.there_is_additional_operation": "[zh]there is additional operation",
1291
1291
  "text.there_is_completed_item_already": "[zh]there is completed item already",
1292
1292
  "text.there_is_duplicated_products": "[zh]there is duplicated products",
1293
+ "text.there_is_no_airway_bill_for_this_ro": "[zh]there is no airway bill for this RO",
1293
1294
  "text.there_is_no_arrival_notice_no": "[zh]there is no arrival notice no",
1294
1295
  "text.there_is_no_from_location": "[zh]there is no from location",
1295
1296
  "text.there_is_no_inventory": "[zh]there is no inventory",