@things-factory/warehouse-base 7.0.1-alpha.10 → 7.0.1-alpha.101
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/client/bootstrap.js +1 -1
- package/dist-server/service/inventory/inventory-query.js +12 -0
- package/dist-server/service/inventory/inventory-query.js.map +1 -1
- package/dist-server/service/inventory-change/inventory-change-mutation.js +12 -37
- package/dist-server/service/inventory-change/inventory-change-mutation.js.map +1 -1
- package/dist-server/service/inventory-change/inventory-change.js +5 -2
- package/dist-server/service/inventory-change/inventory-change.js.map +1 -1
- package/dist-server/service/inventory-history/inventory-history.js +10 -3
- package/dist-server/service/inventory-history/inventory-history.js.map +1 -1
- package/dist-server/service/inventory-item/inventory-item.js +1 -1
- package/dist-server/service/inventory-item/inventory-item.js.map +1 -1
- package/dist-server/service/inventory-item-change/inventory-item-change.js +1 -1
- package/dist-server/service/inventory-item-change/inventory-item-change.js.map +1 -1
- package/dist-server/service/inventory-product/inventory-product.js +1 -1
- package/dist-server/service/inventory-product/inventory-product.js.map +1 -1
- package/dist-server/service/location/location.js +1 -1
- package/dist-server/service/location/location.js.map +1 -1
- package/dist-server/service/movement/movement.js +1 -1
- package/dist-server/service/movement/movement.js.map +1 -1
- package/dist-server/service/pallet/pallet.js +1 -1
- package/dist-server/service/pallet/pallet.js.map +1 -1
- package/dist-server/service/pallet-count/pallet-count.js +1 -1
- package/dist-server/service/pallet-count/pallet-count.js.map +1 -1
- package/dist-server/service/tote/tote.js +1 -1
- package/dist-server/service/tote/tote.js.map +1 -1
- package/dist-server/service/warehouse/warehouse.js +1 -1
- package/dist-server/service/warehouse/warehouse.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/server/service/inventory/inventory-query.ts +14 -0
- package/server/service/inventory-change/inventory-change-mutation.ts +21 -67
- package/server/service/inventory-change/inventory-change.ts +15 -3
- package/server/service/inventory-history/inventory-history.ts +25 -5
- package/server/service/inventory-item/inventory-item.ts +1 -1
- package/server/service/inventory-item-change/inventory-item-change.ts +1 -1
- package/server/service/inventory-product/inventory-product.ts +1 -1
- package/server/service/location/location.ts +1 -1
- package/server/service/movement/movement.ts +11 -2
- package/server/service/pallet/pallet.ts +1 -1
- package/server/service/pallet-count/pallet-count.ts +1 -1
- package/server/service/tote/tote.ts +1 -1
- package/server/service/warehouse/warehouse.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/warehouse-base",
|
|
3
|
-
"version": "7.0.1-alpha.
|
|
3
|
+
"version": "7.0.1-alpha.101",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@things-factory/biz-base": "^7.0.1-alpha.
|
|
28
|
-
"@things-factory/id-rule-base": "^7.0.1-alpha.
|
|
29
|
-
"@things-factory/integration-sellercraft": "^7.0.1-alpha.
|
|
30
|
-
"@things-factory/marketplace-base": "^7.0.1-alpha.
|
|
31
|
-
"@things-factory/product-base": "^7.0.1-alpha.
|
|
32
|
-
"@things-factory/setting-base": "^7.0.1-alpha.
|
|
27
|
+
"@things-factory/biz-base": "^7.0.1-alpha.100",
|
|
28
|
+
"@things-factory/id-rule-base": "^7.0.1-alpha.100",
|
|
29
|
+
"@things-factory/integration-sellercraft": "^7.0.1-alpha.101",
|
|
30
|
+
"@things-factory/marketplace-base": "^7.0.1-alpha.101",
|
|
31
|
+
"@things-factory/product-base": "^7.0.1-alpha.100",
|
|
32
|
+
"@things-factory/setting-base": "^7.0.1-alpha.100"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "531f4b0e658c733f68e3fd0e7f84e13c2afe7816"
|
|
35
35
|
}
|
|
@@ -825,6 +825,8 @@ export class InventoryQuery {
|
|
|
825
825
|
let availableStockFilter = params.filters.find(filter => filter.name == 'availableStock')
|
|
826
826
|
let lowStockFilter = params.filters.find(filter => filter.name == 'lowStock')
|
|
827
827
|
let overStockFilter = params.filters.find(filter => filter.name == 'overStock')
|
|
828
|
+
let warehouseNameFilter = params.filters.find(filter => filter.name == 'warehouseName')
|
|
829
|
+
let unexpiredOnlyFilter = params.filters.find(filter => filter.name === 'unexpiredOnly')
|
|
828
830
|
|
|
829
831
|
if (bizplaceFilter) {
|
|
830
832
|
const bizplaceQueryBuilder: SelectQueryBuilder<Bizplace> = getRepository(Bizplace).createQueryBuilder('b')
|
|
@@ -893,6 +895,11 @@ export class InventoryQuery {
|
|
|
893
895
|
availableStockQuery = ` AND SUM("Inventory"."qty") > 0`
|
|
894
896
|
}
|
|
895
897
|
|
|
898
|
+
let unexpiredOnlyQuery = ''
|
|
899
|
+
if (unexpiredOnlyFilter?.value) {
|
|
900
|
+
unexpiredOnlyQuery = 'AND "Inventory"."expiration_date" >= CURRENT_DATE'
|
|
901
|
+
}
|
|
902
|
+
|
|
896
903
|
let thresholdQuery = ''
|
|
897
904
|
if (lowStockFilter?.value) {
|
|
898
905
|
thresholdQuery = `AND COALESCE("ProductDetailBizplaceSetting"."min_qty", "Product"."min_qty",0) > SUM("Inventory"."qty")`
|
|
@@ -903,6 +910,11 @@ export class InventoryQuery {
|
|
|
903
910
|
COALESCE("ProductDetailBizplaceSetting"."max_qty", "Product"."max_qty",0) < SUM("Inventory"."qty")`
|
|
904
911
|
}
|
|
905
912
|
|
|
913
|
+
let warehouseQuery = ''
|
|
914
|
+
if (warehouseNameFilter?.value) {
|
|
915
|
+
warehouseQuery = `AND "Warehouse"."name" like '%${warehouseNameFilter.value}%'`
|
|
916
|
+
}
|
|
917
|
+
|
|
906
918
|
await tx.query(
|
|
907
919
|
`
|
|
908
920
|
create temp table temp_inv_history AS
|
|
@@ -927,6 +939,8 @@ export class InventoryQuery {
|
|
|
927
939
|
AND "Inventory"."domain_id" = $1
|
|
928
940
|
${bizplaceQuery}
|
|
929
941
|
${productQuery}
|
|
942
|
+
${warehouseQuery}
|
|
943
|
+
${unexpiredOnlyQuery}
|
|
930
944
|
GROUP BY "Product"."id", "ProductRef"."id", "Bizplace"."id", "ProductDetailBizplaceSetting"."id", "Warehouse"."id"
|
|
931
945
|
HAVING 1 = 1
|
|
932
946
|
${availableStockQuery}
|
|
@@ -26,10 +26,7 @@ import { InventoryChangeList, InventoryChangePatch, NewInventoryChange } from '.
|
|
|
26
26
|
export class InventoryChangeMutation {
|
|
27
27
|
@Directive('@transaction')
|
|
28
28
|
@Mutation(returns => InventoryChange)
|
|
29
|
-
async createInventoryChange(
|
|
30
|
-
@Arg('inventoryChange') inventoryChange: NewInventoryChange,
|
|
31
|
-
@Ctx() context: ResolverContext
|
|
32
|
-
): Promise<InventoryChange> {
|
|
29
|
+
async createInventoryChange(@Arg('inventoryChange') inventoryChange: NewInventoryChange, @Ctx() context: ResolverContext): Promise<InventoryChange> {
|
|
33
30
|
const { domain, user, tx } = context.state
|
|
34
31
|
|
|
35
32
|
return await tx.getRepository(InventoryChange).save({
|
|
@@ -42,11 +39,7 @@ export class InventoryChangeMutation {
|
|
|
42
39
|
|
|
43
40
|
@Directive('@transaction')
|
|
44
41
|
@Mutation(returns => InventoryChange)
|
|
45
|
-
async updateInventoryChange(
|
|
46
|
-
@Arg('name') name: string,
|
|
47
|
-
@Arg('patch') patch: InventoryChangePatch,
|
|
48
|
-
@Ctx() context: ResolverContext
|
|
49
|
-
): Promise<InventoryChange> {
|
|
42
|
+
async updateInventoryChange(@Arg('name') name: string, @Arg('patch') patch: InventoryChangePatch, @Ctx() context: ResolverContext): Promise<InventoryChange> {
|
|
50
43
|
const { domain, user, tx } = context.state
|
|
51
44
|
|
|
52
45
|
const repository = tx.getRepository(InventoryChange)
|
|
@@ -117,10 +110,7 @@ export class InventoryChangeMutation {
|
|
|
117
110
|
|
|
118
111
|
@Directive('@transaction')
|
|
119
112
|
@Mutation(returns => Boolean)
|
|
120
|
-
async deleteInventoryChanges(
|
|
121
|
-
@Arg('names', type => [String]) names: string[],
|
|
122
|
-
@Ctx() context: ResolverContext
|
|
123
|
-
): Promise<Boolean> {
|
|
113
|
+
async deleteInventoryChanges(@Arg('names', type => [String]) names: string[], @Ctx() context: ResolverContext): Promise<Boolean> {
|
|
124
114
|
const { domain, tx } = context.state
|
|
125
115
|
|
|
126
116
|
await tx.getRepository(InventoryChange).delete({
|
|
@@ -133,10 +123,7 @@ export class InventoryChangeMutation {
|
|
|
133
123
|
@Directive('@privilege(category: "inventory", privilege: "mutation")')
|
|
134
124
|
@Directive('@transaction')
|
|
135
125
|
@Mutation(returns => Boolean)
|
|
136
|
-
async submitInventoryChanges(
|
|
137
|
-
@Arg('patches', type => [InventoryPatch]) patches: InventoryPatch[],
|
|
138
|
-
@Ctx() context: ResolverContext
|
|
139
|
-
) {
|
|
126
|
+
async submitInventoryChanges(@Arg('patches', type => [InventoryPatch]) patches: InventoryPatch[], @Ctx() context: ResolverContext) {
|
|
140
127
|
const { domain, user, tx } = context.state
|
|
141
128
|
try {
|
|
142
129
|
const _createRecords = []
|
|
@@ -168,9 +155,7 @@ export class InventoryChangeMutation {
|
|
|
168
155
|
const invLockedQty: number = foundExistingPallet?.lockedQty == null ? 0 : foundExistingPallet?.lockedQty
|
|
169
156
|
|
|
170
157
|
if (patches[i]?.qty < invLockedQty) {
|
|
171
|
-
throw new Error(
|
|
172
|
-
'Adjusted qty value should not be lower than released qty, kindly contact our support for assistance'
|
|
173
|
-
)
|
|
158
|
+
throw new Error('Adjusted qty value should not be lower than released qty, kindly contact our support for assistance')
|
|
174
159
|
}
|
|
175
160
|
|
|
176
161
|
if (foundExistingPallet) {
|
|
@@ -203,10 +188,7 @@ export class InventoryChangeMutation {
|
|
|
203
188
|
newRecord.status = 'PENDING'
|
|
204
189
|
newRecord.transactionType = 'NEW'
|
|
205
190
|
|
|
206
|
-
newRecord.expirationDate =
|
|
207
|
-
((newRecord?.expirationDate && new Date(newRecord.expirationDate).getFullYear()) || 0) < 2000
|
|
208
|
-
? null
|
|
209
|
-
: newRecord.expirationDate
|
|
191
|
+
newRecord.expirationDate = ((newRecord?.expirationDate && new Date(newRecord.expirationDate).getFullYear()) || 0) < 2000 ? null : newRecord.expirationDate
|
|
210
192
|
|
|
211
193
|
const newInventoryChange: InventoryChange = await inventoryChangeRepo.save({
|
|
212
194
|
...newRecord,
|
|
@@ -252,10 +234,7 @@ export class InventoryChangeMutation {
|
|
|
252
234
|
newInventoryItemChange.serialNumber = inventoryItemChange.serialNumber
|
|
253
235
|
newInventoryItemChange.type = inventoryItemChange.type
|
|
254
236
|
newInventoryItemChange.status = newInventoryChange.status
|
|
255
|
-
newInventoryItemChange.inventoryItem =
|
|
256
|
-
newInventoryItemChange?.type == INVENTORY_ITEM_CHANGE_TYPE.NEW
|
|
257
|
-
? null
|
|
258
|
-
: newInventoryItemChange.inventoryItem
|
|
237
|
+
newInventoryItemChange.inventoryItem = newInventoryItemChange?.type == INVENTORY_ITEM_CHANGE_TYPE.NEW ? null : newInventoryItemChange.inventoryItem
|
|
259
238
|
newInventoryItemChange.inventoryChange = newInventoryChange
|
|
260
239
|
newInventoryItemChange.domain = domain
|
|
261
240
|
newInventoryItemChange.creator = user
|
|
@@ -295,8 +274,7 @@ export class InventoryChangeMutation {
|
|
|
295
274
|
updateRecord.warehouse = location.warehouse
|
|
296
275
|
}
|
|
297
276
|
|
|
298
|
-
if (!!updateRecord?.bizplace?.id)
|
|
299
|
-
updateRecord.bizplace = await tx.getRepository(Bizplace).findOne(updateRecord.bizplace.id)
|
|
277
|
+
if (!!updateRecord?.bizplace?.id) updateRecord.bizplace = await tx.getRepository(Bizplace).findOne(updateRecord.bizplace.id)
|
|
300
278
|
|
|
301
279
|
let product: Product
|
|
302
280
|
|
|
@@ -307,16 +285,14 @@ export class InventoryChangeMutation {
|
|
|
307
285
|
product = existingRecord.product
|
|
308
286
|
}
|
|
309
287
|
|
|
310
|
-
updateRecord.transactionType
|
|
311
|
-
|
|
312
|
-
|
|
288
|
+
if (!updateRecord.transactionType) {
|
|
289
|
+
updateRecord.transactionType = 'CHANGES'
|
|
290
|
+
}
|
|
313
291
|
|
|
314
292
|
updateRecord.status = 'PENDING'
|
|
315
293
|
|
|
316
294
|
updateRecord.expirationDate =
|
|
317
|
-
((updateRecord?.expirationDate && new Date(updateRecord.expirationDate).getFullYear()) || 0) < 2000
|
|
318
|
-
? null
|
|
319
|
-
: updateRecord.expirationDate
|
|
295
|
+
((updateRecord?.expirationDate && new Date(updateRecord.expirationDate).getFullYear()) || 0) < 2000 ? null : updateRecord.expirationDate
|
|
320
296
|
|
|
321
297
|
const updatedInventoryChange: InventoryChange = await inventoryChangeRepo.save({
|
|
322
298
|
palletId: existingRecord.palletId,
|
|
@@ -359,10 +335,7 @@ export class InventoryChangeMutation {
|
|
|
359
335
|
newInventoryItemChange.type = inventoryItemChange.type
|
|
360
336
|
newInventoryItemChange.status = updatedInventoryChange.status
|
|
361
337
|
newInventoryItemChange.inventory = updatedInventoryChange.inventory
|
|
362
|
-
newInventoryItemChange.inventoryItem =
|
|
363
|
-
newInventoryItemChange?.type == INVENTORY_ITEM_CHANGE_TYPE.NEW
|
|
364
|
-
? null
|
|
365
|
-
: inventoryItemChange.inventoryItem
|
|
338
|
+
newInventoryItemChange.inventoryItem = newInventoryItemChange?.type == INVENTORY_ITEM_CHANGE_TYPE.NEW ? null : inventoryItemChange.inventoryItem
|
|
366
339
|
newInventoryItemChange.inventoryChange = updatedInventoryChange
|
|
367
340
|
newInventoryItemChange.domain = domain
|
|
368
341
|
newInventoryItemChange.creator = user
|
|
@@ -444,24 +417,12 @@ export class InventoryChangeMutation {
|
|
|
444
417
|
@Directive('@privilege(category: "inventory_adjustment_approval", privilege: "mutation")')
|
|
445
418
|
@Directive('@transaction')
|
|
446
419
|
@Mutation(returns => Boolean)
|
|
447
|
-
async rejectInventoryChanges(
|
|
448
|
-
@Arg('patches', type => [InventoryChangePatch]) patches: InventoryChangePatch[],
|
|
449
|
-
@Ctx() context: ResolverContext
|
|
450
|
-
): Promise<Boolean> {
|
|
420
|
+
async rejectInventoryChanges(@Arg('patches', type => [InventoryChangePatch]) patches: InventoryChangePatch[], @Ctx() context: ResolverContext): Promise<Boolean> {
|
|
451
421
|
const { domain, user, tx } = context.state
|
|
452
422
|
|
|
453
423
|
const _inventoryChanges = await tx.getRepository(InventoryChange).find({
|
|
454
424
|
where: { id: In(patches.map(item => item.id)) },
|
|
455
|
-
relations: [
|
|
456
|
-
'inventory',
|
|
457
|
-
'inventory.bizplace',
|
|
458
|
-
'inventory.product',
|
|
459
|
-
'inventory.location',
|
|
460
|
-
'inventory.warehouse',
|
|
461
|
-
'bizplace',
|
|
462
|
-
'product',
|
|
463
|
-
'location'
|
|
464
|
-
]
|
|
425
|
+
relations: ['inventory', 'inventory.bizplace', 'inventory.product', 'inventory.location', 'inventory.warehouse', 'bizplace', 'product', 'location']
|
|
465
426
|
})
|
|
466
427
|
|
|
467
428
|
if (_inventoryChanges.length > 0) {
|
|
@@ -556,9 +517,7 @@ async function upsertInventoryItems(context, inventoryChange, approvalStatus, tx
|
|
|
556
517
|
inventoryItem = await tx.getRepository(InventoryItem).save(inventoryItem)
|
|
557
518
|
}
|
|
558
519
|
|
|
559
|
-
await tx
|
|
560
|
-
.getRepository(InventoryItemChange)
|
|
561
|
-
.update({ id: inventoryItemChange.id }, { status: approvalStatus, inventoryItem })
|
|
520
|
+
await tx.getRepository(InventoryItemChange).update({ id: inventoryItemChange.id }, { status: approvalStatus, inventoryItem })
|
|
562
521
|
})
|
|
563
522
|
)
|
|
564
523
|
}
|
|
@@ -750,10 +709,7 @@ export async function approveInventoryChanges(patches: any, context: ResolverCon
|
|
|
750
709
|
transactionType: transactionType == '' ? 'ADJUSTMENT' : transactionType,
|
|
751
710
|
productId: newRecord.product ? newRecord.product.id : inventory.product.id,
|
|
752
711
|
warehouseId: newRecord.warehouse ? newRecord.warehouse.id : inventory.warehouse.id,
|
|
753
|
-
locationId:
|
|
754
|
-
newRecord.location && newRecord.location.id != inventory.location.id
|
|
755
|
-
? newRecord.location.id
|
|
756
|
-
: inventory.location.id,
|
|
712
|
+
locationId: newRecord.location && newRecord.location.id != inventory.location.id ? newRecord.location.id : inventory.location.id,
|
|
757
713
|
uom: newRecord.uom != null ? newRecord.uom : inventory.uom
|
|
758
714
|
}
|
|
759
715
|
delete inventoryHistory.id
|
|
@@ -786,6 +742,8 @@ export async function approveInventoryChanges(patches: any, context: ResolverCon
|
|
|
786
742
|
} else {
|
|
787
743
|
statusFilter = (newRecord.qty != null ? newRecord.qty : inventory.qty) > 0 ? 'STORED' : 'TERMINATED'
|
|
788
744
|
}
|
|
745
|
+
|
|
746
|
+
delete newRecord.createdAt
|
|
789
747
|
await tx.getRepository(Inventory).save({
|
|
790
748
|
...inventory,
|
|
791
749
|
...newRecord,
|
|
@@ -874,8 +832,7 @@ export async function approveInventoryChanges(patches: any, context: ResolverCon
|
|
|
874
832
|
const ecommerceCtrl: EcommerceController = new EcommerceController(tx, domain, user)
|
|
875
833
|
await ecommerceCtrl.updateProductVariationStock(marketplaceStores, inventory.product.id, companyDomain)
|
|
876
834
|
|
|
877
|
-
if (newRecord?.product || newRecord?.bizplace)
|
|
878
|
-
await ecommerceCtrl.updateProductVariationStock(marketplaceStores, newRecord.product.id, companyDomain)
|
|
835
|
+
if (newRecord?.product || newRecord?.bizplace) await ecommerceCtrl.updateProductVariationStock(marketplaceStores, newRecord.product.id, companyDomain)
|
|
879
836
|
}
|
|
880
837
|
}
|
|
881
838
|
|
|
@@ -940,10 +897,7 @@ export async function approveInventoryChanges(patches: any, context: ResolverCon
|
|
|
940
897
|
newRecord.cartonId = cartonId
|
|
941
898
|
}
|
|
942
899
|
|
|
943
|
-
let expirationDate =
|
|
944
|
-
((newRecord?.expirationDate && new Date(newRecord.expirationDate).getFullYear()) || 0) < 2000
|
|
945
|
-
? null
|
|
946
|
-
: newRecord.expirationDate
|
|
900
|
+
let expirationDate = ((newRecord?.expirationDate && new Date(newRecord.expirationDate).getFullYear()) || 0) < 2000 ? null : newRecord.expirationDate
|
|
947
901
|
|
|
948
902
|
let savedInventory = await tx.getRepository(Inventory).save({
|
|
949
903
|
...newRecord,
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { Field, ID, ObjectType } from 'type-graphql'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Column,
|
|
4
|
+
CreateDateColumn,
|
|
5
|
+
Entity,
|
|
6
|
+
Index,
|
|
7
|
+
ManyToOne,
|
|
8
|
+
PrimaryGeneratedColumn,
|
|
9
|
+
RelationId,
|
|
10
|
+
UpdateDateColumn
|
|
11
|
+
} from 'typeorm'
|
|
3
12
|
|
|
4
13
|
import { User } from '@things-factory/auth-base'
|
|
5
14
|
import { Bizplace } from '@things-factory/biz-base'
|
|
@@ -15,7 +24,10 @@ import { Location } from '../location/location'
|
|
|
15
24
|
@Index('ix_inventory-change_0', (inventoryChange: InventoryChange) => [inventoryChange.domain, inventoryChange.id], {
|
|
16
25
|
unique: true
|
|
17
26
|
})
|
|
18
|
-
@Index('ix_inventory-change_1', (inventoryChange: InventoryChange) => [
|
|
27
|
+
@Index('ix_inventory-change_1', (inventoryChange: InventoryChange) => [
|
|
28
|
+
inventoryChange.domain,
|
|
29
|
+
inventoryChange.inventory
|
|
30
|
+
])
|
|
19
31
|
@ObjectType()
|
|
20
32
|
export class InventoryChange {
|
|
21
33
|
@PrimaryGeneratedColumn('uuid')
|
|
@@ -35,7 +47,7 @@ export class InventoryChange {
|
|
|
35
47
|
cartonId: string
|
|
36
48
|
|
|
37
49
|
@ManyToOne(type => Domain)
|
|
38
|
-
@Field()
|
|
50
|
+
@Field(type => Domain)
|
|
39
51
|
domain: Domain
|
|
40
52
|
|
|
41
53
|
@RelationId((inventoryChange: InventoryChange) => inventoryChange.domain)
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { Field, ID, ObjectType } from 'type-graphql'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Column,
|
|
4
|
+
CreateDateColumn,
|
|
5
|
+
Entity,
|
|
6
|
+
Index,
|
|
7
|
+
ManyToOne,
|
|
8
|
+
PrimaryGeneratedColumn,
|
|
9
|
+
RelationId,
|
|
10
|
+
UpdateDateColumn
|
|
11
|
+
} from 'typeorm'
|
|
3
12
|
|
|
4
13
|
import { User } from '@things-factory/auth-base'
|
|
5
14
|
import { Bizplace } from '@things-factory/biz-base'
|
|
@@ -12,9 +21,20 @@ import { Pallet } from '../pallet/pallet'
|
|
|
12
21
|
import { Warehouse } from '../warehouse/warehouse'
|
|
13
22
|
|
|
14
23
|
@Entity()
|
|
15
|
-
@Index(
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
@Index(
|
|
25
|
+
'ix_inventory-history_0',
|
|
26
|
+
(inventoryHistory: InventoryHistory) => [inventoryHistory.domain, inventoryHistory.name],
|
|
27
|
+
{ unique: true }
|
|
28
|
+
)
|
|
29
|
+
@Index('ix_inventory-history_1', (inventoryHistory: InventoryHistory) => [
|
|
30
|
+
inventoryHistory.domain,
|
|
31
|
+
inventoryHistory.palletId
|
|
32
|
+
])
|
|
33
|
+
@Index('ix_inventory-history_2', (inventoryHistory: InventoryHistory) => [
|
|
34
|
+
inventoryHistory.inventory,
|
|
35
|
+
inventoryHistory.transactionType,
|
|
36
|
+
inventoryHistory.refOrderId
|
|
37
|
+
])
|
|
18
38
|
@ObjectType()
|
|
19
39
|
export class InventoryHistory {
|
|
20
40
|
@PrimaryGeneratedColumn('uuid')
|
|
@@ -26,7 +46,7 @@ export class InventoryHistory {
|
|
|
26
46
|
seq?: number
|
|
27
47
|
|
|
28
48
|
@ManyToOne(type => Domain)
|
|
29
|
-
@Field()
|
|
49
|
+
@Field(type => Domain)
|
|
30
50
|
domain?: Domain
|
|
31
51
|
|
|
32
52
|
@RelationId((inventoryHistory: InventoryHistory) => inventoryHistory.domain)
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { Field, Float, ID, ObjectType } from 'type-graphql'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Column,
|
|
4
|
+
CreateDateColumn,
|
|
5
|
+
Entity,
|
|
6
|
+
Index,
|
|
7
|
+
ManyToOne,
|
|
8
|
+
PrimaryGeneratedColumn,
|
|
9
|
+
RelationId,
|
|
10
|
+
UpdateDateColumn
|
|
11
|
+
} from 'typeorm'
|
|
3
12
|
|
|
4
13
|
import { User } from '@things-factory/auth-base'
|
|
5
14
|
import { Bizplace } from '@things-factory/biz-base'
|
|
@@ -16,7 +25,7 @@ export class Movement {
|
|
|
16
25
|
id: string
|
|
17
26
|
|
|
18
27
|
@ManyToOne(type => Domain)
|
|
19
|
-
@Field()
|
|
28
|
+
@Field(type => Domain)
|
|
20
29
|
domain: Domain
|
|
21
30
|
|
|
22
31
|
@RelationId((movement: Movement) => movement.domain)
|