@things-factory/warehouse-base 4.3.514 → 4.3.516
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/service/inventory-history/inventory-history-query.js +2 -2
- package/dist-server/service/warehouse/warehouse-mutation.js +13 -14
- package/dist-server/service/warehouse/warehouse-mutation.js.map +1 -1
- package/package.json +2 -2
- package/server/service/inventory-history/inventory-history-query.ts +2 -2
- package/server/service/warehouse/warehouse-mutation.ts +22 -15
|
@@ -1525,7 +1525,7 @@ async function massageInventoryPalletSummary(tx, params, bizplace, context) {
|
|
|
1525
1525
|
else 0 end
|
|
1526
1526
|
else 0 end) as opening_qty,
|
|
1527
1527
|
SUM(case when invHistory.created_at >= $1 and invHistory.created_at <= $2 then
|
|
1528
|
-
case when (invHistory.transaction_type = 'UNLOADING' or invHistory.transaction_type = 'NEW') then 1 else 0 end
|
|
1528
|
+
case when (invHistory.transaction_type = 'UNLOADING' or invHistory.transaction_type = 'NEW' or invHistory.transaction_type = 'CANCEL_ORDER') then 1 else 0 end
|
|
1529
1529
|
else 0 end) as total_in_qty,
|
|
1530
1530
|
SUM(case when invHistory.created_at >= $1 and invHistory.created_at <= $2 then
|
|
1531
1531
|
case when invHistory.status = 'TERMINATED' AND invHistory.transaction_type <> 'ADJUSTMENT' then -1 else 0 end
|
|
@@ -1541,7 +1541,7 @@ async function massageInventoryPalletSummary(tx, params, bizplace, context) {
|
|
|
1541
1541
|
prd.sku as product_sku, prd.name as product_name, prd.description as product_description, prd.type AS product_type
|
|
1542
1542
|
from temp_inv_history invh
|
|
1543
1543
|
inner join temp_products prd on prd.id = invh.product_id
|
|
1544
|
-
where (transaction_type = 'UNLOADING' or invh.transaction_type = 'NEW')
|
|
1544
|
+
where (transaction_type = 'UNLOADING' or invh.transaction_type = 'NEW' or invh.transaction_type = 'CANCEL_ORDER')
|
|
1545
1545
|
and invh.created_at >= $1
|
|
1546
1546
|
) as invIn where rn = 1
|
|
1547
1547
|
union all
|
|
@@ -31,28 +31,27 @@ let WarehouseMutation = class WarehouseMutation {
|
|
|
31
31
|
const { tx, domain, user } = context.state;
|
|
32
32
|
for (let patch of patches) {
|
|
33
33
|
let foundWarehouse;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
else if (patch === null || patch === void 0 ? void 0 : patch.id) {
|
|
41
|
-
foundWarehouse = await tx.getRepository(warehouse_1.Warehouse).findOne({
|
|
42
|
-
domain,
|
|
43
|
-
id: patch.id
|
|
44
|
-
});
|
|
45
|
-
}
|
|
34
|
+
foundWarehouse = await tx.getRepository(warehouse_1.Warehouse).findOne({
|
|
35
|
+
domain,
|
|
36
|
+
id: patch.id
|
|
37
|
+
});
|
|
46
38
|
if (!foundWarehouse) {
|
|
47
|
-
patch === null || patch === void 0 ? true : delete patch.id;
|
|
48
39
|
await tx.getRepository(warehouse_1.Warehouse).save(Object.assign(Object.assign({}, patch), { domain, creator: user, updater: user }));
|
|
49
40
|
}
|
|
50
41
|
else {
|
|
51
42
|
if (patch.cuFlag === '+') {
|
|
52
43
|
throw new Error(i18next_1.default.t('error.warehouse (x) already exists', { x: patch.name }));
|
|
53
44
|
}
|
|
45
|
+
if ((!patch.name || !foundWarehouse.name) && (!patch.type || !foundWarehouse.type)) {
|
|
46
|
+
throw new Error(i18next_1.default.t('text.empty_value_in_list'));
|
|
47
|
+
}
|
|
48
|
+
if ((patch.name) && (patch.type === '')) {
|
|
49
|
+
throw new Error(i18next_1.default.t('text.empty_value_in_list'));
|
|
50
|
+
}
|
|
51
|
+
const updatedName = patch.name || foundWarehouse.name;
|
|
52
|
+
const updatedType = patch.type || foundWarehouse.type;
|
|
54
53
|
delete patch.cuFlag;
|
|
55
|
-
await tx.getRepository(warehouse_1.Warehouse).update({ id: foundWarehouse.id }, Object.assign(Object.assign({}, patch), { updater: user }));
|
|
54
|
+
await tx.getRepository(warehouse_1.Warehouse).update({ id: foundWarehouse.id }, Object.assign(Object.assign({}, patch), { name: updatedName, type: updatedType, updater: user }));
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warehouse-mutation.js","sourceRoot":"","sources":["../../../server/service/warehouse/warehouse-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+CAAsE;AAMtE,2CAAuC;AACvC,uDAAgE;AAEhE,sDAA6B;AAGtB,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAItB,AAAN,KAAK,CAAC,eAAe,CAAmB,SAAuB,EAAS,OAAY;QAClF,OAAO,MAAM,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAClD,CAAC;IAKK,AAAN,KAAK,CAAC,eAAe,CACR,EAAU,EACP,KAAqB,EAC5B,OAAY;QAEnB,OAAO,MAAM,eAAe,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;IAClD,CAAC;IAKK,AAAN,KAAK,CAAC,uBAAuB,CACe,OAAyB,EAC5D,OAAY;QAEnB,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAsD,OAAO,CAAC,KAAK,CAAA;QAE7F,KAAK,IAAI,KAAK,IAAI,OAAO,EAAE;YACzB,IAAI,cAAyB,CAAA;YAE7B,
|
|
1
|
+
{"version":3,"file":"warehouse-mutation.js","sourceRoot":"","sources":["../../../server/service/warehouse/warehouse-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+CAAsE;AAMtE,2CAAuC;AACvC,uDAAgE;AAEhE,sDAA6B;AAGtB,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAItB,AAAN,KAAK,CAAC,eAAe,CAAmB,SAAuB,EAAS,OAAY;QAClF,OAAO,MAAM,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAClD,CAAC;IAKK,AAAN,KAAK,CAAC,eAAe,CACR,E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|
3
|
+
"version": "4.3.516",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"@things-factory/product-base": "^4.3.495",
|
|
33
33
|
"@things-factory/setting-base": "^4.3.452"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "e978cd97325cd1fe187d81e566f393f5d94093ea"
|
|
36
36
|
}
|
|
@@ -1714,7 +1714,7 @@ async function massageInventoryPalletSummary(tx: EntityManager, params: ListPara
|
|
|
1714
1714
|
else 0 end
|
|
1715
1715
|
else 0 end) as opening_qty,
|
|
1716
1716
|
SUM(case when invHistory.created_at >= $1 and invHistory.created_at <= $2 then
|
|
1717
|
-
case when (invHistory.transaction_type = 'UNLOADING' or invHistory.transaction_type = 'NEW') then 1 else 0 end
|
|
1717
|
+
case when (invHistory.transaction_type = 'UNLOADING' or invHistory.transaction_type = 'NEW' or invHistory.transaction_type = 'CANCEL_ORDER') then 1 else 0 end
|
|
1718
1718
|
else 0 end) as total_in_qty,
|
|
1719
1719
|
SUM(case when invHistory.created_at >= $1 and invHistory.created_at <= $2 then
|
|
1720
1720
|
case when invHistory.status = 'TERMINATED' AND invHistory.transaction_type <> 'ADJUSTMENT' then -1 else 0 end
|
|
@@ -1730,7 +1730,7 @@ async function massageInventoryPalletSummary(tx: EntityManager, params: ListPara
|
|
|
1730
1730
|
prd.sku as product_sku, prd.name as product_name, prd.description as product_description, prd.type AS product_type
|
|
1731
1731
|
from temp_inv_history invh
|
|
1732
1732
|
inner join temp_products prd on prd.id = invh.product_id
|
|
1733
|
-
where (transaction_type = 'UNLOADING' or invh.transaction_type = 'NEW')
|
|
1733
|
+
where (transaction_type = 'UNLOADING' or invh.transaction_type = 'NEW' or invh.transaction_type = 'CANCEL_ORDER')
|
|
1734
1734
|
and invh.created_at >= $1
|
|
1735
1735
|
) as invIn where rn = 1
|
|
1736
1736
|
union all
|
|
@@ -41,33 +41,40 @@ export class WarehouseMutation {
|
|
|
41
41
|
for (let patch of patches) {
|
|
42
42
|
let foundWarehouse: Warehouse
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
})
|
|
49
|
-
} else if (patch?.id) {
|
|
50
|
-
foundWarehouse = await tx.getRepository(Warehouse).findOne({
|
|
51
|
-
domain,
|
|
52
|
-
id: patch.id
|
|
53
|
-
})
|
|
54
|
-
}
|
|
44
|
+
foundWarehouse = await tx.getRepository(Warehouse).findOne({
|
|
45
|
+
domain,
|
|
46
|
+
id: patch.id
|
|
47
|
+
})
|
|
55
48
|
|
|
56
49
|
if (!foundWarehouse) {
|
|
57
|
-
delete patch?.id
|
|
58
50
|
await tx.getRepository(Warehouse).save({ ...patch, domain, creator: user, updater: user })
|
|
59
51
|
} else {
|
|
60
52
|
if (patch.cuFlag === '+') {
|
|
61
53
|
throw new Error(i18next.t('error.warehouse (x) already exists', { x: patch.name }))
|
|
62
54
|
}
|
|
63
|
-
|
|
55
|
+
|
|
56
|
+
if ((!patch.name || !foundWarehouse.name) && (!patch.type || !foundWarehouse.type)) {
|
|
57
|
+
throw new Error(i18next.t('text.empty_value_in_list'));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if ((patch.name) && (patch.type === '')) {
|
|
61
|
+
throw new Error(i18next.t('text.empty_value_in_list'));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const updatedName = patch.name || foundWarehouse.name;
|
|
65
|
+
const updatedType = patch.type || foundWarehouse.type;
|
|
66
|
+
|
|
67
|
+
delete patch.cuFlag;
|
|
68
|
+
|
|
64
69
|
await tx.getRepository(Warehouse).update(
|
|
65
70
|
{ id: foundWarehouse.id },
|
|
66
71
|
{
|
|
67
72
|
...patch,
|
|
68
|
-
|
|
73
|
+
name: updatedName,
|
|
74
|
+
type: updatedType,
|
|
75
|
+
updater: user,
|
|
69
76
|
}
|
|
70
|
-
)
|
|
77
|
+
);
|
|
71
78
|
}
|
|
72
79
|
}
|
|
73
80
|
|