@things-factory/sales-base 4.3.106 → 4.3.108
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 +1 -0
- package/dist-server/service/arrival-notice/arrival-notice-query.js.map +1 -1
- package/dist-server/service/draft-release-good/draft-release-good-mutation.js +3 -4
- 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 +11 -15
- package/dist-server/service/draft-release-good/draft-release-good-query.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 +196 -177
- package/dist-server/service/others/other-query.js.map +1 -1
- package/dist-server/service/others/other-types.js +9 -1
- 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 +18 -8
- package/dist-server/service/release-good/release-good-mutation.js.map +1 -1
- package/dist-server/service/release-good/release-good-query.js +3 -2
- 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/return-order/return-order-mutation.js +3 -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 +39 -104
- 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-query.ts +1 -0
- package/server/service/draft-release-good/draft-release-good-mutation.ts +3 -4
- package/server/service/draft-release-good/draft-release-good-query.ts +17 -21
- 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 +231 -219
- package/server/service/others/other-types.ts +7 -1
- 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 +21 -8
- package/server/service/release-good/release-good-query.ts +3 -2
- package/server/service/release-good/release-good-types.ts +4 -3
- package/server/service/return-order/return-order-mutation.ts +4 -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 +75 -149
- package/translations/en.json +1 -0
- package/translations/ko.json +2 -1
- package/translations/ms.json +2 -1
- package/translations/zh.json +25 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Field, Float, Int, ObjectType } from 'type-graphql'
|
|
2
|
-
import { Product } from '@things-factory/product-base'
|
|
2
|
+
import { Product, ProductDetail } from '@things-factory/product-base'
|
|
3
3
|
import { ScalarDate } from '@things-factory/shell'
|
|
4
4
|
|
|
5
5
|
@ObjectType()
|
|
@@ -19,6 +19,9 @@ export class InventoryProductGroup {
|
|
|
19
19
|
@Field({ nullable: true })
|
|
20
20
|
productId: string
|
|
21
21
|
|
|
22
|
+
@Field({ nullable: true })
|
|
23
|
+
productDetailId: string
|
|
24
|
+
|
|
22
25
|
@Field({ nullable: true })
|
|
23
26
|
batchId: string
|
|
24
27
|
|
|
@@ -102,4 +105,7 @@ export class InventoryProductGroup {
|
|
|
102
105
|
|
|
103
106
|
@Field(type => Product, { nullable: true })
|
|
104
107
|
product: Product
|
|
108
|
+
|
|
109
|
+
@Field(type => ProductDetail, { nullable: true })
|
|
110
|
+
productDetail: ProductDetail
|
|
105
111
|
}
|
|
@@ -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,
|
|
@@ -17,7 +17,7 @@ import { MarketplaceStore } from '@things-factory/integration-marketplace'
|
|
|
17
17
|
import { Sellercraft, SellercraftStatus } from '@things-factory/integration-sellercraft'
|
|
18
18
|
import { MarketplaceOrder, MarketplaceProductVariation } from '@things-factory/marketplace-base'
|
|
19
19
|
// import { sendNotification } from '@things-factory/notification'
|
|
20
|
-
import { Product, ProductBundleSetting } from '@things-factory/product-base'
|
|
20
|
+
import { Product, ProductBundleSetting, ProductDetail } from '@things-factory/product-base'
|
|
21
21
|
import { PartnerSetting, Setting } from '@things-factory/setting-base'
|
|
22
22
|
import { Domain } from '@things-factory/shell'
|
|
23
23
|
import { Inventory } from '@things-factory/warehouse-base'
|
|
@@ -676,7 +676,7 @@ export async function generateReleaseGoodFunction(
|
|
|
676
676
|
|
|
677
677
|
const pbSettings: ProductBundleSetting[] = await tx.getRepository(ProductBundleSetting).find({
|
|
678
678
|
where: { productBundle: oi.product.id },
|
|
679
|
-
relations: ['product', 'productBundle']
|
|
679
|
+
relations: ['product', 'productBundle', 'productDetail']
|
|
680
680
|
})
|
|
681
681
|
|
|
682
682
|
pbSettings.forEach(pbs => {
|
|
@@ -690,6 +690,9 @@ export async function generateReleaseGoodFunction(
|
|
|
690
690
|
id: pbs.product.id,
|
|
691
691
|
name: pbs.product.name,
|
|
692
692
|
groupType: PRODUCT_GROUP_TYPE.SINGLE
|
|
693
|
+
},
|
|
694
|
+
productDetail: {
|
|
695
|
+
id: pbs.productDetail.id
|
|
693
696
|
}
|
|
694
697
|
}
|
|
695
698
|
splitBundleOIs.push(splitOI)
|
|
@@ -704,6 +707,10 @@ export async function generateReleaseGoodFunction(
|
|
|
704
707
|
newReleaseGood = await tx.getRepository(ReleaseGood).save(newReleaseGood)
|
|
705
708
|
|
|
706
709
|
for (let oi of orderInventories) {
|
|
710
|
+
let productDetail: any = await tx
|
|
711
|
+
.getRepository(ProductDetail)
|
|
712
|
+
.findOne(oi.productDetail.id, { relations: ['product'] })
|
|
713
|
+
|
|
707
714
|
let newOrderInv: OrderInventory = Object.assign({}, oi)
|
|
708
715
|
newOrderInv = {
|
|
709
716
|
...newOrderInv,
|
|
@@ -712,7 +719,8 @@ export async function generateReleaseGoodFunction(
|
|
|
712
719
|
status: ORDER_INVENTORY_STATUS.PENDING,
|
|
713
720
|
name: OrderNoGenerator.orderInventory(),
|
|
714
721
|
releaseGood: newReleaseGood,
|
|
715
|
-
product:
|
|
722
|
+
product: productDetail.product,
|
|
723
|
+
productDetail,
|
|
716
724
|
creator: user,
|
|
717
725
|
updater: user
|
|
718
726
|
}
|
|
@@ -750,9 +758,9 @@ export async function generateReleaseGoodFunction(
|
|
|
750
758
|
}
|
|
751
759
|
|
|
752
760
|
let assignedOrderInventories: OrderInventory[] = await InventoryUtil.autoAssignInventoryForRelease(
|
|
753
|
-
newOrderInv.product,
|
|
754
761
|
oi,
|
|
755
|
-
|
|
762
|
+
productDetail.product,
|
|
763
|
+
productDetail,
|
|
756
764
|
locationSortingRules,
|
|
757
765
|
bizplace,
|
|
758
766
|
warehouseDomain,
|
|
@@ -1379,12 +1387,17 @@ export async function bulkGenerateReleaseGood(
|
|
|
1379
1387
|
}
|
|
1380
1388
|
}
|
|
1381
1389
|
|
|
1382
|
-
|
|
1390
|
+
let productDetail = oi.orderProduct?.productDetail
|
|
1391
|
+
let product = oi.orderProduct?.product
|
|
1392
|
+
if (!productDetail) {
|
|
1393
|
+
productDetail = await tx.getRepository(ProductDetail).findOne(oi.productDetailId, { relations: ['product'] })
|
|
1394
|
+
product = productDetail.product
|
|
1395
|
+
}
|
|
1383
1396
|
|
|
1384
1397
|
let assignedResult = await InventoryUtil.autoAssignInventoryForRelease(
|
|
1385
|
-
product,
|
|
1386
1398
|
oi,
|
|
1387
|
-
|
|
1399
|
+
product,
|
|
1400
|
+
productDetail,
|
|
1388
1401
|
locationSortingRules,
|
|
1389
1402
|
bizplace,
|
|
1390
1403
|
warehouseDomain,
|
|
@@ -133,7 +133,6 @@ export class ReleaseGoodQuery {
|
|
|
133
133
|
'orderInventories.product',
|
|
134
134
|
'orderInventories.inventory',
|
|
135
135
|
'orderInventories.inventory.product',
|
|
136
|
-
'orderInventories.inventory.product.productDetails',
|
|
137
136
|
'orderVass',
|
|
138
137
|
'orderVass.vas',
|
|
139
138
|
'creator',
|
|
@@ -197,6 +196,7 @@ export class ReleaseGoodQuery {
|
|
|
197
196
|
.createQueryBuilder('oi')
|
|
198
197
|
.leftJoinAndSelect('oi.inventory', 'inventory')
|
|
199
198
|
.leftJoinAndSelect('oi.product', 'product')
|
|
199
|
+
.leftJoinAndSelect('oi.productDetail', 'productDetail')
|
|
200
200
|
.leftJoinAndSelect('inventory.location', 'location')
|
|
201
201
|
.where('oi.domain_id = :domainId', { domainId: domain.id })
|
|
202
202
|
.andWhere('oi.release_good_id = :releaseGoodId', { releaseGoodId: releaseGood.id })
|
|
@@ -227,6 +227,7 @@ export class ReleaseGoodQuery {
|
|
|
227
227
|
batchIdRef: inventory.batchIdRef,
|
|
228
228
|
palletId: inventory.palletId,
|
|
229
229
|
product: orderInv.product,
|
|
230
|
+
productDetail: orderInv.productDetail,
|
|
230
231
|
productIdRef: orderInv.product.id,
|
|
231
232
|
productName: `${orderInv.product.name} (${orderInv.product.description})`,
|
|
232
233
|
packingType: orderInv.packingType,
|
|
@@ -934,7 +935,7 @@ function _extractData(rawData, validatedData) {
|
|
|
934
935
|
errorMsg:
|
|
935
936
|
!raw.productId || !raw.productDetailId
|
|
936
937
|
? 'inventory or product not found'
|
|
937
|
-
: raw.releaseQty <= 0
|
|
938
|
+
: raw.releaseQty <= 0 || raw.releaseQty % 1 != 0
|
|
938
939
|
? 'invalid release qty'
|
|
939
940
|
: raw.assignedQty < raw.releaseQty
|
|
940
941
|
? 'insufficient stock'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Field, Float, InputType, Int, ObjectType } from 'type-graphql'
|
|
2
2
|
|
|
3
|
-
import { Product } from '@things-factory/product-base'
|
|
3
|
+
import { Product, ProductDetail } from '@things-factory/product-base'
|
|
4
4
|
import { ObjectRef } from '@things-factory/shell'
|
|
5
5
|
import { Location } from '@things-factory/warehouse-base'
|
|
6
6
|
|
|
@@ -77,6 +77,9 @@ export class InventoryInfos {
|
|
|
77
77
|
@Field(type => Product, { nullable: true })
|
|
78
78
|
product?: Product
|
|
79
79
|
|
|
80
|
+
@Field(type => ProductDetail, { nullable: true })
|
|
81
|
+
productDetail?: ProductDetail
|
|
82
|
+
|
|
80
83
|
@Field({ nullable: true })
|
|
81
84
|
packingType?: string
|
|
82
85
|
|
|
@@ -185,8 +188,6 @@ export class NewReleaseGood {
|
|
|
185
188
|
@Field({ nullable: true })
|
|
186
189
|
orderMethod: string
|
|
187
190
|
|
|
188
|
-
|
|
189
|
-
|
|
190
191
|
@Field({ nullable: true })
|
|
191
192
|
collectionOrderNo: string
|
|
192
193
|
|
|
@@ -6,7 +6,7 @@ import { Attachment, createAttachments } from '@things-factory/attachment-base'
|
|
|
6
6
|
import { Role, User } from '@things-factory/auth-base'
|
|
7
7
|
import { Bizplace, getDomainUsers } from '@things-factory/biz-base'
|
|
8
8
|
import { sendNotification } from '@things-factory/notification'
|
|
9
|
-
import { Product } from '@things-factory/product-base'
|
|
9
|
+
import { Product, ProductDetail } from '@things-factory/product-base'
|
|
10
10
|
import { Domain } from '@things-factory/shell'
|
|
11
11
|
import { Inventory } from '@things-factory/warehouse-base'
|
|
12
12
|
|
|
@@ -59,6 +59,7 @@ export class ReturnOrderMutation {
|
|
|
59
59
|
itm =>
|
|
60
60
|
itm.product.id === curr.product.id &&
|
|
61
61
|
itm.packingType === curr.packingType &&
|
|
62
|
+
itm.productDetailId === curr.product.productDetailId &&
|
|
62
63
|
itm.batchId === curr.batchId &&
|
|
63
64
|
itm.packingSize === curr.packingSize
|
|
64
65
|
)
|
|
@@ -68,6 +69,7 @@ export class ReturnOrderMutation {
|
|
|
68
69
|
} else {
|
|
69
70
|
existingItem.returnQty = existingItem.returnQty + curr.returnQty
|
|
70
71
|
existingItem.returnUomValue = existingItem.returnUomValue + curr.returnUomValue
|
|
72
|
+
existingItem.remark = `${existingItem.remark} | ${curr.remark}`
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
return acc
|
|
@@ -99,6 +101,7 @@ export class ReturnOrderMutation {
|
|
|
99
101
|
newOrderInv.name = OrderNoGenerator.orderInventory()
|
|
100
102
|
newOrderInv.returnOrder = createdReturnOrder
|
|
101
103
|
newOrderInv.product = await tx.getRepository(Product).findOne(moi.product.id)
|
|
104
|
+
newOrderInv.productDetail = await tx.getRepository(ProductDetail).findOne(moi.productDetail.id)
|
|
102
105
|
newOrderInv.creator = user
|
|
103
106
|
newOrderInv.updater = user
|
|
104
107
|
|
|
@@ -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
|
|
|
@@ -127,6 +127,10 @@ export class ReverseKittingOrderInventory {
|
|
|
127
127
|
@Field({ nullable: true })
|
|
128
128
|
updatedAt?: Date
|
|
129
129
|
|
|
130
|
+
@ManyToOne(type => ProductDetail, { nullable: true })
|
|
131
|
+
@Field({ nullable: true })
|
|
132
|
+
productDetail: ProductDetail
|
|
133
|
+
|
|
130
134
|
@ManyToOne(type => User, { nullable: true })
|
|
131
135
|
@Field({ nullable: true })
|
|
132
136
|
creator?: User
|