@things-factory/warehouse-base 3.8.24 → 3.8.28
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.
|
@@ -22,21 +22,23 @@ class SellercraftController extends warehouse_controller_1.WarehouseController {
|
|
|
22
22
|
locationTypes: [constants_1.LOCATION_TYPE.QUARANTINE, constants_1.LOCATION_TYPE.RESERVE]
|
|
23
23
|
});
|
|
24
24
|
let inventories = await qb.getMany();
|
|
25
|
-
let defaultProductDetail;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
total
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
let defaultProductDetail = product.productDetails.find(productDetail => productDetail.isDefault);
|
|
26
|
+
let inventoryTotalQty = 0;
|
|
27
|
+
if ((inventories === null || inventories === void 0 ? void 0 : inventories.length) > 0) {
|
|
28
|
+
const sellercraftInvs = await Promise.all(inventories.map(async (inventory) => {
|
|
29
|
+
const inventoryPackingType = inventory.packingType;
|
|
30
|
+
let packingSize = 1;
|
|
31
|
+
if (inventoryPackingType !== defaultProductDetail.packingType) {
|
|
32
|
+
const unmatchingProductDetail = product.productDetails.find(productDetail => productDetail.packingType === inventoryPackingType);
|
|
33
|
+
packingSize = await this.getChildPackingSize(productDetails, defaultProductDetail, unmatchingProductDetail);
|
|
34
|
+
}
|
|
35
|
+
return { quantity: inventory.qty * packingSize - inventory.lockedQty * packingSize };
|
|
36
|
+
}));
|
|
37
|
+
inventoryTotalQty = sellercraftInvs.reduce((total, currentValue) => {
|
|
38
|
+
total += currentValue.quantity;
|
|
39
|
+
return total;
|
|
40
|
+
}, 0);
|
|
41
|
+
}
|
|
40
42
|
const sellercraftInv = [
|
|
41
43
|
{
|
|
42
44
|
sku: product.sku,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sellercraft-controller.js","sourceRoot":"","sources":["../../../server/controllers/ecommerce/sellercraft-controller.ts"],"names":[],"mappings":";;;AAAA,qFAAqF;AAGrF,+CAAiE;AACjE,iEAA6D;AAC7D,kEAA6D;AAE7D,MAAa,qBAAsB,SAAQ,0CAAmB;IAC5D,KAAK,CAAC,sBAAsB,CAAC,WAAwB,EAAE,SAAoB;QACzE,IAAI,OAAO,GAAY,SAAS,CAAC,OAAO,CAAA;QACxC,MAAM,cAAc,GAAoB,OAAO,CAAC,cAAc,CAAA;QAE9D,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,qBAAS,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAA;QAC7E,EAAE,CAAC,iBAAiB,CAAC,cAAc,EAAE,KAAK,CAAC;aACxC,QAAQ,CAAC,+BAA+B,CAAC;aACzC,QAAQ,CAAC,iCAAiC,CAAC;aAC3C,QAAQ,CAAC,2BAA2B,CAAC;aACrC,QAAQ,CAAC,yCAAyC,CAAC;aACnD,aAAa,CAAC;YACb,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;YACxB,SAAS,EAAE,OAAO,CAAC,EAAE;YACrB,MAAM,EAAE,4BAAgB,CAAC,UAAU;YACnC,aAAa,EAAE,CAAC,yBAAa,CAAC,UAAU,EAAE,yBAAa,CAAC,OAAO,CAAC;SACjE,CAAC,CAAA;QAEJ,IAAI,WAAW,GAAgB,MAAM,EAAE,CAAC,OAAO,EAAE,CAAA;QAEjD,IAAI,
|
|
1
|
+
{"version":3,"file":"sellercraft-controller.js","sourceRoot":"","sources":["../../../server/controllers/ecommerce/sellercraft-controller.ts"],"names":[],"mappings":";;;AAAA,qFAAqF;AAGrF,+CAAiE;AACjE,iEAA6D;AAC7D,kEAA6D;AAE7D,MAAa,qBAAsB,SAAQ,0CAAmB;IAC5D,KAAK,CAAC,sBAAsB,CAAC,WAAwB,EAAE,SAAoB;QACzE,IAAI,OAAO,GAAY,SAA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,aAAa,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,WAAW,CAAC,SAAS,EAAE,cAAc,EAAE,CAAC,CAAA;IACvG,CAAC;CACF;AAlED,sDAkEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/warehouse-base",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.28",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@things-factory/biz-base": "^3.8.
|
|
27
|
+
"@things-factory/biz-base": "^3.8.26",
|
|
28
28
|
"@things-factory/id-rule-base": "^3.8.0",
|
|
29
|
-
"@things-factory/integration-sellercraft": "^3.8.
|
|
30
|
-
"@things-factory/marketplace-base": "^3.8.
|
|
31
|
-
"@things-factory/product-base": "^3.8.
|
|
29
|
+
"@things-factory/integration-sellercraft": "^3.8.28",
|
|
30
|
+
"@things-factory/marketplace-base": "^3.8.28",
|
|
31
|
+
"@things-factory/product-base": "^3.8.26",
|
|
32
32
|
"@things-factory/setting-base": "^3.8.0"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "8bc0e8adad38cec375d701d66f2f198bceafd644"
|
|
35
35
|
}
|
|
@@ -25,29 +25,32 @@ export class SellercraftController extends WarehouseController {
|
|
|
25
25
|
|
|
26
26
|
let inventories: Inventory[] = await qb.getMany()
|
|
27
27
|
|
|
28
|
-
let defaultProductDetail: ProductDetail
|
|
29
|
-
|
|
30
|
-
inventories.map(async (inventory: Inventory) => {
|
|
31
|
-
const inventoryPackingType: string = inventory.packingType
|
|
32
|
-
defaultProductDetail = product.productDetails.find(productDetail => productDetail.isDefault)
|
|
28
|
+
let defaultProductDetail: ProductDetail = product.productDetails.find(productDetail => productDetail.isDefault)
|
|
29
|
+
let inventoryTotalQty: number = 0
|
|
33
30
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
)
|
|
31
|
+
if (inventories?.length > 0) {
|
|
32
|
+
const sellercraftInvs: any[] = await Promise.all(
|
|
33
|
+
inventories.map(async (inventory: Inventory) => {
|
|
34
|
+
const inventoryPackingType: string = inventory.packingType
|
|
39
35
|
|
|
40
|
-
packingSize =
|
|
41
|
-
|
|
36
|
+
let packingSize: number = 1
|
|
37
|
+
if (inventoryPackingType !== defaultProductDetail.packingType) {
|
|
38
|
+
const unmatchingProductDetail: ProductDetail = product.productDetails.find(
|
|
39
|
+
productDetail => productDetail.packingType === inventoryPackingType
|
|
40
|
+
)
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
packingSize = await this.getChildPackingSize(productDetails, defaultProductDetail, unmatchingProductDetail)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return { quantity: inventory.qty * packingSize - inventory.lockedQty * packingSize }
|
|
46
|
+
})
|
|
47
|
+
)
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
inventoryTotalQty = sellercraftInvs.reduce((total, currentValue) => {
|
|
50
|
+
total += currentValue.quantity
|
|
51
|
+
return total
|
|
52
|
+
}, 0)
|
|
53
|
+
}
|
|
51
54
|
|
|
52
55
|
const sellercraftInv: any[] = [
|
|
53
56
|
{
|