@things-factory/warehouse-base 4.3.518 → 4.3.524
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.
|
@@ -50,25 +50,26 @@ class WebspertController {
|
|
|
50
50
|
return "'" + (productDetail === null || productDetail === void 0 ? void 0 : productDetail.trim()) + "'";
|
|
51
51
|
}).join(',');
|
|
52
52
|
let rawQb = await tx.getRepository(inventory_1.Inventory).query(`
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
select pd.id as "productDetailId", p.sku, pd.ref_code as "refCode", i.bizplace_id as "bizplaceId", i.domain_id as "domainId",
|
|
54
|
+
sum(i.qty - coalesce(i.locked_qty,0) - coalesce(i.transfer_qty,0) - coalesce(pds.unassigned_qty,0)) as "availableQty"
|
|
55
|
+
from inventories i
|
|
56
|
+
inner join locations loc on loc.id = i.location_id
|
|
57
|
+
inner join product_details pd on pd.id = i.product_detail_id
|
|
58
|
+
left join product_detail_stocks pds on pds.product_detail_id = pd.id
|
|
59
|
+
left join products p on p.id = pd.product_id
|
|
60
|
+
where
|
|
61
|
+
loc."type" not in ('QUARANTINE', 'RESERVED') and
|
|
62
|
+
i.status = 'STORED' and
|
|
63
|
+
i.bizplace_id = $1 and
|
|
64
|
+
i.domain_id = $2 and
|
|
65
|
+
i.product_detail_id in (${productDetailsID})
|
|
66
|
+
group by pd.id, p.sku, pd.ref_code, i.bizplace_id, i.domain_id
|
|
67
|
+
`, [bizplace.id, domain.id]);
|
|
67
68
|
for (let index = 0; index < rawQb.length; index++) {
|
|
68
69
|
const data = rawQb[index];
|
|
69
70
|
////// Calling Webspert API 1 by 1 is unavoidable as Webspert's API only allow singular update
|
|
70
71
|
this.sendRequestToAPI('product/update_product_stock_by_sku', {
|
|
71
|
-
sku: data.
|
|
72
|
+
sku: data.sku,
|
|
72
73
|
stock: data.availableQty
|
|
73
74
|
}, domain, user);
|
|
74
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webspert-controller.js","sourceRoot":"","sources":["../../../server/controllers/ecommerce/webspert-controller.ts"],"names":[],"mappings":";;;;;;AAAA,qCAAqE;AAGrE,6CAA4C;AAG5C,6CAA4C;AAC5C,uEAAmE;AAEnE,iEAA6D;AAE7D,kDAAyB;AAEzB,IAAI,cAAc,GAAQ,YAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;AAEhD,0EAA0E;AAE1E,MAAa,kBAAkB;IACtB,MAAM,CAAC,KAAK,CAAC,WAAW,CAC7B,cAA+B,EAC/B,QAAkB,EAClB,MAAc,EACd,IAAU,EACV,EAAkB;QAElB,IAAI,EAAE,EAAE;YACN,MAAM,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;SACpE;aAAM;YACL,MAAM,IAAA,uBAAa,GAAE,CAAC,WAAW,CAAC,KAAK,EAAE,EAAiB,EAAE,EAAE;gBAC5D,MAAM,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;YACrE,CAAC,CAAC,CAAA;SACH;IACH,CAAC;IAEO,MAAM,CAAC,KAAK,CAAC,YAAY,CAC/B,cAA+B,EAC/B,QAAkB,EAClB,MAAc,EACd,IAAU,EACV,EAAiB;QACjB,4CAA4C;QAC5C,MAAM,SAAS,GAAG,GAAG,CAAA;QAErB,2BAA2B;QAC3B,IAAI,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE;YAC7D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,aAAa,CAAC,EAAE,CAAC,EAAE;gBAC3C,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;aAC3B;YACD,OAAO,GAAG,CAAA;QACZ,CAAC,EAAE,EAAE,CAAC;aACH,MAAM,CAAC,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,EAAE;YACpC,IAAI,GAAG,GAAG,SAAS,KAAK,CAAC,EAAE;gBACzB,OAAO,CAAC,GAAG,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC,CAAA;aACnC;iBAAM;gBACL,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;gBACzC,OAAO,GAAG,CAAA;aACX;QACH,CAAC,EAAE,EAAE,CAAC,CAAA;QAER,sBAAsB;QACtB,uKAAuK;QACvK,OAAO,CAAC,GAAG,CACT,MAAM,CAAC,GAAG,CAAC,KAAK,EAAC,cAAc,EAAC,EAAE;YAChC,IAAI;gBACF,IAAI,gBAAgB,GAAG,cAAc,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;oBACxD,OAAO,GAAG,IAAG,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,EAAE,CAAA,GAAG,GAAG,CAAA;gBAC1C,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;gBAEZ,IAAI,KAAK,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,qBAAS,CAAC,CAAC,KAAK,CAAC
|
|
1
|
+
{"version":3,"file":"webspert-controller.js","sourceRoot":"","sources":["../../../server/controllers/ecommerce/webspert-controller.ts"],"names":[],"mappings":";;;;;;AAAA,qCAAqE;AAGrE,6CAA4C;AAG5C,6CAA4C;AAC5C,uEAAmE;AAEnE,iEAA6D;AAE7D,kDAAyB;AAEzB,IAAI,cAAc,GAAQ,YAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;AAEhD,0EAA0E;AAE1E,MAAa,kBAAkB;I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{
|
|
2
2
|
"name": "@things-factory/warehouse-base",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.524",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@things-factory/biz-base": "^4.3.
|
|
27
|
-
"@things-factory/id-rule-base": "^4.3.
|
|
28
|
-
"@things-factory/integration-accounting": "^4.3.
|
|
29
|
-
"@things-factory/integration-powrup": "^4.3.
|
|
30
|
-
"@things-factory/integration-sellercraft": "^4.3.
|
|
31
|
-
"@things-factory/marketplace-base": "^4.3.
|
|
32
|
-
"@things-factory/product-base": "^4.3.
|
|
33
|
-
"@things-factory/setting-base": "^4.3.
|
|
26
|
+
"@things-factory/biz-base": "^4.3.524",
|
|
27
|
+
"@things-factory/id-rule-base": "^4.3.524",
|
|
28
|
+
"@things-factory/integration-accounting": "^4.3.524",
|
|
29
|
+
"@things-factory/integration-powrup": "^4.3.524",
|
|
30
|
+
"@things-factory/integration-sellercraft": "^4.3.524",
|
|
31
|
+
"@things-factory/marketplace-base": "^4.3.524",
|
|
32
|
+
"@things-factory/product-base": "^4.3.524",
|
|
33
|
+
"@things-factory/setting-base": "^4.3.524"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "0e6819f6c2efc8070607e0e0379a1c7ffb235abf"
|
|
36
36
|
}
|
|
@@ -67,20 +67,21 @@ export class WebspertController {
|
|
|
67
67
|
}).join(',')
|
|
68
68
|
|
|
69
69
|
let rawQb = await tx.getRepository(Inventory).query(`
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
select pd.id as "productDetailId", p.sku, pd.ref_code as "refCode", i.bizplace_id as "bizplaceId", i.domain_id as "domainId",
|
|
71
|
+
sum(i.qty - coalesce(i.locked_qty,0) - coalesce(i.transfer_qty,0) - coalesce(pds.unassigned_qty,0)) as "availableQty"
|
|
72
|
+
from inventories i
|
|
73
|
+
inner join locations loc on loc.id = i.location_id
|
|
74
|
+
inner join product_details pd on pd.id = i.product_detail_id
|
|
75
|
+
left join product_detail_stocks pds on pds.product_detail_id = pd.id
|
|
76
|
+
left join products p on p.id = pd.product_id
|
|
77
|
+
where
|
|
78
|
+
loc."type" not in ('QUARANTINE', 'RESERVED') and
|
|
79
|
+
i.status = 'STORED' and
|
|
80
|
+
i.bizplace_id = $1 and
|
|
81
|
+
i.domain_id = $2 and
|
|
82
|
+
i.product_detail_id in (${productDetailsID})
|
|
83
|
+
group by pd.id, p.sku, pd.ref_code, i.bizplace_id, i.domain_id
|
|
84
|
+
`, [bizplace.id, domain.id])
|
|
84
85
|
|
|
85
86
|
|
|
86
87
|
for (let index = 0; index < rawQb.length; index++) {
|
|
@@ -89,7 +90,7 @@ export class WebspertController {
|
|
|
89
90
|
this.sendRequestToAPI(
|
|
90
91
|
'product/update_product_stock_by_sku',
|
|
91
92
|
{
|
|
92
|
-
sku: data.
|
|
93
|
+
sku: data.sku,
|
|
93
94
|
stock: data.availableQty
|
|
94
95
|
},
|
|
95
96
|
domain,
|