@things-factory/sales-base 4.3.81 → 4.3.82
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-query.js.map +1 -1
- package/dist-server/service/arrival-notice/arrival-notice-types.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/claim/claim-mutation.js.map +1 -1
- package/dist-server/service/claim/claim-query.js.map +1 -1
- package/dist-server/service/claim/claim-types.js.map +1 -1
- package/dist-server/service/claim/claim.js.map +1 -1
- package/dist-server/service/claim-detail/claim-detail-mutation.js.map +1 -1
- package/dist-server/service/claim-detail/claim-detail-query.js.map +1 -1
- package/dist-server/service/claim-detail/claim-detail-types.js.map +1 -1
- package/dist-server/service/claim-detail/claim-detail.js.map +1 -1
- package/dist-server/service/claim-order/claim-order-mutation.js.map +1 -1
- package/dist-server/service/claim-order/claim-order-query.js.map +1 -1
- package/dist-server/service/claim-order/claim-order-types.js.map +1 -1
- package/dist-server/service/claim-order/claim-order.js.map +1 -1
- package/dist-server/service/collection-order/collection-order-mutation.js.map +1 -1
- package/dist-server/service/collection-order/collection-order-query.js.map +1 -1
- package/dist-server/service/collection-order/collection-order-types.js.map +1 -1
- package/dist-server/service/collection-order/collection-order.js.map +1 -1
- package/dist-server/service/delivery-order/delivery-order-mutation.js.map +1 -1
- package/dist-server/service/delivery-order/delivery-order-query.js.map +1 -1
- package/dist-server/service/delivery-order/delivery-order-types.js.map +1 -1
- package/dist-server/service/delivery-order/delivery-order.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-type.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/goods-receival-note/goods-receival-note-mutation.js.map +1 -1
- package/dist-server/service/goods-receival-note/goods-receival-note-query.js.map +1 -1
- package/dist-server/service/goods-receival-note/goods-receival-note-types.js.map +1 -1
- package/dist-server/service/goods-receival-note/goods-receival-note.js.map +1 -1
- package/dist-server/service/inventory-check/inventory-check-mutation.js.map +1 -1
- package/dist-server/service/inventory-check/inventory-check-query.js.map +1 -1
- package/dist-server/service/inventory-check/inventory-check-types.js.map +1 -1
- package/dist-server/service/inventory-check/inventory-check.js.map +1 -1
- package/dist-server/service/invoice/invoice-mutation.js.map +1 -1
- package/dist-server/service/invoice/invoice-query.js.map +1 -1
- package/dist-server/service/invoice/invoice-types.js.map +1 -1
- package/dist-server/service/invoice/invoice.js.map +1 -1
- package/dist-server/service/invoice-product/invoice-product-mutation.js.map +1 -1
- package/dist-server/service/invoice-product/invoice-product-query.js.map +1 -1
- package/dist-server/service/invoice-product/invoice-product-types.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/job-sheet/job-sheet-mutation.js.map +1 -1
- package/dist-server/service/job-sheet/job-sheet-query.js.map +1 -1
- package/dist-server/service/job-sheet/job-sheet-types.js.map +1 -1
- package/dist-server/service/job-sheet/job-sheet.js.map +1 -1
- package/dist-server/service/manifest/manifest-mutation.js.map +1 -1
- package/dist-server/service/manifest/manifest-query.js.map +1 -1
- package/dist-server/service/manifest/manifest-type.js.map +1 -1
- package/dist-server/service/manifest/manifest.js.map +1 -1
- package/dist-server/service/order-inventory/order-inventory-mutation.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-mutation.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-product/order-product.js.map +1 -1
- package/dist-server/service/order-tote/order-tote-mutation.js.map +1 -1
- package/dist-server/service/order-tote/order-tote-query.js.map +1 -1
- package/dist-server/service/order-tote/order-tote-types.js.map +1 -1
- package/dist-server/service/order-tote/order-tote.js.map +1 -1
- package/dist-server/service/order-tote-item/order-tote-item-mutation.js.map +1 -1
- package/dist-server/service/order-tote-item/order-tote-item-query.js.map +1 -1
- package/dist-server/service/order-tote-item/order-tote-item-types.js.map +1 -1
- package/dist-server/service/order-tote-item/order-tote-item.js.map +1 -1
- package/dist-server/service/order-tote-seal/order-tote-seal-mutation.js.map +1 -1
- package/dist-server/service/order-tote-seal/order-tote-seal-query.js.map +1 -1
- package/dist-server/service/order-tote-seal/order-tote-seal-types.js.map +1 -1
- package/dist-server/service/order-tote-seal/order-tote-seal.js.map +1 -1
- package/dist-server/service/order-vas/order-vas-mutation.js.map +1 -1
- package/dist-server/service/order-vas/order-vas-query.js.map +1 -1
- package/dist-server/service/order-vas/order-vas-types.js.map +1 -1
- package/dist-server/service/order-vas/order-vas.js +9 -3
- package/dist-server/service/order-vas/order-vas.js.map +1 -1
- package/dist-server/service/others/other-query.js +17 -21
- 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/purchase-order/purchase-order-types.js.map +1 -1
- package/dist-server/service/purchase-order/purchase-order.js.map +1 -1
- package/dist-server/service/purchase-order-other-charge/purchase-order-other-charge-mutation.js.map +1 -1
- package/dist-server/service/purchase-order-other-charge/purchase-order-other-charge-query.js.map +1 -1
- package/dist-server/service/purchase-order-other-charge/purchase-order-other-charge-types.js.map +1 -1
- package/dist-server/service/purchase-order-other-charge/purchase-order-other-charge.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/retail-replenishment-order/retail-replenishment-order-mutation.js.map +1 -1
- package/dist-server/service/retail-replenishment-order/retail-replenishment-order-query.js.map +1 -1
- package/dist-server/service/retail-replenishment-order/retail-replenishment-order-types.js.map +1 -1
- package/dist-server/service/retail-replenishment-order/retail-replenishment-order.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-query.js.map +1 -1
- package/dist-server/service/return-order/return-order-types.js.map +1 -1
- package/dist-server/service/return-order/return-order.js.map +1 -1
- package/dist-server/service/reverse-kitting-order/reverse-kitting-order-mutation.js.map +1 -1
- package/dist-server/service/reverse-kitting-order/reverse-kitting-order-query.js.map +1 -1
- package/dist-server/service/reverse-kitting-order/reverse-kitting-order-type.js.map +1 -1
- package/dist-server/service/reverse-kitting-order/reverse-kitting-order.js.map +1 -1
- package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-mutation.js.map +1 -1
- package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-query.js.map +1 -1
- package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-type.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/service/shipping-order/shipping-order-mutation.js.map +1 -1
- package/dist-server/service/shipping-order/shipping-order-query.js.map +1 -1
- package/dist-server/service/shipping-order/shipping-order-types.js.map +1 -1
- package/dist-server/service/shipping-order/shipping-order.js.map +1 -1
- package/dist-server/service/transfer-order/transfer-order-mutation.js.map +1 -1
- package/dist-server/service/transfer-order/transfer-order-query.js.map +1 -1
- package/dist-server/service/transfer-order/transfer-order-types.js.map +1 -1
- package/dist-server/service/transfer-order/transfer-order.js.map +1 -1
- package/dist-server/service/vas/vas-mutation.js.map +1 -1
- package/dist-server/service/vas/vas-query.js.map +1 -1
- package/dist-server/service/vas/vas-types.js.map +1 -1
- package/dist-server/service/vas/vas.js.map +1 -1
- package/dist-server/service/vas-order/vas-order-mutation.js.map +1 -1
- package/dist-server/service/vas-order/vas-order-query.js.map +1 -1
- package/dist-server/service/vas-order/vas-order-types.js.map +1 -1
- package/dist-server/service/vas-order/vas-order.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 +30 -31
- 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
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from '@things-factory/biz-base'
|
|
14
14
|
import { generateId } from '@things-factory/id-rule-base'
|
|
15
15
|
import { sendNotification } from '@things-factory/notification'
|
|
16
|
-
import { Product } from '@things-factory/product-base'
|
|
16
|
+
import { Product, ProductDetail } from '@things-factory/product-base'
|
|
17
17
|
import { PartnerSetting, Setting } from '@things-factory/setting-base'
|
|
18
18
|
import { Domain } from '@things-factory/shell'
|
|
19
19
|
|
|
@@ -339,7 +339,6 @@ export class ArrivalNoticeMutation {
|
|
|
339
339
|
domain,
|
|
340
340
|
bizplace: foundBizplace,
|
|
341
341
|
name: OrderNoGenerator.orderProduct(),
|
|
342
|
-
// product: await childTx.getRepository(Product).findOne(op.product.id),
|
|
343
342
|
status: ORDER_PRODUCT_STATUS.PENDING,
|
|
344
343
|
arrivalNotice: createdArrivalNotice,
|
|
345
344
|
creator: user
|
|
@@ -974,6 +973,7 @@ export async function addArrivalNoticeProducts(
|
|
|
974
973
|
tx?: EntityManager
|
|
975
974
|
): Promise<void> {
|
|
976
975
|
const productRepo: Repository<Product> = tx?.getRepository(Product) || getRepository(Product)
|
|
976
|
+
const productDetailRepo: Repository<ProductDetail> = tx?.getRepository(ProductDetail) || getRepository(ProductDetail)
|
|
977
977
|
const orderProductRepo: Repository<OrderProduct> = tx?.getRepository(OrderProduct) || getRepository(OrderProduct)
|
|
978
978
|
|
|
979
979
|
if (!arrivalNotice?.bizplace || !arrivalNotice?.orderProducts?.length) {
|
|
@@ -991,6 +991,7 @@ export async function addArrivalNoticeProducts(
|
|
|
991
991
|
bizplace: arrivalNotice.bizplace,
|
|
992
992
|
name: OrderNoGenerator.orderProduct(),
|
|
993
993
|
product: await productRepo.findOne(op.product.id),
|
|
994
|
+
productDetail: await productDetailRepo.findOne(op.productDetail.id),
|
|
994
995
|
arrivalNotice,
|
|
995
996
|
creator: user
|
|
996
997
|
}
|
|
@@ -1058,8 +1059,10 @@ function extractArrivalNotices(rawArrivalNotices): Partial<ArrivalNotice[]> {
|
|
|
1058
1059
|
})
|
|
1059
1060
|
|
|
1060
1061
|
const product: Product = Object.assign(new Product(), { id: raw.productId, sku: raw.sku })
|
|
1062
|
+
const productDetail: ProductDetail = Object.assign(new ProductDetail(), { id: raw.productDetailId })
|
|
1061
1063
|
const orderProduct: Partial<OrderProduct> = {
|
|
1062
1064
|
product,
|
|
1065
|
+
productDetail,
|
|
1063
1066
|
batchId: raw.batchId,
|
|
1064
1067
|
batchIdRef: raw.batchIdRef,
|
|
1065
1068
|
packingType: raw.packingType,
|
|
@@ -1070,7 +1073,7 @@ function extractArrivalNotices(rawArrivalNotices): Partial<ArrivalNotice[]> {
|
|
|
1070
1073
|
totalUomValue: raw.totalUomValue,
|
|
1071
1074
|
palletQty: raw.palletQty,
|
|
1072
1075
|
unitPrice: raw.unitPrice,
|
|
1073
|
-
manufactureDate: raw.manufactureDate
|
|
1076
|
+
manufactureDate: raw.manufactureDate,
|
|
1074
1077
|
}
|
|
1075
1078
|
|
|
1076
1079
|
if (idx >= 0) {
|
|
@@ -148,6 +148,10 @@ export class ArrivalNotice {
|
|
|
148
148
|
@Field({ nullable: true })
|
|
149
149
|
description: string
|
|
150
150
|
|
|
151
|
+
@Column({ nullable: true })
|
|
152
|
+
@Field({ nullable: true })
|
|
153
|
+
source: string
|
|
154
|
+
|
|
151
155
|
@OneToOne(type => PurchaseOrder, { nullable: true })
|
|
152
156
|
@JoinColumn()
|
|
153
157
|
@Field(type => PurchaseOrder, { nullable: true })
|
|
@@ -195,6 +195,7 @@ export class DraftReleaseGoodMutation {
|
|
|
195
195
|
relations: [
|
|
196
196
|
'orderProducts',
|
|
197
197
|
'orderProducts.product',
|
|
198
|
+
'orderProducts.productDetail',
|
|
198
199
|
'orderProducts.productBundle',
|
|
199
200
|
'shippingOrder',
|
|
200
201
|
'bizplace',
|
|
@@ -262,13 +263,14 @@ export class DraftReleaseGoodMutation {
|
|
|
262
263
|
draftOrder.orderProducts = draftOrder.orderProducts.map(itm => {
|
|
263
264
|
let foundProductInv = productInventory.items.find(
|
|
264
265
|
i =>
|
|
265
|
-
(i.
|
|
266
|
-
i.packingType == itm.packingType &&
|
|
267
|
-
i.packingSize == itm.packingSize &&
|
|
268
|
-
i.uom == itm.uom &&
|
|
266
|
+
(i.productDetailId == itm?.productDetail?.id || i.productId == itm?.productBundle?.id) &&
|
|
269
267
|
itm.releaseQty <= i.remainQty
|
|
270
268
|
)
|
|
271
|
-
return {
|
|
269
|
+
return {
|
|
270
|
+
...itm,
|
|
271
|
+
releaseUomValue: (foundProductInv.remainUomValue / foundProductInv.remainQty) * itm.releaseQty,
|
|
272
|
+
status: foundProductInv ? 'suffice' : 'insufficient'
|
|
273
|
+
}
|
|
272
274
|
})
|
|
273
275
|
|
|
274
276
|
let insufficient = draftOrder.orderProducts.find(op => op.status == 'insufficient')
|
|
@@ -277,10 +279,6 @@ export class DraftReleaseGoodMutation {
|
|
|
277
279
|
let releaseGood = { ...draftOrder }
|
|
278
280
|
delete releaseGood.id
|
|
279
281
|
delete releaseGood.name
|
|
280
|
-
delete releaseGood.createdAt
|
|
281
|
-
delete releaseGood.createdBy
|
|
282
|
-
delete releaseGood.updatedAt
|
|
283
|
-
delete releaseGood.updatedBy
|
|
284
282
|
|
|
285
283
|
let orderInventories = []
|
|
286
284
|
|
|
@@ -497,7 +495,6 @@ export async function createDraftReleaseGoodFunction(
|
|
|
497
495
|
updater: user
|
|
498
496
|
})
|
|
499
497
|
|
|
500
|
-
|
|
501
498
|
// // 3. Create draft release good product
|
|
502
499
|
await upsertDraftReleaseGoodProducts(
|
|
503
500
|
domain,
|
|
@@ -632,6 +629,7 @@ export async function upsertDraftReleaseGoodProducts(
|
|
|
632
629
|
relations: [
|
|
633
630
|
'orderProducts',
|
|
634
631
|
'orderProducts.product',
|
|
632
|
+
'orderProducts.productDetail',
|
|
635
633
|
'orderProducts.productBundle',
|
|
636
634
|
'orderProducts.creator',
|
|
637
635
|
'orderProducts.updater'
|
|
@@ -733,8 +731,8 @@ export async function upsertDraftReleaseGoodProducts(
|
|
|
733
731
|
updatePatch['packingType'] = op?.packingType
|
|
734
732
|
? op.packingType
|
|
735
733
|
: product?.packingType
|
|
736
|
-
|
|
737
|
-
|
|
734
|
+
? product.packingType
|
|
735
|
+
: productBundle.packingType
|
|
738
736
|
updatePatch['uom'] = op?.uom ? op.uom : product?.primaryUnit ? product.primaryUnit : 'UNIT'
|
|
739
737
|
updatePatch['uomValue'] = op?.uomValue ? op.uomValue : product?.primaryValue ? product.primaryValue : 0
|
|
740
738
|
|
|
@@ -255,6 +255,7 @@ export async function getDraftReleaseGoodFunction(_: any, name: any, context: an
|
|
|
255
255
|
'releaseGood',
|
|
256
256
|
'orderProducts',
|
|
257
257
|
'orderProducts.product',
|
|
258
|
+
'orderProducts.productDetail',
|
|
258
259
|
'orderProducts.productBundle',
|
|
259
260
|
'shippingOrder',
|
|
260
261
|
'bizplace',
|
|
@@ -316,11 +317,7 @@ export async function getDraftReleaseGoodFunction(_: any, name: any, context: an
|
|
|
316
317
|
|
|
317
318
|
result.orderProducts = result.orderProducts.map(itm => {
|
|
318
319
|
let foundProductInv = productInventory?.items.find(
|
|
319
|
-
i =>
|
|
320
|
-
(i.productId == itm?.product?.id || i.productId == itm?.productBundle?.id) &&
|
|
321
|
-
i.packingType == itm.packingType &&
|
|
322
|
-
i.packingSize == itm.packingSize &&
|
|
323
|
-
i.uom == itm.uom
|
|
320
|
+
i => i.productDetailId == itm?.productDetail?.id || i.productId == itm?.productBundle?.id
|
|
324
321
|
)
|
|
325
322
|
return {
|
|
326
323
|
...itm,
|
|
@@ -330,6 +327,9 @@ export async function getDraftReleaseGoodFunction(_: any, name: any, context: an
|
|
|
330
327
|
brand: foundProductInv.productBrand,
|
|
331
328
|
sku: foundProductInv.productSKU
|
|
332
329
|
},
|
|
330
|
+
productDetail: itm.productDetail || {
|
|
331
|
+
id: foundProductInv.productDetailId
|
|
332
|
+
},
|
|
333
333
|
groupType: foundProductInv ? foundProductInv.groupType : 'SINGLE',
|
|
334
334
|
remainQty: foundProductInv ? foundProductInv.remainQty : 0,
|
|
335
335
|
remainUomValue: foundProductInv ? foundProductInv.remainUomValue : 0,
|
|
@@ -237,6 +237,10 @@ export class DraftReleaseGood {
|
|
|
237
237
|
@Field({ nullable: true })
|
|
238
238
|
packageId: string
|
|
239
239
|
|
|
240
|
+
@Column({ nullable: true })
|
|
241
|
+
@Field({ nullable: true })
|
|
242
|
+
source: string
|
|
243
|
+
|
|
240
244
|
@ManyToOne(type => ContactPoint)
|
|
241
245
|
@Field(type => ContactPoint, { nullable: true })
|
|
242
246
|
deliverTo: ContactPoint
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from 'typeorm'
|
|
12
12
|
|
|
13
13
|
import { User } from '@things-factory/auth-base'
|
|
14
|
-
import { Product } from '@things-factory/product-base'
|
|
14
|
+
import { Product, ProductDetail } from '@things-factory/product-base'
|
|
15
15
|
import { Domain } from '@things-factory/shell'
|
|
16
16
|
|
|
17
17
|
import { Invoice } from '../invoice/invoice'
|
|
@@ -77,6 +77,10 @@ export class InvoiceProduct {
|
|
|
77
77
|
@Field({ nullable: true })
|
|
78
78
|
shippingFeePaidByCustomer: number
|
|
79
79
|
|
|
80
|
+
@ManyToOne(type => ProductDetail, { nullable: true })
|
|
81
|
+
@Field({ nullable: true })
|
|
82
|
+
productDetail: ProductDetail
|
|
83
|
+
|
|
80
84
|
@CreateDateColumn()
|
|
81
85
|
@Field()
|
|
82
86
|
createdAt: Date
|
|
@@ -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
|
}
|
|
@@ -205,32 +205,30 @@ 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
|
-
|
|
208
|
+
product:
|
|
209
|
+
total > 0 ? { id: items[0].productId, sku: items[0].productSKU, name: items[0].productName } : { id: null },
|
|
210
|
+
productDetail: total > 0 ? { id: items[0].productDetailId } : { id: null },
|
|
211
|
+
inventory:
|
|
212
|
+
total > 0
|
|
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 : ''
|
|
213
218
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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,
|
|
219
|
+
: null,
|
|
220
|
+
productId: total > 0 ? items[0].productId : null,
|
|
221
|
+
productDetailID: total > 0 ? items[0].productDetailId : null,
|
|
222
|
+
productSKU: total > 0 ? items[0].productSKU : orderInventory.productSKU,
|
|
223
|
+
productName: total > 0 ? items[0].productName : null,
|
|
224
|
+
uom: total > 0 ? items[0].uom : null,
|
|
225
|
+
remainQty: total > 0 ? items[0].remainQty : null,
|
|
226
|
+
remainUomValue: total > 0 ? items[0].remainUomValue : null,
|
|
227
|
+
remainUomValueWithUom: total > 0 ? items[0].remainUomValueWithUom : '',
|
|
228
|
+
batchId: total > 0 ? items[0].batchId : null,
|
|
229
|
+
batchIdRef: total > 0 ? items[0].batchIdRef : null,
|
|
230
|
+
packingType: total > 0 ? items[0].packingType : orderInventory.packingType,
|
|
231
|
+
packingSize: total > 0 ? items[0].packingSize : 1,
|
|
234
232
|
releaseQty: orderInventory.releaseQty
|
|
235
233
|
? Number.isInteger(orderInventory.releaseQty)
|
|
236
234
|
? orderInventory.releaseQty
|
|
@@ -354,7 +352,7 @@ export class OtherQuery {
|
|
|
354
352
|
let productDetail: ProductDetail
|
|
355
353
|
const hasConditions: boolean = Boolean(
|
|
356
354
|
(orderProduct?.packingType && orderProduct?.packingType.trim() != '') ||
|
|
357
|
-
|
|
355
|
+
(orderProduct?.uom && orderProduct?.uom.trim() != '')
|
|
358
356
|
)
|
|
359
357
|
let productDetailCondition: any = { product: foundProduct }
|
|
360
358
|
|
|
@@ -377,8 +375,8 @@ export class OtherQuery {
|
|
|
377
375
|
? productDetail.uomValue
|
|
378
376
|
: null
|
|
379
377
|
: orderProduct?.uomValue
|
|
380
|
-
|
|
381
|
-
|
|
378
|
+
? orderProduct.uomValue
|
|
379
|
+
: productDetail.uomValue
|
|
382
380
|
|
|
383
381
|
newOrderProduct = {
|
|
384
382
|
...orderProduct,
|
|
@@ -484,7 +482,7 @@ export class OtherQuery {
|
|
|
484
482
|
let productDetail: ProductDetail
|
|
485
483
|
const hasConditions: boolean = Boolean(
|
|
486
484
|
(orderProduct?.packingType && orderProduct?.packingType.trim() != '') ||
|
|
487
|
-
|
|
485
|
+
(orderProduct?.uom && orderProduct?.uom.trim() != '')
|
|
488
486
|
)
|
|
489
487
|
let productDetailCondition: any = { product: foundProduct }
|
|
490
488
|
|
|
@@ -507,8 +505,8 @@ export class OtherQuery {
|
|
|
507
505
|
? productDetail.uomValue
|
|
508
506
|
: null
|
|
509
507
|
: orderProduct?.uomValue
|
|
510
|
-
|
|
511
|
-
|
|
508
|
+
? orderProduct.uomValue
|
|
509
|
+
: productDetail.uomValue
|
|
512
510
|
|
|
513
511
|
newOrderProduct = {
|
|
514
512
|
...orderProduct,
|
|
@@ -528,6 +526,7 @@ export class OtherQuery {
|
|
|
528
526
|
primaryUnit: productDetail?.uom ? productDetail.uom : null,
|
|
529
527
|
primaryValue: productDetail?.uomValue ? productDetail.uomValue : null
|
|
530
528
|
},
|
|
529
|
+
productDetail,
|
|
531
530
|
totalUomValue:
|
|
532
531
|
orderProduct.packQty > 0
|
|
533
532
|
? 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,
|