@things-factory/operato-hub 4.3.573 → 4.3.574
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/routers/api/restful-apis/v1/warehouse/get-inbound-order-details.js +20 -14
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-inbound-order-details.js.map +1 -1
- package/package.json +2 -2
- package/server/routers/api/restful-apis/v1/warehouse/get-inbound-order-details.ts +17 -14
|
@@ -43,11 +43,19 @@ api_1.restfulApiRouter.get('/v1/warehouse/get-inbound-order-details', middleware
|
|
|
43
43
|
'arrivalNotice.orderInventories.inventory'
|
|
44
44
|
]
|
|
45
45
|
});
|
|
46
|
-
let grnOrderInventories = goodsReceivedNote.arrivalNotice.orderInventories.reduce((acc, orderInventory) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
let grnOrderInventories = goodsReceivedNote === null || goodsReceivedNote === void 0 ? void 0 : goodsReceivedNote.arrivalNotice.orderInventories.reduce((acc, orderInventory) => {
|
|
47
|
+
// let key = `${orderInventory.productDetail.id}_${orderInventory.batchId}_${orderInventory.packingType}_${orderInventory.uom}_${orderInventory.inventory.expirationDate}`
|
|
48
|
+
var _a, _b, _c;
|
|
49
|
+
let existingItem = acc.find(item => {
|
|
50
|
+
var _a;
|
|
51
|
+
return item.product.id === orderInventory.product.id &&
|
|
52
|
+
item.batchId === orderInventory.batchId &&
|
|
53
|
+
item.packingType === orderInventory.packingType &&
|
|
54
|
+
item.uom === orderInventory.uom &&
|
|
55
|
+
item.expirationDate === ((_a = orderInventory.inventory) === null || _a === void 0 ? void 0 : _a.expirationDate);
|
|
56
|
+
});
|
|
57
|
+
if (!existingItem) {
|
|
58
|
+
acc.push({
|
|
51
59
|
product: {
|
|
52
60
|
id: orderInventory.product.id,
|
|
53
61
|
sku: orderInventory.product.sku,
|
|
@@ -59,23 +67,21 @@ api_1.restfulApiRouter.get('/v1/warehouse/get-inbound-order-details', middleware
|
|
|
59
67
|
packingSize: orderInventory.productDetail.packingSize,
|
|
60
68
|
uom: orderInventory.productDetail.uom
|
|
61
69
|
},
|
|
62
|
-
type: orderInventory.type,
|
|
63
70
|
batchId: orderInventory.batchId,
|
|
64
71
|
packingType: orderInventory.packingType,
|
|
65
72
|
packingSize: orderInventory.packingSize,
|
|
66
73
|
status: orderInventory.status,
|
|
67
|
-
qty: 0,
|
|
74
|
+
qty: ((_a = orderInventory.inventory) === null || _a === void 0 ? void 0 : _a.qty) || 0,
|
|
68
75
|
uom: orderInventory.uom,
|
|
69
76
|
uomValue: orderInventory.uomValue,
|
|
70
|
-
expirationDate: (
|
|
71
|
-
};
|
|
77
|
+
expirationDate: (_b = orderInventory.inventory) === null || _b === void 0 ? void 0 : _b.expirationDate
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
existingItem.qty += ((_c = orderInventory.inventory) === null || _c === void 0 ? void 0 : _c.qty) || 0;
|
|
72
82
|
}
|
|
73
|
-
// Accumulate the quantity
|
|
74
|
-
acc[key].qty += (_b = orderInventory.inventory) === null || _b === void 0 ? void 0 : _b.qty;
|
|
75
83
|
return acc;
|
|
76
|
-
},
|
|
77
|
-
// Convert the grouped object back to an array
|
|
78
|
-
grnOrderInventories = Object.values(grnOrderInventories);
|
|
84
|
+
}, []);
|
|
79
85
|
// create and format data response
|
|
80
86
|
let orderProducts = [];
|
|
81
87
|
for (const orderProduct of arrivalNotice.orderProducts) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-inbound-order-details.js","sourceRoot":"","sources":["../../../../../../server/routers/api/restful-apis/v1/warehouse/get-inbound-order-details.ts"],"names":[],"mappings":";;;;;AAAA,oDAAsB;AACtB,qCAAuC;AAEvC,6CAAgE;AAChE,2DAA6E;AAC7E,gDAA4F;AAC5F,oDAAyF;AAEzF,sBAAM,CAAC,GAAG,CACR,yCAAyC,EACzC,gCAAkB,EAClB,kCAAoB,EACpB,+BAA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details.js","sourceRoot":"","sources":["../../../../../../server/routers/api/restful-apis/v1/warehouse/get-inbound-order-details.ts"],"names":[],"mappings":";;;;;AAAA,oDAAsB;AACtB,qCAAuC;AAEvC,6CAAgE;AAChE,2DAA6E;AAC7E,gDAA4F;AAC5F,oDAAyF;AAEzF,sBAAM,CAAC,GAAG,CACR,yCAAyC,EACzC,gCAAkB,EAClB,kCAAoB,EACpB,+BAAiB,EACjB,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;;IACtB,IAAI;QACF,uCAAuC;QACvC,kCAAkC;QAClC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAChC,IAAI,MAAM,mCAAQ,OAAO,CAAC,KAAK,KAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAE,CAAA;QACpD,IAAI,gBAAC,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE;YAC/B,MAAM,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;YACzC,OAAO,MAAM,CAAC,YAAY,CAAC,CAAA;SAC5B;QAED,IAAI,gBAAC,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;YAC1B,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;YAChC,OAAO,MAAM,CAAC,OAAO,CAAC,CAAA;SACvB;QAED,MAAM,aAAa,GAAkB,MAAM,IAAA,uBAAa,EAAC,0BAAa,CAAC,CAAC,OAAO,CAAC;YAC9E,KAAK,EAAE,MAAM;YACb,SAAS,EAAE,CAAC,eAAe,EAAE,uBAAuB,EAAE,UAAU,CAAC;SAClE,CAAC,CAAA;QAEF,IAAI,CAAC,aAAa,EAAE;YAClB,MAAM,IAAI,qBAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAA;SAC5C;QAED,MAAM,iBAAiB,GAAsB,MAAM,IAAA,uBAAa,EAAC,8BAAiB,CAAC,CAAC,OAA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AAiB,CAAC,KAAK;gBAC9B,MAAM,EAAE,iBAAiB,CAAC,MAAM;gBAChC,aAAa,EAAE,mBAAmB;aACnC;SACF,CAAA;QAED,OAAO,CAAC,IAAI,GAAG;YACb,IAAI;SACL,CAAA;KACF;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,YAAY,qBAAQ;YAAE,IAAA,4BAAe,EAAC,OAAO,EAAE,CAAC,CAAC,CAAA;;YACjD,IAAA,qCAAwB,EAAC,OAAO,EAAE,CAAC,CAAC,CAAA;KAC1C;AACH,CAAC,CACF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/operato-hub",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.574",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -122,5 +122,5 @@
|
|
|
122
122
|
"resolutions": {
|
|
123
123
|
"core-js": "^3.16.0"
|
|
124
124
|
},
|
|
125
|
-
"gitHead": "
|
|
125
|
+
"gitHead": "e16e67d0683a0762a602d2ae8a910fd3eefc7a0f"
|
|
126
126
|
}
|
|
@@ -49,11 +49,19 @@ router.get(
|
|
|
49
49
|
]
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
-
let grnOrderInventories = goodsReceivedNote
|
|
53
|
-
let key = `${orderInventory.
|
|
52
|
+
let grnOrderInventories = goodsReceivedNote?.arrivalNotice.orderInventories.reduce((acc, orderInventory) => {
|
|
53
|
+
// let key = `${orderInventory.productDetail.id}_${orderInventory.batchId}_${orderInventory.packingType}_${orderInventory.uom}_${orderInventory.inventory.expirationDate}`
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
let existingItem = acc.find(item =>
|
|
56
|
+
item.product.id === orderInventory.product.id &&
|
|
57
|
+
item.batchId === orderInventory.batchId &&
|
|
58
|
+
item.packingType === orderInventory.packingType &&
|
|
59
|
+
item.uom === orderInventory.uom &&
|
|
60
|
+
item.expirationDate === orderInventory.inventory?.expirationDate
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
if (!existingItem) {
|
|
64
|
+
acc.push({
|
|
57
65
|
product: {
|
|
58
66
|
id: orderInventory.product.id,
|
|
59
67
|
sku: orderInventory.product.sku,
|
|
@@ -65,26 +73,21 @@ router.get(
|
|
|
65
73
|
packingSize: orderInventory.productDetail.packingSize,
|
|
66
74
|
uom: orderInventory.productDetail.uom
|
|
67
75
|
},
|
|
68
|
-
type: orderInventory.type,
|
|
69
76
|
batchId: orderInventory.batchId,
|
|
70
77
|
packingType: orderInventory.packingType,
|
|
71
78
|
packingSize: orderInventory.packingSize,
|
|
72
79
|
status: orderInventory.status,
|
|
73
|
-
qty: 0,
|
|
80
|
+
qty: orderInventory.inventory?.qty || 0,
|
|
74
81
|
uom: orderInventory.uom,
|
|
75
82
|
uomValue: orderInventory.uomValue,
|
|
76
83
|
expirationDate: orderInventory.inventory?.expirationDate
|
|
77
|
-
}
|
|
84
|
+
})
|
|
85
|
+
} else {
|
|
86
|
+
existingItem.qty += orderInventory.inventory?.qty || 0
|
|
78
87
|
}
|
|
79
88
|
|
|
80
|
-
// Accumulate the quantity
|
|
81
|
-
acc[key].qty += orderInventory.inventory?.qty
|
|
82
|
-
|
|
83
89
|
return acc
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
// Convert the grouped object back to an array
|
|
87
|
-
grnOrderInventories = Object.values(grnOrderInventories)
|
|
90
|
+
}, [])
|
|
88
91
|
|
|
89
92
|
// create and format data response
|
|
90
93
|
let orderProducts = []
|