@things-factory/sales-base 4.3.82 → 4.3.83
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 +5 -6
- package/dist-server/service/arrival-notice/arrival-notice-mutation.js.map +1 -1
- package/dist-server/service/arrival-notice/arrival-notice.js +0 -5
- package/dist-server/service/arrival-notice/arrival-notice.js.map +1 -1
- package/dist-server/service/draft-release-good/draft-release-good-mutation.js +8 -3
- 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 +7 -4
- 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 +0 -5
- package/dist-server/service/draft-release-good/draft-release-good.js.map +1 -1
- package/dist-server/service/invoice-product/invoice-product.js +3 -8
- package/dist-server/service/invoice-product/invoice-product.js.map +1 -1
- package/dist-server/service/order-inventory/order-inventory-query.js +1 -2
- package/dist-server/service/order-inventory/order-inventory-query.js.map +1 -1
- package/dist-server/service/order-inventory/order-inventory-types.js +10 -18
- package/dist-server/service/order-inventory/order-inventory-types.js.map +1 -1
- package/dist-server/service/order-inventory/order-inventory.js +3 -12
- package/dist-server/service/order-inventory/order-inventory.js.map +1 -1
- package/dist-server/service/order-product/order-product-query.js +0 -1
- package/dist-server/service/order-product/order-product-query.js.map +1 -1
- package/dist-server/service/order-product/order-product-types.js +10 -18
- package/dist-server/service/order-product/order-product-types.js.map +1 -1
- package/dist-server/service/order-vas/order-vas.js +3 -8
- package/dist-server/service/order-vas/order-vas.js.map +1 -1
- package/dist-server/service/others/other-query.js +21 -17
- package/dist-server/service/others/other-query.js.map +1 -1
- package/dist-server/service/others/other-types.js +0 -4
- package/dist-server/service/others/other-types.js.map +1 -1
- package/dist-server/service/purchase-order/purchase-order-mutation.js +2 -10
- package/dist-server/service/purchase-order/purchase-order-mutation.js.map +1 -1
- package/dist-server/service/purchase-order/purchase-order-query.js +0 -1
- package/dist-server/service/purchase-order/purchase-order-query.js.map +1 -1
- package/dist-server/service/release-good/release-good-mutation.js +49 -187
- package/dist-server/service/release-good/release-good-mutation.js.map +1 -1
- package/dist-server/service/release-good/release-good-query.js +6 -4
- package/dist-server/service/release-good/release-good-query.js.map +1 -1
- package/dist-server/service/release-good/release-good-types.js +4 -8
- package/dist-server/service/release-good/release-good-types.js.map +1 -1
- package/dist-server/service/release-good/release-good.js +0 -5
- package/dist-server/service/release-good/release-good.js.map +1 -1
- package/dist-server/service/return-order/return-order-mutation.js +0 -2
- 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 +3 -8
- package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js.map +1 -1
- package/dist-server/utils/inventory-util.js +102 -33
- package/dist-server/utils/inventory-util.js.map +1 -1
- package/package.json +13 -13
- package/server/service/arrival-notice/arrival-notice-mutation.ts +3 -6
- package/server/service/arrival-notice/arrival-notice.ts +0 -4
- package/server/service/draft-release-good/draft-release-good-mutation.ts +12 -10
- package/server/service/draft-release-good/draft-release-good-query.ts +5 -5
- package/server/service/draft-release-good/draft-release-good.ts +0 -4
- package/server/service/invoice-product/invoice-product.ts +1 -5
- package/server/service/order-inventory/order-inventory-query.ts +0 -2
- package/server/service/order-inventory/order-inventory-types.ts +0 -6
- package/server/service/order-inventory/order-inventory.ts +1 -8
- package/server/service/order-product/order-product-query.ts +0 -1
- package/server/service/order-product/order-product-types.ts +0 -6
- package/server/service/order-vas/order-vas.ts +1 -6
- package/server/service/others/other-query.ts +31 -30
- package/server/service/others/other-types.ts +0 -3
- package/server/service/purchase-order/purchase-order-mutation.ts +1 -10
- package/server/service/purchase-order/purchase-order-query.ts +0 -1
- package/server/service/release-good/release-good-mutation.ts +50 -221
- package/server/service/release-good/release-good-query.ts +7 -4
- package/server/service/release-good/release-good-types.ts +3 -4
- package/server/service/release-good/release-good.ts +6 -8
- package/server/service/return-order/return-order-mutation.ts +1 -3
- package/server/service/return-order/return-order-types.ts +0 -1
- package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.ts +1 -5
- package/server/utils/inventory-util.ts +147 -67
|
@@ -286,7 +286,6 @@ 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')
|
|
290
289
|
.leftJoinAndSelect('oi.creator', 'creator')
|
|
291
290
|
.leftJoinAndSelect('oi.updater', 'updater')
|
|
292
291
|
|
|
@@ -300,7 +299,6 @@ export class OrderInventoryQuery {
|
|
|
300
299
|
releaseGoodName: item.releaseGood.name,
|
|
301
300
|
palletId: item.inventory.palletId,
|
|
302
301
|
productId: item.inventory.product.id,
|
|
303
|
-
productDetailId: item.inventory.productDetail.id,
|
|
304
302
|
productName: item.inventory.product.name,
|
|
305
303
|
productSKU: item.inventory.product.sku,
|
|
306
304
|
productBrand: item.inventory.product.brand,
|
|
@@ -41,9 +41,6 @@ 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
|
-
|
|
47
44
|
@Field({ nullable: true })
|
|
48
45
|
productSKU: string
|
|
49
46
|
|
|
@@ -203,9 +200,6 @@ export class OrderInventoryPatch {
|
|
|
203
200
|
@Field({ nullable: true })
|
|
204
201
|
productId: string
|
|
205
202
|
|
|
206
|
-
@Field({ nullable: true })
|
|
207
|
-
productDetailId: string
|
|
208
|
-
|
|
209
203
|
@Field({ nullable: true })
|
|
210
204
|
orderProductId: string
|
|
211
205
|
|
|
@@ -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
|
|
16
|
+
import { Product } 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,13 +341,6 @@ 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
|
-
|
|
351
344
|
@Field({ nullable: true })
|
|
352
345
|
dispatchedAt: Date
|
|
353
346
|
|
|
@@ -26,7 +26,6 @@ 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')
|
|
30
29
|
.leftJoinAndSelect('op.domain', 'domain')
|
|
31
30
|
.leftJoinAndSelect('op.bizplace', 'bizplace')
|
|
32
31
|
.leftJoinAndSelect('bizplace.company', 'company')
|
|
@@ -84,9 +84,6 @@ 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
|
-
|
|
90
87
|
@Field(type => InboundProduct, { nullable: true })
|
|
91
88
|
product: InboundProduct
|
|
92
89
|
|
|
@@ -228,9 +225,6 @@ export class NewOrderProduct {
|
|
|
228
225
|
@Field(type => ObjectRef, { nullable: true })
|
|
229
226
|
toInventory: ObjectRef
|
|
230
227
|
|
|
231
|
-
@Field(type => ObjectRef, { nullable: true })
|
|
232
|
-
productDetail: ObjectRef
|
|
233
|
-
|
|
234
228
|
@Field(type => InboundProduct, { nullable: true })
|
|
235
229
|
product: InboundProduct
|
|
236
230
|
|
|
@@ -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
|
|
15
|
+
import { Product } 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,10 +200,6 @@ 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
|
-
|
|
207
203
|
@ManyToOne(type => User)
|
|
208
204
|
@Field(type => User, { nullable: true })
|
|
209
205
|
creator: User
|
|
@@ -217,5 +213,4 @@ export class OrderVas {
|
|
|
217
213
|
|
|
218
214
|
@RelationId((orderVas: OrderVas) => orderVas.updater)
|
|
219
215
|
updaterId: string
|
|
220
|
-
|
|
221
216
|
}
|
|
@@ -205,30 +205,32 @@ export class OtherQuery {
|
|
|
205
205
|
|
|
206
206
|
let packageUomValue = availableItem ? availableItem.remainUomValue / availableItem.remainQty : null
|
|
207
207
|
const newOrderInventory: any = {
|
|
208
|
-
product:
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
? {
|
|
214
|
-
...items[0],
|
|
215
|
-
remainQty: total > 0 ? items[0].remainQty : null,
|
|
216
|
-
remainUomValue: total > 0 ? items[0].remainUomValue : null,
|
|
217
|
-
remainUomValueWithUom: total > 0 ? items[0].remainUomValueWithUom : ''
|
|
208
|
+
product: availableItem
|
|
209
|
+
? {
|
|
210
|
+
id: availableItem.productId,
|
|
211
|
+
sku: availableItem.productSKU,
|
|
212
|
+
name: availableItem.productName
|
|
218
213
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
214
|
+
: { id: null },
|
|
215
|
+
inventory: availableItem
|
|
216
|
+
? {
|
|
217
|
+
...availableItem,
|
|
218
|
+
remainQty: availableItem ? availableItem.remainQty : null,
|
|
219
|
+
remainUomValue: availableItem ? availableItem.remainUomValue : null,
|
|
220
|
+
remainUomValueWithUom: availableItem ? availableItem.remainUomValueWithUom : ''
|
|
221
|
+
}
|
|
222
|
+
: null,
|
|
223
|
+
productId: availableItem ? availableItem.productId : null,
|
|
224
|
+
productSKU: availableItem ? availableItem.productSKU : orderInventory.productSKU,
|
|
225
|
+
productName: availableItem ? availableItem.productName : null,
|
|
226
|
+
uom: availableItem ? availableItem.uom : null,
|
|
227
|
+
remainQty: availableItem ? availableItem.remainQty : null,
|
|
228
|
+
remainUomValue: availableItem ? availableItem.remainUomValue : null,
|
|
229
|
+
remainUomValueWithUom: availableItem ? availableItem.remainUomValueWithUom : '',
|
|
230
|
+
batchId: availableItem ? availableItem.batchId : null,
|
|
231
|
+
batchIdRef: availableItem ? availableItem.batchIdRef : null,
|
|
232
|
+
packingType: availableItem ? availableItem.packingType : orderInventory.packingType,
|
|
233
|
+
packingSize: availableItem ? availableItem.packingSize : 1,
|
|
232
234
|
releaseQty: orderInventory.releaseQty
|
|
233
235
|
? Number.isInteger(orderInventory.releaseQty)
|
|
234
236
|
? orderInventory.releaseQty
|
|
@@ -352,7 +354,7 @@ export class OtherQuery {
|
|
|
352
354
|
let productDetail: ProductDetail
|
|
353
355
|
const hasConditions: boolean = Boolean(
|
|
354
356
|
(orderProduct?.packingType && orderProduct?.packingType.trim() != '') ||
|
|
355
|
-
|
|
357
|
+
(orderProduct?.uom && orderProduct?.uom.trim() != '')
|
|
356
358
|
)
|
|
357
359
|
let productDetailCondition: any = { product: foundProduct }
|
|
358
360
|
|
|
@@ -375,8 +377,8 @@ export class OtherQuery {
|
|
|
375
377
|
? productDetail.uomValue
|
|
376
378
|
: null
|
|
377
379
|
: orderProduct?.uomValue
|
|
378
|
-
|
|
379
|
-
|
|
380
|
+
? orderProduct.uomValue
|
|
381
|
+
: productDetail.uomValue
|
|
380
382
|
|
|
381
383
|
newOrderProduct = {
|
|
382
384
|
...orderProduct,
|
|
@@ -482,7 +484,7 @@ export class OtherQuery {
|
|
|
482
484
|
let productDetail: ProductDetail
|
|
483
485
|
const hasConditions: boolean = Boolean(
|
|
484
486
|
(orderProduct?.packingType && orderProduct?.packingType.trim() != '') ||
|
|
485
|
-
|
|
487
|
+
(orderProduct?.uom && orderProduct?.uom.trim() != '')
|
|
486
488
|
)
|
|
487
489
|
let productDetailCondition: any = { product: foundProduct }
|
|
488
490
|
|
|
@@ -505,8 +507,8 @@ export class OtherQuery {
|
|
|
505
507
|
? productDetail.uomValue
|
|
506
508
|
: null
|
|
507
509
|
: orderProduct?.uomValue
|
|
508
|
-
|
|
509
|
-
|
|
510
|
+
? orderProduct.uomValue
|
|
511
|
+
: productDetail.uomValue
|
|
510
512
|
|
|
511
513
|
newOrderProduct = {
|
|
512
514
|
...orderProduct,
|
|
@@ -526,7 +528,6 @@ export class OtherQuery {
|
|
|
526
528
|
primaryUnit: productDetail?.uom ? productDetail.uom : null,
|
|
527
529
|
primaryValue: productDetail?.uomValue ? productDetail.uomValue : null
|
|
528
530
|
},
|
|
529
|
-
productDetail,
|
|
530
531
|
totalUomValue:
|
|
531
532
|
orderProduct.packQty > 0
|
|
532
533
|
? uomValue
|
|
@@ -69,14 +69,7 @@ export class PurchaseOrderMutation {
|
|
|
69
69
|
|
|
70
70
|
const findPurchaseOrder: PurchaseOrder = await getRepository(PurchaseOrder).findOne({
|
|
71
71
|
where: { domain, id },
|
|
72
|
-
relations: [
|
|
73
|
-
'orderProducts',
|
|
74
|
-
'orderProducts.product',
|
|
75
|
-
'orderProducts.productDetail',
|
|
76
|
-
'bufferLocation',
|
|
77
|
-
'bizplace',
|
|
78
|
-
'domain'
|
|
79
|
-
]
|
|
72
|
+
relations: ['orderProducts', 'orderProducts.product', 'bufferLocation', 'bizplace', 'domain']
|
|
80
73
|
})
|
|
81
74
|
|
|
82
75
|
// const findPurchaseOrder: PurchaseOrder = await tx.getRepository(PurchaseOrder).findOne({id}, { relations:['bizplace']})
|
|
@@ -425,7 +418,6 @@ export async function upsertPurchaseOrderProducts(
|
|
|
425
418
|
const bizplaceRepo: Repository<Product> = tx?.getRepository(Bizplace) || getRepository(Bizplace)
|
|
426
419
|
const orderProductRepo: Repository<OrderProduct> = tx?.getRepository(OrderProduct) || getRepository(OrderProduct)
|
|
427
420
|
const productRepo: Repository<Product> = tx?.getRepository(Product) || getRepository(Product)
|
|
428
|
-
const productDetailRepo: Repository<Product> = tx?.getRepository(ProductDetail) || getRepository(ProductDetail)
|
|
429
421
|
|
|
430
422
|
// // Remove all existing order products that do not exist in current input
|
|
431
423
|
let removeOP = purchaseOrder.orderProducts.filter(
|
|
@@ -451,7 +443,6 @@ export async function upsertPurchaseOrderProducts(
|
|
|
451
443
|
bizplace: bizplace,
|
|
452
444
|
name: op?.id ? op.name : OrderNoGenerator.orderProduct(),
|
|
453
445
|
product: await productRepo.findOne(op.product.id),
|
|
454
|
-
productDetail: await productDetailRepo.findOne(op.productDetail.id),
|
|
455
446
|
packingSize: foundProductDetail?.packingSize || 1,
|
|
456
447
|
purchaseOrder: purchaseOrder,
|
|
457
448
|
status: purchaseOrder.status,
|