@things-factory/operato-wms 5.0.13 → 6.0.0-alpha.1
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.
- package/client/pages/bulk-operation/bulk-operation.js +96 -8
- package/client/pages/bulk-operation/validate-gan-popup.js +37 -27
- package/client/pages/bulk-operation/validate-ro-popup.js +40 -0
- package/client/pages/components/select-inventory-popup.js +633 -0
- package/client/pages/constants/order.js +2 -1
- package/client/pages/inbound/pallet-label-popup.js +2 -0
- package/client/pages/inbound/select-product-batch.js +7 -1
- package/client/pages/inbound/undo-unload-popup.js +37 -21
- package/client/pages/inbound/unload-product.js +147 -59
- package/client/pages/inbound/worksheet-putaway.js +1 -1
- package/client/pages/inbound/worksheet-unloading.js +11 -7
- package/client/pages/inventory/inventory-adjustment.js +261 -238
- package/client/pages/inventory/inventory-by-product-detail.js +99 -92
- package/client/pages/inventory/inventory-by-product.js +170 -68
- package/client/pages/inventory/onhand-inventory.js +10 -12
- package/client/pages/inventory/serial-number-list-popup.js +36 -5
- package/client/pages/inventory-check/inspecting-product.js +1 -1
- package/client/pages/manifest/create-loading-manifest.js +47 -22
- package/client/pages/manifest/dispatcher-verification-popup.js +24 -13
- package/client/pages/manifest/loading-manifest-detail.js +311 -46
- package/client/pages/manifest/loading-manifest-list.js +86 -13
- package/client/pages/order/arrival-notice/arrival-notice-detail.js +305 -52
- package/client/pages/order/arrival-notice/arrival-notice-list.js +20 -1
- package/client/pages/order/arrival-notice/create-arrival-notice.js +2 -2
- package/client/pages/order/goods-received-note/received-note-detail.js +187 -15
- package/client/pages/order/release-order/b2b/b2b-order-list.js +76 -80
- package/client/pages/order/release-order/b2c/b2c-order-requests.js +148 -123
- package/client/pages/order/release-order/batch-picking-popup.js +11 -0
- package/client/pages/order/release-order/create-release-order.js +762 -250
- package/client/pages/order/release-order/release-extra-product-popup.js +10 -3
- package/client/pages/order/release-order/release-order-detail.js +897 -215
- package/client/pages/order/transport-order/delivery-note-popup.js +1050 -107
- package/client/pages/order/transport-order/print-delivery-note.js +214 -33
- package/client/pages/order/transport-order/upload-delivery-note.js +6 -4
- package/client/pages/order/transport-order/view-delivery-note.js +0 -1
- package/client/pages/outbound/generate-worksheet-popup.js +374 -0
- package/client/pages/outbound/inventory-reassign-popup.js +1097 -0
- package/client/pages/outbound/loading-product.js +88 -78
- package/client/pages/outbound/merged-outbound-worksheet.js +1 -1
- package/client/pages/outbound/packing-product.js +193 -82
- package/client/pages/outbound/packing-worksheet-list.js +10 -9
- package/client/pages/outbound/picking-product.js +979 -905
- package/client/pages/outbound/route-label-popup.js +283 -191
- package/client/pages/outbound/serial-number-popup.js +1 -0
- package/client/pages/outbound/sorting-product.js +12 -12
- package/client/pages/outbound/worksheet-batch-picking.js +39 -5
- package/client/pages/outbound/worksheet-packing.js +17 -4
- package/client/pages/outbound/worksheet-picking.js +45 -6
- package/client/pages/report/inbound-serial-number-report.js +86 -9
- package/client/pages/report/inventory-report.js +10 -0
- package/client/pages/report/inventory-summary-report.js +28 -19
- package/client/pages/report/outbound-order-details-report.js +204 -43
- package/client/pages/report/outbound-serial-number-report.js +87 -9
- package/client/pages/report/release-inventory-report.js +503 -0
- package/client/route.js +5 -0
- package/client/util/index.js +2 -0
- package/client/util/page-settings.js +43 -0
- package/client/util/toast.js +10 -0
- package/dist-server/graphql/resolvers/board-setting/board-settings.js +3 -3
- package/dist-server/graphql/resolvers/board-setting/board-settings.js.map +1 -1
- package/dist-server/graphql/resolvers/custom/elccl/elccl-daily-collection-report.js +2 -2
- package/dist-server/graphql/resolvers/custom/elccl/elccl-daily-collection-report.js.map +1 -1
- package/dist-server/graphql/resolvers/custom/elccl/elccl-daily-order-inventory-report.js +1 -1
- package/dist-server/graphql/resolvers/custom/elccl/elccl-daily-order-inventory-report.js.map +1 -1
- package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-pallet-detail-report.js +2 -2
- package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-pallet-detail-report.js.map +1 -1
- package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js +9 -10
- package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js.map +1 -1
- package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js +2 -2
- package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js.map +1 -1
- package/dist-server/graphql/resolvers/custom/elccl/elccl-onhand-inventory-counter.js +6 -4
- package/dist-server/graphql/resolvers/custom/elccl/elccl-onhand-inventory-counter.js.map +1 -1
- package/dist-server/graphql/resolvers/custom/kimeda/kimeda-onhand-inventory-counter.js +6 -4
- package/dist-server/graphql/resolvers/custom/kimeda/kimeda-onhand-inventory-counter.js.map +1 -1
- package/dist-server/graphql/resolvers/dashboard/arrival-notices-by-status.js +21 -10
- package/dist-server/graphql/resolvers/dashboard/arrival-notices-by-status.js.map +1 -1
- package/dist-server/graphql/resolvers/dashboard/collection-orders-by-status.js +1 -2
- package/dist-server/graphql/resolvers/dashboard/collection-orders-by-status.js.map +1 -1
- package/dist-server/graphql/resolvers/dashboard/delivery-orders-by-status.js +1 -2
- package/dist-server/graphql/resolvers/dashboard/delivery-orders-by-status.js.map +1 -1
- package/dist-server/graphql/resolvers/dashboard/index.js +2 -1
- package/dist-server/graphql/resolvers/dashboard/index.js.map +1 -1
- package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js +17 -1
- package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js.map +1 -1
- package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js +113 -75
- package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js.map +1 -1
- package/dist-server/graphql/resolvers/dashboard/release-goods-by-status.js +21 -10
- package/dist-server/graphql/resolvers/dashboard/release-goods-by-status.js.map +1 -1
- package/dist-server/graphql/resolvers/dashboard/unit-inbounded-outbounded.js +56 -0
- package/dist-server/graphql/resolvers/dashboard/unit-inbounded-outbounded.js.map +1 -0
- package/dist-server/graphql/resolvers/index.js +5 -4
- package/dist-server/graphql/resolvers/index.js.map +1 -1
- package/dist-server/graphql/resolvers/inventory-comparison/inventory-comparison-list.js.map +1 -1
- package/dist-server/graphql/resolvers/opa-menu/opa-menus.js +8 -7
- package/dist-server/graphql/resolvers/opa-menu/opa-menus.js.map +1 -1
- package/dist-server/graphql/resolvers/{extra → other}/add-release-good-products.js +59 -8
- package/dist-server/graphql/resolvers/other/add-release-good-products.js.map +1 -0
- package/dist-server/graphql/resolvers/{extra → other}/index.js +3 -1
- package/dist-server/graphql/resolvers/other/index.js.map +1 -0
- package/dist-server/graphql/resolvers/other/page-settings.js +87 -0
- package/dist-server/graphql/resolvers/other/page-settings.js.map +1 -0
- package/dist-server/graphql/resolvers/reports/costing-report.js +4 -4
- package/dist-server/graphql/resolvers/reports/costing-report.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js +3 -3
- package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/inbound-serial-number-report.js +36 -7
- package/dist-server/graphql/resolvers/reports/inbound-serial-number-report.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/index.js +2 -1
- package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +69 -30
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/outbound-serial-number-report.js +36 -11
- package/dist-server/graphql/resolvers/reports/outbound-serial-number-report.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/product-label-report.js +3 -3
- package/dist-server/graphql/resolvers/reports/product-label-report.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/release-inventory-report.js +180 -0
- package/dist-server/graphql/resolvers/reports/release-inventory-report.js.map +1 -0
- package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js +2 -2
- package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js.map +1 -1
- package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js +1 -1
- package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js.map +1 -1
- package/dist-server/graphql/types/dashboard/index.js +1 -0
- package/dist-server/graphql/types/dashboard/index.js.map +1 -1
- package/dist-server/graphql/types/index.js +7 -2
- package/dist-server/graphql/types/index.js.map +1 -1
- package/dist-server/graphql/types/other/index.js +19 -0
- package/dist-server/graphql/types/other/index.js.map +1 -0
- package/dist-server/graphql/types/other/page-setting.js +34 -0
- package/dist-server/graphql/types/other/page-setting.js.map +1 -0
- package/dist-server/graphql/types/reports/index.js +6 -1
- package/dist-server/graphql/types/reports/index.js.map +1 -1
- package/dist-server/graphql/types/reports/outbound-order-details-report.js +17 -1
- package/dist-server/graphql/types/reports/outbound-order-details-report.js.map +1 -1
- package/dist-server/graphql/types/reports/release-inventory-report-list.js +12 -0
- package/dist-server/graphql/types/reports/release-inventory-report-list.js.map +1 -0
- package/dist-server/graphql/types/reports/release-inventory-report.js +27 -0
- package/dist-server/graphql/types/reports/release-inventory-report.js.map +1 -0
- package/dist-server/migrations/1568858861188-SeedSetting.js +5 -6
- package/dist-server/migrations/1568858861188-SeedSetting.js.map +1 -1
- package/dist-server/migrations/1623308919899-SeedLocationRecommendSetting.js +1 -1
- package/dist-server/migrations/1623308919899-SeedLocationRecommendSetting.js.map +1 -1
- package/dist-server/migrations/1623381200659-SeedStoringRule.js +1 -1
- package/dist-server/migrations/1623381200659-SeedStoringRule.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/dist-server/utils/report-query-util.js +5 -2
- package/dist-server/utils/report-query-util.js.map +1 -1
- package/helps/release-note.ko.md +8 -20
- package/helps/release-note.md +8 -20
- package/helps/release-note.ms.md +8 -20
- package/helps/release-note.zh.md +8 -20
- package/package.json +42 -42
- package/server/graphql/resolvers/board-setting/board-settings.ts +4 -6
- package/server/graphql/resolvers/custom/elccl/elccl-daily-collection-report.ts +4 -5
- package/server/graphql/resolvers/custom/elccl/elccl-daily-order-inventory-report.ts +9 -10
- package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-pallet-detail-report.ts +4 -5
- package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.ts +17 -19
- package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.ts +10 -8
- package/server/graphql/resolvers/custom/elccl/elccl-onhand-inventory-counter.ts +9 -9
- package/server/graphql/resolvers/custom/kimeda/kimeda-onhand-inventory-counter.ts +9 -9
- package/server/graphql/resolvers/dashboard/arrival-notices-by-status.ts +23 -14
- package/server/graphql/resolvers/dashboard/collection-orders-by-status.ts +4 -5
- package/server/graphql/resolvers/dashboard/delivery-orders-by-status.ts +4 -5
- package/server/graphql/resolvers/dashboard/index.ts +3 -1
- package/server/graphql/resolvers/dashboard/inventory-expiry-monitor.ts +18 -6
- package/server/graphql/resolvers/dashboard/outbound-order-by-status.ts +114 -81
- package/server/graphql/resolvers/dashboard/release-goods-by-status.ts +23 -14
- package/server/graphql/resolvers/dashboard/unit-inbounded-outbounded.ts +61 -0
- package/server/graphql/resolvers/index.ts +5 -4
- package/server/graphql/resolvers/inventory-comparison/inventory-comparison-list.ts +11 -9
- package/server/graphql/resolvers/opa-menu/opa-menus.ts +7 -6
- package/server/graphql/resolvers/{extra → other}/add-release-good-products.ts +73 -12
- package/server/graphql/resolvers/other/index.ts +10 -0
- package/server/graphql/resolvers/other/page-settings.ts +105 -0
- package/server/graphql/resolvers/reports/costing-report.ts +8 -10
- package/server/graphql/resolvers/reports/inbound-order-details-report.ts +7 -9
- package/server/graphql/resolvers/reports/inbound-serial-number-report.ts +41 -13
- package/server/graphql/resolvers/reports/index.ts +3 -1
- package/server/graphql/resolvers/reports/outbound-order-details-report.ts +76 -38
- package/server/graphql/resolvers/reports/outbound-serial-number-report.ts +42 -18
- package/server/graphql/resolvers/reports/product-label-report.ts +4 -6
- package/server/graphql/resolvers/reports/release-inventory-report.ts +201 -0
- package/server/graphql/resolvers/shipping-provider/shipping-providers.ts +3 -5
- package/server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.ts +10 -10
- package/server/graphql/types/dashboard/index.ts +1 -0
- package/server/graphql/types/index.ts +8 -2
- package/server/graphql/types/other/index.ts +19 -0
- package/server/graphql/types/other/page-setting.ts +33 -0
- package/server/graphql/types/reports/index.ts +6 -1
- package/server/graphql/types/reports/outbound-order-details-report.ts +17 -1
- package/server/graphql/types/reports/release-inventory-report-list.ts +8 -0
- package/server/graphql/types/reports/release-inventory-report.ts +23 -0
- package/server/migrations/1568858861188-SeedSetting.ts +4 -4
- package/server/migrations/1623308919899-SeedLocationRecommendSetting.ts +3 -2
- package/server/migrations/1623381200659-SeedStoringRule.ts +3 -2
- package/server/utils/report-query-util.ts +5 -2
- package/things-factory.config.js +4 -0
- package/translations/en.json +148 -27
- package/translations/ko.json +185 -105
- package/translations/ms.json +183 -98
- package/translations/zh.json +197 -112
- package/dist-server/graphql/resolvers/extra/add-release-good-products.js.map +0 -1
- package/dist-server/graphql/resolvers/extra/index.js.map +0 -1
- package/dist-server/graphql/types/extra/index.js +0 -11
- package/dist-server/graphql/types/extra/index.js.map +0 -1
- package/server/graphql/resolvers/extra/index.ts +0 -5
- package/server/graphql/types/extra/index.ts +0 -7
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { EntityManager } from 'typeorm'
|
|
2
|
-
|
|
3
1
|
import { User } from '@things-factory/auth-base'
|
|
4
2
|
import { Bizplace } from '@things-factory/biz-base'
|
|
5
|
-
import { ListParam } from '@things-factory/shell'
|
|
3
|
+
import { Filter, ListParam } from '@things-factory/shell'
|
|
6
4
|
|
|
7
5
|
import { rawProductsQuery } from '../../../utils'
|
|
8
6
|
|
|
9
7
|
export const outboundOrderDetailsReport = {
|
|
10
|
-
async outboundOrderDetailsReport(_: any, params: ListParam, context:
|
|
8
|
+
async outboundOrderDetailsReport(_: any, params: ListParam, context: ResolverContext) {
|
|
11
9
|
try {
|
|
12
|
-
const { tx }
|
|
13
|
-
let bizplaceFilter = { name: '', operator: '', value: '' }
|
|
10
|
+
const { tx } = context.state
|
|
11
|
+
let bizplaceFilter: Filter = { name: '', operator: '', value: '' }
|
|
14
12
|
let userFilter = params.filters.find(data => data.name === 'user')
|
|
15
13
|
let fromDate = params.filters.find(data => data.name === 'fromDate')
|
|
16
14
|
let toDate = params.filters.find(data => data.name === 'toDate')
|
|
@@ -19,10 +17,10 @@ export const outboundOrderDetailsReport = {
|
|
|
19
17
|
let status = params.filters.find(data => data.name === 'status')
|
|
20
18
|
|
|
21
19
|
if (userFilter) {
|
|
22
|
-
const user
|
|
20
|
+
const user = (await tx.getRepository(User).findOne({
|
|
23
21
|
where: { id: userFilter.value },
|
|
24
22
|
relations: ['bizplaces']
|
|
25
|
-
})
|
|
23
|
+
})) as User & { bizplaces: Bizplace[] }
|
|
26
24
|
|
|
27
25
|
const bizplace: Bizplace = user.bizplaces[0]
|
|
28
26
|
|
|
@@ -35,7 +33,7 @@ export const outboundOrderDetailsReport = {
|
|
|
35
33
|
|
|
36
34
|
if (!bizplaceFilter || !fromDate || !toDate) throw 'Invalid input'
|
|
37
35
|
|
|
38
|
-
const bizplace: Bizplace = await tx.getRepository(Bizplace).
|
|
36
|
+
const bizplace: Bizplace = await tx.getRepository(Bizplace).findOneBy({
|
|
39
37
|
id: bizplaceFilter.value
|
|
40
38
|
})
|
|
41
39
|
|
|
@@ -54,30 +52,37 @@ export const outboundOrderDetailsReport = {
|
|
|
54
52
|
`
|
|
55
53
|
create temp table temp_outbound_order_report on commit drop as (
|
|
56
54
|
select * from (
|
|
57
|
-
select oi.id,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
do2.
|
|
61
|
-
do2.
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
select oi.id,
|
|
56
|
+
oi.release_qty AS "release_qty", oi.picked_at, oi.picked_by, oi.packed_at, oi.packed_by, oi.loaded_at, oi.loaded_by,
|
|
57
|
+
oi.release_qty as "qty", oi.release_uom_value as "uom_value", oi.return_to_location_qty, oi.return_to_location_uom_value,
|
|
58
|
+
coalesce(do2.other_driver, td.name) as driver_name,
|
|
59
|
+
coalesce(do2.truck_no, tv.name, rg.truck_no) as vehicle_no,
|
|
60
|
+
do2.name AS "delivery_order_no", do2.delivery_date AS "delivery_order_delivery_date", do2."to", do2.contact_point_ref_id, do2.pallet_qty,
|
|
61
|
+
coalesce(do2.delivery_date_time, do2.delivery_date::timestamp, ms.dispatched_at, null) as "dispatched_at",
|
|
62
|
+
rg.bizplace_id, $5 AS "bizplace_name", $6 AS "bizplace_description",
|
|
63
|
+
coalesce( concat(do2.delivery_address_1, do2.delivery_address_2, do2.delivery_address_3, do2.delivery_address_4, do2.delivery_address_5, do2.postal_code, do2.country), concat(rg.delivery_address_1, rg.delivery_address_2, rg.delivery_address_3, rg.delivery_address_4, rg.delivery_address_5, rg.postal_code, rg.country)) as delivery_address,
|
|
64
|
+
so.container_no, so.container_size,
|
|
65
|
+
rg.export_option, rg.name AS "ro_no", rg."type" as "ro_type", rg.ref_no AS "ref_no_1", rg.ref_no_2 AS "ref_no_2", rg.ref_no_3 AS "ref_no_3", rg.status as "ro_status",
|
|
66
|
+
rg.created_at AS "order_created_at", rg.accepted_at, u4.name as accepted_by, rg.checked_remark_by, rg.checked_remark_at, coalesce(do2.own_collection, rg.own_transport) AS own_transport,
|
|
64
67
|
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",
|
|
65
|
-
i.packing_type as "pack_type", i.packing_size as "pack_size",
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
i.packing_type as "pack_type", i.packing_size as "pack_size",
|
|
69
|
+
i.uom, i.unit_cost,
|
|
70
|
+
i.id as inventory_id, i.pallet_id, i.carton_id, i.batch_id, i.batch_id_ref, i.expiration_date, i.manufacture_date,
|
|
71
|
+
coalesce(ms.name,'') as manifest_no, coalesce(rg.manifested_at, ms.created_at) as manifested_at, coalesce(u6.name, u5.name) as manifested_by
|
|
72
|
+
from release_goods rg
|
|
73
|
+
inner join order_inventories oi on rg.id = oi.release_good_id
|
|
74
|
+
left join shipping_orders so on so.id = rg.shipping_order_id
|
|
72
75
|
left join users u4 on u4.id = rg.accepted_by_id
|
|
76
|
+
left join manifests ms on ms.id = rg.manifest_id
|
|
77
|
+
left join users u5 on u5.id = ms.creator_id
|
|
78
|
+
left join users u6 on u6.id = rg.manifested_by_id
|
|
73
79
|
inner join inventories i on i.id = oi.inventory_id
|
|
74
80
|
inner join temp_products p on p.id = oi.product_id
|
|
75
81
|
left join delivery_orders do2 on do2.id = oi.delivery_order_id
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
)
|
|
82
|
+
left join transport_drivers td ON td.id = do2.transport_driver_id
|
|
83
|
+
left join transport_vehicles tv on tv.id = do2.transport_vehicle_id
|
|
84
|
+
where rg.bizplace_id = $2 and rg.domain_id = $1
|
|
85
|
+
and rg.created_at >= $3 and rg.created_at <= $4
|
|
81
86
|
and oi.status <> 'REPLACED'
|
|
82
87
|
${status ? `and rg.status = '${status.value}' ` : ``}
|
|
83
88
|
) src
|
|
@@ -85,7 +90,7 @@ export const outboundOrderDetailsReport = {
|
|
|
85
90
|
${extraQueryFilters}
|
|
86
91
|
)
|
|
87
92
|
`,
|
|
88
|
-
[context.state.domain.id, bizplace.id, fromDate.value, toDate.value]
|
|
93
|
+
[context.state.domain.id, bizplace.id, fromDate.value, toDate.value, bizplace.name, bizplace.description]
|
|
89
94
|
)
|
|
90
95
|
|
|
91
96
|
console.timeEnd('temp')
|
|
@@ -93,6 +98,16 @@ export const outboundOrderDetailsReport = {
|
|
|
93
98
|
select count(*) from temp_outbound_order_report
|
|
94
99
|
`)
|
|
95
100
|
|
|
101
|
+
await tx.query(
|
|
102
|
+
`
|
|
103
|
+
create temp table temp_outbound_order_worksheet on commit drop as (
|
|
104
|
+
select oi.id, w.started_at, w.ended_at, w.type from temp_outbound_order_report oi
|
|
105
|
+
inner join worksheet_details wd on wd.target_inventory_id = oi.id
|
|
106
|
+
inner join worksheets w on w.id = wd.worksheet_id
|
|
107
|
+
)
|
|
108
|
+
`
|
|
109
|
+
)
|
|
110
|
+
|
|
96
111
|
console.time('result')
|
|
97
112
|
const result: any = await tx.query(
|
|
98
113
|
`
|
|
@@ -101,10 +116,12 @@ export const outboundOrderDetailsReport = {
|
|
|
101
116
|
round((qty * unit_nett_weight)::numeric ,4) as total_unit_nett_weight,
|
|
102
117
|
round((qty * unit_gross_weight)::numeric ,4) as total_unit_gross_weight
|
|
103
118
|
from (
|
|
104
|
-
select
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
119
|
+
select oi.*,
|
|
120
|
+
wpick.started_at as picking_start, wpick.ended_at as picking_complete,
|
|
121
|
+
wpack.started_at as packing_start, wpack.ended_at as packing_complete,
|
|
122
|
+
wsort.started_at as sorting_start, wsort.ended_at as sorting_complete,
|
|
123
|
+
wload.started_at as loading_start, wload.ended_at as loading_complete,
|
|
124
|
+
coalesce(delivery_address, concat(cp.address, cp.address_2)) as "delivery_address",
|
|
108
125
|
coalesce((select volume from product_details pd where pd.product_id = oi.product_id and pd.packing_type = oi.pack_type and pd.packing_size = oi.pack_size
|
|
109
126
|
order by created_at desc
|
|
110
127
|
fetch first 1 rows only),0) as unit_volume,
|
|
@@ -124,10 +141,15 @@ export const outboundOrderDetailsReport = {
|
|
|
124
141
|
order by created_at desc
|
|
125
142
|
fetch first 1 rows only), oi.unit_cost, 0) as unit_cost
|
|
126
143
|
from temp_outbound_order_report oi
|
|
127
|
-
left join worksheet_details wd on wd.target_inventory_id = oi.id
|
|
128
|
-
left join worksheets w on w.id = wd.worksheet_id
|
|
129
144
|
left join contact_points cp on cp.id = oi.contact_point_ref_id
|
|
130
|
-
|
|
145
|
+
left join temp_outbound_order_worksheet wpick on wpick.id = oi.id
|
|
146
|
+
and (wpick.type= 'PICKING' OR wpick.type = 'BATCH_PICKING')
|
|
147
|
+
left join temp_outbound_order_worksheet wpack on wpack.id = oi.id
|
|
148
|
+
and wpack.type= 'PACKING'
|
|
149
|
+
left join temp_outbound_order_worksheet wsort on wsort.id = oi.id
|
|
150
|
+
and wsort.type= 'SORTING'
|
|
151
|
+
left join temp_outbound_order_worksheet wload on wload.id = oi.id
|
|
152
|
+
and wload.type= 'LOADING'
|
|
131
153
|
order by oi.ro_no, oi.product_sku
|
|
132
154
|
offset $1 limit $2
|
|
133
155
|
) src
|
|
@@ -145,8 +167,10 @@ export const outboundOrderDetailsReport = {
|
|
|
145
167
|
description: itm.bizplace_description
|
|
146
168
|
},
|
|
147
169
|
doNo: itm.delivery_order_no,
|
|
148
|
-
doDeliveryDate: itm.
|
|
170
|
+
doDeliveryDate: itm.delivery_order_delivery_date,
|
|
171
|
+
dispatchedAt: itm.dispatched_at,
|
|
149
172
|
deliveryAddress: itm.delivery_address,
|
|
173
|
+
manifestNo: itm.manifest_no,
|
|
150
174
|
roNo: itm.ro_no,
|
|
151
175
|
roType: itm.ro_type,
|
|
152
176
|
status: itm.ro_status,
|
|
@@ -158,6 +182,12 @@ export const outboundOrderDetailsReport = {
|
|
|
158
182
|
orderCreatedAt: itm.order_created_at,
|
|
159
183
|
pickingStart: itm.picking_start,
|
|
160
184
|
pickingComplete: itm.picking_complete,
|
|
185
|
+
packingStart: itm.packing_start,
|
|
186
|
+
packingComplete: itm.packing_complete,
|
|
187
|
+
sortingStart: itm.sorting_start,
|
|
188
|
+
sortingComplete: itm.sorting_complete,
|
|
189
|
+
loadingStart: itm.loading_start,
|
|
190
|
+
loadingComplete: itm.loading_complete,
|
|
161
191
|
product: {
|
|
162
192
|
id: itm.product_id,
|
|
163
193
|
sku: itm.product_sku,
|
|
@@ -194,7 +224,15 @@ export const outboundOrderDetailsReport = {
|
|
|
194
224
|
checkedRemarkAt: itm.checked_remark_at,
|
|
195
225
|
loadedAt: itm.loaded_at,
|
|
196
226
|
loadedBy: itm.loaded_by,
|
|
197
|
-
|
|
227
|
+
manifestedAt: itm.manifested_at,
|
|
228
|
+
manifestedBy: itm.manifested_by,
|
|
229
|
+
exportOption: itm.export_option,
|
|
230
|
+
containerNo: itm.container_no,
|
|
231
|
+
containerSize: itm.container_size,
|
|
232
|
+
palletQty: itm.pallet_qty,
|
|
233
|
+
transportOption: itm.own_transport ? 'Own Transport' : 'Warehouse Transport',
|
|
234
|
+
vehicleNo: itm.vehicle_no,
|
|
235
|
+
driverName: itm.driver_name
|
|
198
236
|
}
|
|
199
237
|
})
|
|
200
238
|
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { EntityManager } from 'typeorm'
|
|
2
|
-
|
|
3
1
|
import { User } from '@things-factory/auth-base'
|
|
4
2
|
import { Bizplace } from '@things-factory/biz-base'
|
|
5
|
-
import { ListParam } from '@things-factory/shell'
|
|
3
|
+
import { Filter, ListParam } from '@things-factory/shell'
|
|
6
4
|
|
|
7
5
|
import { rawProductsQuery } from '../../../utils'
|
|
8
6
|
|
|
9
7
|
export const outboundSerialNumberReport = {
|
|
10
|
-
async outboundSerialNumberReport(_: any, params: ListParam, context:
|
|
8
|
+
async outboundSerialNumberReport(_: any, params: ListParam, context: ResolverContext) {
|
|
11
9
|
try {
|
|
12
|
-
const { tx }
|
|
13
|
-
let bizplaceFilter = { name: '', operator: '', value: '' }
|
|
10
|
+
const { tx } = context.state
|
|
11
|
+
let bizplaceFilter: Filter = { name: '', operator: '', value: '' }
|
|
14
12
|
let userFilter = params.filters.find(data => data.name === 'user')
|
|
15
13
|
let fromDate = params.filters.find(data => data.name === 'fromDate')
|
|
16
14
|
let toDate = params.filters.find(data => data.name === 'toDate')
|
|
17
|
-
let
|
|
15
|
+
let orderNo = params.filters.find(data => data.name === 'orderNo')
|
|
16
|
+
let ref = params.filters.find(data => data.name === 'ref')
|
|
17
|
+
let palletId = params.filters.find(data => data.name === 'palletId')
|
|
18
|
+
let cartonId = params.filters.find(data => data.name === 'cartonId')
|
|
19
|
+
let serialNumber = params.filters.find(data => data.name === 'serialNumber')
|
|
18
20
|
|
|
19
21
|
if (userFilter) {
|
|
20
|
-
const user
|
|
22
|
+
const user = (await tx.getRepository(User).findOne({
|
|
21
23
|
where: { id: userFilter.value },
|
|
22
24
|
relations: ['bizplaces']
|
|
23
|
-
})
|
|
25
|
+
})) as User & { bizplaces: Bizplace[] }
|
|
24
26
|
|
|
25
27
|
const bizplace: Bizplace = user.bizplaces[0]
|
|
26
28
|
|
|
@@ -33,15 +35,40 @@ export const outboundSerialNumberReport = {
|
|
|
33
35
|
|
|
34
36
|
if (!bizplaceFilter || !fromDate || !toDate) throw 'Invalid input'
|
|
35
37
|
|
|
36
|
-
const bizplace: Bizplace = await tx.getRepository(Bizplace).
|
|
38
|
+
const bizplace: Bizplace = await tx.getRepository(Bizplace).findOneBy({
|
|
37
39
|
id: bizplaceFilter.value
|
|
38
40
|
})
|
|
39
41
|
|
|
40
42
|
await rawProductsQuery(tx, params, bizplace)
|
|
41
43
|
|
|
42
44
|
let extraQueryFilters = ''
|
|
43
|
-
if (
|
|
44
|
-
extraQueryFilters = `${extraQueryFilters} and order_no like '%${
|
|
45
|
+
if (orderNo) {
|
|
46
|
+
extraQueryFilters = `${extraQueryFilters} and order_no like '%${orderNo.value}%' `
|
|
47
|
+
}
|
|
48
|
+
if (palletId) {
|
|
49
|
+
extraQueryFilters = `${extraQueryFilters} and pallet_id like '%${palletId.value}%' `
|
|
50
|
+
}
|
|
51
|
+
if (cartonId) {
|
|
52
|
+
extraQueryFilters = `${extraQueryFilters} and carton_id like '%${cartonId.value}%' `
|
|
53
|
+
}
|
|
54
|
+
if (serialNumber) {
|
|
55
|
+
extraQueryFilters = `${extraQueryFilters} and serial_number like '%${serialNumber.value}%' `
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let refNoQueryFilter = ''
|
|
59
|
+
if (ref) {
|
|
60
|
+
let refValue = ref.value
|
|
61
|
+
.toLowerCase()
|
|
62
|
+
.split(',')
|
|
63
|
+
.map(ref => {
|
|
64
|
+
return "'%" + ref.trim().replace(/'/g, "''") + "%'"
|
|
65
|
+
})
|
|
66
|
+
.join(',')
|
|
67
|
+
refNoQueryFilter = `AND (
|
|
68
|
+
Lower(rg.ref_no) LIKE ANY(ARRAY[${refValue}])
|
|
69
|
+
OR Lower(rg.ref_no_2) LIKE ANY(ARRAY[${refValue}])
|
|
70
|
+
OR Lower(rg.ref_no_3) LIKE ANY(ARRAY[${refValue}])
|
|
71
|
+
)`
|
|
45
72
|
}
|
|
46
73
|
|
|
47
74
|
await tx.query(
|
|
@@ -60,17 +87,14 @@ export const outboundSerialNumberReport = {
|
|
|
60
87
|
coalesce(w.started_at,ii.created_at) as "etd"
|
|
61
88
|
from inventory_items ii
|
|
62
89
|
inner join inventories i on i.id = ii.inventory_id
|
|
63
|
-
inner join
|
|
90
|
+
inner join temp_products p on p.id = i.product_id
|
|
64
91
|
left join product_details pd on pd.product_id = p.id and pd.packing_type = i.packing_type and pd.packing_size = i.packing_size
|
|
65
92
|
inner join release_goods rg on rg.id = ii.outbound_order_id::uuid
|
|
66
|
-
left join contact_points cp on cp.id = rg.deliver_to_id
|
|
67
|
-
left join order_inventories oi on oi.release_good_id = rg.id and oi.inventory_id = i.id
|
|
68
|
-
left join delivery_orders do2 on do2.id = oi.delivery_order_id
|
|
69
|
-
left join contact_points cp2 on cp2.id = do2.contact_point_ref_id
|
|
70
93
|
left join worksheets w on w.arrival_notice_id = rg.id and w.type = 'PICKING'
|
|
71
94
|
where
|
|
72
95
|
i.domain_id = $1 and i.bizplace_id = $2
|
|
73
96
|
and coalesce(w.started_at, ii.created_at) between $3 and $4
|
|
97
|
+
${refNoQueryFilter}
|
|
74
98
|
order by coalesce(w.started_at, ii.created_at), p.sku
|
|
75
99
|
) src
|
|
76
100
|
where 1=1
|
|
@@ -101,7 +125,7 @@ export const outboundSerialNumberReport = {
|
|
|
101
125
|
name: bizplace.name
|
|
102
126
|
},
|
|
103
127
|
fullDeliveryAddress: itm.full_delivery_address,
|
|
104
|
-
attentionTo:itm.attention_to,
|
|
128
|
+
attentionTo: itm.attention_to,
|
|
105
129
|
palletId: itm.pallet_id,
|
|
106
130
|
cartonId: itm.carton_id,
|
|
107
131
|
orderNo: itm.order_no,
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { getRepository } from 'typeorm'
|
|
2
|
-
|
|
3
1
|
import { Sequence, SEQUENCE_TYPE } from '@things-factory/id-rule-base'
|
|
4
|
-
import {
|
|
2
|
+
import { getRepository, ListParam } from '@things-factory/shell'
|
|
5
3
|
|
|
6
4
|
export const productLabelReport = {
|
|
7
|
-
async productLabelReport(_: any, params: ListParam, context:
|
|
5
|
+
async productLabelReport(_: any, params: ListParam, context: ResolverContext) {
|
|
8
6
|
try {
|
|
9
|
-
const { domain }
|
|
10
|
-
// const { domain }
|
|
7
|
+
const { domain } = context.state
|
|
8
|
+
// const { domain } = context.state
|
|
11
9
|
const bizplaceId = params.filters.find(data => data.name === 'bizplace').value
|
|
12
10
|
const type = params.filters.find(data => data.name === 'type')?.value
|
|
13
11
|
const fromDate = params.filters.find(data => data.name === 'fromDate').value
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { Bizplace } from '@things-factory/biz-base'
|
|
2
|
+
import { ListParam } from '@things-factory/shell'
|
|
3
|
+
|
|
4
|
+
import { rawProductsQuery } from '../../../utils'
|
|
5
|
+
|
|
6
|
+
export const releaseInventoryReport = {
|
|
7
|
+
async releaseInventoryReport(_: any, params: ListParam, context: ResolverContext) {
|
|
8
|
+
try {
|
|
9
|
+
const { tx } = context.state
|
|
10
|
+
// let bizplaceFilter = { name: '', operator: '', value: '' }
|
|
11
|
+
// let userFilter = params.filters.find(data => data.name === 'user')
|
|
12
|
+
let order = params.filters.find(data => data.name === 'order')
|
|
13
|
+
let orderDate = params.filters.find(data => data.name === 'orderDate')
|
|
14
|
+
let product = params.filters.find(data => data.name === 'product')
|
|
15
|
+
let bizplace = params.filters.find(data => data.name === 'bizplace')
|
|
16
|
+
let palletId = params.filters.find(data => data.name === 'palletId')
|
|
17
|
+
let cartonId = params.filters.find(data => data.name === 'cartonId')
|
|
18
|
+
|
|
19
|
+
// if (userFilter) {
|
|
20
|
+
// const user = await tx.getRepository(User).findOne({
|
|
21
|
+
// where: { id: userFilter.value },
|
|
22
|
+
// relations: ['bizplaces']
|
|
23
|
+
// }) as User & { bizplaces: Bizplace[] }
|
|
24
|
+
|
|
25
|
+
// const bizplace: Bizplace = user.bizplaces[0]
|
|
26
|
+
|
|
27
|
+
if (!bizplace) throw 'Invalid input'
|
|
28
|
+
|
|
29
|
+
// bizplaceFilter = { name: 'bizplace', operator: 'eq', value: bizplace.id }
|
|
30
|
+
// } else {
|
|
31
|
+
// bizplaceFilter = params.filters.find(data => data.name === 'bizplace')
|
|
32
|
+
// }
|
|
33
|
+
|
|
34
|
+
// if (!bizplaceFilter) throw 'Invalid input'
|
|
35
|
+
let roFilter = '',
|
|
36
|
+
ccFilter = '',
|
|
37
|
+
queryFilter = ''
|
|
38
|
+
if (order) {
|
|
39
|
+
let orderValue = order.value
|
|
40
|
+
.toLowerCase()
|
|
41
|
+
.split(',')
|
|
42
|
+
.map(prod => {
|
|
43
|
+
return "'%" + prod.trim().replace(/'/g, "''") + "%'"
|
|
44
|
+
})
|
|
45
|
+
.join(',')
|
|
46
|
+
roFilter += `AND (
|
|
47
|
+
Lower(od.name) LIKE ANY(ARRAY[${orderValue}])
|
|
48
|
+
OR Lower(od.ref_no) LIKE ANY(ARRAY[${orderValue}])
|
|
49
|
+
OR Lower(od.ref_no_2) LIKE ANY(ARRAY[${orderValue}])
|
|
50
|
+
OR Lower(od.ref_no_3) LIKE ANY(ARRAY[${orderValue}])
|
|
51
|
+
)`
|
|
52
|
+
ccFilter += `AND (
|
|
53
|
+
Lower(od.name) LIKE ANY(ARRAY[${orderValue}])
|
|
54
|
+
)`
|
|
55
|
+
}
|
|
56
|
+
if (orderDate) {
|
|
57
|
+
queryFilter += ` AND od.created_at between '${orderDate.value}'::timestamp and '${orderDate.value}'::timestamp + INTERVAL '1 day'`
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (palletId) {
|
|
61
|
+
queryFilter += ` AND lower(i.pallet_id) like '%${palletId.value.toLowerCase()}%'`
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (cartonId) {
|
|
65
|
+
queryFilter += ` AND lower(i.carton_id) like '%${cartonId.value.toLowerCase()}%'`
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (bizplace) {
|
|
69
|
+
queryFilter += ` AND od.bizplace_id = '${bizplace.value}'`
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const bizplaceObj: Bizplace = await tx.getRepository(Bizplace).findOneBy({
|
|
73
|
+
id: bizplace.value
|
|
74
|
+
})
|
|
75
|
+
await rawProductsQuery(tx, params, bizplaceObj)
|
|
76
|
+
|
|
77
|
+
// let productQuery = ''
|
|
78
|
+
// if (product) {
|
|
79
|
+
// let productValue = product.value
|
|
80
|
+
// .toLowerCase()
|
|
81
|
+
// .split(',')
|
|
82
|
+
// .map(prod => {
|
|
83
|
+
// return "'%" + prod.trim().replace(/'/g, "''") + "%'"
|
|
84
|
+
// })
|
|
85
|
+
// .join(',')
|
|
86
|
+
// queryFilter = `AND (
|
|
87
|
+
// Lower(p.name) LIKE ANY(ARRAY[${productValue}])
|
|
88
|
+
// OR Lower(p.sku) LIKE ANY(ARRAY[${productValue}])
|
|
89
|
+
// OR Lower(p.description) LIKE ANY(ARRAY[${productValue}])
|
|
90
|
+
// OR Lower(p.brand_sku) LIKE ANY(ARRAY[${productValue}])
|
|
91
|
+
// OR Lower(p.brand) LIKE ANY(ARRAY[${productValue}])
|
|
92
|
+
// )`
|
|
93
|
+
// }
|
|
94
|
+
|
|
95
|
+
await tx.query(
|
|
96
|
+
`
|
|
97
|
+
create temp table data_src on commit drop as (
|
|
98
|
+
select * from (
|
|
99
|
+
select p.sku as product_sku, p.name as product_name, p.description as product_description, p.brand as product_brand,
|
|
100
|
+
b.id as bizplace_id, b.name as bizplace_name, b.description as bizplace_description, i.packing_type,
|
|
101
|
+
oi.release_qty as assigned_qty, oi.release_uom_value as uom_value, i.uom,
|
|
102
|
+
od.name as order_no, od.type::varchar as "type", od.status, od.created_at as order_at, od.release_date,
|
|
103
|
+
i.pallet_id, i.carton_id, i.batch_id, i.batch_id_ref, i.expiration_date, i.manufacture_date, l.name as location_name
|
|
104
|
+
from (
|
|
105
|
+
select inventory_id, release_good_id, sum(release_qty) as release_qty, sum(release_uom_value) as release_uom_value from order_inventories oi
|
|
106
|
+
inner join release_goods od on od.id = oi.release_good_id
|
|
107
|
+
where release_good_id is not null
|
|
108
|
+
and od.status in ('PENDING', 'PENDING_RECEIVE', 'PENDING_CANCEL', 'PENDING_WORKSHEET', 'READY_TO_PICK', 'PICKING')
|
|
109
|
+
and od.domain_id = $1
|
|
110
|
+
and oi.status != 'REPLACED'
|
|
111
|
+
group by inventory_id, release_good_id
|
|
112
|
+
) oi
|
|
113
|
+
inner join release_goods od on od.id = oi.release_good_id
|
|
114
|
+
inner join bizplaces b on b.id = od.bizplace_id
|
|
115
|
+
inner join inventories i on i.id = oi.inventory_id
|
|
116
|
+
inner join locations l on l.id = i.location_id
|
|
117
|
+
inner join temp_products p on p.id = i.product_id
|
|
118
|
+
where 1 = 1
|
|
119
|
+
${roFilter}
|
|
120
|
+
${queryFilter}
|
|
121
|
+
union all
|
|
122
|
+
select p.sku as product_sku, p.name as product_name, p.description as product_description, p.brand as product_brand,
|
|
123
|
+
b.id as bizplace_id, b.name as bizplace_name, b.description as bizplace_description, i.packing_type,
|
|
124
|
+
oi.release_qty as assigned_qty, oi.release_uom_value as uom_value, i.uom,
|
|
125
|
+
od.name as order_no, 'cc' as "type", od.status, od.created_at as order_at, od.execution_date,
|
|
126
|
+
i.pallet_id, i.carton_id, i.batch_id, i.batch_id_ref, i.expiration_date, i.manufacture_date, l.name as location_name
|
|
127
|
+
from order_inventories oi
|
|
128
|
+
inner join bizplaces b on b.id = oi.bizplace_id
|
|
129
|
+
inner join inventory_checks od on od.id = oi.inventory_check_id
|
|
130
|
+
inner join inventories i on i.id = oi.inventory_id
|
|
131
|
+
inner join locations l on l.id = i.location_id
|
|
132
|
+
inner join temp_products p on p.id = i.product_id
|
|
133
|
+
where od.status <> 'DONE'
|
|
134
|
+
and od.domain_id = $1
|
|
135
|
+
${ccFilter}
|
|
136
|
+
${queryFilter}
|
|
137
|
+
) src
|
|
138
|
+
order by product_sku, packing_type, order_no
|
|
139
|
+
);
|
|
140
|
+
`,
|
|
141
|
+
[context.state.domain.id]
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
const total: any = await tx.query(`
|
|
145
|
+
select count(*) from data_src
|
|
146
|
+
`)
|
|
147
|
+
|
|
148
|
+
const result: any = await tx.query(
|
|
149
|
+
`
|
|
150
|
+
select * from data_src
|
|
151
|
+
offset $1 limit $2
|
|
152
|
+
`,
|
|
153
|
+
[(params.pagination.page - 1) * params.pagination.limit, params.pagination.limit]
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
let items = result.map(itm => {
|
|
157
|
+
let data = {
|
|
158
|
+
bizplace: {
|
|
159
|
+
id: itm.bizplace_id,
|
|
160
|
+
name: itm.bizplace_name,
|
|
161
|
+
description: itm.bizplace_description
|
|
162
|
+
},
|
|
163
|
+
product: {
|
|
164
|
+
id: itm.product_id,
|
|
165
|
+
sku: itm.product_sku,
|
|
166
|
+
name: itm.product_name,
|
|
167
|
+
description: itm.product_description,
|
|
168
|
+
brand: itm.product_brand
|
|
169
|
+
},
|
|
170
|
+
location: {
|
|
171
|
+
name: itm.location_name
|
|
172
|
+
},
|
|
173
|
+
packingType: itm.packing_type,
|
|
174
|
+
assignedQty: itm.assigned_qty,
|
|
175
|
+
assignedUomValue: itm.uom_value,
|
|
176
|
+
assignedUom: itm.uom,
|
|
177
|
+
orderNo: itm.order_no,
|
|
178
|
+
type: itm.type,
|
|
179
|
+
status: itm.status,
|
|
180
|
+
orderAt: itm.order_at,
|
|
181
|
+
releaseDate: itm.release_date,
|
|
182
|
+
palletId: itm.pallet_id,
|
|
183
|
+
cartonId: itm.carton_id,
|
|
184
|
+
batchId: itm.batch_id,
|
|
185
|
+
batchIdRef: itm.batch_id_ref,
|
|
186
|
+
expirationDate: itm.expiration_date,
|
|
187
|
+
manufactureDate: itm.manufacture_date
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return data
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
return {
|
|
194
|
+
items,
|
|
195
|
+
total: total[0].count
|
|
196
|
+
}
|
|
197
|
+
} catch (error) {
|
|
198
|
+
throw error
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { getRepository } from 'typeorm'
|
|
2
1
|
import { ReleaseGood } from '@things-factory/sales-base'
|
|
3
|
-
|
|
4
|
-
import { Domain, ListParam } from '@things-factory/shell'
|
|
2
|
+
import { getRepository, ListParam } from '@things-factory/shell'
|
|
5
3
|
|
|
6
4
|
export const shippingProviders = {
|
|
7
|
-
async shippingProviders(_: any, params: ListParam, context:
|
|
5
|
+
async shippingProviders(_: any, params: ListParam, context: ResolverContext) {
|
|
8
6
|
try {
|
|
9
|
-
const { domain }
|
|
7
|
+
const { domain } = context.state
|
|
10
8
|
|
|
11
9
|
const items: any[] = await getRepository(ReleaseGood).query(`
|
|
12
10
|
SELECT DISTINCT transporter FROM release_goods WHERE domain_id = '${domain.id}' AND transporter IS NOT null AND transporter != '' AND type = 'b2c'
|
package/server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { EntityManager } from 'typeorm'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { EntityManager, In, Repository } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
import { OrderInventory } from '@things-factory/sales-base'
|
|
4
|
+
import { approveInventoryChanges, InventoryChange } from '@things-factory/warehouse-base'
|
|
5
|
+
import { Worksheet, WorksheetDetail } from '@things-factory/worksheet-base'
|
|
6
6
|
|
|
7
7
|
export const warehouseInventoryAdjustment = {
|
|
8
|
-
async warehouseInventoryAdjustment(_: any, { patches }, context:
|
|
8
|
+
async warehouseInventoryAdjustment(_: any, { patches }, context: ResolverContext) {
|
|
9
9
|
try {
|
|
10
10
|
const item = await approveInventoryChanges(patches, context)
|
|
11
11
|
|
|
12
12
|
// Retrieve order inventory
|
|
13
|
-
const { tx }
|
|
13
|
+
const { tx } = context.state
|
|
14
14
|
|
|
15
15
|
const _inventoryChanges = await tx.getRepository(InventoryChange).find({
|
|
16
16
|
where: { id: In(patches.map(item => item.id)) },
|
|
@@ -44,7 +44,7 @@ export const warehouseInventoryAdjustment = {
|
|
|
44
44
|
where: { inventory: In(invId), status: 'PICKING' }
|
|
45
45
|
})
|
|
46
46
|
|
|
47
|
-
await tx.getRepository(OrderInventory).update(
|
|
47
|
+
await (tx.getRepository(OrderInventory) as Repository<OrderInventory>).update(
|
|
48
48
|
{
|
|
49
49
|
inventory: In(invId),
|
|
50
50
|
status: 'PICKING'
|
|
@@ -55,7 +55,7 @@ export const warehouseInventoryAdjustment = {
|
|
|
55
55
|
const orderInvId: any[] = orderInventory.map((oi: any) => oi.id)
|
|
56
56
|
const releaseGoodId: any[] = orderInventory.map((roId: any) => roId.releaseGoodId)
|
|
57
57
|
|
|
58
|
-
await tx.getRepository(WorksheetDetail).update(
|
|
58
|
+
await (tx.getRepository(WorksheetDetail) as Repository<WorksheetDetail>).update(
|
|
59
59
|
{
|
|
60
60
|
targetInventory: In(orderInvId),
|
|
61
61
|
status: 'EXECUTING'
|
|
@@ -63,7 +63,7 @@ export const warehouseInventoryAdjustment = {
|
|
|
63
63
|
{ status: 'MISSING' }
|
|
64
64
|
)
|
|
65
65
|
|
|
66
|
-
await tx.getRepository(Worksheet).update(
|
|
66
|
+
await (tx.getRepository(Worksheet) as Repository<Worksheet>).update(
|
|
67
67
|
{
|
|
68
68
|
releaseGood: In(releaseGoodId),
|
|
69
69
|
status: 'EXECUTING'
|
|
@@ -9,5 +9,6 @@ export const Query = /* GraphQL */ `
|
|
|
9
9
|
releaseGoodsByStatus(filters: [Filter]): [OrderStatusCounter] @transaction
|
|
10
10
|
outboundOrderByStatus(filters: [Filter]): [OrderStatusCounter] @transaction
|
|
11
11
|
inventoryExpiryMonitor(filters: [Filter]): InventoryExpiryStatus @transaction
|
|
12
|
+
unitInboundedOutbounded(filters: [Filter]): [OrderStatusCounter] @transaction
|
|
12
13
|
`
|
|
13
14
|
export const Types = [InventoryExpiryCounter, InventoryExpiryStatus, OrderStatusCounter]
|
|
@@ -2,12 +2,13 @@ import * as BoardSetting from './board-setting'
|
|
|
2
2
|
import * as CustomElccl from './custom/elccl'
|
|
3
3
|
import * as CustomKimeda from './custom/kimeda'
|
|
4
4
|
import * as Dashboard from './dashboard'
|
|
5
|
-
import * as
|
|
5
|
+
import * as Other from './other'
|
|
6
6
|
import * as OpaMenu from './opa-menu'
|
|
7
7
|
import * as Reports from './reports'
|
|
8
8
|
import * as InventoryComparison from './inventory-comparison'
|
|
9
9
|
import * as ShippingProvider from './shipping-provider'
|
|
10
10
|
import * as WarehouseInventory from './warehouse-inventory-adjustment'
|
|
11
|
+
|
|
11
12
|
export const queries = [
|
|
12
13
|
BoardSetting.Query,
|
|
13
14
|
CustomElccl.Query,
|
|
@@ -17,9 +18,13 @@ export const queries = [
|
|
|
17
18
|
Reports.Query,
|
|
18
19
|
InventoryComparison.Query,
|
|
19
20
|
ShippingProvider.Query,
|
|
21
|
+
Other.Query
|
|
20
22
|
]
|
|
21
23
|
|
|
22
|
-
export const mutations = [
|
|
24
|
+
export const mutations = [
|
|
25
|
+
Other.Mutation,
|
|
26
|
+
WarehouseInventory.Mutation
|
|
27
|
+
]
|
|
23
28
|
|
|
24
29
|
export const types = [
|
|
25
30
|
...BoardSetting.Types,
|
|
@@ -29,4 +34,5 @@ export const types = [
|
|
|
29
34
|
...Reports.Types,
|
|
30
35
|
...InventoryComparison.Types,
|
|
31
36
|
...ShippingProvider.Types,
|
|
37
|
+
...Other.Types
|
|
32
38
|
]
|