@things-factory/operato-hub 4.3.572 → 4.3.573
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/graphql/resolvers/synchronization/powrup-get-airway-bill.js +1 -1
- package/dist-server/graphql/resolvers/synchronization/powrup-get-airway-bill.js.map +1 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-inbound-order-details.js +52 -0
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-inbound-order-details.js.map +1 -1
- package/openapi/v1/inbound.yaml +71 -0
- package/package.json +2 -2
- package/server/graphql/resolvers/synchronization/powrup-get-airway-bill.ts +2 -2
- package/server/routers/api/restful-apis/v1/warehouse/get-inbound-order-details.ts +59 -2
|
@@ -27,7 +27,7 @@ exports.powrupGetAirwayBillResolver = {
|
|
|
27
27
|
.andWhere(`rg.ref_order_id NOTNULL`)
|
|
28
28
|
.andWhere(`(rg.lmd_option = false or rg.lmd_option ISNULL)`)
|
|
29
29
|
.andWhere(`rg.status NOT IN (:...status) `, {
|
|
30
|
-
status: [sales_base_1.ORDER_STATUS.CANCELLED, sales_base_1.ORDER_STATUS.PENDING_CANCEL, sales_base_1.ORDER_STATUS.DONE]
|
|
30
|
+
status: [sales_base_1.ORDER_STATUS.PACKING, sales_base_1.ORDER_STATUS.CANCELLED, sales_base_1.ORDER_STATUS.PENDING_CANCEL, sales_base_1.ORDER_STATUS.DONE]
|
|
31
31
|
})
|
|
32
32
|
.andWhere(`opk.airway_bill ISNULL`)
|
|
33
33
|
.orderBy(`rg.created_at`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powrup-get-airway-bill.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/synchronization/powrup-get-airway-bill.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,yDAA2D;AAC3D,6CAA4C;AAC5C,2EAAgF;AAChF,2DAAuE;AAEvE,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAE1D,QAAA,2BAA2B,GAAG;IACzC,KAAK,CAAC,mBAAmB,CAAC,CAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"powrup-get-airway-bill.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/synchronization/powrup-get-airway-bill.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,yDAA2D;AAC3D,6CAA4C;AAC5C,2EAAgF;AAChF,2DAAuE;AAEvE,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAE1D,QAAA,2BAA2B,GAAG;IACzC,KAAK,CAAC,mBAAmB,CAAC,CAAO,EAAE,EAAG,EAAE,OAAY;QAClD,IAAI;YACF,MAAM,IAAA,uBAAa,GAAE,CAAC,WAAW,CAAC,KAAK,EAAC,EAAE,EAAC,EAAE;gBAC3C,IAAI;oBACF,MAAM,MAAM,GAAW,MAAM,EAAE;yBAC5B,aAAa,CAAC,2BAAM,CAAC;yBACrB,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,6BAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;oBAElE,IAAI,cAAc,GAAG,MAAM,EAAE;yBAC1B,aAAa,CAAC,yBAAY,CAAC;yBAC3B,kBAAkB,CAAC,KAAK,CAAC;yBACzB,kBAAkB,CAAC,iBAAiB,EAAE,IAAI,CAAC;yBAC3C,kBAAkB,CAAC,YAAY,EAAE,QAAQ,CAAC;yBAC1C,kBAAkB,CAAC,cAAc,EAAE,UAAU,CAAC;yBAC9C,kBAAkB,CAAC,aAAa,EAAE,SAAS,CAAC;yBAC5C,KAAK,CAAC,qBAAqB,EAAE,EAAE,MAAM,EAAE,2BAAe,CAAC,MAAM,EAAE,CAAC;yBAChE,QAAQ,CAAC,mBAAmB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;yBACh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mCAAmC,CAAC,EAAE,CAAC,CAAA;SACrD;IACH,CAAC;CACF,CAAA"}
|
|
@@ -31,6 +31,51 @@ api_1.restfulApiRouter.get('/v1/warehouse/get-inbound-order-details', middleware
|
|
|
31
31
|
if (!arrivalNotice) {
|
|
32
32
|
throw new error_util_1.ApiError('E04', 'arrival notice');
|
|
33
33
|
}
|
|
34
|
+
const goodsReceivedNote = await (0, typeorm_1.getRepository)(sales_base_1.GoodsReceivalNote).findOne({
|
|
35
|
+
where: { arrivalNotice },
|
|
36
|
+
relations: [
|
|
37
|
+
'bizplace',
|
|
38
|
+
'domain',
|
|
39
|
+
'arrivalNotice',
|
|
40
|
+
'arrivalNotice.orderInventories',
|
|
41
|
+
'arrivalNotice.orderInventories.product',
|
|
42
|
+
'arrivalNotice.orderInventories.productDetail',
|
|
43
|
+
'arrivalNotice.orderInventories.inventory'
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
let grnOrderInventories = goodsReceivedNote.arrivalNotice.orderInventories.reduce((acc, orderInventory) => {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
let key = `${orderInventory.product.id}_${orderInventory.batchId}_${orderInventory.packingType}_${orderInventory.uom}_${orderInventory.inventory.expirationDate}`;
|
|
49
|
+
if (!acc[key]) {
|
|
50
|
+
acc[key] = {
|
|
51
|
+
product: {
|
|
52
|
+
id: orderInventory.product.id,
|
|
53
|
+
sku: orderInventory.product.sku,
|
|
54
|
+
brandSku: orderInventory.product.brandSku,
|
|
55
|
+
name: orderInventory.product.name,
|
|
56
|
+
description: orderInventory.product.description,
|
|
57
|
+
refCode: orderInventory.productDetail.refCode,
|
|
58
|
+
packingType: orderInventory.productDetail.packingType,
|
|
59
|
+
packingSize: orderInventory.productDetail.packingSize,
|
|
60
|
+
uom: orderInventory.productDetail.uom
|
|
61
|
+
},
|
|
62
|
+
type: orderInventory.type,
|
|
63
|
+
batchId: orderInventory.batchId,
|
|
64
|
+
packingType: orderInventory.packingType,
|
|
65
|
+
packingSize: orderInventory.packingSize,
|
|
66
|
+
status: orderInventory.status,
|
|
67
|
+
qty: 0,
|
|
68
|
+
uom: orderInventory.uom,
|
|
69
|
+
uomValue: orderInventory.uomValue,
|
|
70
|
+
expirationDate: (_a = orderInventory.inventory) === null || _a === void 0 ? void 0 : _a.expirationDate
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
// Accumulate the quantity
|
|
74
|
+
acc[key].qty += (_b = orderInventory.inventory) === null || _b === void 0 ? void 0 : _b.qty;
|
|
75
|
+
return acc;
|
|
76
|
+
}, {});
|
|
77
|
+
// Convert the grouped object back to an array
|
|
78
|
+
grnOrderInventories = Object.values(grnOrderInventories);
|
|
34
79
|
// create and format data response
|
|
35
80
|
let orderProducts = [];
|
|
36
81
|
for (const orderProduct of arrivalNotice.orderProducts) {
|
|
@@ -72,6 +117,13 @@ api_1.restfulApiRouter.get('/v1/warehouse/get-inbound-order-details', middleware
|
|
|
72
117
|
companyName: ((_b = arrivalNotice === null || arrivalNotice === void 0 ? void 0 : arrivalNotice.supplier) === null || _b === void 0 ? void 0 : _b.companyName) || null,
|
|
73
118
|
email: ((_c = arrivalNotice === null || arrivalNotice === void 0 ? void 0 : arrivalNotice.supplier) === null || _c === void 0 ? void 0 : _c.email) || null,
|
|
74
119
|
accountNo: ((_d = arrivalNotice === null || arrivalNotice === void 0 ? void 0 : arrivalNotice.supplier) === null || _d === void 0 ? void 0 : _d.accountNo) || null
|
|
120
|
+
},
|
|
121
|
+
grn: {
|
|
122
|
+
id: goodsReceivedNote.id,
|
|
123
|
+
grnNo: goodsReceivedNote.grnNo,
|
|
124
|
+
refNo: goodsReceivedNote.refNo,
|
|
125
|
+
status: goodsReceivedNote.status,
|
|
126
|
+
orderProducts: grnOrderInventories
|
|
75
127
|
}
|
|
76
128
|
};
|
|
77
129
|
context.body = {
|
|
@@ -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,
|
|
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,+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,qB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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/openapi/v1/inbound.yaml
CHANGED
|
@@ -337,6 +337,77 @@ definitions:
|
|
|
337
337
|
accountNo:
|
|
338
338
|
type: 'string'
|
|
339
339
|
example: 'COMPANY-ACODE'
|
|
340
|
+
grn:
|
|
341
|
+
type: 'object'
|
|
342
|
+
properties:
|
|
343
|
+
id:
|
|
344
|
+
type: 'string'
|
|
345
|
+
example: 'uuid2669-646f-42a0-8364-56f670fuuid'
|
|
346
|
+
refNo:
|
|
347
|
+
type: 'string'
|
|
348
|
+
example: 'GAN-xxxxxxxx'
|
|
349
|
+
status:
|
|
350
|
+
type: 'string'
|
|
351
|
+
example: 'PENDING_RECEIVE'
|
|
352
|
+
orderProducts:
|
|
353
|
+
type: 'array'
|
|
354
|
+
items:
|
|
355
|
+
type: 'object'
|
|
356
|
+
properties:
|
|
357
|
+
product:
|
|
358
|
+
type: 'object'
|
|
359
|
+
properties:
|
|
360
|
+
id:
|
|
361
|
+
type: 'string'
|
|
362
|
+
example: 'uuid2669-646f-42a0-8364-56f670fuuid'
|
|
363
|
+
sku:
|
|
364
|
+
type: 'string'
|
|
365
|
+
example: 'xxxxxxxx'
|
|
366
|
+
brandSku:
|
|
367
|
+
type: 'string'
|
|
368
|
+
example: 'string'
|
|
369
|
+
name:
|
|
370
|
+
type: 'string'
|
|
371
|
+
example: 'xxxxxxxx'
|
|
372
|
+
description:
|
|
373
|
+
type: 'string'
|
|
374
|
+
example: 'xxxxxxxx'
|
|
375
|
+
refCode:
|
|
376
|
+
type: 'string'
|
|
377
|
+
example: 'xxxxxxxx'
|
|
378
|
+
packingType:
|
|
379
|
+
type: 'string'
|
|
380
|
+
example: 'DRUM'
|
|
381
|
+
packingSize:
|
|
382
|
+
type: 'integer'
|
|
383
|
+
example: 1
|
|
384
|
+
uom:
|
|
385
|
+
type: 'string'
|
|
386
|
+
example: 'kg'
|
|
387
|
+
type:
|
|
388
|
+
type: 'string'
|
|
389
|
+
example: 'ARRIVAL_NOTICE'
|
|
390
|
+
batchId:
|
|
391
|
+
type: 'string'
|
|
392
|
+
example: '24090487'
|
|
393
|
+
packingType:
|
|
394
|
+
type: 'string'
|
|
395
|
+
example: 'DRUM'
|
|
396
|
+
packingSize:
|
|
397
|
+
type: 'integer'
|
|
398
|
+
example: 1
|
|
399
|
+
status:
|
|
400
|
+
type: 'string'
|
|
401
|
+
example: 'TERMINATED'
|
|
402
|
+
qty:
|
|
403
|
+
type: 'integer'
|
|
404
|
+
example: 4
|
|
405
|
+
uom:
|
|
406
|
+
type: 'string'
|
|
407
|
+
example: 'kg'
|
|
408
|
+
expirationDate:
|
|
409
|
+
type: 'string'
|
|
410
|
+
example: 'utc 0 date'
|
|
340
411
|
xml:
|
|
341
412
|
name: 'GetInboundOrderDetails'
|
|
342
413
|
|
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.573",
|
|
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": "15d8bc5cdc55b056e9bf164bd44148a80af8aa22"
|
|
126
126
|
}
|
|
@@ -8,7 +8,7 @@ import { ORDER_STATUS, OrderPackage } from '@things-factory/sales-base'
|
|
|
8
8
|
const { PerformanceObserver, performance } = require('node:perf_hooks')
|
|
9
9
|
|
|
10
10
|
export const powrupGetAirwayBillResolver = {
|
|
11
|
-
async powrupGetAirwayBill(_: void, {}, context: any): Promise<void> {
|
|
11
|
+
async powrupGetAirwayBill(_: void, { }, context: any): Promise<void> {
|
|
12
12
|
try {
|
|
13
13
|
await getConnection().transaction(async tx => {
|
|
14
14
|
try {
|
|
@@ -28,7 +28,7 @@ export const powrupGetAirwayBillResolver = {
|
|
|
28
28
|
.andWhere(`rg.ref_order_id NOTNULL`)
|
|
29
29
|
.andWhere(`(rg.lmd_option = false or rg.lmd_option ISNULL)`)
|
|
30
30
|
.andWhere(`rg.status NOT IN (:...status) `, {
|
|
31
|
-
status: [ORDER_STATUS.CANCELLED, ORDER_STATUS.PENDING_CANCEL, ORDER_STATUS.DONE]
|
|
31
|
+
status: [ORDER_STATUS.PACKING, ORDER_STATUS.CANCELLED, ORDER_STATUS.PENDING_CANCEL, ORDER_STATUS.DONE]
|
|
32
32
|
})
|
|
33
33
|
.andWhere(`opk.airway_bill ISNULL`)
|
|
34
34
|
.orderBy(`rg.created_at`)
|
|
@@ -2,8 +2,7 @@ import _ from 'lodash'
|
|
|
2
2
|
import { getRepository } from 'typeorm'
|
|
3
3
|
|
|
4
4
|
import { restfulApiRouter as router } from '@things-factory/api'
|
|
5
|
-
import { ArrivalNotice } from '@things-factory/sales-base'
|
|
6
|
-
|
|
5
|
+
import { ArrivalNotice, GoodsReceivalNote } from '@things-factory/sales-base'
|
|
7
6
|
import { businessMiddleware, loggingMiddleware, validationMiddleware } from '../middlewares'
|
|
8
7
|
import { ApiError, ApiErrorHandler, throwInternalServerError } from '../utils/error-util'
|
|
9
8
|
|
|
@@ -36,6 +35,57 @@ router.get(
|
|
|
36
35
|
if (!arrivalNotice) {
|
|
37
36
|
throw new ApiError('E04', 'arrival notice')
|
|
38
37
|
}
|
|
38
|
+
|
|
39
|
+
const goodsReceivedNote: GoodsReceivalNote = await getRepository(GoodsReceivalNote).findOne({
|
|
40
|
+
where: { arrivalNotice },
|
|
41
|
+
relations: [
|
|
42
|
+
'bizplace',
|
|
43
|
+
'domain',
|
|
44
|
+
'arrivalNotice',
|
|
45
|
+
'arrivalNotice.orderInventories',
|
|
46
|
+
'arrivalNotice.orderInventories.product',
|
|
47
|
+
'arrivalNotice.orderInventories.productDetail',
|
|
48
|
+
'arrivalNotice.orderInventories.inventory'
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
let grnOrderInventories = goodsReceivedNote.arrivalNotice.orderInventories.reduce((acc, orderInventory) => {
|
|
53
|
+
let key = `${orderInventory.product.id}_${orderInventory.batchId}_${orderInventory.packingType}_${orderInventory.uom}_${orderInventory.inventory.expirationDate}`
|
|
54
|
+
|
|
55
|
+
if (!acc[key]) {
|
|
56
|
+
acc[key] = {
|
|
57
|
+
product: {
|
|
58
|
+
id: orderInventory.product.id,
|
|
59
|
+
sku: orderInventory.product.sku,
|
|
60
|
+
brandSku: orderInventory.product.brandSku,
|
|
61
|
+
name: orderInventory.product.name,
|
|
62
|
+
description: orderInventory.product.description,
|
|
63
|
+
refCode: orderInventory.productDetail.refCode,
|
|
64
|
+
packingType: orderInventory.productDetail.packingType,
|
|
65
|
+
packingSize: orderInventory.productDetail.packingSize,
|
|
66
|
+
uom: orderInventory.productDetail.uom
|
|
67
|
+
},
|
|
68
|
+
type: orderInventory.type,
|
|
69
|
+
batchId: orderInventory.batchId,
|
|
70
|
+
packingType: orderInventory.packingType,
|
|
71
|
+
packingSize: orderInventory.packingSize,
|
|
72
|
+
status: orderInventory.status,
|
|
73
|
+
qty: 0, // Initialize quantity
|
|
74
|
+
uom: orderInventory.uom,
|
|
75
|
+
uomValue: orderInventory.uomValue,
|
|
76
|
+
expirationDate: orderInventory.inventory?.expirationDate
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Accumulate the quantity
|
|
81
|
+
acc[key].qty += orderInventory.inventory?.qty
|
|
82
|
+
|
|
83
|
+
return acc
|
|
84
|
+
}, {})
|
|
85
|
+
|
|
86
|
+
// Convert the grouped object back to an array
|
|
87
|
+
grnOrderInventories = Object.values(grnOrderInventories)
|
|
88
|
+
|
|
39
89
|
// create and format data response
|
|
40
90
|
let orderProducts = []
|
|
41
91
|
for (const orderProduct of arrivalNotice.orderProducts) {
|
|
@@ -77,6 +127,13 @@ router.get(
|
|
|
77
127
|
companyName: arrivalNotice?.supplier?.companyName || null,
|
|
78
128
|
email: arrivalNotice?.supplier?.email || null,
|
|
79
129
|
accountNo: arrivalNotice?.supplier?.accountNo || null
|
|
130
|
+
},
|
|
131
|
+
grn: {
|
|
132
|
+
id: goodsReceivedNote.id,
|
|
133
|
+
grnNo: goodsReceivedNote.grnNo,
|
|
134
|
+
refNo: goodsReceivedNote.refNo,
|
|
135
|
+
status: goodsReceivedNote.status,
|
|
136
|
+
orderProducts: grnOrderInventories
|
|
80
137
|
}
|
|
81
138
|
}
|
|
82
139
|
|