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