@things-factory/sales-base 4.3.0-alpha.0 → 4.3.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/dist-server/constants/attachment-type.js +2 -1
- package/dist-server/constants/attachment-type.js.map +1 -1
- package/dist-server/constants/index.js +2 -5
- package/dist-server/constants/index.js.map +1 -1
- package/dist-server/constants/order.js +12 -3
- package/dist-server/constants/order.js.map +1 -1
- package/dist-server/constants/release-good.js +9 -0
- package/dist-server/constants/release-good.js.map +1 -0
- package/dist-server/controllers/ecommerce/index.js +1 -5
- package/dist-server/controllers/ecommerce/index.js.map +1 -1
- package/dist-server/controllers/index.js +1 -5
- package/dist-server/controllers/index.js.map +1 -1
- package/dist-server/errors/index.js +1 -5
- package/dist-server/errors/index.js.map +1 -1
- package/dist-server/errors/validation-error.js +1 -5
- package/dist-server/errors/validation-error.js.map +1 -1
- package/dist-server/index.js +1 -5
- package/dist-server/index.js.map +1 -1
- package/dist-server/service/arrival-notice/index.js +1 -5
- package/dist-server/service/arrival-notice/index.js.map +1 -1
- package/dist-server/service/claim/index.js +1 -5
- package/dist-server/service/claim/index.js.map +1 -1
- package/dist-server/service/claim-detail/index.js +1 -5
- package/dist-server/service/claim-detail/index.js.map +1 -1
- package/dist-server/service/claim-order/index.js +1 -5
- package/dist-server/service/claim-order/index.js.map +1 -1
- package/dist-server/service/collection-order/index.js +1 -5
- package/dist-server/service/collection-order/index.js.map +1 -1
- package/dist-server/service/delivery-order/index.js +1 -5
- package/dist-server/service/delivery-order/index.js.map +1 -1
- package/dist-server/service/draft-release-good/draft-release-good-mutation.js +501 -0
- package/dist-server/service/draft-release-good/draft-release-good-mutation.js.map +1 -0
- package/dist-server/service/draft-release-good/draft-release-good-query.js +289 -0
- package/dist-server/service/draft-release-good/draft-release-good-query.js.map +1 -0
- package/dist-server/service/draft-release-good/draft-release-good-type.js +364 -0
- package/dist-server/service/draft-release-good/draft-release-good-type.js.map +1 -0
- package/dist-server/service/draft-release-good/draft-release-good.js +321 -0
- package/dist-server/service/draft-release-good/draft-release-good.js.map +1 -0
- package/dist-server/service/draft-release-good/index.js +21 -0
- package/dist-server/service/draft-release-good/index.js.map +1 -0
- package/dist-server/service/goods-receival-note/index.js +1 -5
- package/dist-server/service/goods-receival-note/index.js.map +1 -1
- package/dist-server/service/index.js +48 -24
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/inventory-check/index.js +1 -5
- package/dist-server/service/inventory-check/index.js.map +1 -1
- package/dist-server/service/invoice/index.js +1 -5
- package/dist-server/service/invoice/index.js.map +1 -1
- package/dist-server/service/invoice-product/index.js +1 -5
- package/dist-server/service/invoice-product/index.js.map +1 -1
- package/dist-server/service/job-sheet/index.js +1 -5
- package/dist-server/service/job-sheet/index.js.map +1 -1
- package/dist-server/service/order-inventory/index.js +1 -5
- package/dist-server/service/order-inventory/index.js.map +1 -1
- package/dist-server/service/order-inventory/order-inventory-query.js +38 -1
- package/dist-server/service/order-inventory/order-inventory-query.js.map +1 -1
- package/dist-server/service/order-inventory/order-inventory-types.js +9 -1
- package/dist-server/service/order-inventory/order-inventory-types.js.map +1 -1
- package/dist-server/service/order-inventory/order-inventory.js +5 -1
- package/dist-server/service/order-inventory/order-inventory.js.map +1 -1
- package/dist-server/service/order-product/index.js +1 -5
- package/dist-server/service/order-product/index.js.map +1 -1
- package/dist-server/service/order-product/order-product-types.js +13 -13
- package/dist-server/service/order-product/order-product-types.js.map +1 -1
- package/dist-server/service/order-product/order-product.js +39 -4
- package/dist-server/service/order-product/order-product.js.map +1 -1
- package/dist-server/service/order-tote/index.js +21 -0
- package/dist-server/service/order-tote/index.js.map +1 -0
- package/dist-server/service/order-tote/order-tote-mutation.js +56 -0
- package/dist-server/service/order-tote/order-tote-mutation.js.map +1 -0
- package/dist-server/service/order-tote/order-tote-query.js +123 -0
- package/dist-server/service/order-tote/order-tote-query.js.map +1 -0
- package/dist-server/service/order-tote/order-tote-types.js +79 -0
- package/dist-server/service/order-tote/order-tote-types.js.map +1 -0
- package/dist-server/service/order-tote/order-tote.js +91 -0
- package/dist-server/service/order-tote/order-tote.js.map +1 -0
- package/dist-server/service/order-tote-item/index.js +21 -0
- package/dist-server/service/order-tote-item/index.js.map +1 -0
- package/dist-server/service/order-tote-item/order-tote-item-mutation.js +56 -0
- package/dist-server/service/order-tote-item/order-tote-item-mutation.js.map +1 -0
- package/dist-server/service/order-tote-item/order-tote-item-query.js +100 -0
- package/dist-server/service/order-tote-item/order-tote-item-query.js.map +1 -0
- package/dist-server/service/order-tote-item/order-tote-item-types.js +91 -0
- package/dist-server/service/order-tote-item/order-tote-item-types.js.map +1 -0
- package/dist-server/service/order-tote-item/order-tote-item.js +104 -0
- package/dist-server/service/order-tote-item/order-tote-item.js.map +1 -0
- package/dist-server/service/order-tote-seal/index.js +21 -0
- package/dist-server/service/order-tote-seal/index.js.map +1 -0
- package/dist-server/service/order-tote-seal/order-tote-seal-mutation.js +56 -0
- package/dist-server/service/order-tote-seal/order-tote-seal-mutation.js.map +1 -0
- package/dist-server/service/order-tote-seal/order-tote-seal-query.js +97 -0
- package/dist-server/service/order-tote-seal/order-tote-seal-query.js.map +1 -0
- package/dist-server/service/order-tote-seal/order-tote-seal-types.js +71 -0
- package/dist-server/service/order-tote-seal/order-tote-seal-types.js.map +1 -0
- package/dist-server/service/order-tote-seal/order-tote-seal.js +71 -0
- package/dist-server/service/order-tote-seal/order-tote-seal.js.map +1 -0
- package/dist-server/service/order-vas/index.js +1 -5
- package/dist-server/service/order-vas/index.js.map +1 -1
- package/dist-server/service/others/index.js +1 -5
- package/dist-server/service/others/index.js.map +1 -1
- package/dist-server/service/others/other-query.js +37 -2
- package/dist-server/service/others/other-query.js.map +1 -1
- package/dist-server/service/purchase-order/index.js +1 -5
- package/dist-server/service/purchase-order/index.js.map +1 -1
- package/dist-server/service/purchase-order-other-charge/index.js +1 -5
- package/dist-server/service/purchase-order-other-charge/index.js.map +1 -1
- package/dist-server/service/release-good/index.js +1 -5
- package/dist-server/service/release-good/index.js.map +1 -1
- package/dist-server/service/release-good/release-good-mutation.js +23 -1
- package/dist-server/service/release-good/release-good-mutation.js.map +1 -1
- package/dist-server/service/release-good/release-good-query.js +28 -2
- package/dist-server/service/release-good/release-good-query.js.map +1 -1
- package/dist-server/service/release-good/release-good.js +32 -12
- package/dist-server/service/release-good/release-good.js.map +1 -1
- package/dist-server/service/retail-replenishment-order/index.js +1 -5
- package/dist-server/service/retail-replenishment-order/index.js.map +1 -1
- package/dist-server/service/return-order/index.js +1 -5
- package/dist-server/service/return-order/index.js.map +1 -1
- package/dist-server/service/reverse-kitting-order/index.js +1 -5
- package/dist-server/service/reverse-kitting-order/index.js.map +1 -1
- package/dist-server/service/reverse-kitting-order-inventory/index.js +1 -5
- package/dist-server/service/reverse-kitting-order-inventory/index.js.map +1 -1
- package/dist-server/service/shipping-order/index.js +1 -5
- package/dist-server/service/shipping-order/index.js.map +1 -1
- package/dist-server/service/transfer-order/index.js +1 -5
- package/dist-server/service/transfer-order/index.js.map +1 -1
- package/dist-server/service/vas/index.js +1 -5
- package/dist-server/service/vas/index.js.map +1 -1
- package/dist-server/service/vas-order/index.js +1 -5
- package/dist-server/service/vas-order/index.js.map +1 -1
- package/dist-server/utils/index.js +1 -5
- package/dist-server/utils/index.js.map +1 -1
- package/dist-server/utils/inventory-util.js +258 -99
- package/dist-server/utils/inventory-util.js.map +1 -1
- package/dist-server/utils/order-no-generator.js +7 -0
- package/dist-server/utils/order-no-generator.js.map +1 -1
- package/package.json +13 -13
- package/server/constants/attachment-type.ts +2 -1
- package/server/constants/index.ts +1 -0
- package/server/constants/order.ts +12 -2
- package/server/constants/release-good.ts +6 -0
- package/server/service/draft-release-good/draft-release-good-mutation.ts +671 -0
- package/server/service/draft-release-good/draft-release-good-query.ts +314 -0
- package/server/service/draft-release-good/draft-release-good-type.ts +261 -0
- package/server/service/draft-release-good/draft-release-good.ts +270 -0
- package/server/service/draft-release-good/index.ts +9 -0
- package/server/service/index.ts +51 -21
- package/server/service/order-inventory/order-inventory-query.ts +40 -2
- package/server/service/order-inventory/order-inventory-types.ts +6 -0
- package/server/service/order-inventory/order-inventory.ts +5 -5
- package/server/service/order-product/order-product-types.ts +5 -3
- package/server/service/order-product/order-product.ts +30 -3
- package/server/service/order-tote/index.ts +9 -0
- package/server/service/order-tote/order-tote-mutation.ts +30 -0
- package/server/service/order-tote/order-tote-query.ts +114 -0
- package/server/service/order-tote/order-tote-types.ts +47 -0
- package/server/service/order-tote/order-tote.ts +62 -0
- package/server/service/order-tote-item/index.ts +9 -0
- package/server/service/order-tote-item/order-tote-item-mutation.ts +30 -0
- package/server/service/order-tote-item/order-tote-item-query.ts +88 -0
- package/server/service/order-tote-item/order-tote-item-types.ts +56 -0
- package/server/service/order-tote-item/order-tote-item.ts +72 -0
- package/server/service/order-tote-seal/index.ts +9 -0
- package/server/service/order-tote-seal/order-tote-seal-mutation.ts +30 -0
- package/server/service/order-tote-seal/order-tote-seal-query.ts +60 -0
- package/server/service/order-tote-seal/order-tote-seal-types.ts +41 -0
- package/server/service/order-tote-seal/order-tote-seal.ts +46 -0
- package/server/service/others/other-query.ts +43 -8
- package/server/service/release-good/release-good-mutation.ts +24 -2
- package/server/service/release-good/release-good-query.ts +57 -30
- package/server/service/release-good/release-good.ts +28 -9
- package/server/utils/inventory-util.ts +287 -106
- package/server/utils/order-no-generator.ts +42 -48
|
@@ -46,113 +46,271 @@ export const InventoryUtil = {
|
|
|
46
46
|
* @param {Object} trxMgr
|
|
47
47
|
* @returns { object } {items, total}
|
|
48
48
|
*/
|
|
49
|
-
async
|
|
49
|
+
async bizplaceProductInventory(bizplaces: Bizplace[], params: ListParam, context: any, trxMgr: EntityManager) {
|
|
50
50
|
try {
|
|
51
51
|
let filters = params.filters
|
|
52
|
+
|
|
52
53
|
const { domain }: { domain: Domain } = context.state
|
|
53
54
|
|
|
54
|
-
const { bizplaceIds, productWhereClause, bundleWhereClause, whereClause, batchBundle } = await getConditions(
|
|
55
|
+
const { bizplaceIds, productWhereClause, bundleWhereClause, whereClause, batchBundle, productDetailWhereClause } = await getConditions(
|
|
55
56
|
bizplaces,
|
|
56
57
|
filters,
|
|
57
|
-
trxMgr
|
|
58
|
+
trxMgr,
|
|
59
|
+
false
|
|
58
60
|
)
|
|
59
61
|
|
|
62
|
+
let productFilter = filters.find(itm => itm.name == 'productName')
|
|
63
|
+
|
|
60
64
|
let queryStrings = `
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
CREATE TEMP TABLE temp_inventory_product_group ON COMMIT DROP AS (
|
|
66
|
+
SELECT * FROM (
|
|
67
|
+
WITH oi as (
|
|
68
|
+
SELECT
|
|
69
|
+
SUM(oi.release_qty) AS release_qty,
|
|
70
|
+
SUM(oi.release_uom_value) AS release_uom_value,
|
|
71
|
+
oi.batch_id,
|
|
72
|
+
oi.batch_id_ref,
|
|
73
|
+
oi.product_id,
|
|
74
|
+
p.name AS product_name,
|
|
75
|
+
oi.packing_type,
|
|
76
|
+
oi.packing_size,
|
|
77
|
+
oi.uom
|
|
78
|
+
FROM
|
|
79
|
+
order_inventories oi
|
|
80
|
+
LEFT JOIN
|
|
81
|
+
products p
|
|
82
|
+
ON
|
|
83
|
+
oi.product_id = p.id
|
|
84
|
+
WHERE
|
|
85
|
+
(oi.status = 'PENDING' or oi.status = 'PENDING_RECEIVE' or oi.status = 'PENDING_WORKSHEET' or oi.status = 'PENDING_SPLIT')
|
|
86
|
+
AND oi.batch_id NOTNULL
|
|
87
|
+
AND oi.product_id NOTNULL
|
|
88
|
+
AND oi.packing_type NOTNULL
|
|
89
|
+
AND oi.packing_size NOTNULL
|
|
90
|
+
AND oi.inventory_id IS NULL
|
|
91
|
+
GROUP BY
|
|
92
|
+
oi.batch_id,
|
|
93
|
+
oi.batch_id_ref,
|
|
94
|
+
oi.product_id,
|
|
95
|
+
oi.packing_type,
|
|
96
|
+
oi.packing_size,
|
|
97
|
+
oi.uom,
|
|
98
|
+
p.name
|
|
99
|
+
)
|
|
64
100
|
SELECT
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
p.
|
|
71
|
-
|
|
72
|
-
oi.
|
|
73
|
-
oi.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
ON
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
(oi.status = 'PENDING' or oi.status = 'PENDING_RECEIVE' or oi.status = 'PENDING_WORKSHEET' or oi.status = 'PENDING_SPLIT')
|
|
82
|
-
AND oi.batch_id NOTNULL
|
|
83
|
-
AND oi.product_id NOTNULL
|
|
84
|
-
AND oi.packing_type NOTNULL
|
|
85
|
-
AND oi.packing_size NOTNULL
|
|
86
|
-
AND oi.inventory_id IS NULL
|
|
87
|
-
GROUP BY
|
|
88
|
-
oi.batch_id,
|
|
89
|
-
oi.batch_id_ref,
|
|
90
|
-
oi.product_id,
|
|
91
|
-
oi.packing_type,
|
|
92
|
-
oi.packing_size,
|
|
93
|
-
oi.uom,
|
|
94
|
-
p.name
|
|
95
|
-
)
|
|
96
|
-
SELECT
|
|
97
|
-
i.batch_id AS "batchId",
|
|
98
|
-
i.batch_id_ref AS "batchIdRef",
|
|
99
|
-
i.packing_type AS "packingType",
|
|
100
|
-
i.packing_size AS "packingSize",
|
|
101
|
-
i.uom AS "uom",
|
|
102
|
-
concat(p.name, ' (', p.description, ')') AS "productName",
|
|
103
|
-
coalesce(p.sku, '') AS "productSKU",
|
|
104
|
-
coalesce(p.brand, '') AS "productBrand",
|
|
105
|
-
p.id AS "productId",
|
|
106
|
-
SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0)) - MAX(COALESCE(bp.bundle_product_release_qty, 0)) AS "remainQty",
|
|
107
|
-
SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)) AS "remainUomValue",
|
|
108
|
-
concat(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)), ' ', i.uom) AS "remainUomValueWithUom",
|
|
109
|
-
'SINGLE' AS "groupType"
|
|
110
|
-
FROM
|
|
111
|
-
inventories i
|
|
112
|
-
LEFT JOIN products p ON i.product_id = p.id
|
|
101
|
+
pd.packing_type AS "packingType",
|
|
102
|
+
pd.packing_size AS "packingSize",
|
|
103
|
+
pd.uom AS "uom",
|
|
104
|
+
concat(p.name, ' (', p.description, ')') AS "productName",
|
|
105
|
+
coalesce(p.sku, '') AS "productSKU",
|
|
106
|
+
coalesce(p.brand, '') AS "productBrand",
|
|
107
|
+
p.id AS "productId",
|
|
108
|
+
COALESCE(SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0)) - MAX(COALESCE(bp.bundle_product_release_qty, 0)),0) AS "remainQty",
|
|
109
|
+
COALESCE(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)),0) AS "remainUomValue",
|
|
110
|
+
concat(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)), ' ', pd.uom) AS "remainUomValueWithUom",
|
|
111
|
+
'SINGLE' AS "groupType"
|
|
112
|
+
FROM products p
|
|
113
|
+
INNER join product_details pd on pd.product_id = p.id
|
|
114
|
+
LEFT JOIN inventories i ON i.product_id = p.id and i.domain_id = $1 and i.status = 'STORED'
|
|
115
|
+
INNER JOIN locations l2 ON i.location_id = l2.id AND i.domain_id = l2.domain_id AND l2.type NOT IN ('${LOCATION_TYPE.QUARANTINE}', '${LOCATION_TYPE.RESERVE}')
|
|
116
|
+
and i.packing_type = pd.packing_type and i.packing_size = pd.packing_size and i.uom = pd.uom
|
|
113
117
|
LEFT JOIN oi ON i.batch_id = oi.batch_id AND p.name = oi.product_name AND i.packing_type = oi.packing_type AND i.packing_size = oi.packing_size AND i.uom = oi.uom
|
|
114
|
-
LEFT JOIN locations l2 ON i.location_id = l2.id AND i.domain_id = l2.domain_id
|
|
115
118
|
LEFT JOIN (
|
|
116
119
|
SELECT pbs.product_id, SUM(pbs.bundle_qty * src.release_qty) AS bundle_product_release_qty, SUM(pbs.bundle_qty * src.release_uom_value) AS bundle_product_release_uom_value
|
|
117
120
|
FROM product_bundle_settings pbs
|
|
118
|
-
INNER JOIN json_populate_recordset(NULL::order_inventories,'${batchBundle}') src ON src.product_id = pbs.product_bundle_id
|
|
121
|
+
INNER JOIN json_populate_recordset(NULL::order_inventories, '${batchBundle}') src ON src.product_id = pbs.product_bundle_id
|
|
119
122
|
GROUP BY pbs.product_id
|
|
120
123
|
) bp on i.product_id = bp.product_id
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
124
|
+
WHERE p.bizplace_id IN (${bizplaceIds})
|
|
125
|
+
${productDetailWhereClause}
|
|
126
|
+
${productFilter ? `AND (
|
|
127
|
+
lower(p.sku) ilike '${productFilter.value}'
|
|
128
|
+
OR lower(p.name) ilike '${productFilter.value}'
|
|
129
|
+
OR lower(p.description) ilike '${productFilter.value}'
|
|
130
|
+
)
|
|
131
|
+
` : ``}
|
|
132
|
+
GROUP BY
|
|
133
|
+
p.id,
|
|
134
|
+
pd.packing_type,
|
|
135
|
+
pd.packing_size,
|
|
136
|
+
pd.uom
|
|
137
|
+
UNION
|
|
138
|
+
SELECT packing_type, packing_size,'UNIT' AS "uom", name AS "productName", sku AS "productSKU", '-' AS "productBrand", id AS "productId",
|
|
139
|
+
COALESCE(MIN(FLOOR(pbs."availableQty")),0) AS "remainQty",
|
|
140
|
+
COALESCE(MIN(FLOOR(pbs."availableUomValue")),0) AS "remainUomValue",
|
|
141
|
+
CONCAT(COALESCE(MIN(FLOOR(pbs."availableUomValue")),0),' UNIT') AS "remainUomValueWithUom",
|
|
142
|
+
'BUNDLE' AS "groupType"
|
|
143
|
+
FROM product_bundles pb
|
|
144
|
+
LEFT JOIN (
|
|
145
|
+
SELECT pbs.product_id, pbs.product_bundle_id, min(pbs.bundle_qty),
|
|
146
|
+
(SUM(COALESCE(i2.qty, 0)) - SUM(COALESCE(i2.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0))) / min(pbs.bundle_qty) AS "availableQty",
|
|
147
|
+
(SUM(COALESCE(i2.uom_value, 0)) - SUM(COALESCE(i2.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0))) / min(pbs.bundle_qty) AS "availableUomValue"
|
|
148
|
+
FROM product_bundle_settings pbs
|
|
149
|
+
LEFT JOIN inventories i2 ON i2.product_id = pbs.product_id AND i2.domain_id = $1
|
|
150
|
+
INNER JOIN locations l2 ON i2.location_id = l2.id AND i2.domain_id = l2.domain_id AND l2.type NOT IN ('${LOCATION_TYPE.QUARANTINE}', '${LOCATION_TYPE.RESERVE}')
|
|
151
|
+
AND i2.bizplace_id IN (${bizplaceIds})
|
|
152
|
+
AND i2.status = 'STORED'
|
|
153
|
+
LEFT JOIN oi ON oi.product_id = i2.product_id
|
|
154
|
+
GROUP BY
|
|
155
|
+
pbs.product_id,
|
|
156
|
+
pbs.product_bundle_id
|
|
157
|
+
) pbs ON pbs.product_bundle_id = pb.id
|
|
158
|
+
${bundleWhereClause}
|
|
159
|
+
AND pb.bizplace_id IN (${bizplaceIds})
|
|
160
|
+
${productFilter ? `AND (
|
|
161
|
+
lower(pb.sku) ilike '${productFilter.value}'
|
|
162
|
+
OR lower(pb.name) ilike '${productFilter.value}'
|
|
163
|
+
OR lower(pb.description) ilike '${productFilter.value}'
|
|
164
|
+
)
|
|
165
|
+
` : ``}
|
|
166
|
+
GROUP BY
|
|
167
|
+
pb.packing_type,
|
|
168
|
+
pb.packing_size,
|
|
169
|
+
pb.name,
|
|
170
|
+
pb.sku,
|
|
171
|
+
pb.id
|
|
172
|
+
)
|
|
173
|
+
AS inv_prod_grp
|
|
174
|
+
${whereClause}
|
|
175
|
+
order by "productSKU", "productName"
|
|
151
176
|
)
|
|
152
|
-
|
|
153
|
-
|
|
177
|
+
`
|
|
178
|
+
|
|
179
|
+
await trxMgr.query(queryStrings, [domain.id])
|
|
180
|
+
|
|
181
|
+
const [{ total }]: any = await trxMgr.query(`select count(*) as total from temp_inventory_product_group`)
|
|
182
|
+
let items: any[] = []
|
|
183
|
+
|
|
184
|
+
if (params?.pagination) {
|
|
185
|
+
items = await trxMgr.query(`select * from temp_inventory_product_group OFFSET $1 LIMIT $2`, [
|
|
186
|
+
(params.pagination.page - 1) * params.pagination.limit,
|
|
187
|
+
params.pagination.limit
|
|
188
|
+
])
|
|
189
|
+
} else {
|
|
190
|
+
items = await trxMgr.query(`select * from temp_inventory_product_group`)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return { items, total }
|
|
194
|
+
} catch (error) {
|
|
195
|
+
throw error
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Get all available product belonging to list of bizplaces
|
|
201
|
+
* @param {[Object]} bizplaces
|
|
202
|
+
* @param {Object} params
|
|
203
|
+
* @param {Object} context
|
|
204
|
+
* @param {Object} trxMgr
|
|
205
|
+
* @returns { object } {items, total}
|
|
206
|
+
*/
|
|
207
|
+
async bizplaceInventoryProductGroup(bizplaces: Bizplace[], params: ListParam, context: any, trxMgr: EntityManager) {
|
|
208
|
+
try {
|
|
209
|
+
let filters = params.filters
|
|
210
|
+
const { domain }: { domain: Domain } = context.state
|
|
211
|
+
|
|
212
|
+
const { bizplaceIds, productWhereClause, bundleWhereClause, whereClause, batchBundle } = await getConditions(
|
|
213
|
+
bizplaces,
|
|
214
|
+
filters,
|
|
215
|
+
trxMgr
|
|
154
216
|
)
|
|
155
|
-
|
|
217
|
+
|
|
218
|
+
let queryStrings = `
|
|
219
|
+
CREATE TEMP TABLE temp_inventory_product_group AS (
|
|
220
|
+
SELECT * FROM (
|
|
221
|
+
WITH oi as (
|
|
222
|
+
SELECT
|
|
223
|
+
SUM(oi.release_qty) AS release_qty,
|
|
224
|
+
SUM(oi.release_uom_value) AS release_uom_value,
|
|
225
|
+
oi.batch_id,
|
|
226
|
+
oi.batch_id_ref,
|
|
227
|
+
oi.product_id,
|
|
228
|
+
p.name AS product_name,
|
|
229
|
+
oi.packing_type,
|
|
230
|
+
oi.packing_size,
|
|
231
|
+
oi.uom
|
|
232
|
+
FROM
|
|
233
|
+
order_inventories oi
|
|
234
|
+
LEFT JOIN
|
|
235
|
+
products p
|
|
236
|
+
ON
|
|
237
|
+
oi.product_id = p.id
|
|
238
|
+
WHERE
|
|
239
|
+
(oi.status = 'PENDING' or oi.status = 'PENDING_RECEIVE' or oi.status = 'PENDING_WORKSHEET' or oi.status = 'PENDING_SPLIT')
|
|
240
|
+
AND oi.batch_id NOTNULL
|
|
241
|
+
AND oi.product_id NOTNULL
|
|
242
|
+
AND oi.packing_type NOTNULL
|
|
243
|
+
AND oi.packing_size NOTNULL
|
|
244
|
+
AND oi.inventory_id IS NULL
|
|
245
|
+
GROUP BY
|
|
246
|
+
oi.batch_id,
|
|
247
|
+
oi.batch_id_ref,
|
|
248
|
+
oi.product_id,
|
|
249
|
+
oi.packing_type,
|
|
250
|
+
oi.packing_size,
|
|
251
|
+
oi.uom,
|
|
252
|
+
p.name
|
|
253
|
+
)
|
|
254
|
+
SELECT
|
|
255
|
+
i.batch_id AS "batchId",
|
|
256
|
+
i.batch_id_ref AS "batchIdRef",
|
|
257
|
+
i.packing_type AS "packingType",
|
|
258
|
+
i.packing_size AS "packingSize",
|
|
259
|
+
i.uom AS "uom",
|
|
260
|
+
concat(p.name, ' (', p.description, ')') AS "productName",
|
|
261
|
+
coalesce(p.sku, '') AS "productSKU",
|
|
262
|
+
coalesce(p.brand, '') AS "productBrand",
|
|
263
|
+
p.id AS "productId",
|
|
264
|
+
SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0)) - MAX(COALESCE(bp.bundle_product_release_qty, 0)) AS "remainQty",
|
|
265
|
+
SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)) AS "remainUomValue",
|
|
266
|
+
concat(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)), ' ', i.uom) AS "remainUomValueWithUom",
|
|
267
|
+
'SINGLE' AS "groupType"
|
|
268
|
+
FROM
|
|
269
|
+
inventories i
|
|
270
|
+
LEFT JOIN products p ON i.product_id = p.id
|
|
271
|
+
LEFT JOIN oi ON i.batch_id = oi.batch_id AND p.name = oi.product_name AND i.packing_type = oi.packing_type AND i.packing_size = oi.packing_size AND i.uom = oi.uom
|
|
272
|
+
LEFT JOIN locations l2 ON i.location_id = l2.id AND i.domain_id = l2.domain_id
|
|
273
|
+
LEFT JOIN (
|
|
274
|
+
SELECT pbs.product_id, SUM(pbs.bundle_qty * src.release_qty) AS bundle_product_release_qty, SUM(pbs.bundle_qty * src.release_uom_value) AS bundle_product_release_uom_value
|
|
275
|
+
FROM product_bundle_settings pbs
|
|
276
|
+
INNER JOIN json_populate_recordset(NULL::order_inventories,'${batchBundle}') src ON src.product_id = pbs.product_bundle_id
|
|
277
|
+
GROUP BY pbs.product_id
|
|
278
|
+
) bp on i.product_id = bp.product_id
|
|
279
|
+
WHERE i.domain_id = $1
|
|
280
|
+
AND l2.type NOT IN ('${LOCATION_TYPE.QUARANTINE}', '${LOCATION_TYPE.RESERVE}')
|
|
281
|
+
${productWhereClause}
|
|
282
|
+
GROUP BY
|
|
283
|
+
i.batch_id,
|
|
284
|
+
i.batch_id_ref,
|
|
285
|
+
p.id,
|
|
286
|
+
i.packing_type,
|
|
287
|
+
i.packing_size,
|
|
288
|
+
i.uom
|
|
289
|
+
UNION
|
|
290
|
+
SELECT 'BUNDLE' AS "batchId", null as "batchIdRef", packing_type, packing_size,'UNIT' AS "uom", name AS "productName", sku AS "productSKU", 'brand' AS "productBrand", id AS "productId",
|
|
291
|
+
MIN(FLOOR(pbs."availableQty")) AS "remainQty",
|
|
292
|
+
MIN(FLOOR(pbs."availableUomValue")) AS "remainUomValue",
|
|
293
|
+
CONCAT(MIN(FLOOR(pbs."availableUomValue")),' UNIT') AS "remainUomValueWithUom",
|
|
294
|
+
'BUNDLE' AS "groupType"
|
|
295
|
+
FROM product_bundles pb
|
|
296
|
+
INNER JOIN (
|
|
297
|
+
SELECT pbs.product_id, pbs.product_bundle_id, min(pbs.bundle_qty),
|
|
298
|
+
(SUM(COALESCE(i2.qty, 0)) - SUM(COALESCE(i2.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0))) / min(pbs.bundle_qty) AS "availableQty",
|
|
299
|
+
(SUM(COALESCE(i2.uom_value, 0)) - SUM(COALESCE(i2.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0))) / min(pbs.bundle_qty) AS "availableUomValue"
|
|
300
|
+
FROM product_bundle_settings pbs
|
|
301
|
+
LEFT JOIN inventories i2 ON i2.product_id = pbs.product_id AND i2.domain_id = $1
|
|
302
|
+
AND i2.bizplace_id IN (${bizplaceIds})
|
|
303
|
+
AND i2.status = 'STORED'
|
|
304
|
+
LEFT JOIN oi ON oi.product_id = i2.product_id
|
|
305
|
+
GROUP BY pbs.product_id, pbs.product_bundle_id
|
|
306
|
+
) pbs ON pbs.product_bundle_id = pb.id
|
|
307
|
+
${bundleWhereClause}
|
|
308
|
+
GROUP BY pb.packing_type, pb.packing_size, pb.name, pb.sku, pb.id
|
|
309
|
+
)
|
|
310
|
+
AS inv_prod_grp
|
|
311
|
+
${whereClause}
|
|
312
|
+
)
|
|
313
|
+
`
|
|
156
314
|
|
|
157
315
|
await trxMgr.query(queryStrings, [domain.id])
|
|
158
316
|
|
|
@@ -229,11 +387,10 @@ export const InventoryUtil = {
|
|
|
229
387
|
SUM(COALESCE(i.locked_qty, 0)) + MAX(COALESCE(oi.release_qty, 0)) AS "totalLockedQty",
|
|
230
388
|
SUM(COALESCE(i.locked_uom_value, 0)) + MAX(COALESCE(oi.release_uom_value, 0)) AS "totalLockedUomValue",
|
|
231
389
|
concat(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)), ' ', i.uom) AS "remainUomValueWithUom"
|
|
232
|
-
FROM
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
LEFT JOIN locations l2 ON i.location_id = l2.id AND i.domain_id = l2.domain_id
|
|
390
|
+
FROM inventories i
|
|
391
|
+
LEFT JOIN products p ON i.product_id = p.id
|
|
392
|
+
LEFT JOIN oi ON p.name = oi.product_name AND i.packing_type = oi.packing_type AND i.packing_size = oi.packing_size AND i.uom = oi.uom
|
|
393
|
+
LEFT JOIN locations l2 ON i.location_id = l2.id AND i.domain_id = l2.domain_id
|
|
237
394
|
WHERE i.domain_id = $1
|
|
238
395
|
AND l2.type NOT IN ('${LOCATION_TYPE.QUARANTINE}', '${LOCATION_TYPE.RESERVE}')
|
|
239
396
|
${apiWhereClause}
|
|
@@ -459,12 +616,14 @@ interface Conditions {
|
|
|
459
616
|
whereClause: string
|
|
460
617
|
batchBundle: string
|
|
461
618
|
apiWhereClause: string
|
|
619
|
+
productDetailWhereClause: string
|
|
462
620
|
}
|
|
463
621
|
|
|
464
622
|
async function getConditions(
|
|
465
623
|
bizplaces: Bizplace[],
|
|
466
624
|
filters: [{ name: string; operator: string; value: any }],
|
|
467
|
-
trxMgr: EntityManager
|
|
625
|
+
trxMgr: EntityManager,
|
|
626
|
+
hasRemainingQty: Boolean = true
|
|
468
627
|
): Promise<Conditions> {
|
|
469
628
|
let bizplaceIds = bizplaces.map((bizplace: Bizplace) => `'${bizplace.id}'`).join()
|
|
470
629
|
|
|
@@ -479,9 +638,9 @@ async function getConditions(
|
|
|
479
638
|
WHERE pb.status = 'ACTIVATED'
|
|
480
639
|
`
|
|
481
640
|
|
|
482
|
-
let whereClause = `
|
|
483
|
-
|
|
484
|
-
|
|
641
|
+
let whereClause = hasRemainingQty ? ` WHERE "remainQty" > 0` : ` WHERE 1 = 1`
|
|
642
|
+
|
|
643
|
+
let productDetailWhereClause = ``
|
|
485
644
|
|
|
486
645
|
let batchBundle: string
|
|
487
646
|
if (filters?.length) {
|
|
@@ -492,6 +651,16 @@ async function getConditions(
|
|
|
492
651
|
let value = filter.value
|
|
493
652
|
|
|
494
653
|
switch (name) {
|
|
654
|
+
case 'productId':
|
|
655
|
+
if (operator == 'in')
|
|
656
|
+
whereClause += `AND "productId" ${operator === 'in' ? 'IN' : 'NOT IN'} (${value.map(itm => { return `'${itm}'` }).join(',')})`
|
|
657
|
+
break
|
|
658
|
+
|
|
659
|
+
case 'productBundleId':
|
|
660
|
+
if (operator == 'in')
|
|
661
|
+
whereClause += `AND "productId" ${operator === 'in' ? 'IN' : 'NOT IN'} (${value.map(itm => { return `'${itm}'` }).join(',')})`
|
|
662
|
+
break
|
|
663
|
+
|
|
495
664
|
case 'batchId':
|
|
496
665
|
whereClause += `AND LOWER("batchId") LIKE '${value.toLowerCase()}'`
|
|
497
666
|
break
|
|
@@ -592,21 +761,33 @@ async function getConditions(
|
|
|
592
761
|
case 'batch_product':
|
|
593
762
|
productWhereClause += `
|
|
594
763
|
AND (i.batch_id, p.id, i.packing_type) ${operator === 'in' ? 'IN' : 'NOT IN'} (${value
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
764
|
+
.map(
|
|
765
|
+
(v: { batchId: string; productId: string; packingType: string }) =>
|
|
766
|
+
`('${v.batchId}', '${v.productId}', '${v.packingType}')`
|
|
767
|
+
)
|
|
768
|
+
.join()})
|
|
600
769
|
`
|
|
601
770
|
break
|
|
602
771
|
|
|
603
772
|
case 'batch_bundle':
|
|
604
773
|
bundleWhereClause += `
|
|
605
774
|
${bundleWhereClause == '' ? 'WHERE' : 'AND'} pb.id ${operator === 'in' ? 'IN' : 'NOT IN'} (${value
|
|
606
|
-
|
|
607
|
-
|
|
775
|
+
.map((v: { productId: string }) => `('${v.productId}')`)
|
|
776
|
+
.join()})
|
|
608
777
|
`
|
|
609
778
|
break
|
|
779
|
+
|
|
780
|
+
case 'product':
|
|
781
|
+
productDetailWhereClause += `
|
|
782
|
+
AND (pd.product_id, pd.packing_type, pd.packing_size, pd.uom) ${operator === 'in' ? 'IN' : 'NOT IN'} (${value
|
|
783
|
+
.map(
|
|
784
|
+
(v: { productId: string; packingType: string; packingSize: string, uom: string }) =>
|
|
785
|
+
`('${v.productId}', '${v.packingType}', '${v.packingSize}', '${v.uom}')`
|
|
786
|
+
)
|
|
787
|
+
.join()})
|
|
788
|
+
`
|
|
789
|
+
break
|
|
790
|
+
|
|
610
791
|
}
|
|
611
792
|
})
|
|
612
793
|
)
|
|
@@ -624,7 +805,7 @@ async function getConditions(
|
|
|
624
805
|
)
|
|
625
806
|
}
|
|
626
807
|
|
|
627
|
-
return { bizplaceIds, productWhereClause, apiWhereClause, bundleWhereClause, whereClause, batchBundle }
|
|
808
|
+
return { bizplaceIds, productWhereClause, apiWhereClause, bundleWhereClause, whereClause, batchBundle, productDetailWhereClause }
|
|
628
809
|
}
|
|
629
810
|
|
|
630
811
|
async function createInventory(
|
|
@@ -3,51 +3,44 @@ import uuid from 'uuid/v4'
|
|
|
3
3
|
export class OrderNoGenerator {
|
|
4
4
|
static arrivalNotice() {
|
|
5
5
|
const currentDate = new Date()
|
|
6
|
-
return `GAN-${currentDate.getFullYear()}${
|
|
7
|
-
currentDate.
|
|
8
|
-
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
6
|
+
return `GAN-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
7
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
static collectionOrder() {
|
|
12
11
|
const currentDate = new Date()
|
|
13
|
-
return `CO-${currentDate.getFullYear()}${
|
|
14
|
-
currentDate.
|
|
15
|
-
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
12
|
+
return `CO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
13
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
static cycleCount() {
|
|
19
17
|
const currentDate = new Date()
|
|
20
|
-
return `CC-${currentDate.getFullYear()}${
|
|
21
|
-
currentDate.
|
|
22
|
-
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
18
|
+
return `CC-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
19
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
static deliveryOrder() {
|
|
26
23
|
const currentDate = new Date()
|
|
27
|
-
return `DO-${currentDate.getFullYear()}${
|
|
28
|
-
currentDate.
|
|
29
|
-
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
24
|
+
return `DO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
25
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
static goodsReceiveNote() {
|
|
33
29
|
const currentDate = new Date()
|
|
34
|
-
return `GRN-${currentDate.getFullYear()}${
|
|
35
|
-
currentDate.
|
|
36
|
-
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
30
|
+
return `GRN-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
31
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
37
32
|
}
|
|
38
33
|
|
|
39
34
|
static jobSheet(domainName) {
|
|
40
35
|
const currentDate = new Date()
|
|
41
|
-
return `${domainName}-${currentDate.getFullYear()}${
|
|
42
|
-
currentDate.
|
|
43
|
-
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
36
|
+
return `${domainName}-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
37
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
44
38
|
}
|
|
45
39
|
|
|
46
40
|
static manifest() {
|
|
47
41
|
const currentDate = new Date()
|
|
48
|
-
return `LM-${currentDate.getFullYear()}${
|
|
49
|
-
currentDate.
|
|
50
|
-
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
42
|
+
return `LM-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
43
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
51
44
|
}
|
|
52
45
|
|
|
53
46
|
static orderInventory() {
|
|
@@ -66,18 +59,26 @@ export class OrderNoGenerator {
|
|
|
66
59
|
return `OV-${uuid()}`
|
|
67
60
|
}
|
|
68
61
|
|
|
62
|
+
static orderToteItem() {
|
|
63
|
+
return `OTI-${uuid()}`
|
|
64
|
+
}
|
|
65
|
+
|
|
69
66
|
static purchaseOrder() {
|
|
70
67
|
const currentDate = new Date()
|
|
71
|
-
return `PO-${currentDate.getFullYear()}${
|
|
72
|
-
currentDate.
|
|
73
|
-
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
68
|
+
return `PO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
69
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
74
70
|
}
|
|
75
71
|
|
|
76
72
|
static releaseGood() {
|
|
77
73
|
const currentDate = new Date()
|
|
78
|
-
return `RO-${currentDate.getFullYear()}${
|
|
79
|
-
currentDate.
|
|
80
|
-
|
|
74
|
+
return `RO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
75
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static draftReleaseGood() {
|
|
79
|
+
const currentDate = new Date()
|
|
80
|
+
return `ODO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
81
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
static releaseVas() {
|
|
@@ -86,50 +87,43 @@ export class OrderNoGenerator {
|
|
|
86
87
|
|
|
87
88
|
static retailReplenishmentOrder() {
|
|
88
89
|
const currentDate = new Date()
|
|
89
|
-
return `RR-${currentDate.getFullYear()}${
|
|
90
|
-
currentDate.
|
|
91
|
-
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
90
|
+
return `RR-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
91
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
static returnOrder() {
|
|
95
95
|
const currentDate = new Date()
|
|
96
|
-
return `RTO-${currentDate.getFullYear()}${
|
|
97
|
-
currentDate.
|
|
98
|
-
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
96
|
+
return `RTO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
97
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
static shippingOrder() {
|
|
102
101
|
const currentDate = new Date()
|
|
103
|
-
return `SO-${currentDate.getFullYear()}${
|
|
104
|
-
currentDate.
|
|
105
|
-
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
102
|
+
return `SO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
103
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
106
104
|
}
|
|
107
105
|
|
|
108
106
|
static stockTake() {
|
|
109
107
|
const currentDate = new Date()
|
|
110
|
-
return `ST-${currentDate.getFullYear()}${
|
|
111
|
-
currentDate.
|
|
112
|
-
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
108
|
+
return `ST-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
109
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
113
110
|
}
|
|
114
111
|
|
|
115
112
|
static transferOrder() {
|
|
116
113
|
const currentDate = new Date()
|
|
117
|
-
return `TO-${currentDate.getFullYear()}${
|
|
118
|
-
currentDate.
|
|
119
|
-
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
114
|
+
return `TO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
115
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
120
116
|
}
|
|
121
117
|
|
|
122
118
|
static vasOrder() {
|
|
123
119
|
const currentDate = new Date()
|
|
124
|
-
return `VO-${currentDate.getFullYear()}${
|
|
125
|
-
currentDate.
|
|
126
|
-
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
120
|
+
return `VO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
121
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
127
122
|
}
|
|
128
123
|
|
|
129
124
|
static invoice() {
|
|
130
125
|
const currentDate = new Date()
|
|
131
|
-
return `INV-${currentDate.getFullYear()}${
|
|
132
|
-
currentDate.
|
|
133
|
-
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
126
|
+
return `INV-${currentDate.getFullYear()}${currentDate.getMonth() + 1
|
|
127
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
134
128
|
}
|
|
135
129
|
}
|