@things-factory/sales-base 4.0.37 → 4.0.41
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/sellercraft-controller.js +4 -3
- package/dist-server/controllers/ecommerce/sellercraft-controller.js.map +1 -1
- package/dist-server/service/arrival-notice/arrival-notice-mutation.js +42 -35
- package/dist-server/service/arrival-notice/arrival-notice-mutation.js.map +1 -1
- package/dist-server/service/arrival-notice/arrival-notice-query.js +91 -79
- package/dist-server/service/arrival-notice/arrival-notice-query.js.map +1 -1
- package/dist-server/service/arrival-notice/arrival-notice-types.js +8 -0
- package/dist-server/service/arrival-notice/arrival-notice-types.js.map +1 -1
- package/dist-server/service/arrival-notice/arrival-notice.js +20 -15
- package/dist-server/service/arrival-notice/arrival-notice.js.map +1 -1
- package/dist-server/service/delivery-order/delivery-order-mutation.js +28 -26
- package/dist-server/service/delivery-order/delivery-order-mutation.js.map +1 -1
- package/dist-server/service/delivery-order/delivery-order-query.js +14 -14
- package/dist-server/service/delivery-order/delivery-order-query.js.map +1 -1
- package/dist-server/service/delivery-order/delivery-order-summary-report.js +145 -0
- package/dist-server/service/delivery-order/delivery-order-summary-report.js.map +1 -0
- package/dist-server/service/delivery-order/delivery-order.js +16 -13
- package/dist-server/service/delivery-order/delivery-order.js.map +1 -1
- package/dist-server/service/delivery-order/index.js +3 -1
- package/dist-server/service/delivery-order/index.js.map +1 -1
- package/dist-server/service/index.js +12 -4
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/invoice/invoice-mutation.js +21 -3
- package/dist-server/service/invoice/invoice-mutation.js.map +1 -1
- package/dist-server/service/invoice/invoice-query.js +5 -7
- package/dist-server/service/invoice/invoice-query.js.map +1 -1
- package/dist-server/service/invoice/invoice-types.js +302 -20
- package/dist-server/service/invoice/invoice-types.js.map +1 -1
- package/dist-server/service/invoice/invoice.js +190 -26
- package/dist-server/service/invoice/invoice.js.map +1 -1
- package/dist-server/service/invoice-product/index.js +21 -0
- package/dist-server/service/invoice-product/index.js.map +1 -0
- package/dist-server/service/invoice-product/invoice-product-mutation.js +70 -0
- package/dist-server/service/invoice-product/invoice-product-mutation.js.map +1 -0
- package/dist-server/service/invoice-product/invoice-product-query.js +95 -0
- package/dist-server/service/invoice-product/invoice-product-query.js.map +1 -0
- package/dist-server/service/invoice-product/invoice-product-types.js +125 -0
- package/dist-server/service/invoice-product/invoice-product-types.js.map +1 -0
- package/dist-server/service/invoice-product/invoice-product.js +117 -0
- package/dist-server/service/invoice-product/invoice-product.js.map +1 -0
- package/dist-server/service/order-inventory/order-inventory-query.js +9 -7
- package/dist-server/service/order-inventory/order-inventory-query.js.map +1 -1
- package/dist-server/service/order-inventory/order-inventory.js +31 -25
- package/dist-server/service/order-inventory/order-inventory.js.map +1 -1
- package/dist-server/service/order-product/order-product.js +26 -21
- package/dist-server/service/order-product/order-product.js.map +1 -1
- package/dist-server/service/order-vas/order-vas.js +34 -27
- package/dist-server/service/order-vas/order-vas.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/purchase-order/purchase-order-mutation.js +23 -36
- package/dist-server/service/purchase-order/purchase-order-mutation.js.map +1 -1
- package/dist-server/service/release-good/release-good-mutation.js +84 -82
- package/dist-server/service/release-good/release-good-mutation.js.map +1 -1
- package/dist-server/service/release-good/release-good-query.js +8 -9
- package/dist-server/service/release-good/release-good-query.js.map +1 -1
- package/dist-server/service/release-good/release-good.js +2 -0
- package/dist-server/service/release-good/release-good.js.map +1 -1
- package/dist-server/service/return-order/return-order-mutation.js +3 -3
- package/dist-server/service/return-order/return-order-mutation.js.map +1 -1
- package/dist-server/utils/order-no-generator.js +7 -0
- package/dist-server/utils/order-no-generator.js.map +1 -1
- package/package.json +12 -12
- package/server/controllers/ecommerce/sellercraft-controller.ts +2 -1
- package/server/service/arrival-notice/arrival-notice-mutation.ts +11 -15
- package/server/service/arrival-notice/arrival-notice-query.ts +94 -78
- package/server/service/arrival-notice/arrival-notice-types.ts +6 -0
- package/server/service/arrival-notice/arrival-notice.ts +6 -1
- package/server/service/delivery-order/delivery-order-mutation.ts +4 -8
- package/server/service/delivery-order/delivery-order-query.ts +4 -4
- package/server/service/delivery-order/delivery-order-summary-report.ts +152 -0
- package/server/service/delivery-order/delivery-order.ts +4 -1
- package/server/service/delivery-order/index.ts +3 -1
- package/server/service/index.ts +20 -12
- package/server/service/invoice/invoice-mutation.ts +45 -7
- package/server/service/invoice/invoice-query.ts +6 -6
- package/server/service/invoice/invoice-types.ts +231 -18
- package/server/service/invoice/invoice.ts +154 -20
- package/server/service/invoice-product/index.ts +9 -0
- package/server/service/invoice-product/invoice-product-mutation.ts +54 -0
- package/server/service/invoice-product/invoice-product-query.ts +55 -0
- package/server/service/invoice-product/invoice-product-types.ts +80 -0
- package/server/service/invoice-product/invoice-product.ts +93 -0
- package/server/service/order-inventory/order-inventory-query.ts +3 -1
- package/server/service/order-inventory/order-inventory.ts +11 -13
- package/server/service/order-product/order-product.ts +13 -13
- package/server/service/order-vas/order-vas.ts +15 -15
- package/server/service/others/other-query.ts +9 -15
- package/server/service/others/other-types.ts +31 -0
- package/server/service/purchase-order/purchase-order-mutation.ts +19 -21
- package/server/service/release-good/release-good-mutation.ts +64 -58
- package/server/service/release-good/release-good-query.ts +6 -12
- package/server/service/release-good/release-good.ts +2 -0
- package/server/service/return-order/return-order-mutation.ts +5 -4
- package/server/utils/order-no-generator.ts +11 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Arg, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
|
|
2
|
+
import { getRepository } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import { User } from '@things-factory/auth-base'
|
|
5
|
+
import { buildQuery, Domain, Filter, Pagination, Sorting } from '@things-factory/shell'
|
|
6
|
+
|
|
7
|
+
import { InvoiceProduct } from './invoice-product'
|
|
8
|
+
import { InvoiceProductList } from './invoice-product-types'
|
|
9
|
+
|
|
10
|
+
@Resolver(InvoiceProduct)
|
|
11
|
+
export class InvoiceProductQuery {
|
|
12
|
+
@Query(returns => InvoiceProductList)
|
|
13
|
+
async invoiceProducts(
|
|
14
|
+
@Ctx() context: any,
|
|
15
|
+
@Arg('filters', type => [Filter], { nullable: true }) filters?: Filter[],
|
|
16
|
+
@Arg('pagination', type => Pagination, { nullable: true }) pagination?: Pagination,
|
|
17
|
+
@Arg('sortings', type => [Sorting], { nullable: true }) sortings?: Sorting[]
|
|
18
|
+
): Promise<InvoiceProductList> {
|
|
19
|
+
const queryBuilder = getRepository(InvoiceProduct).createQueryBuilder()
|
|
20
|
+
buildQuery(queryBuilder, { filters, pagination, sortings }, context)
|
|
21
|
+
const [items, total] = await queryBuilder
|
|
22
|
+
.leftJoinAndSelect('InvoiceProduct.domain', 'Domain')
|
|
23
|
+
.leftJoinAndSelect('InvoiceProduct.invoice', 'Invoice')
|
|
24
|
+
.leftJoinAndSelect('InvoiceProduct.creator', 'Creator')
|
|
25
|
+
.leftJoinAndSelect('InvoiceProduct.updater', 'Updater')
|
|
26
|
+
.getManyAndCount()
|
|
27
|
+
|
|
28
|
+
return { items, total }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Query(returns => InvoiceProduct)
|
|
32
|
+
async invoiceProduct(@Arg('name') name: string, @Ctx() context: any): Promise<InvoiceProduct> {
|
|
33
|
+
const { domain }: { domain: Domain } = context.state
|
|
34
|
+
|
|
35
|
+
return await getRepository(InvoiceProduct).findOne({
|
|
36
|
+
where: { domain, name },
|
|
37
|
+
relations: ['domain', 'invoice', 'creator', 'updater']
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@FieldResolver(type => Domain)
|
|
42
|
+
async domain(@Root() invoiceProduct: InvoiceProduct): Promise<Domain> {
|
|
43
|
+
return await getRepository(Domain).findOne(invoiceProduct.domainId)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@FieldResolver(type => User)
|
|
47
|
+
async creator(@Root() invoiceProduct: InvoiceProduct): Promise<User> {
|
|
48
|
+
return await getRepository(User).findOne(invoiceProduct.creatorId)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@FieldResolver(type => User)
|
|
52
|
+
async updater(@Root() invoiceProduct: InvoiceProduct): Promise<User> {
|
|
53
|
+
return await getRepository(User).findOne(invoiceProduct.updaterId)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Field, Float, InputType, Int, ObjectType } from 'type-graphql'
|
|
2
|
+
|
|
3
|
+
import { ObjectRef } from '@things-factory/shell'
|
|
4
|
+
|
|
5
|
+
import { InvoiceProduct } from './invoice-product'
|
|
6
|
+
|
|
7
|
+
@ObjectType()
|
|
8
|
+
export class InvoiceProductList {
|
|
9
|
+
@Field(type => [InvoiceProduct], { nullable: true })
|
|
10
|
+
items: InvoiceProduct[]
|
|
11
|
+
|
|
12
|
+
@Field(type => Int, { nullable: true })
|
|
13
|
+
total: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@InputType()
|
|
17
|
+
export class ProductInput {
|
|
18
|
+
@Field()
|
|
19
|
+
sku: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@InputType()
|
|
23
|
+
export class NewInvoiceProduct {
|
|
24
|
+
@Field({ nullable: true })
|
|
25
|
+
name: string
|
|
26
|
+
|
|
27
|
+
@Field({ nullable: true })
|
|
28
|
+
sku: string
|
|
29
|
+
|
|
30
|
+
@Field({ nullable: true })
|
|
31
|
+
description: string
|
|
32
|
+
|
|
33
|
+
@Field(type => ObjectRef)
|
|
34
|
+
invoice: ObjectRef
|
|
35
|
+
|
|
36
|
+
@Field(type => ProductInput)
|
|
37
|
+
product: ProductInput
|
|
38
|
+
|
|
39
|
+
@Field(type => Int)
|
|
40
|
+
qty: number
|
|
41
|
+
|
|
42
|
+
@Field(type => Float, { nullable: false })
|
|
43
|
+
otherCharges: number
|
|
44
|
+
|
|
45
|
+
@Field(type => Float)
|
|
46
|
+
unitPrice: number
|
|
47
|
+
|
|
48
|
+
@Field(type => Float)
|
|
49
|
+
paidPrice: number
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@InputType()
|
|
53
|
+
export class InvoiceProductPatch {
|
|
54
|
+
@Field({ nullable: true })
|
|
55
|
+
name: string
|
|
56
|
+
|
|
57
|
+
@Field({ nullable: true })
|
|
58
|
+
sku: string
|
|
59
|
+
|
|
60
|
+
@Field({ nullable: true })
|
|
61
|
+
description: string
|
|
62
|
+
|
|
63
|
+
@Field(type => ObjectRef)
|
|
64
|
+
invoice: ObjectRef
|
|
65
|
+
|
|
66
|
+
@Field(type => ProductInput)
|
|
67
|
+
product: ProductInput
|
|
68
|
+
|
|
69
|
+
@Field(type => Int)
|
|
70
|
+
qty: number
|
|
71
|
+
|
|
72
|
+
@Field(type => Float, { nullable: false })
|
|
73
|
+
otherCharges: number
|
|
74
|
+
|
|
75
|
+
@Field(type => Float)
|
|
76
|
+
unitPrice: number
|
|
77
|
+
|
|
78
|
+
@Field(type => Float)
|
|
79
|
+
paidPrice: number
|
|
80
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Field, ID, ObjectType } from 'type-graphql'
|
|
2
|
+
import {
|
|
3
|
+
Column,
|
|
4
|
+
CreateDateColumn,
|
|
5
|
+
Entity,
|
|
6
|
+
Index,
|
|
7
|
+
ManyToOne,
|
|
8
|
+
PrimaryGeneratedColumn,
|
|
9
|
+
RelationId,
|
|
10
|
+
UpdateDateColumn
|
|
11
|
+
} from 'typeorm'
|
|
12
|
+
|
|
13
|
+
import { User } from '@things-factory/auth-base'
|
|
14
|
+
import { Product } from '@things-factory/product-base'
|
|
15
|
+
import { Domain } from '@things-factory/shell'
|
|
16
|
+
|
|
17
|
+
import { Invoice } from '../invoice/invoice'
|
|
18
|
+
|
|
19
|
+
@Entity()
|
|
20
|
+
@Index('ix_invoice_product_0', (invoiceProduct: InvoiceProduct) => [invoiceProduct.id], {
|
|
21
|
+
unique: true
|
|
22
|
+
})
|
|
23
|
+
@ObjectType()
|
|
24
|
+
export class InvoiceProduct {
|
|
25
|
+
@PrimaryGeneratedColumn('uuid')
|
|
26
|
+
@Field(type => ID)
|
|
27
|
+
readonly id: string
|
|
28
|
+
|
|
29
|
+
@ManyToOne(type => Domain)
|
|
30
|
+
@Field(type => Domain, { nullable: true })
|
|
31
|
+
domain: Domain
|
|
32
|
+
|
|
33
|
+
@RelationId((invoiceProduct: InvoiceProduct) => invoiceProduct.domain)
|
|
34
|
+
domainId: string
|
|
35
|
+
|
|
36
|
+
@Column({ nullable: true })
|
|
37
|
+
@Field({ nullable: true })
|
|
38
|
+
sku: string
|
|
39
|
+
|
|
40
|
+
@Column()
|
|
41
|
+
@Field()
|
|
42
|
+
name: string
|
|
43
|
+
|
|
44
|
+
@Column({ nullable: true })
|
|
45
|
+
@Field()
|
|
46
|
+
description: string
|
|
47
|
+
|
|
48
|
+
@ManyToOne(type => Invoice)
|
|
49
|
+
@Field(type => Invoice)
|
|
50
|
+
invoice: Invoice
|
|
51
|
+
|
|
52
|
+
@ManyToOne(type => Product, { nullable: true })
|
|
53
|
+
@Field(type => Product, { nullable: true })
|
|
54
|
+
product: Product
|
|
55
|
+
|
|
56
|
+
@Column('int', { default: 0 })
|
|
57
|
+
@Field()
|
|
58
|
+
qty: number
|
|
59
|
+
|
|
60
|
+
@Column('float', { default: 0 })
|
|
61
|
+
@Field({ nullable: true })
|
|
62
|
+
otherCharges: number
|
|
63
|
+
|
|
64
|
+
@Column('float', { default: 0 })
|
|
65
|
+
@Field()
|
|
66
|
+
unitPrice: number
|
|
67
|
+
|
|
68
|
+
@Column('float', { default: 0 })
|
|
69
|
+
@Field()
|
|
70
|
+
paidPrice: number
|
|
71
|
+
|
|
72
|
+
@CreateDateColumn()
|
|
73
|
+
@Field()
|
|
74
|
+
createdAt: Date
|
|
75
|
+
|
|
76
|
+
@UpdateDateColumn()
|
|
77
|
+
@Field({ nullable: true })
|
|
78
|
+
updatedAt: Date
|
|
79
|
+
|
|
80
|
+
@ManyToOne(type => User, { nullable: true })
|
|
81
|
+
@Field(type => User, { nullable: true })
|
|
82
|
+
creator: User
|
|
83
|
+
|
|
84
|
+
@RelationId((invoiceProduct: InvoiceProduct) => invoiceProduct.creator)
|
|
85
|
+
creatorId: string
|
|
86
|
+
|
|
87
|
+
@ManyToOne(type => User, { nullable: true })
|
|
88
|
+
@Field(type => User, { nullable: true })
|
|
89
|
+
updater: User
|
|
90
|
+
|
|
91
|
+
@RelationId((invoiceProduct: InvoiceProduct) => invoiceProduct.updater)
|
|
92
|
+
updaterId: string
|
|
93
|
+
}
|
|
@@ -6,7 +6,9 @@ import { getPermittedBizplaceIds } from '@things-factory/biz-base'
|
|
|
6
6
|
import { Product } from '@things-factory/product-base'
|
|
7
7
|
import { buildQuery, convertListParams, Domain, Filter, ListParam, Pagination, Sorting } from '@things-factory/shell'
|
|
8
8
|
|
|
9
|
-
import { ArrivalNotice
|
|
9
|
+
import { ArrivalNotice } from '../arrival-notice/arrival-notice'
|
|
10
|
+
import { OrderInventoryList } from '../order-inventory/order-inventory-types'
|
|
11
|
+
import { ReleaseGood } from '../release-good/release-good'
|
|
10
12
|
import { OrderInventory } from './order-inventory'
|
|
11
13
|
|
|
12
14
|
interface filterInterface {
|
|
@@ -16,15 +16,13 @@ import { Product } from '@things-factory/product-base'
|
|
|
16
16
|
import { Domain } from '@things-factory/shell'
|
|
17
17
|
import { Inventory, Location } from '@things-factory/warehouse-base'
|
|
18
18
|
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
TransferOrder
|
|
27
|
-
} from '../'
|
|
19
|
+
import { ArrivalNotice } from '../arrival-notice/arrival-notice'
|
|
20
|
+
import { DeliveryOrder } from '../delivery-order/delivery-order'
|
|
21
|
+
import { InventoryCheck } from '../inventory-check/inventory-check'
|
|
22
|
+
import { OrderProduct } from '../order-product/order-product'
|
|
23
|
+
import { ReleaseGood } from '../release-good/release-good'
|
|
24
|
+
import { ReturnOrder } from '../return-order/return-order'
|
|
25
|
+
import { TransferOrder } from '../transfer-order/transfer-order'
|
|
28
26
|
|
|
29
27
|
@Entity()
|
|
30
28
|
@Index('ix_order-inventory_0', (orderInventory: OrderInventory) => [orderInventory.domain, orderInventory.name], {
|
|
@@ -57,7 +55,7 @@ import {
|
|
|
57
55
|
@ObjectType()
|
|
58
56
|
export class OrderInventory {
|
|
59
57
|
@PrimaryGeneratedColumn('uuid')
|
|
60
|
-
@Field(type => ID)
|
|
58
|
+
@Field(type => ID, { nullable: true })
|
|
61
59
|
readonly id: string
|
|
62
60
|
|
|
63
61
|
@ManyToOne(type => Domain)
|
|
@@ -75,7 +73,7 @@ export class OrderInventory {
|
|
|
75
73
|
bizplaceId: string
|
|
76
74
|
|
|
77
75
|
@Column()
|
|
78
|
-
@Field()
|
|
76
|
+
@Field({ nullable: true })
|
|
79
77
|
name: string
|
|
80
78
|
|
|
81
79
|
@Column({ nullable: true })
|
|
@@ -122,8 +120,8 @@ export class OrderInventory {
|
|
|
122
120
|
packingType: string
|
|
123
121
|
|
|
124
122
|
@Column('float', { default: 1 })
|
|
125
|
-
@Field()
|
|
126
|
-
packingSize
|
|
123
|
+
@Field({ nullable: true })
|
|
124
|
+
packingSize?: number
|
|
127
125
|
|
|
128
126
|
@ManyToOne(type => ArrivalNotice)
|
|
129
127
|
@Field(type => ArrivalNotice, { nullable: true })
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { User } from '@things-factory/auth-base'
|
|
2
|
-
import { Bizplace } from '@things-factory/biz-base'
|
|
3
|
-
import { Product } from '@things-factory/product-base'
|
|
4
|
-
import { Domain } from '@things-factory/shell'
|
|
5
|
-
import { Inventory } from '@things-factory/warehouse-base'
|
|
6
1
|
import { Field, ID, ObjectType } from 'type-graphql'
|
|
7
2
|
import {
|
|
8
3
|
Column,
|
|
@@ -14,14 +9,19 @@ import {
|
|
|
14
9
|
RelationId,
|
|
15
10
|
UpdateDateColumn
|
|
16
11
|
} from 'typeorm'
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} from '../'
|
|
12
|
+
|
|
13
|
+
import { User } from '@things-factory/auth-base'
|
|
14
|
+
import { Bizplace } from '@things-factory/biz-base'
|
|
15
|
+
import { Product } from '@things-factory/product-base'
|
|
16
|
+
import { Domain } from '@things-factory/shell'
|
|
17
|
+
import { Inventory } from '@things-factory/warehouse-base'
|
|
18
|
+
|
|
19
|
+
import { ArrivalNotice } from '../arrival-notice/arrival-notice'
|
|
20
|
+
import { CollectionOrder } from '../collection-order/collection-order'
|
|
21
|
+
import { DeliveryOrder } from '../delivery-order/delivery-order'
|
|
22
|
+
import { PurchaseOrder } from '../purchase-order/purchase-order'
|
|
23
|
+
import { ReleaseGood } from '../release-good/release-good'
|
|
24
|
+
import { RetailReplenishmentOrder } from '../retail-replenishment-order/retail-replenishment-order'
|
|
25
25
|
|
|
26
26
|
@Entity()
|
|
27
27
|
@Index('ix_order-product_0', (orderProduct: OrderProduct) => [orderProduct.domain, orderProduct.name], {
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { User } from '@things-factory/auth-base'
|
|
2
|
-
import { Bizplace } from '@things-factory/biz-base'
|
|
3
|
-
import { Product } from '@things-factory/product-base'
|
|
4
|
-
import { Domain } from '@things-factory/shell'
|
|
5
|
-
import { Inventory } from '@things-factory/warehouse-base'
|
|
6
1
|
import { Field, ID, ObjectType } from 'type-graphql'
|
|
7
2
|
import {
|
|
8
3
|
Column,
|
|
@@ -14,16 +9,21 @@ import {
|
|
|
14
9
|
RelationId,
|
|
15
10
|
UpdateDateColumn
|
|
16
11
|
} from 'typeorm'
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} from '../'
|
|
12
|
+
|
|
13
|
+
import { User } from '@things-factory/auth-base'
|
|
14
|
+
import { Bizplace } from '@things-factory/biz-base'
|
|
15
|
+
import { Product } from '@things-factory/product-base'
|
|
16
|
+
import { Domain } from '@things-factory/shell'
|
|
17
|
+
import { Inventory } from '@things-factory/warehouse-base'
|
|
18
|
+
|
|
19
|
+
import { ArrivalNotice } from '../arrival-notice/arrival-notice'
|
|
20
|
+
import { ReleaseGood } from '../release-good/release-good'
|
|
21
|
+
import { RetailReplenishmentOrder } from '../retail-replenishment-order/retail-replenishment-order'
|
|
22
|
+
import { ReturnOrder } from '../return-order/return-order'
|
|
23
|
+
import { ShippingOrder } from '../shipping-order/shipping-order'
|
|
24
|
+
import { TransferOrder } from '../transfer-order/transfer-order'
|
|
25
|
+
import { VasOrder } from '../vas-order/vas-order'
|
|
26
|
+
import { Vas } from '../vas/vas'
|
|
27
27
|
|
|
28
28
|
@Entity('order_vass')
|
|
29
29
|
@Index('ix_order-vas_0', (orderVas: OrderVas) => [orderVas.domain, orderVas.name], { unique: true })
|
|
@@ -7,7 +7,7 @@ import { Bizplace, getPermittedBizplaces } from '@things-factory/biz-base'
|
|
|
7
7
|
import { Product, ProductDetail } from '@things-factory/product-base'
|
|
8
8
|
import { Domain, ListParam } from '@things-factory/shell'
|
|
9
9
|
|
|
10
|
-
import { InventoryProductGroupList, NewOrderInventory, NewOrderProduct, OrderInventory, OrderProduct } from '../'
|
|
10
|
+
import { InventoryProductGroup, InventoryProductGroupList, NewOrderInventory, NewOrderProduct, OrderInventory, OrderProduct } from '../'
|
|
11
11
|
import { InventoryUtil } from '../../utils'
|
|
12
12
|
|
|
13
13
|
@Resolver()
|
|
@@ -16,12 +16,8 @@ export class OtherQuery {
|
|
|
16
16
|
@Directive('@transaction')
|
|
17
17
|
@Query(returns => InventoryProductGroupList)
|
|
18
18
|
async inventoryProductGroup(@Ctx() context: any, @Args() params: ListParam): Promise<InventoryProductGroupList> {
|
|
19
|
-
const {
|
|
20
|
-
|
|
21
|
-
user,
|
|
22
|
-
tx,
|
|
23
|
-
bizplace
|
|
24
|
-
}: { domain: Domain; user: User; tx: EntityManager; bizplace: Bizplace } = context.state
|
|
19
|
+
const { domain, user, tx, bizplace }: { domain: Domain; user: User; tx: EntityManager; bizplace: Bizplace } =
|
|
20
|
+
context.state
|
|
25
21
|
|
|
26
22
|
let permittedBizplaces: Bizplace[] = await getPermittedBizplaces(domain, user)
|
|
27
23
|
|
|
@@ -52,7 +48,8 @@ export class OtherQuery {
|
|
|
52
48
|
}
|
|
53
49
|
|
|
54
50
|
@Directive('@privilege(category: "order_customer", privilege: "query")')
|
|
55
|
-
@
|
|
51
|
+
@Directive('@transaction')
|
|
52
|
+
@Query(returns => [OrderInventory])
|
|
56
53
|
async bulkUploadValidateWarehousePartnersProductsQuantity(
|
|
57
54
|
@Ctx() context: any,
|
|
58
55
|
@Arg('partnerBizplaceId') partnerBizplaceId: string,
|
|
@@ -197,18 +194,15 @@ export class OtherQuery {
|
|
|
197
194
|
}
|
|
198
195
|
|
|
199
196
|
@Directive('@privilege(category: "order_customer", privilege: "query")')
|
|
200
|
-
@
|
|
197
|
+
@Directive('@transaction')
|
|
198
|
+
@Query(returns => [InventoryProductGroup])
|
|
201
199
|
async bulkUploadValidateOrderProducts(
|
|
202
200
|
@Ctx() context: any,
|
|
203
201
|
@Arg('partnerBizplaceId') partnerBizplaceId: string,
|
|
204
202
|
@Arg('orderProducts', type => [NewOrderProduct], { nullable: true }) orderProducts: NewOrderProduct[]
|
|
205
203
|
): Promise<OrderProduct[]> {
|
|
206
|
-
const {
|
|
207
|
-
|
|
208
|
-
user,
|
|
209
|
-
tx,
|
|
210
|
-
bizplace
|
|
211
|
-
}: { domain: Domain; user: User; tx: EntityManager; bizplace: Bizplace } = context.state
|
|
204
|
+
const { domain, user, tx, bizplace }: { domain: Domain; user: User; tx: EntityManager; bizplace: Bizplace } =
|
|
205
|
+
context.state
|
|
212
206
|
|
|
213
207
|
const productDetailRepo = tx.getRepository(ProductDetail)
|
|
214
208
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Field, Float, Int, ObjectType } from 'type-graphql'
|
|
2
|
+
import { Product } from '@things-factory/product-base'
|
|
2
3
|
|
|
3
4
|
@ObjectType()
|
|
4
5
|
export class InventoryProductGroupList {
|
|
@@ -11,6 +12,9 @@ export class InventoryProductGroupList {
|
|
|
11
12
|
|
|
12
13
|
@ObjectType()
|
|
13
14
|
export class InventoryProductGroup {
|
|
15
|
+
@Field({ nullable: true })
|
|
16
|
+
id: string
|
|
17
|
+
|
|
14
18
|
@Field({ nullable: true })
|
|
15
19
|
productId: string
|
|
16
20
|
|
|
@@ -35,6 +39,12 @@ export class InventoryProductGroup {
|
|
|
35
39
|
@Field(type => Float, { nullable: true })
|
|
36
40
|
packingSize: number
|
|
37
41
|
|
|
42
|
+
@Field(type => Int, { nullable: true })
|
|
43
|
+
packQty: number
|
|
44
|
+
|
|
45
|
+
@Field(type => Int, { nullable: true })
|
|
46
|
+
palletQty: number
|
|
47
|
+
|
|
38
48
|
@Field(type => Float, { nullable: true })
|
|
39
49
|
remainQty: number
|
|
40
50
|
|
|
@@ -50,6 +60,27 @@ export class InventoryProductGroup {
|
|
|
50
60
|
@Field({ nullable: true })
|
|
51
61
|
uom: string
|
|
52
62
|
|
|
63
|
+
@Field(type => Float, { nullable: true })
|
|
64
|
+
uomValue: number
|
|
65
|
+
|
|
66
|
+
@Field({ nullable: true })
|
|
67
|
+
totalUomValue: String
|
|
68
|
+
|
|
53
69
|
@Field({ nullable: true })
|
|
54
70
|
groupType: string
|
|
71
|
+
|
|
72
|
+
@Field(type => Int, { nullable: true })
|
|
73
|
+
manufactureYear: number
|
|
74
|
+
|
|
75
|
+
@Field(type => Float, { nullable: true })
|
|
76
|
+
unitPrice: number
|
|
77
|
+
|
|
78
|
+
@Field({ nullable: true })
|
|
79
|
+
remark: string
|
|
80
|
+
|
|
81
|
+
@Field(type => Float, { nullable: true })
|
|
82
|
+
isError: Boolean
|
|
83
|
+
|
|
84
|
+
@Field(type => Product, { nullable: true })
|
|
85
|
+
product: Product
|
|
55
86
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FileUpload, GraphQLUpload } from 'graphql-upload'
|
|
2
|
+
import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
|
|
3
|
+
import { EntityManager, getRepository, Repository } from 'typeorm'
|
|
4
|
+
|
|
5
|
+
import { Attachment, createAttachments, deleteAttachmentsByRef } from '@things-factory/attachment-base'
|
|
2
6
|
import { User } from '@things-factory/auth-base'
|
|
3
7
|
import { Bizplace, ContactPoint, getPermittedBizplaces } from '@things-factory/biz-base'
|
|
4
8
|
import { generateId } from '@things-factory/id-rule-base'
|
|
@@ -6,9 +10,7 @@ import { Product } from '@things-factory/product-base'
|
|
|
6
10
|
import { Setting } from '@things-factory/setting-base'
|
|
7
11
|
import { Domain } from '@things-factory/shell'
|
|
8
12
|
import { Location } from '@things-factory/warehouse-base'
|
|
9
|
-
|
|
10
|
-
import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
|
|
11
|
-
import { EntityManager, getRepository, Repository } from 'typeorm'
|
|
13
|
+
|
|
12
14
|
import {
|
|
13
15
|
ArrivalNotice,
|
|
14
16
|
NewPurchaseOrder,
|
|
@@ -40,14 +42,14 @@ export class PurchaseOrderMutation {
|
|
|
40
42
|
async upsertPurchaseOrder(
|
|
41
43
|
@Ctx() context: any,
|
|
42
44
|
@Arg('purchaseOrder', type => PurchaseOrderPatch) purchaseOrder: PurchaseOrderPatch,
|
|
43
|
-
@Arg('
|
|
45
|
+
@Arg('files', type => [GraphQLUpload], { nullable: true }) files?: FileUpload
|
|
44
46
|
): Promise<PurchaseOrder> {
|
|
45
47
|
try {
|
|
46
48
|
const { tx }: { tx: EntityManager } = context.state
|
|
47
49
|
const createdPurchaseOrder: PurchaseOrder = await upsertPurchaseOrderFunction(
|
|
48
50
|
null,
|
|
49
51
|
purchaseOrder,
|
|
50
|
-
|
|
52
|
+
files,
|
|
51
53
|
context,
|
|
52
54
|
tx
|
|
53
55
|
)
|
|
@@ -197,17 +199,14 @@ export class PurchaseOrderMutation {
|
|
|
197
199
|
export async function upsertPurchaseOrderFunction(
|
|
198
200
|
_: any,
|
|
199
201
|
purchaseOrder: any,
|
|
200
|
-
|
|
202
|
+
files: FileUpload[],
|
|
201
203
|
context: any,
|
|
202
204
|
tx?: EntityManager
|
|
203
205
|
): Promise<PurchaseOrder> {
|
|
204
|
-
const { domain, user }: { domain: Domain; user: User } = context.state
|
|
205
|
-
let orderProducts: OrderProduct[] = purchaseOrder.orderProducts
|
|
206
|
-
|
|
207
206
|
if (!purchaseOrder.id) {
|
|
208
|
-
purchaseOrder = await createPurchaseOrderFunction(_, purchaseOrder,
|
|
207
|
+
purchaseOrder = await createPurchaseOrderFunction(_, purchaseOrder, files, context, tx)
|
|
209
208
|
} else {
|
|
210
|
-
purchaseOrder = await updatePurchaseOrderFunction(_, purchaseOrder,
|
|
209
|
+
purchaseOrder = await updatePurchaseOrderFunction(_, purchaseOrder, files, context, tx)
|
|
211
210
|
}
|
|
212
211
|
|
|
213
212
|
return purchaseOrder
|
|
@@ -216,7 +215,7 @@ export async function upsertPurchaseOrderFunction(
|
|
|
216
215
|
export async function createPurchaseOrderFunction(
|
|
217
216
|
_: any,
|
|
218
217
|
purchaseOrder: any,
|
|
219
|
-
|
|
218
|
+
files: FileUpload[],
|
|
220
219
|
context: any,
|
|
221
220
|
tx?: EntityManager
|
|
222
221
|
): Promise<PurchaseOrder> {
|
|
@@ -297,8 +296,8 @@ export async function createPurchaseOrderFunction(
|
|
|
297
296
|
}
|
|
298
297
|
|
|
299
298
|
// // 4. Create Attacments
|
|
300
|
-
if (
|
|
301
|
-
const attachments: Attachment[] =
|
|
299
|
+
if (files?.length) {
|
|
300
|
+
const attachments: Attachment[] = files.map(attachment => {
|
|
302
301
|
return {
|
|
303
302
|
file: attachment,
|
|
304
303
|
refBy: createdPurchaseOrder.id,
|
|
@@ -314,7 +313,7 @@ export async function createPurchaseOrderFunction(
|
|
|
314
313
|
export async function updatePurchaseOrderFunction(
|
|
315
314
|
_: any,
|
|
316
315
|
purchaseOrder: any,
|
|
317
|
-
|
|
316
|
+
files: FileUpload[],
|
|
318
317
|
context: any,
|
|
319
318
|
tx?: EntityManager
|
|
320
319
|
): Promise<PurchaseOrder> {
|
|
@@ -386,14 +385,13 @@ export async function updatePurchaseOrderFunction(
|
|
|
386
385
|
})
|
|
387
386
|
|
|
388
387
|
// // 6. Remove All Attachment
|
|
389
|
-
|
|
390
|
-
await
|
|
388
|
+
if (foundAttachments?.length) {
|
|
389
|
+
await deleteAttachmentsByRef(_, { refBys: foundAttachments.map(file => file.refBy) }, context)
|
|
391
390
|
}
|
|
392
391
|
|
|
393
392
|
// // 7. Add New Attachment
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
const attachments: Attachment[] = newAttachments.map(attachment => {
|
|
393
|
+
if (files?.length > 0) {
|
|
394
|
+
const attachments: Attachment[] = files.map(attachment => {
|
|
397
395
|
return {
|
|
398
396
|
file: attachment,
|
|
399
397
|
refBy: updatePurchaseOrder.id,
|