@things-factory/sales-base 4.0.35 → 4.0.39
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/controllers/ecommerce/ecommerce-controller.js +12 -4
- package/dist-server/controllers/ecommerce/ecommerce-controller.js.map +1 -1
- package/dist-server/controllers/ecommerce/sellercraft-controller.js +28 -16
- package/dist-server/controllers/ecommerce/sellercraft-controller.js.map +1 -1
- package/dist-server/service/arrival-notice/arrival-notice-mutation.js +2 -2
- package/dist-server/service/arrival-notice/arrival-notice-mutation.js.map +1 -1
- package/dist-server/service/arrival-notice/arrival-notice-query.js +4 -4
- package/dist-server/service/arrival-notice/arrival-notice-query.js.map +1 -1
- package/dist-server/service/order-inventory/order-inventory-types.js +15 -11
- package/dist-server/service/order-inventory/order-inventory-types.js.map +1 -1
- package/dist-server/service/order-inventory/order-inventory.js +3 -3
- package/dist-server/service/order-inventory/order-inventory.js.map +1 -1
- package/dist-server/service/others/other-query.js +4 -2
- package/dist-server/service/others/other-query.js.map +1 -1
- package/dist-server/service/others/other-types.js +42 -0
- package/dist-server/service/others/other-types.js.map +1 -1
- package/dist-server/service/release-good/release-good-mutation.js +22 -10
- package/dist-server/service/release-good/release-good-mutation.js.map +1 -1
- package/dist-server/service/release-good/release-good-query.js +3 -4
- package/dist-server/service/release-good/release-good-query.js.map +1 -1
- package/dist-server/service/return-order/return-order-mutation.js +18 -3
- package/dist-server/service/return-order/return-order-mutation.js.map +1 -1
- package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-type.js +9 -5
- 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 +3 -2
- package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js.map +1 -1
- package/package.json +12 -12
- package/server/controllers/ecommerce/ecommerce-controller.ts +14 -6
- package/server/controllers/ecommerce/sellercraft-controller.ts +31 -19
- package/server/service/arrival-notice/arrival-notice-mutation.ts +2 -2
- package/server/service/arrival-notice/arrival-notice-query.ts +3 -3
- package/server/service/order-inventory/order-inventory-types.ts +14 -11
- package/server/service/order-inventory/order-inventory.ts +4 -4
- package/server/service/others/other-query.ts +9 -15
- package/server/service/others/other-types.ts +31 -0
- package/server/service/release-good/release-good-mutation.ts +38 -15
- package/server/service/release-good/release-good-query.ts +11 -10
- package/server/service/return-order/return-order-mutation.ts +26 -3
- package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-type.ts +8 -5
- package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.ts +3 -2
|
@@ -371,9 +371,13 @@ export class ReleaseGoodQuery {
|
|
|
371
371
|
const PROD_ALIAS = 'PROD'
|
|
372
372
|
const GAN_ALIAS = 'GAN'
|
|
373
373
|
const conditions = filters
|
|
374
|
-
let {
|
|
375
|
-
|
|
376
|
-
|
|
374
|
+
let {
|
|
375
|
+
batchId = null,
|
|
376
|
+
containerNo = null,
|
|
377
|
+
product = [],
|
|
378
|
+
packingType = null,
|
|
379
|
+
inventory = []
|
|
380
|
+
} = getConditionValues(conditions)
|
|
377
381
|
|
|
378
382
|
const SELECT: string = `
|
|
379
383
|
SELECT
|
|
@@ -648,7 +652,7 @@ export async function bulkReleaseGoodsAvailableItemsFunction(
|
|
|
648
652
|
let availableItems = await tx.query(
|
|
649
653
|
`
|
|
650
654
|
WITH inv AS (
|
|
651
|
-
SELECT i.product_id, foo.product_detail_id, foo.sku, foo.product_info, i.
|
|
655
|
+
SELECT i.product_id, foo.product_detail_id, foo.sku, foo.product_info, i.packing_type, i.packing_size, i.uom,
|
|
652
656
|
SUM(i.qty - COALESCE(i.locked_qty, 0)) - COALESCE(
|
|
653
657
|
(
|
|
654
658
|
SELECT SUM(oi.release_qty) FROM order_inventories oi
|
|
@@ -686,7 +690,7 @@ export async function bulkReleaseGoodsAvailableItemsFunction(
|
|
|
686
690
|
AND i.domain_id = $1
|
|
687
691
|
AND i.bizplace_id = $2
|
|
688
692
|
WHERE l.type NOT IN ($3, $4)
|
|
689
|
-
GROUP BY i.product_id, foo.product_detail_id, foo.sku,foo.product_info, i.
|
|
693
|
+
GROUP BY i.product_id, foo.product_detail_id, foo.sku,foo.product_info, i.packing_type, i.packing_size, i.uom
|
|
690
694
|
ORDER BY foo.sku, remain_qty
|
|
691
695
|
) SELECT * FROM inv WHERE remain_qty > 0
|
|
692
696
|
`,
|
|
@@ -701,7 +705,6 @@ export async function bulkReleaseGoodsAvailableItemsFunction(
|
|
|
701
705
|
productDetailId: item.product_detail_id,
|
|
702
706
|
productInfo: item.product_info,
|
|
703
707
|
sku: item.sku,
|
|
704
|
-
batchId: item.batch_id,
|
|
705
708
|
packingType: item.packing_type,
|
|
706
709
|
packingSize: Number(item.packing_size || 0),
|
|
707
710
|
uom: item.uom,
|
|
@@ -762,10 +765,10 @@ function _extractData(rawData, validatedData) {
|
|
|
762
765
|
|
|
763
766
|
raw.productId = validatedData[idx].productId
|
|
764
767
|
raw.productDetailId = validatedData[idx].productDetailId
|
|
768
|
+
raw.productInfo = validatedData[idx].productInfo
|
|
765
769
|
raw.packingType = validatedData[idx].packingType
|
|
766
770
|
raw.packingSize = validatedData[idx].packingSize
|
|
767
771
|
raw.uom = validatedData[idx].uom
|
|
768
|
-
raw.batchId = validatedData[idx].batchId
|
|
769
772
|
} else {
|
|
770
773
|
raw.assignedQty = 0
|
|
771
774
|
raw.assignedUomValue = 0
|
|
@@ -795,9 +798,7 @@ function _extractData(rawData, validatedData) {
|
|
|
795
798
|
})
|
|
796
799
|
}
|
|
797
800
|
|
|
798
|
-
function getConditionValues(
|
|
799
|
-
conditions: Filter[]
|
|
800
|
-
): {
|
|
801
|
+
function getConditionValues(conditions: Filter[]): {
|
|
801
802
|
batchId?: string
|
|
802
803
|
containerNo?: string
|
|
803
804
|
product?: string[]
|
|
@@ -6,6 +6,7 @@ import { Product } from '@things-factory/product-base'
|
|
|
6
6
|
import { Domain } from '@things-factory/shell'
|
|
7
7
|
import { Inventory } from '@things-factory/warehouse-base'
|
|
8
8
|
import { FileUpload, GraphQLUpload } from 'graphql-upload'
|
|
9
|
+
import { TransferOrderMutation } from 'server'
|
|
9
10
|
import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
|
|
10
11
|
import { EntityManager, In } from 'typeorm'
|
|
11
12
|
import { NewOrderInventory, NewReturnOrder, OrderInventory, OrderVas, ReturnOrderPatch } from '../'
|
|
@@ -48,9 +49,31 @@ export class ReturnOrderMutation {
|
|
|
48
49
|
const { tx, domain, user }: { tx: EntityManager; domain: Domain; user: User } = context.state
|
|
49
50
|
|
|
50
51
|
const bizplace: Bizplace = await tx.getRepository(Bizplace).findOne(returnOrder.customerBizplaceId)
|
|
52
|
+
|
|
51
53
|
let orderInventories: NewOrderInventory[] = returnOrder.orderInventories
|
|
52
54
|
let foundInv = Inventory
|
|
53
55
|
|
|
56
|
+
const mergedOrderInventories = orderInventories.reduce((acc, curr) => {
|
|
57
|
+
let existingItem = acc.find(
|
|
58
|
+
itm =>
|
|
59
|
+
itm.product.id === curr.product.id &&
|
|
60
|
+
itm.packingType === curr.packingType &&
|
|
61
|
+
itm.batchId === curr.batchId &&
|
|
62
|
+
itm.packingSize === curr.packingSize
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
if (!existingItem) {
|
|
66
|
+
acc.push(curr)
|
|
67
|
+
} else {
|
|
68
|
+
existingItem.returnQty = existingItem.returnQty + curr.returnQty
|
|
69
|
+
existingItem.returnUomValue = existingItem.returnUomValue + curr.returnUomValue
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return acc
|
|
73
|
+
}, [])
|
|
74
|
+
|
|
75
|
+
returnOrder.orderInventories = mergedOrderInventories
|
|
76
|
+
|
|
54
77
|
let newReturnOrder: NewReturnOrder = {
|
|
55
78
|
...returnOrder,
|
|
56
79
|
name: OrderNoGenerator.returnOrder(),
|
|
@@ -67,14 +90,14 @@ export class ReturnOrderMutation {
|
|
|
67
90
|
|
|
68
91
|
let createdReturnOrder: ReturnOrder = await tx.getRepository(ReturnOrder).save(newReturnOrder)
|
|
69
92
|
|
|
70
|
-
for (let
|
|
71
|
-
let newOrderInv: OrderInventory = Object.assign({},
|
|
93
|
+
for (let moi of mergedOrderInventories) {
|
|
94
|
+
let newOrderInv: OrderInventory = Object.assign({}, moi) as any
|
|
72
95
|
newOrderInv.domain = domain
|
|
73
96
|
newOrderInv.bizplace = bizplace
|
|
74
97
|
newOrderInv.status = ORDER_INVENTORY_STATUS.PENDING
|
|
75
98
|
newOrderInv.name = OrderNoGenerator.orderInventory()
|
|
76
99
|
newOrderInv.returnOrder = createdReturnOrder
|
|
77
|
-
newOrderInv.product = await tx.getRepository(Product).findOne(
|
|
100
|
+
newOrderInv.product = await tx.getRepository(Product).findOne(moi.product.id)
|
|
78
101
|
newOrderInv.creator = user
|
|
79
102
|
newOrderInv.updater = user
|
|
80
103
|
|
package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-type.ts
CHANGED
|
@@ -48,10 +48,10 @@ export class ReverseKittingOrderInventoryPatch {
|
|
|
48
48
|
@Field(type => ID, { nullable: true })
|
|
49
49
|
id?: string
|
|
50
50
|
|
|
51
|
-
@Field()
|
|
51
|
+
@Field({ nullable: true })
|
|
52
52
|
name: string
|
|
53
53
|
|
|
54
|
-
@Field(type => Int)
|
|
54
|
+
@Field(type => Int, { nullable: true })
|
|
55
55
|
set: number
|
|
56
56
|
|
|
57
57
|
@Field({ nullable: true })
|
|
@@ -69,17 +69,20 @@ export class ReverseKittingOrderInventoryPatch {
|
|
|
69
69
|
@Field(type => Float, { nullable: true })
|
|
70
70
|
uomValue?: number
|
|
71
71
|
|
|
72
|
-
@Field(type => ObjectRef)
|
|
72
|
+
@Field(type => ObjectRef, { nullable: true })
|
|
73
73
|
reverseKittingOrder: ObjectRef
|
|
74
74
|
|
|
75
|
-
@Field(type => ObjectRef)
|
|
75
|
+
@Field(type => ObjectRef, { nullable: true })
|
|
76
76
|
inventory: ObjectRef
|
|
77
77
|
|
|
78
78
|
@Field({ nullable: true })
|
|
79
79
|
status: string
|
|
80
80
|
|
|
81
|
-
@Field()
|
|
81
|
+
@Field({ nullable: true })
|
|
82
82
|
cuFlag: string
|
|
83
|
+
|
|
84
|
+
@Field({ nullable: true })
|
|
85
|
+
issue: string
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
@ObjectType()
|
|
@@ -12,12 +12,12 @@ 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
16
|
import { Domain } from '@things-factory/shell'
|
|
16
17
|
import { Inventory } from '@things-factory/warehouse-base'
|
|
17
|
-
import { Product } from '@things-factory/product-base'
|
|
18
|
-
import { Vas } from '../vas/vas'
|
|
19
18
|
|
|
20
19
|
import { ReverseKittingOrder } from '../reverse-kitting-order/reverse-kitting-order'
|
|
20
|
+
import { Vas } from '../vas/vas'
|
|
21
21
|
|
|
22
22
|
@Entity()
|
|
23
23
|
@Index(
|
|
@@ -115,6 +115,7 @@ export class ReverseKittingOrderInventory {
|
|
|
115
115
|
@Field({ nullable: true })
|
|
116
116
|
description?: string
|
|
117
117
|
|
|
118
|
+
@Column({ nullable: true })
|
|
118
119
|
@Field({ nullable: true })
|
|
119
120
|
issue?: string
|
|
120
121
|
|