@things-factory/warehouse-base 8.0.3 → 8.0.6

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.
Files changed (88) hide show
  1. package/dist-server/tsconfig.tsbuildinfo +1 -1
  2. package/package.json +8 -8
  3. package/server/constants/index.ts +0 -5
  4. package/server/constants/inventory.ts +0 -67
  5. package/server/constants/location.ts +0 -14
  6. package/server/constants/pallet.ts +0 -10
  7. package/server/constants/rule-type.ts +0 -5
  8. package/server/constants/tote.ts +0 -5
  9. package/server/controllers/ecommerce/ecommerce-controller.ts +0 -108
  10. package/server/controllers/ecommerce/index.ts +0 -2
  11. package/server/controllers/ecommerce/sellercraft-controller.ts +0 -100
  12. package/server/controllers/index.ts +0 -2
  13. package/server/controllers/warehouse-controller.ts +0 -181
  14. package/server/index.ts +0 -9
  15. package/server/middlewares/index.ts +0 -0
  16. package/server/migrations/index.ts +0 -9
  17. package/server/service/index.ts +0 -80
  18. package/server/service/inventory/index.ts +0 -6
  19. package/server/service/inventory/inventory-mutation.ts +0 -530
  20. package/server/service/inventory/inventory-query.ts +0 -1263
  21. package/server/service/inventory/inventory-types.ts +0 -367
  22. package/server/service/inventory/inventory.ts +0 -408
  23. package/server/service/inventory-change/index.ts +0 -6
  24. package/server/service/inventory-change/inventory-change-mutation.ts +0 -969
  25. package/server/service/inventory-change/inventory-change-query.ts +0 -93
  26. package/server/service/inventory-change/inventory-change-types.ts +0 -36
  27. package/server/service/inventory-change/inventory-change.ts +0 -164
  28. package/server/service/inventory-history/index.ts +0 -6
  29. package/server/service/inventory-history/inventory-history-mutation.ts +0 -116
  30. package/server/service/inventory-history/inventory-history-query.ts +0 -1845
  31. package/server/service/inventory-history/inventory-history-types.ts +0 -444
  32. package/server/service/inventory-history/inventory-history.ts +0 -203
  33. package/server/service/inventory-item/index.ts +0 -6
  34. package/server/service/inventory-item/inventory-item-mutation.ts +0 -217
  35. package/server/service/inventory-item/inventory-item-query.ts +0 -226
  36. package/server/service/inventory-item/inventory-item-type.ts +0 -74
  37. package/server/service/inventory-item/inventory-item.ts +0 -105
  38. package/server/service/inventory-item-change/index.ts +0 -6
  39. package/server/service/inventory-item-change/inventory-item-change-mutation.ts +0 -119
  40. package/server/service/inventory-item-change/inventory-item-change-query.ts +0 -47
  41. package/server/service/inventory-item-change/inventory-item-change-type.ts +0 -68
  42. package/server/service/inventory-item-change/inventory-item-change.ts +0 -92
  43. package/server/service/inventory-product/index.ts +0 -6
  44. package/server/service/inventory-product/inventory-product-mutation.ts +0 -116
  45. package/server/service/inventory-product/inventory-product-query.ts +0 -47
  46. package/server/service/inventory-product/inventory-product-type.ts +0 -59
  47. package/server/service/inventory-product/inventory-product.ts +0 -88
  48. package/server/service/location/index.ts +0 -6
  49. package/server/service/location/location-mutation.ts +0 -134
  50. package/server/service/location/location-query.ts +0 -244
  51. package/server/service/location/location-types.ts +0 -173
  52. package/server/service/location/location.ts +0 -121
  53. package/server/service/movement/index.ts +0 -6
  54. package/server/service/movement/movement-mutation.ts +0 -60
  55. package/server/service/movement/movement-query.ts +0 -263
  56. package/server/service/movement/movement-types.ts +0 -74
  57. package/server/service/movement/movement.ts +0 -81
  58. package/server/service/pallet/index.ts +0 -6
  59. package/server/service/pallet/pallet-mutation.ts +0 -242
  60. package/server/service/pallet/pallet-query.ts +0 -106
  61. package/server/service/pallet/pallet-types.ts +0 -80
  62. package/server/service/pallet/pallet.ts +0 -92
  63. package/server/service/pallet-count/index.ts +0 -6
  64. package/server/service/pallet-count/pallet-count-mutation.ts +0 -151
  65. package/server/service/pallet-count/pallet-count-query.ts +0 -45
  66. package/server/service/pallet-count/pallet-count-types.ts +0 -36
  67. package/server/service/pallet-count/pallet-count.ts +0 -70
  68. package/server/service/pallet-history/index.ts +0 -6
  69. package/server/service/pallet-history/pallet-history-mutation.ts +0 -114
  70. package/server/service/pallet-history/pallet-history-query.ts +0 -48
  71. package/server/service/pallet-history/pallet-history-types.ts +0 -36
  72. package/server/service/pallet-history/pallet-history.ts +0 -89
  73. package/server/service/reduced-inventory-history/index.ts +0 -3
  74. package/server/service/reduced-inventory-history/reduced-inventory-history.ts +0 -92
  75. package/server/service/tote/index.ts +0 -6
  76. package/server/service/tote/tote-mutation.ts +0 -201
  77. package/server/service/tote/tote-query.ts +0 -106
  78. package/server/service/tote/tote-types.ts +0 -44
  79. package/server/service/tote/tote.ts +0 -77
  80. package/server/service/warehouse/index.ts +0 -6
  81. package/server/service/warehouse/warehouse-mutation.ts +0 -152
  82. package/server/service/warehouse/warehouse-query.ts +0 -58
  83. package/server/service/warehouse/warehouse-types.ts +0 -50
  84. package/server/service/warehouse/warehouse.ts +0 -95
  85. package/server/utils/datetime-util.ts +0 -54
  86. package/server/utils/index.ts +0 -3
  87. package/server/utils/inventory-no-generator.ts +0 -15
  88. package/server/utils/inventory-util.ts +0 -490
