@things-factory/operato-hub 4.3.511 → 4.3.513
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-release-order-details.js +43 -23
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-release-order-details.js.map +1 -1
- package/package.json +14 -14
- package/server/routers/api/restful-apis/v1/warehouse/get-release-order-details.ts +46 -24
|
@@ -45,22 +45,52 @@ api_1.restfulApiRouter.get('/v1/warehouse/get-release-order-details', middleware
|
|
|
45
45
|
]
|
|
46
46
|
});
|
|
47
47
|
if (!releaseGood)
|
|
48
|
-
throw new error_util_1.ApiError('E04', `release order: ${filter['name']}
|
|
48
|
+
throw new error_util_1.ApiError('E04', `release order: ${filter['name']} do not exist.`);
|
|
49
|
+
const rgOrderProducts = await (0, typeorm_1.getRepository)(sales_base_1.OrderProduct).createQueryBuilder('op')
|
|
50
|
+
.leftJoinAndSelect('products', 'p', 'p.id = op.product_id')
|
|
51
|
+
.leftJoinAndSelect('product_details', 'pd', 'pd.id = op.product_detail_id')
|
|
52
|
+
.leftJoinAndSelect('product_bundles', 'pdb', 'pdb.id = op.product_bundle_id')
|
|
53
|
+
.where('op.release_good_id = :releaseGoodId', { releaseGoodId: releaseGood.id })
|
|
54
|
+
.orderBy('p.sku', 'ASC')
|
|
55
|
+
.orderBy('pd.name', 'ASC')
|
|
56
|
+
.getRawMany();
|
|
57
|
+
let orderProducts = rgOrderProducts.map(src => {
|
|
58
|
+
return {
|
|
59
|
+
id: src.op_id,
|
|
60
|
+
packingType: src.op_packing_type,
|
|
61
|
+
packingSize: src.op_packing_size,
|
|
62
|
+
batchId: src.op_batch_id,
|
|
63
|
+
releaseQty: src.op_release_qty,
|
|
64
|
+
product: src.p_id ? {
|
|
65
|
+
sku: src.p_sku,
|
|
66
|
+
productDetail: {
|
|
67
|
+
refCode: src.pd_ref_code,
|
|
68
|
+
name: src.pd_name
|
|
69
|
+
}
|
|
70
|
+
} : undefined,
|
|
71
|
+
productBundle: src.pdb_id ? {
|
|
72
|
+
sku: src.pdb_sku,
|
|
73
|
+
name: src.pdb_name
|
|
74
|
+
} : undefined
|
|
75
|
+
};
|
|
76
|
+
});
|
|
49
77
|
const rgOrderInventories = await (0, typeorm_1.getRepository)(sales_base_1.OrderInventory).createQueryBuilder('oi')
|
|
50
78
|
.leftJoinAndSelect('products', 'p', 'p.id = oi.product_id')
|
|
51
79
|
.leftJoinAndSelect('product_details', 'pd', 'pd.id = oi.product_detail_id')
|
|
52
|
-
.leftJoinAndSelect('
|
|
53
|
-
.leftJoinAndSelect('product_bundles', 'pdb', 'pdb.id = op.product_bundle_id')
|
|
80
|
+
.leftJoinAndSelect('inventories', 'inv', 'inv.id = oi.inventory_id')
|
|
54
81
|
.leftJoinAndSelect('delivery_orders', 'do', 'do.id = oi.delivery_order_id')
|
|
55
82
|
.where('oi.release_good_id = :releaseGoodId', { releaseGoodId: releaseGood.id })
|
|
56
83
|
.orderBy('p.sku', 'ASC')
|
|
57
84
|
.orderBy('pd.name', 'ASC')
|
|
58
85
|
.getRawMany();
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
.
|
|
62
|
-
|
|
63
|
-
|
|
86
|
+
let rgOrderToteItems;
|
|
87
|
+
if (rgOrderInventories.length > 0) {
|
|
88
|
+
rgOrderToteItems = await (0, typeorm_1.getRepository)(sales_base_1.OrderToteItem).createQueryBuilder('oti')
|
|
89
|
+
.innerJoinAndSelect('oti.orderTote', 'ot')
|
|
90
|
+
.innerJoinAndSelect('ot.orderToteSeals', 'os')
|
|
91
|
+
.where('oti.order_inventory_id In (:...orderInventoryIds)', { orderInventoryIds: rgOrderInventories.map(src => src.oi_id) })
|
|
92
|
+
.getMany();
|
|
93
|
+
}
|
|
64
94
|
// create and format data response
|
|
65
95
|
let orderInventories = rgOrderInventories.map(src => {
|
|
66
96
|
return {
|
|
@@ -69,6 +99,8 @@ api_1.restfulApiRouter.get('/v1/warehouse/get-release-order-details', middleware
|
|
|
69
99
|
packingType: src.oi_packing_type,
|
|
70
100
|
packingSize: src.oi_packing_size,
|
|
71
101
|
batchId: src.oi_batch_id,
|
|
102
|
+
palletId: src.inv_pallet_id,
|
|
103
|
+
cartonId: src.inv_carton_id,
|
|
72
104
|
product: {
|
|
73
105
|
sku: src.p_sku,
|
|
74
106
|
productDetail: {
|
|
@@ -80,20 +112,7 @@ api_1.restfulApiRouter.get('/v1/warehouse/get-release-order-details', middleware
|
|
|
80
112
|
refCode: src.pd_ref_code,
|
|
81
113
|
name: src.pd_name
|
|
82
114
|
},
|
|
83
|
-
|
|
84
|
-
product: {
|
|
85
|
-
sku: src.p_sku,
|
|
86
|
-
productDetail: {
|
|
87
|
-
refCode: src.pd_ref_code,
|
|
88
|
-
name: src.pd_name
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
productBundle: {
|
|
92
|
-
sku: src.pdb_sku,
|
|
93
|
-
name: src.pdb_name
|
|
94
|
-
},
|
|
95
|
-
releaseQty: src.op_releaseQty
|
|
96
|
-
},
|
|
115
|
+
orderProducts: orderProducts.find(op => op.id === src.oi_order_product_id),
|
|
97
116
|
orderToteItems: rgOrderToteItems.filter(oti => oti.orderInventoryId === src.oi_id).map(oti => {
|
|
98
117
|
return {
|
|
99
118
|
qty: oti.qty,
|
|
@@ -223,7 +242,8 @@ api_1.restfulApiRouter.get('/v1/warehouse/get-release-order-details', middleware
|
|
|
223
242
|
phone2: releaseGood.phone2,
|
|
224
243
|
email: releaseGood.email
|
|
225
244
|
},
|
|
226
|
-
|
|
245
|
+
orderProducts: orderProducts.length > 0 ? orderProducts : null,
|
|
246
|
+
orderInventories: orderInventories.length > 0 ? orderInventories : null,
|
|
227
247
|
orderPackages: orderPackages.length > 0 ? orderPackages : null,
|
|
228
248
|
deliveryOrders: deliveryOrders.length > 0 ? deliveryOrders : null,
|
|
229
249
|
attachment: attachments.length > 0 ? attachments : null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-release-order-details.js","sourceRoot":"","sources":["../../../../../../server/routers/api/restful-apis/v1/warehouse/get-release-order-details.ts"],"names":[],"mappings":";;;;;AAAA,oDAAsB;AACtB,qCAAqD;AAErD,6CAAgE;AAChE,qEAA4D;AAC5D,
|
|
1
|
+
{"version":3,"file":"get-release-order-details.js","sourceRoot":"","sources":["../../../../../../server/routers/api/restful-apis/v1/warehouse/get-release-order-details.ts"],"names":[],"mappings":";;;;;AAAA,oDAAsB;AACtB,qCAAqD;AAErD,6CAAgE;AAChE,qEAA4D;AAC5D,2DAAoH;AAEpH,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,MAAM,CAAC,EAAE;YACzB,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;YAC/B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAA;SACtB;QAED,IAAI,gBAAC,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE;YAC5B,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;YACnC,OAAO,MAAM,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KAAK;gBACxB,UAAU,EAAE,WAAW,CAAC,UAAU;gBAClC,OAAO,EAAE,WAAW,CAAC,OAAO;gBAC5B,MAAM,EAAE,WAAW,CAAC,MAAM;gBAC1B,MAAM,EAAE,WAAW,CAAC,MAAM;gBAC1B,KAAK,EAAE,WAAW,CAAC,KAAK;aACzB;YACD,aAAa,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI;YAC9D,gBAAgB,EAAE,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI;YACvE,aAAa,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI;YAC9D,cAAc,EAAE,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI;YACjE,UAAU,EAAE,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;SACxD,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.513",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -77,22 +77,22 @@
|
|
|
77
77
|
"@things-factory/i18n-base": "^4.3.434",
|
|
78
78
|
"@things-factory/import-ui": "^4.3.434",
|
|
79
79
|
"@things-factory/import-ui-excel": "^4.3.434",
|
|
80
|
-
"@things-factory/integration-accounting": "^4.3.
|
|
81
|
-
"@things-factory/integration-fulfillment": "^4.3.
|
|
82
|
-
"@things-factory/integration-lmd": "^4.3.
|
|
83
|
-
"@things-factory/integration-marketplace": "^4.3.
|
|
84
|
-
"@things-factory/integration-pos": "^4.3.
|
|
85
|
-
"@things-factory/integration-powrup": "^4.3.
|
|
86
|
-
"@things-factory/integration-sellercraft": "^4.3.
|
|
87
|
-
"@things-factory/integration-sftp": "^4.3.
|
|
80
|
+
"@things-factory/integration-accounting": "^4.3.512",
|
|
81
|
+
"@things-factory/integration-fulfillment": "^4.3.512",
|
|
82
|
+
"@things-factory/integration-lmd": "^4.3.512",
|
|
83
|
+
"@things-factory/integration-marketplace": "^4.3.512",
|
|
84
|
+
"@things-factory/integration-pos": "^4.3.512",
|
|
85
|
+
"@things-factory/integration-powrup": "^4.3.512",
|
|
86
|
+
"@things-factory/integration-sellercraft": "^4.3.512",
|
|
87
|
+
"@things-factory/integration-sftp": "^4.3.512",
|
|
88
88
|
"@things-factory/lite-menu": "^4.3.452",
|
|
89
|
-
"@things-factory/marketplace-base": "^4.3.
|
|
89
|
+
"@things-factory/marketplace-base": "^4.3.512",
|
|
90
90
|
"@things-factory/more-ui": "^4.3.434",
|
|
91
91
|
"@things-factory/notification": "^4.3.452",
|
|
92
92
|
"@things-factory/pdf": "^4.3.381",
|
|
93
93
|
"@things-factory/product-ui": "^4.3.495",
|
|
94
94
|
"@things-factory/resource-ui": "^4.3.452",
|
|
95
|
-
"@things-factory/sales-base": "^4.3.
|
|
95
|
+
"@things-factory/sales-base": "^4.3.513",
|
|
96
96
|
"@things-factory/scene-data-transform": "^4.3.381",
|
|
97
97
|
"@things-factory/scene-excel": "^4.3.381",
|
|
98
98
|
"@things-factory/scene-firebase": "^4.3.381",
|
|
@@ -108,8 +108,8 @@
|
|
|
108
108
|
"@things-factory/shell": "^4.3.434",
|
|
109
109
|
"@things-factory/system-ui": "^4.3.434",
|
|
110
110
|
"@things-factory/transport-base": "^4.3.452",
|
|
111
|
-
"@things-factory/warehouse-base": "^4.3.
|
|
112
|
-
"@things-factory/worksheet-base": "^4.3.
|
|
111
|
+
"@things-factory/warehouse-base": "^4.3.512",
|
|
112
|
+
"@things-factory/worksheet-base": "^4.3.513",
|
|
113
113
|
"cron-parser": "^4.7.0",
|
|
114
114
|
"koa2-swagger-ui": "^5.0.2",
|
|
115
115
|
"swagger-jsdoc": "^5.0.0",
|
|
@@ -122,5 +122,5 @@
|
|
|
122
122
|
"resolutions": {
|
|
123
123
|
"core-js": "^3.16.0"
|
|
124
124
|
},
|
|
125
|
-
"gitHead": "
|
|
125
|
+
"gitHead": "bafb9b801eed4c3cfb36adc5b8cbbc8fea982506"
|
|
126
126
|
}
|
|
@@ -3,7 +3,7 @@ import { getRepository, QueryBuilder } from 'typeorm'
|
|
|
3
3
|
|
|
4
4
|
import { restfulApiRouter as router } from '@things-factory/api'
|
|
5
5
|
import { Attachment } from '@things-factory/attachment-base'
|
|
6
|
-
import { DeliveryOrder, ReleaseGood, OrderInventory, OrderToteItem } from '@things-factory/sales-base'
|
|
6
|
+
import { DeliveryOrder, ReleaseGood, OrderProduct, OrderInventory, OrderToteItem } from '@things-factory/sales-base'
|
|
7
7
|
|
|
8
8
|
import { businessMiddleware, loggingMiddleware, validationMiddleware } from '../middlewares'
|
|
9
9
|
import { ApiError, ApiErrorHandler, throwInternalServerError } from '../utils/error-util'
|
|
@@ -53,24 +53,56 @@ router.get(
|
|
|
53
53
|
]
|
|
54
54
|
})
|
|
55
55
|
|
|
56
|
-
if (!releaseGood) throw new ApiError('E04', `release order: ${filter['name']}
|
|
56
|
+
if (!releaseGood) throw new ApiError('E04', `release order: ${filter['name']} do not exist.`)
|
|
57
|
+
|
|
58
|
+
const rgOrderProducts: any[] = await getRepository(OrderProduct).createQueryBuilder('op')
|
|
59
|
+
.leftJoinAndSelect('products', 'p', 'p.id = op.product_id')
|
|
60
|
+
.leftJoinAndSelect('product_details', 'pd', 'pd.id = op.product_detail_id')
|
|
61
|
+
.leftJoinAndSelect('product_bundles', 'pdb', 'pdb.id = op.product_bundle_id')
|
|
62
|
+
.where('op.release_good_id = :releaseGoodId', { releaseGoodId: releaseGood.id })
|
|
63
|
+
.orderBy('p.sku', 'ASC')
|
|
64
|
+
.orderBy('pd.name', 'ASC')
|
|
65
|
+
.getRawMany()
|
|
66
|
+
|
|
67
|
+
let orderProducts: OrderProduct[] = rgOrderProducts.map(src => {
|
|
68
|
+
return {
|
|
69
|
+
id: src.op_id,
|
|
70
|
+
packingType: src.op_packing_type,
|
|
71
|
+
packingSize: src.op_packing_size,
|
|
72
|
+
batchId: src.op_batch_id,
|
|
73
|
+
releaseQty: src.op_release_qty,
|
|
74
|
+
product: src.p_id ? {
|
|
75
|
+
sku: src.p_sku,
|
|
76
|
+
productDetail: {
|
|
77
|
+
refCode: src.pd_ref_code,
|
|
78
|
+
name: src.pd_name
|
|
79
|
+
}
|
|
80
|
+
} : undefined,
|
|
81
|
+
productBundle: src.pdb_id ? {
|
|
82
|
+
sku: src.pdb_sku,
|
|
83
|
+
name: src.pdb_name
|
|
84
|
+
} : undefined
|
|
85
|
+
}
|
|
86
|
+
})
|
|
57
87
|
|
|
58
88
|
const rgOrderInventories: any[] = await getRepository(OrderInventory).createQueryBuilder('oi')
|
|
59
89
|
.leftJoinAndSelect('products', 'p', 'p.id = oi.product_id')
|
|
60
90
|
.leftJoinAndSelect('product_details', 'pd', 'pd.id = oi.product_detail_id')
|
|
61
|
-
.leftJoinAndSelect('
|
|
62
|
-
.leftJoinAndSelect('product_bundles', 'pdb', 'pdb.id = op.product_bundle_id')
|
|
91
|
+
.leftJoinAndSelect('inventories', 'inv', 'inv.id = oi.inventory_id')
|
|
63
92
|
.leftJoinAndSelect('delivery_orders', 'do', 'do.id = oi.delivery_order_id')
|
|
64
93
|
.where('oi.release_good_id = :releaseGoodId', { releaseGoodId: releaseGood.id })
|
|
65
94
|
.orderBy('p.sku', 'ASC')
|
|
66
95
|
.orderBy('pd.name', 'ASC')
|
|
67
96
|
.getRawMany()
|
|
68
97
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
.
|
|
72
|
-
|
|
73
|
-
|
|
98
|
+
let rgOrderToteItems: any[]
|
|
99
|
+
if (rgOrderInventories.length > 0) {
|
|
100
|
+
rgOrderToteItems = await getRepository(OrderToteItem).createQueryBuilder('oti')
|
|
101
|
+
.innerJoinAndSelect('oti.orderTote', 'ot')
|
|
102
|
+
.innerJoinAndSelect('ot.orderToteSeals', 'os')
|
|
103
|
+
.where('oti.order_inventory_id In (:...orderInventoryIds)', { orderInventoryIds: rgOrderInventories.map(src => src.oi_id) })
|
|
104
|
+
.getMany()
|
|
105
|
+
}
|
|
74
106
|
|
|
75
107
|
// create and format data response
|
|
76
108
|
let orderInventories: OrderInventory[] = rgOrderInventories.map(src => {
|
|
@@ -80,6 +112,8 @@ router.get(
|
|
|
80
112
|
packingType: src.oi_packing_type,
|
|
81
113
|
packingSize: src.oi_packing_size,
|
|
82
114
|
batchId: src.oi_batch_id,
|
|
115
|
+
palletId: src.inv_pallet_id,
|
|
116
|
+
cartonId: src.inv_carton_id,
|
|
83
117
|
product: {
|
|
84
118
|
sku: src.p_sku,
|
|
85
119
|
productDetail: {
|
|
@@ -91,20 +125,7 @@ router.get(
|
|
|
91
125
|
refCode: src.pd_ref_code,
|
|
92
126
|
name: src.pd_name
|
|
93
127
|
},
|
|
94
|
-
|
|
95
|
-
product: {
|
|
96
|
-
sku: src.p_sku,
|
|
97
|
-
productDetail: {
|
|
98
|
-
refCode: src.pd_ref_code,
|
|
99
|
-
name: src.pd_name
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
productBundle: {
|
|
103
|
-
sku: src.pdb_sku,
|
|
104
|
-
name: src.pdb_name
|
|
105
|
-
},
|
|
106
|
-
releaseQty: src.op_releaseQty
|
|
107
|
-
},
|
|
128
|
+
orderProducts: orderProducts.find(op => op.id === src.oi_order_product_id),
|
|
108
129
|
orderToteItems: rgOrderToteItems.filter(oti => oti.orderInventoryId === src.oi_id).map(oti => {
|
|
109
130
|
return {
|
|
110
131
|
qty: oti.qty,
|
|
@@ -240,7 +261,8 @@ router.get(
|
|
|
240
261
|
phone2: releaseGood.phone2,
|
|
241
262
|
email: releaseGood.email
|
|
242
263
|
},
|
|
243
|
-
|
|
264
|
+
orderProducts: orderProducts.length > 0 ? orderProducts : null,
|
|
265
|
+
orderInventories: orderInventories.length > 0 ? orderInventories : null,
|
|
244
266
|
orderPackages: orderPackages.length > 0 ? orderPackages : null,
|
|
245
267
|
deliveryOrders: deliveryOrders.length > 0 ? deliveryOrders : null,
|
|
246
268
|
attachment: attachments.length > 0 ? attachments : null
|