@things-factory/sales-base 4.3.79 → 4.3.80-alpha.0
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/service/arrival-notice/arrival-notice-mutation.js +6 -5
- package/dist-server/service/arrival-notice/arrival-notice-mutation.js.map +1 -1
- package/dist-server/service/arrival-notice/arrival-notice.js +5 -0
- package/dist-server/service/arrival-notice/arrival-notice.js.map +1 -1
- package/dist-server/service/draft-release-good/draft-release-good-mutation.js +3 -8
- package/dist-server/service/draft-release-good/draft-release-good-mutation.js.map +1 -1
- package/dist-server/service/draft-release-good/draft-release-good-query.js +4 -7
- package/dist-server/service/draft-release-good/draft-release-good-query.js.map +1 -1
- package/dist-server/service/draft-release-good/draft-release-good.js +5 -0
- package/dist-server/service/draft-release-good/draft-release-good.js.map +1 -1
- package/dist-server/service/invoice-product/invoice-product.js +8 -3
- package/dist-server/service/invoice-product/invoice-product.js.map +1 -1
- package/dist-server/service/order-inventory/order-inventory-query.js +2 -1
- package/dist-server/service/order-inventory/order-inventory-query.js.map +1 -1
- package/dist-server/service/order-inventory/order-inventory-types.js +18 -10
- package/dist-server/service/order-inventory/order-inventory-types.js.map +1 -1
- package/dist-server/service/order-inventory/order-inventory.js +12 -3
- package/dist-server/service/order-inventory/order-inventory.js.map +1 -1
- package/dist-server/service/order-product/order-product-query.js +1 -0
- package/dist-server/service/order-product/order-product-query.js.map +1 -1
- package/dist-server/service/order-product/order-product-types.js +18 -10
- package/dist-server/service/order-product/order-product-types.js.map +1 -1
- package/dist-server/service/order-vas/order-vas.js +8 -3
- package/dist-server/service/order-vas/order-vas.js.map +1 -1
- package/dist-server/service/others/other-query.js +21 -32
- package/dist-server/service/others/other-query.js.map +1 -1
- package/dist-server/service/others/other-types.js +4 -0
- package/dist-server/service/others/other-types.js.map +1 -1
- package/dist-server/service/purchase-order/purchase-order-mutation.js +10 -2
- package/dist-server/service/purchase-order/purchase-order-mutation.js.map +1 -1
- package/dist-server/service/purchase-order/purchase-order-query.js +1 -0
- package/dist-server/service/purchase-order/purchase-order-query.js.map +1 -1
- package/dist-server/service/release-good/release-good-mutation.js +187 -49
- package/dist-server/service/release-good/release-good-mutation.js.map +1 -1
- package/dist-server/service/release-good/release-good-query.js +4 -6
- package/dist-server/service/release-good/release-good-query.js.map +1 -1
- package/dist-server/service/release-good/release-good-types.js +8 -4
- package/dist-server/service/release-good/release-good-types.js.map +1 -1
- package/dist-server/service/release-good/release-good.js +5 -0
- package/dist-server/service/release-good/release-good.js.map +1 -1
- package/dist-server/service/return-order/return-order-mutation.js +2 -0
- package/dist-server/service/return-order/return-order-mutation.js.map +1 -1
- package/dist-server/service/return-order/return-order-types.js.map +1 -1
- package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js +8 -3
- package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js.map +1 -1
- package/dist-server/utils/inventory-util.js +33 -102
- package/dist-server/utils/inventory-util.js.map +1 -1
- package/package.json +13 -13
- package/server/service/arrival-notice/arrival-notice-mutation.ts +6 -3
- package/server/service/arrival-notice/arrival-notice.ts +4 -0
- package/server/service/draft-release-good/draft-release-good-mutation.ts +10 -12
- package/server/service/draft-release-good/draft-release-good-query.ts +5 -5
- package/server/service/draft-release-good/draft-release-good.ts +4 -0
- package/server/service/invoice-product/invoice-product.ts +5 -1
- package/server/service/order-inventory/order-inventory-query.ts +2 -0
- package/server/service/order-inventory/order-inventory-types.ts +6 -0
- package/server/service/order-inventory/order-inventory.ts +8 -1
- package/server/service/order-product/order-product-query.ts +1 -0
- package/server/service/order-product/order-product-types.ts +6 -0
- package/server/service/order-vas/order-vas.ts +6 -1
- package/server/service/others/other-query.ts +34 -43
- package/server/service/others/other-types.ts +3 -0
- package/server/service/purchase-order/purchase-order-mutation.ts +10 -1
- package/server/service/purchase-order/purchase-order-query.ts +1 -0
- package/server/service/release-good/release-good-mutation.ts +221 -50
- package/server/service/release-good/release-good-query.ts +4 -7
- package/server/service/release-good/release-good-types.ts +4 -3
- package/server/service/release-good/release-good.ts +8 -6
- package/server/service/return-order/return-order-mutation.ts +3 -1
- package/server/service/return-order/return-order-types.ts +1 -0
- package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.ts +5 -1
- package/server/utils/inventory-util.ts +67 -147
|
@@ -286,6 +286,7 @@ export class OrderInventoryQuery {
|
|
|
286
286
|
.leftJoinAndSelect('oi.bizplace', 'bizplace')
|
|
287
287
|
.leftJoinAndSelect('oi.inventory', 'inventory')
|
|
288
288
|
.leftJoinAndSelect('inventory.product', 'product')
|
|
289
|
+
.leftJoinAndSelect('inventory.productDetail', 'productDetail')
|
|
289
290
|
.leftJoinAndSelect('oi.creator', 'creator')
|
|
290
291
|
.leftJoinAndSelect('oi.updater', 'updater')
|
|
291
292
|
|
|
@@ -299,6 +300,7 @@ export class OrderInventoryQuery {
|
|
|
299
300
|
releaseGoodName: item.releaseGood.name,
|
|
300
301
|
palletId: item.inventory.palletId,
|
|
301
302
|
productId: item.inventory.product.id,
|
|
303
|
+
productDetailId: item.inventory.productDetail.id,
|
|
302
304
|
productName: item.inventory.product.name,
|
|
303
305
|
productSKU: item.inventory.product.sku,
|
|
304
306
|
productBrand: item.inventory.product.brand,
|
|
@@ -41,6 +41,9 @@ export class NewOrderInventory {
|
|
|
41
41
|
@Field(type => NewProduct, { nullable: true })
|
|
42
42
|
product: NewProduct
|
|
43
43
|
|
|
44
|
+
@Field(type => ObjectRef, { nullable: true })
|
|
45
|
+
productDetail: ObjectRef
|
|
46
|
+
|
|
44
47
|
@Field({ nullable: true })
|
|
45
48
|
productSKU: string
|
|
46
49
|
|
|
@@ -200,6 +203,9 @@ export class OrderInventoryPatch {
|
|
|
200
203
|
@Field({ nullable: true })
|
|
201
204
|
productId: string
|
|
202
205
|
|
|
206
|
+
@Field({ nullable: true })
|
|
207
|
+
productDetailId: string
|
|
208
|
+
|
|
203
209
|
@Field({ nullable: true })
|
|
204
210
|
orderProductId: string
|
|
205
211
|
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
import { User } from '@things-factory/auth-base'
|
|
15
15
|
import { Bizplace } from '@things-factory/biz-base'
|
|
16
|
-
import { Product } from '@things-factory/product-base'
|
|
16
|
+
import { Product, ProductDetail} from '@things-factory/product-base'
|
|
17
17
|
import { Domain } from '@things-factory/shell'
|
|
18
18
|
import { Inventory, Location } from '@things-factory/warehouse-base'
|
|
19
19
|
|
|
@@ -341,6 +341,13 @@ export class OrderInventory {
|
|
|
341
341
|
@Field({ nullable: true })
|
|
342
342
|
loadedAt: Date
|
|
343
343
|
|
|
344
|
+
@ManyToOne(type => ProductDetail, { nullable: true })
|
|
345
|
+
@Field({ nullable: true })
|
|
346
|
+
productDetail: ProductDetail
|
|
347
|
+
|
|
348
|
+
@Field({ nullable: true })
|
|
349
|
+
productDetailId: String
|
|
350
|
+
|
|
344
351
|
@Field({ nullable: true })
|
|
345
352
|
dispatchedAt: Date
|
|
346
353
|
|
|
@@ -26,6 +26,7 @@ export class OrderProductQuery {
|
|
|
26
26
|
|
|
27
27
|
let qb: SelectQueryBuilder<OrderProduct> = await getRepository(OrderProduct).createQueryBuilder('op')
|
|
28
28
|
qb.leftJoinAndSelect('op.product', 'product')
|
|
29
|
+
.leftJoinAndSelect('op.productDetail', 'productDetail')
|
|
29
30
|
.leftJoinAndSelect('op.domain', 'domain')
|
|
30
31
|
.leftJoinAndSelect('op.bizplace', 'bizplace')
|
|
31
32
|
.leftJoinAndSelect('bizplace.company', 'company')
|
|
@@ -84,6 +84,9 @@ export class OrderProductPatch {
|
|
|
84
84
|
@Field(type => ObjectRef, { nullable: true })
|
|
85
85
|
toInventory: ObjectRef
|
|
86
86
|
|
|
87
|
+
@Field(type => ObjectRef, { nullable: true })
|
|
88
|
+
productDetail: ObjectRef
|
|
89
|
+
|
|
87
90
|
@Field(type => InboundProduct, { nullable: true })
|
|
88
91
|
product: InboundProduct
|
|
89
92
|
|
|
@@ -225,6 +228,9 @@ export class NewOrderProduct {
|
|
|
225
228
|
@Field(type => ObjectRef, { nullable: true })
|
|
226
229
|
toInventory: ObjectRef
|
|
227
230
|
|
|
231
|
+
@Field(type => ObjectRef, { nullable: true })
|
|
232
|
+
productDetail: ObjectRef
|
|
233
|
+
|
|
228
234
|
@Field(type => InboundProduct, { nullable: true })
|
|
229
235
|
product: InboundProduct
|
|
230
236
|
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
import { User } from '@things-factory/auth-base'
|
|
14
14
|
import { Bizplace } from '@things-factory/biz-base'
|
|
15
|
-
import { Product } from '@things-factory/product-base'
|
|
15
|
+
import { Product, ProductDetail } from '@things-factory/product-base'
|
|
16
16
|
import { Domain } from '@things-factory/shell'
|
|
17
17
|
import { Inventory } from '@things-factory/warehouse-base'
|
|
18
18
|
|
|
@@ -200,6 +200,10 @@ export class OrderVas {
|
|
|
200
200
|
@Field()
|
|
201
201
|
updatedAt: Date
|
|
202
202
|
|
|
203
|
+
@ManyToOne(type => ProductDetail, { nullable: true })
|
|
204
|
+
@Field({ nullable: true })
|
|
205
|
+
productDetail: ProductDetail
|
|
206
|
+
|
|
203
207
|
@ManyToOne(type => User)
|
|
204
208
|
@Field(type => User, { nullable: true })
|
|
205
209
|
creator: User
|
|
@@ -213,4 +217,5 @@ export class OrderVas {
|
|
|
213
217
|
|
|
214
218
|
@RelationId((orderVas: OrderVas) => orderVas.updater)
|
|
215
219
|
updaterId: string
|
|
220
|
+
|
|
216
221
|
}
|
|
@@ -195,59 +195,49 @@ export class OtherQuery {
|
|
|
195
195
|
|
|
196
196
|
const { items, total } = await InventoryUtil.bizplaceInventoryProductGroup(bizplaces, params, context, tx)
|
|
197
197
|
|
|
198
|
-
|
|
199
|
-
const availableItems = items.filter(item => item.remainQty >= orderInventory.releaseQty)
|
|
200
|
-
let availableItem
|
|
198
|
+
let packageUomValue = total > 0 ? items[0].remainUomValue / items[0].remainQty : null
|
|
201
199
|
|
|
202
|
-
if (availableItems.length > 0) {
|
|
203
|
-
availableItem = availableItems[0]
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
let packageUomValue = availableItem ? availableItem.remainUomValue / availableItem.remainQty : null
|
|
207
200
|
const newOrderInventory: any = {
|
|
208
|
-
product:
|
|
209
|
-
? {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
packingType: availableItem ? availableItem.packingType : orderInventory.packingType,
|
|
233
|
-
packingSize: availableItem ? availableItem.packingSize : 1,
|
|
201
|
+
product:
|
|
202
|
+
total > 0 ? { id: items[0].productId, sku: items[0].productSKU, name: items[0].productName } : { id: null },
|
|
203
|
+
productDetail: total > 0 ? { id: items[0].productDetailId } : { id: null },
|
|
204
|
+
inventory:
|
|
205
|
+
total > 0
|
|
206
|
+
? {
|
|
207
|
+
...items[0],
|
|
208
|
+
remainQty: total > 0 ? items[0].remainQty : null,
|
|
209
|
+
remainUomValue: total > 0 ? items[0].remainUomValue : null,
|
|
210
|
+
remainUomValueWithUom: total > 0 ? items[0].remainUomValueWithUom : ''
|
|
211
|
+
}
|
|
212
|
+
: null,
|
|
213
|
+
productId: total > 0 ? items[0].productId : null,
|
|
214
|
+
productDetailID: total > 0 ? items[0].productDetailId : null,
|
|
215
|
+
productSKU: total > 0 ? items[0].productSKU : orderInventory.productSKU,
|
|
216
|
+
productName: total > 0 ? items[0].productName : null,
|
|
217
|
+
uom: total > 0 ? items[0].uom : null,
|
|
218
|
+
remainQty: total > 0 ? items[0].remainQty : null,
|
|
219
|
+
remainUomValue: total > 0 ? items[0].remainUomValue : null,
|
|
220
|
+
remainUomValueWithUom: total > 0 ? items[0].remainUomValueWithUom : '',
|
|
221
|
+
batchId: total > 0 ? items[0].batchId : null,
|
|
222
|
+
batchIdRef: total > 0 ? items[0].batchIdRef : null,
|
|
223
|
+
packingType: total > 0 ? items[0].packingType : orderInventory.packingType,
|
|
224
|
+
packingSize: total > 0 ? items[0].packingSize : 1,
|
|
234
225
|
releaseQty: orderInventory.releaseQty
|
|
235
226
|
? Number.isInteger(orderInventory.releaseQty)
|
|
236
227
|
? orderInventory.releaseQty
|
|
237
228
|
: null
|
|
238
229
|
: null,
|
|
239
|
-
releaseUomValue:
|
|
240
|
-
|
|
241
|
-
?
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
230
|
+
releaseUomValue:
|
|
231
|
+
total > 0
|
|
232
|
+
? Number.isInteger(orderInventory.releaseQty)
|
|
233
|
+
? parseFloat((orderInventory.releaseQty * packageUomValue).toFixed(2))
|
|
234
|
+
: null
|
|
235
|
+
: null,
|
|
236
|
+
groupType: total > 0 ? items[0].groupType : null,
|
|
237
|
+
isError: total <= 0 ? true : false
|
|
246
238
|
}
|
|
247
239
|
|
|
248
240
|
newOrderInventories.push(newOrderInventory)
|
|
249
|
-
|
|
250
|
-
// end loop
|
|
251
241
|
}
|
|
252
242
|
|
|
253
243
|
try {
|
|
@@ -528,6 +518,7 @@ export class OtherQuery {
|
|
|
528
518
|
primaryUnit: productDetail?.uom ? productDetail.uom : null,
|
|
529
519
|
primaryValue: productDetail?.uomValue ? productDetail.uomValue : null
|
|
530
520
|
},
|
|
521
|
+
productDetail,
|
|
531
522
|
totalUomValue:
|
|
532
523
|
orderProduct.packQty > 0
|
|
533
524
|
? uomValue
|
|
@@ -69,7 +69,14 @@ export class PurchaseOrderMutation {
|
|
|
69
69
|
|
|
70
70
|
const findPurchaseOrder: PurchaseOrder = await getRepository(PurchaseOrder).findOne({
|
|
71
71
|
where: { domain, id },
|
|
72
|
-
relations: [
|
|
72
|
+
relations: [
|
|
73
|
+
'orderProducts',
|
|
74
|
+
'orderProducts.product',
|
|
75
|
+
'orderProducts.productDetail',
|
|
76
|
+
'bufferLocation',
|
|
77
|
+
'bizplace',
|
|
78
|
+
'domain'
|
|
79
|
+
]
|
|
73
80
|
})
|
|
74
81
|
|
|
75
82
|
// const findPurchaseOrder: PurchaseOrder = await tx.getRepository(PurchaseOrder).findOne({id}, { relations:['bizplace']})
|
|
@@ -418,6 +425,7 @@ export async function upsertPurchaseOrderProducts(
|
|
|
418
425
|
const bizplaceRepo: Repository<Product> = tx?.getRepository(Bizplace) || getRepository(Bizplace)
|
|
419
426
|
const orderProductRepo: Repository<OrderProduct> = tx?.getRepository(OrderProduct) || getRepository(OrderProduct)
|
|
420
427
|
const productRepo: Repository<Product> = tx?.getRepository(Product) || getRepository(Product)
|
|
428
|
+
const productDetailRepo: Repository<Product> = tx?.getRepository(ProductDetail) || getRepository(ProductDetail)
|
|
421
429
|
|
|
422
430
|
// // Remove all existing order products that do not exist in current input
|
|
423
431
|
let removeOP = purchaseOrder.orderProducts.filter(
|
|
@@ -443,6 +451,7 @@ export async function upsertPurchaseOrderProducts(
|
|
|
443
451
|
bizplace: bizplace,
|
|
444
452
|
name: op?.id ? op.name : OrderNoGenerator.orderProduct(),
|
|
445
453
|
product: await productRepo.findOne(op.product.id),
|
|
454
|
+
productDetail: await productDetailRepo.findOne(op.productDetail.id),
|
|
446
455
|
packingSize: foundProductDetail?.packingSize || 1,
|
|
447
456
|
purchaseOrder: purchaseOrder,
|
|
448
457
|
status: purchaseOrder.status,
|