@@ -1,45 +0,0 @@
1
- import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
2
-
3
- import { User } from '@things-factory/auth-base'
4
- import { convertListParams, Domain, getRepository, ListParam } from '@things-factory/shell'
5
-
6
- import { PalletCount } from './pallet-count'
7
- import { PalletCountList } from './pallet-count-types'
8
-
9
- @Resolver(PalletCount)
10
- export class PalletCountQuery {
11
- @Query(returns => PalletCountList)
12
- async palletCounts(@Args(type => ListParam) params: ListParam): Promise<PalletCountList> {
13
- const convertedParams = convertListParams(params)
14
- const [items, total] = await getRepository(PalletCount).findAndCount({
15
- ...convertedParams,
16
- relations: ['domain', 'creator', 'updater']
17
- })
18
- return { items, total }
19
- }
20
-
21
- @Query(returns => PalletCount)
22
- async palletCount(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<PalletCount> {
23
- const { domain } = context.state
24
-
25
- return await getRepository(PalletCount).findOne({
26
- where: { domain: { id: domain.id }, name },
27
- relations: ['domain', 'creator', 'updater']
28
- })
29
- }
30
-
31
- @FieldResolver(type => Domain)
32
- async domain(@Root() palletCount: PalletCount) {
33
- return await getRepository(Domain).findOneBy({ id: palletCount.domainId })
34
- }
35
-
36
- @FieldResolver(type => User)
37
- async updater(@Root() palletCount: PalletCount) {
38
- return await getRepository(User).findOneBy({ id: palletCount.updaterId })
39
- }
40
-
41
- @FieldResolver(type => User)
42
- async creator(@Root() palletCount: PalletCount) {
43
- return await getRepository(User).findOneBy({ id: palletCount.creatorId })
44
- }
45
- }
@@ -1,36 +0,0 @@
1
- import { Field, InputType, Int, ObjectType } from 'type-graphql'
2
-
3
- import { PalletCount } from './pallet-count'
4
-
5
- @InputType()
6
- export class NewPalletCount {
7
- @Field()
8
- name: string
9
-
10
- @Field({ nullable: true })
11
- description?: string
12
- }
13
-
14
- @ObjectType()
15
- export class PalletCountList {
16
- @Field(type => [PalletCount], { nullable: true })
17
- items?: PalletCount[]
18
-
19
- @Field(type => Int, { nullable: true })
20
- total?: number
21
- }
22
-
23
- @InputType()
24
- export class PalletCountPatch {
25
- @Field({ nullable: true })
26
- id?: string
27
-
28
- @Field({ nullable: true })
29
- name?: string
30
-
31
- @Field({ nullable: true })
32
- description?: string
33
-
34
- @Field({ nullable: true })
35
- cuFlag?: string
36
- }
@@ -1,70 +0,0 @@
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 { Domain } from '@things-factory/shell'
15
-
16
- @Entity()
17
- @Index('ix_pallet-count_0', (palletCount: PalletCount) => [palletCount.domain, palletCount.name], { unique: true })
18
- @ObjectType()
19
- export class PalletCount {
20
- @PrimaryGeneratedColumn('uuid')
21
- @Field(type => ID)
22
- id: string
23
-
24
- @ManyToOne(type => Domain)
25
- @Field(type => Domain)
26
- domain: Domain
27
-
28
- @RelationId((palletCount: PalletCount) => palletCount.domain)
29
- domainId: string
30
-
31
- @Column()
32
- @Field()
33
- name: string
34
-
35
- @Column({ default: 0 })
36
- @Field()
37
- seq: number
38
-
39
- @Column({
40
- nullable: true
41
- })
42
- @Field({ nullable: true })
43
- description: string
44
-
45
- @CreateDateColumn()
46
- @Field({ nullable: true })
47
- createdAt: Date
48
-
49
- @UpdateDateColumn()
50
- @Field({ nullable: true })
51
- updatedAt: Date
52
-
53
- @ManyToOne(type => User, {
54
- nullable: true
55
- })
56
- @Field({ nullable: true })
57
- creator: User
58
-
59
- @RelationId((palletCount: PalletCount) => palletCount.creator)
60
- creatorId: string
61
-
62
- @ManyToOne(type => User, {
63
- nullable: true
64
- })
65
- @Field({ nullable: true })
66
- updater: User
67
-
68
- @RelationId((palletCount: PalletCount) => palletCount.updater)
69
- updaterId: string
70
- }
@@ -1,6 +0,0 @@
1
- import { PalletHistory } from './pallet-history'
2
- import { PalletHistoryMutation } from './pallet-history-mutation'
3
- import { PalletHistoryQuery } from './pallet-history-query'
4
-
5
- export const entities = [PalletHistory]
6
- export const resolvers = [PalletHistoryQuery, PalletHistoryMutation]
@@ -1,114 +0,0 @@
1
- import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
2
- import { In } from 'typeorm'
3
-
4
- import { PalletHistory } from './pallet-history'
5
- import { NewPalletHistory, PalletHistoryPatch } from './pallet-history-types'
6
-
7
- @Resolver(PalletHistory)
8
- export class PalletHistoryMutation {
9
- @Directive('@transaction')
10
- @Mutation(returns => PalletHistory)
11
- async createPalletHistory(
12
- @Arg('palletHistory') palletHistory: NewPalletHistory,
13
- @Ctx() context: ResolverContext
14
- ): Promise<PalletHistory> {
15
- const { domain, user, tx } = context.state
16
-
17
- return await tx.getRepository(PalletHistory).save({
18
- ...palletHistory,
19
- domain: domain,
20
- creator: user,
21
- updater: user
22
- })
23
- }
24
-
25
- @Directive('@transaction')
26
- @Mutation(returns => PalletHistory)
27
- async updatePalletHistory(
28
- @Arg('name') name: string,
29
- @Arg('patch') patch: PalletHistoryPatch,
30
- @Ctx() context: ResolverContext
31
- ): Promise<PalletHistory> {
32
- const { domain, user, tx } = context.state
33
-
34
- const repository = tx.getRepository(PalletHistory)
35
- const palletHistory = await repository.findOne({
36
- where: { domain: { id: domain.id }, name }
37
- })
38
-
39
- return await repository.save({
40
- ...palletHistory,
41
- ...patch,
42
- updater: user
43
- })
44
- }
45
-
46
- @Directive('@transaction')
47
- @Mutation(returns => [PalletHistory])
48
- async updateMultiplePalletHistory(
49
- @Arg('patches', type => [PalletHistoryPatch]) patches: PalletHistoryPatch[],
50
- @Ctx() context: ResolverContext
51
- ): Promise<PalletHistory[]> {
52
- const { domain, user, tx } = context.state
53
- let results = []
54
- const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
55
- const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
56
- const palletHistoryRepo = tx.getRepository(PalletHistory)
57
-
58
- if (_createRecords.length > 0) {
59
- for (let i = 0; i < _createRecords.length; i++) {
60
- const newRecord = _createRecords[i]
61
-
62
- const result = await palletHistoryRepo.save({
63
- ...newRecord,
64
- domain: domain,
65
- creator: user,
66
- updater: user
67
- })
68
-
69
- results.push({ ...result, cuFlag: '+' })
70
- }
71
- }
72
-
73
- if (_updateRecords.length > 0) {
74
- for (let i = 0; i < _updateRecords.length; i++) {
75
- const newRecord = _updateRecords[i]
76
- const palletHistory = await palletHistoryRepo.findOneBy({ id: newRecord.id })
77
-
78
- const result = await palletHistoryRepo.save({
79
- ...palletHistory,
80
- ...newRecord,
81
- updater: user
82
- })
83
-
84
- results.push({ ...result, cuFlag: 'M' })
85
- }
86
- }
87
-
88
- return results
89
- }
90
-
91
- @Directive('@transaction')
92
- @Mutation(returns => Boolean)
93
- async deletePalletHistory(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<Boolean> {
94
- const { domain, user, tx } = context.state
95
-
96
- await tx.getRepository(PalletHistory).delete({ domain: { id: domain.id }, name })
97
- return true
98
- }
99
-
100
- @Directive('@transaction')
101
- @Mutation(returns => Boolean)
102
- async deletePalletHistories(
103
- @Arg('names', type => [String]) names: string[],
104
- @Ctx() context: ResolverContext
105
- ): Promise<Boolean> {
106
- const { domain, user, tx } = context.state
107
-
108
- await tx.getRepository(PalletHistory).delete({
109
- domain: { id: domain.id },
110
- name: In(names)
111
- })
112
- return true
113
- }
114
- }
@@ -1,48 +0,0 @@
1
- import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
2
-
3
- import { User } from '@things-factory/auth-base'
4
- import { convertListParams, Domain, getRepository, ListParam } from '@things-factory/shell'
5
-
6
- import { PalletHistory } from './pallet-history'
7
- import { PalletHistoryList } from './pallet-history-types'
8
-
9
- @Resolver(PalletHistory)
10
- export class PalletHistoryQuery {
11
- @Query(returns => PalletHistoryList)
12
- async palletHistories(
13
- @Args(type => ListParam) params: ListParam,
14
- @Ctx() context: ResolverContext
15
- ): Promise<PalletHistoryList> {
16
- const convertedParams = convertListParams(params)
17
- const [items, total] = await getRepository(PalletHistory).findAndCount({
18
- ...convertedParams,
19
- relations: ['domain', 'creator', 'updater']
20
- })
21
- return { items, total }
22
- }
23
-
24
- @Query(returns => PalletHistory)
25
- async palletHistory(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<PalletHistory> {
26
- const { domain } = context.state
27
-
28
- return await getRepository(PalletHistory).findOne({
29
- where: { domain: { id: domain.id }, name },
30
- relations: ['domain', 'creator', 'updater']
31
- })
32
- }
33
-
34
- @FieldResolver(type => Domain)
35
- async domain(@Root() palletHistory: PalletHistory) {
36
- return await getRepository(Domain).findOneBy({ id: palletHistory.domainId })
37
- }
38
-
39
- @FieldResolver(type => User)
40
- async updater(@Root() palletHistory: PalletHistory) {
41
- return await getRepository(User).findOneBy({ id: palletHistory.updaterId })
42
- }
43
-
44
- @FieldResolver(type => User)
45
- async creator(@Root() palletHistory: PalletHistory) {
46
- return await getRepository(User).findOneBy({ id: palletHistory.creatorId })
47
- }
48
- }
@@ -1,36 +0,0 @@
1
- import { Field, InputType, Int, ObjectType } from 'type-graphql'
2
-
3
- import { PalletHistory } from './pallet-history'
4
-
5
- @InputType()
6
- export class NewPalletHistory {
7
- @Field()
8
- name: string
9
-
10
- @Field({ nullable: true })
11
- description?: string
12
- }
13
-
14
- @ObjectType()
15
- export class PalletHistoryList {
16
- @Field(type => [PalletHistory], { nullable: true })
17
- items?: PalletHistory[]
18
-
19
- @Field(type => Int, { nullable: true })
20
- total?: number
21
- }
22
-
23
- @InputType()
24
- export class PalletHistoryPatch {
25
- @Field({ nullable: true })
26
- id?: string
27
-
28
- @Field({ nullable: true })
29
- name?: string
30
-
31
- @Field({ nullable: true })
32
- description?: string
33
-
34
- @Field({ nullable: true })
35
- cuFlag?: string
36
- }
@@ -1,89 +0,0 @@
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 { Bizplace } from '@things-factory/biz-base'
15
- import { Domain } from '@things-factory/shell'
16
-
17
- import { Pallet } from '../pallet/pallet'
18
-
19
- @Entity()
20
- @Index('ix_pallet-history_0', (palletHistory: PalletHistory) => [palletHistory.domain, palletHistory.id], {
21
- unique: true
22
- })
23
- @ObjectType()
24
- export class PalletHistory {
25
- @PrimaryGeneratedColumn('uuid')
26
- @Field(type => ID)
27
- id: string
28
-
29
- @ManyToOne(type => Domain)
30
- @Field(type => Domain, { nullable: true })
31
- domain: Domain
32
-
33
- @RelationId((palletHistory: PalletHistory) => palletHistory.domain)
34
- domainId: string
35
-
36
- @Column()
37
- @Field()
38
- name: string
39
-
40
- @Column({ default: 0 })
41
- @Field()
42
- seq: number
43
-
44
- @ManyToOne(type => Bizplace)
45
- @Field()
46
- owner: Bizplace
47
-
48
- @ManyToOne(type => Bizplace)
49
- @Field()
50
- holder: Bizplace
51
-
52
- @ManyToOne(type => Pallet)
53
- @Field()
54
- pallet: Pallet
55
-
56
- @Column()
57
- @Field()
58
- status: string
59
-
60
- @Column({ nullable: true })
61
- @Field({ nullable: true })
62
- type?: string
63
-
64
- @Column()
65
- @Field()
66
- transactionType: string
67
-
68
- @CreateDateColumn()
69
- @Field({ nullable: true })
70
- createdAt: Date
71
-
72
- @UpdateDateColumn()
73
- @Field({ nullable: true })
74
- updatedAt: Date
75
-
76
- @ManyToOne(type => User)
77
- @Field(type => User, { nullable: true })
78
- creator: User
79
-
80
- @RelationId((palletHistory: PalletHistory) => palletHistory.creator)
81
- creatorId: string
82
-
83
- @ManyToOne(type => User)
84
- @Field(type => User, { nullable: true })
85
- updater: User
86
-
87
- @RelationId((palletHistory: PalletHistory) => palletHistory.updater)
88
- updaterId: string
89
- }
@@ -1,3 +0,0 @@
1
- import { ReducedInventoryHistory } from './reduced-inventory-history'
2
-
3
- export const entities = [ReducedInventoryHistory]
@@ -1,92 +0,0 @@
1
- import { ViewColumn, ViewEntity } from 'typeorm'
2
-
3
- @ViewEntity({
4
- expression: `
5
- SELECT ih.* FROM inventory_histories ih
6
- WHERE NOT EXISTS (
7
- SELECT ih2.id FROM inventory_histories ih2
8
- WHERE ih2.domain_id = ih.domain_id AND ih2.pallet_id::text = ih.pallet_id::TEXT
9
- AND (
10
- ((ih2.transaction_type::text = 'CANCEL_ORDER'::text) AND ih2.ref_order_id::text = ih.ref_order_id::TEXT)
11
- OR
12
- ((ih2.seq = (ih.seq + 1) OR ih2.seq = ih.seq) AND (ih2.transaction_type::text = 'UNDO_UNLOADING'::TEXT))
13
- )
14
- )
15
- `
16
- })
17
- export class ReducedInventoryHistory {
18
- @ViewColumn()
19
- id: string
20
-
21
- @ViewColumn()
22
- seq: number
23
-
24
- @ViewColumn()
25
- domainId: string
26
-
27
- @ViewColumn()
28
- bizplaceId: string
29
-
30
- @ViewColumn()
31
- inventoryId: string
32
-
33
- @ViewColumn()
34
- refOrderId: string
35
-
36
- @ViewColumn()
37
- orderNo: string
38
-
39
- @ViewColumn()
40
- name: string
41
-
42
- @ViewColumn()
43
- palletId: string
44
-
45
- @ViewColumn()
46
- cartonId: string
47
-
48
- @ViewColumn()
49
- batchId: string
50
-
51
- @ViewColumn()
52
- batchIdRef: string
53
-
54
- @ViewColumn()
55
- productId: string
56
-
57
- @ViewColumn()
58
- warehouseId: string
59
-
60
- @ViewColumn()
61
- locationId: string
62
-
63
- @ViewColumn()
64
- zone: string
65
-
66
- @ViewColumn()
67
- orderRefNo: string
68
-
69
- @ViewColumn()
70
- packingType: string
71
-
72
- @ViewColumn()
73
- uom: string
74
-
75
- @ViewColumn()
76
- uomValue: number
77
-
78
- @ViewColumn()
79
- openingUomValue: number
80
-
81
- @ViewColumn()
82
- qty: number
83
-
84
- @ViewColumn()
85
- openingQty: number
86
-
87
- @ViewColumn()
88
- status: string
89
-
90
- @ViewColumn()
91
- transactionType: string
92
- }
@@ -1,6 +0,0 @@
1
- import { Tote } from './tote'
2
- import { ToteMutation } from './tote-mutation'
3
- import { ToteQuery } from './tote-query'
4
-
5
- export const entities = [Tote]
6
- export const resolvers = [ToteQuery, ToteMutation]