@things-factory/sales-base 4.3.108 → 4.3.110

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 (79) hide show
  1. package/dist-server/service/arrival-notice/arrival-notice-mutation.js +5 -6
  2. package/dist-server/service/arrival-notice/arrival-notice-mutation.js.map +1 -1
  3. package/dist-server/service/arrival-notice/arrival-notice-query.js +0 -1
  4. package/dist-server/service/arrival-notice/arrival-notice-query.js.map +1 -1
  5. package/dist-server/service/delivery-order/delivery-order-mutation.js +30 -3
  6. package/dist-server/service/delivery-order/delivery-order-mutation.js.map +1 -1
  7. package/dist-server/service/draft-release-good/draft-release-good-mutation.js +4 -3
  8. package/dist-server/service/draft-release-good/draft-release-good-mutation.js.map +1 -1
  9. package/dist-server/service/draft-release-good/draft-release-good-query.js +15 -11
  10. package/dist-server/service/draft-release-good/draft-release-good-query.js.map +1 -1
  11. package/dist-server/service/goods-receival-note/goods-receival-note-mutation.js +32 -4
  12. package/dist-server/service/goods-receival-note/goods-receival-note-mutation.js.map +1 -1
  13. package/dist-server/service/invoice-product/invoice-product.js +3 -8
  14. package/dist-server/service/invoice-product/invoice-product.js.map +1 -1
  15. package/dist-server/service/order-inventory/order-inventory-query.js +1 -2
  16. package/dist-server/service/order-inventory/order-inventory-query.js.map +1 -1
  17. package/dist-server/service/order-inventory/order-inventory-types.js +10 -18
  18. package/dist-server/service/order-inventory/order-inventory-types.js.map +1 -1
  19. package/dist-server/service/order-inventory/order-inventory.js +3 -12
  20. package/dist-server/service/order-inventory/order-inventory.js.map +1 -1
  21. package/dist-server/service/order-product/order-product-query.js +0 -1
  22. package/dist-server/service/order-product/order-product-query.js.map +1 -1
  23. package/dist-server/service/order-product/order-product-types.js +10 -18
  24. package/dist-server/service/order-product/order-product-types.js.map +1 -1
  25. package/dist-server/service/order-product/order-product.js +5 -0
  26. package/dist-server/service/order-product/order-product.js.map +1 -1
  27. package/dist-server/service/order-vas/order-vas.js +3 -8
  28. package/dist-server/service/order-vas/order-vas.js.map +1 -1
  29. package/dist-server/service/others/other-query.js +177 -196
  30. package/dist-server/service/others/other-query.js.map +1 -1
  31. package/dist-server/service/others/other-types.js +1 -9
  32. package/dist-server/service/others/other-types.js.map +1 -1
  33. package/dist-server/service/purchase-order/purchase-order-mutation.js +2 -10
  34. package/dist-server/service/purchase-order/purchase-order-mutation.js.map +1 -1
  35. package/dist-server/service/purchase-order/purchase-order-query.js +0 -1
  36. package/dist-server/service/purchase-order/purchase-order-query.js.map +1 -1
  37. package/dist-server/service/release-good/release-good-mutation.js +8 -18
  38. package/dist-server/service/release-good/release-good-mutation.js.map +1 -1
  39. package/dist-server/service/release-good/release-good-query.js +2 -3
  40. package/dist-server/service/release-good/release-good-query.js.map +1 -1
  41. package/dist-server/service/release-good/release-good-types.js +4 -8
  42. package/dist-server/service/release-good/release-good-types.js.map +1 -1
  43. package/dist-server/service/return-order/return-order-mutation.js +0 -3
  44. package/dist-server/service/return-order/return-order-mutation.js.map +1 -1
  45. package/dist-server/service/return-order/return-order-types.js.map +1 -1
  46. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js +3 -8
  47. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js.map +1 -1
  48. package/dist-server/utils/inventory-util.js +104 -39
  49. package/dist-server/utils/inventory-util.js.map +1 -1
  50. package/package.json +14 -13
  51. package/server/service/arrival-notice/arrival-notice-mutation.ts +3 -6
  52. package/server/service/arrival-notice/arrival-notice-query.ts +0 -1
  53. package/server/service/delivery-order/delivery-order-mutation.ts +49 -19
  54. package/server/service/draft-release-good/draft-release-good-mutation.ts +4 -3
  55. package/server/service/draft-release-good/draft-release-good-query.ts +21 -17
  56. package/server/service/goods-receival-note/goods-receival-note-mutation.ts +38 -4
  57. package/server/service/invoice-product/invoice-product.ts +1 -5
  58. package/server/service/order-inventory/order-inventory-query.ts +0 -2
  59. package/server/service/order-inventory/order-inventory-types.ts +0 -6
  60. package/server/service/order-inventory/order-inventory.ts +1 -8
  61. package/server/service/order-product/order-product-query.ts +0 -1
  62. package/server/service/order-product/order-product-types.ts +0 -6
  63. package/server/service/order-product/order-product.ts +4 -0
  64. package/server/service/order-vas/order-vas.ts +1 -6
  65. package/server/service/others/other-query.ts +219 -231
  66. package/server/service/others/other-types.ts +1 -7
  67. package/server/service/purchase-order/purchase-order-mutation.ts +1 -10
  68. package/server/service/purchase-order/purchase-order-query.ts +0 -1
  69. package/server/service/release-good/release-good-mutation.ts +8 -21
  70. package/server/service/release-good/release-good-query.ts +2 -3
  71. package/server/service/release-good/release-good-types.ts +3 -4
  72. package/server/service/return-order/return-order-mutation.ts +1 -4
  73. package/server/service/return-order/return-order-types.ts +0 -1
  74. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.ts +1 -5
  75. package/server/utils/inventory-util.ts +149 -75
  76. package/translations/en.json +0 -1
  77. package/translations/ko.json +1 -2
  78. package/translations/ms.json +1 -2
  79. package/translations/zh.json +0 -25
@@ -1,4 +1,3 @@
1
- import { ShippingOrder } from '../shipping-order/shipping-order'
2
1
  import { FileUpload, GraphQLUpload } from 'graphql-upload'
3
2
  import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
4
3
  import { EntityManager, getRepository, In, Repository } from 'typeorm'
@@ -6,7 +5,9 @@ import { EntityManager, getRepository, In, Repository } from 'typeorm'
6
5
  import { Attachment, createAttachment, deleteAttachment } from '@things-factory/attachment-base'
7
6
  import { User } from '@things-factory/auth-base'
8
7
  import { Bizplace, ContactPoint, getPermittedBizplaceIds } from '@things-factory/biz-base'
8
+ // import { logger } from '@things-factory/env'
9
9
  import { generateId } from '@things-factory/id-rule-base'
10
+ // import { Account, AccountingAPI } from '@things-factory/integration-accounting'
10
11
  import { Product } from '@things-factory/product-base'
11
12
  import { Setting } from '@things-factory/setting-base'
12
13
  import { Domain, ObjectRef } from '@things-factory/shell'
@@ -24,9 +25,10 @@ import { OrderNoGenerator } from '../../utils/order-no-generator'
24
25
  import { OrderInventory } from '../order-inventory/order-inventory'
25
26
  import { NewOrderInventory, OrderInventoryPatch } from '../order-inventory/order-inventory-types'
26
27
  import { ReleaseGood } from '../release-good/release-good'
28
+ import { ExportInformationPatch, ShippingOrderInfoPatch } from '../release-good/release-good-types'
29
+ import { ShippingOrder } from '../shipping-order/shipping-order'
27
30
  import { DeliveryOrder } from './delivery-order'
28
31
  import { DeliveryOrderPatch, NewDeliveryOrder } from './delivery-order-types'
29
- import { ExportInformationPatch, ShippingOrderInfoPatch } from '../release-good/release-good-types'
30
32
 
31
33
  @Resolver(DeliveryOrder)
32
34
  export class DeliveryOrderMutation {
@@ -210,11 +212,11 @@ export class DeliveryOrderMutation {
210
212
  /**
211
213
  * comment start
212
214
  * detailed review needed 06 Aug 2022 by @ChrisLim-git
213
- * @param context
214
- * @param orderInfo
215
- * @param orderItems
216
- * @param shippingOrderInfo
217
- * @param exportInfo
215
+ * @param context
216
+ * @param orderInfo
217
+ * @param orderItems
218
+ * @param shippingOrderInfo
219
+ * @param exportInfo
218
220
  * @returns DeliveryOrder
219
221
  */
220
222
  @Directive('@transaction')
@@ -231,7 +233,7 @@ export class DeliveryOrderMutation {
231
233
  const { tx, domain, user }: { tx: EntityManager; domain: Domain; user: User } = context.state
232
234
  const foundDeliveryOrder: DeliveryOrder = await tx.getRepository(DeliveryOrder).findOne({
233
235
  where: { domain, name: orderInfo.name },
234
- relations: ['transportVehicle', 'bizplace']
236
+ relations: ['transportVehicle', 'bizplace', 'bizplace.domain']
235
237
  })
236
238
 
237
239
  const foundReleaseGood: ReleaseGood = await tx.getRepository(ReleaseGood).findOne({
@@ -260,16 +262,16 @@ export class DeliveryOrderMutation {
260
262
  const product: Product = inventory.product
261
263
  const foundItem = inventory.reusablePallet
262
264
  ? orderItems.filter(
263
- (item: any) =>
264
- item.productName === `${product.name} (${product.description})` &&
265
- item.batchId === orderInventory.batchId &&
266
- item.pallet === inventory.reusablePallet.name
267
- )
265
+ (item: any) =>
266
+ item.productName === `${product.name} (${product.description})` &&
267
+ item.batchId === orderInventory.batchId &&
268
+ item.pallet === inventory.reusablePallet.name
269
+ )
268
270
  : orderItems.filter(
269
- (item: any) =>
270
- item.productName === `${product.name} (${product.description})` &&
271
- item.batchId === orderInventory.batchId
272
- )
271
+ (item: any) =>
272
+ item.productName === `${product.name} (${product.description})` &&
273
+ item.batchId === orderInventory.batchId
274
+ )
273
275
 
274
276
  if (foundItem[0].remark !== '') orderInventory.remark = foundItem[0].remark
275
277
  return orderInventory
@@ -349,7 +351,7 @@ export class DeliveryOrderMutation {
349
351
  * I think the expectation here is to update instead of save
350
352
  * Should use .update instead of .save as it will override data that was not meant to be updated
351
353
  * example:
352
- *
354
+ *
353
355
  * savedShippingOrder = await tx.getRepository(ShippingOrder).update({
354
356
  * shipName: exportInfo.shipName,
355
357
  * containerNo: exportInfo.containerNo,
@@ -358,7 +360,7 @@ export class DeliveryOrderMutation {
358
360
  * status: ORDER_STATUS.PENDING,
359
361
  * updater: user
360
362
  * })
361
- *
363
+ *
362
364
  * Unless the intention was not to update but to insert
363
365
  */
364
366
  savedShippingOrder = await tx.getRepository(ShippingOrder).save({
@@ -421,6 +423,34 @@ export class DeliveryOrderMutation {
421
423
  updater: user
422
424
  })
423
425
 
426
+ // const orderSource: string = foundReleaseGood.source
427
+ // switch (orderSource) {
428
+ // case ApplicationType.XILNEX:
429
+ // if (foundDeliveryOrder.status === ORDER_STATUS.READY_TO_DISPATCH) {
430
+ // const xilnex: Account = await tx.getRepository(Account).findOne({
431
+ // domain: foundDeliveryOrder.bizplace.domain,
432
+ // status: 'active',
433
+ // platform: 'xilnex'
434
+ // })
435
+
436
+ // if (xilnex) {
437
+ // try {
438
+ // await AccountingAPI.createTransferNote(xilnex, {
439
+ // releaseGood: foundReleaseGood,
440
+ // deliveryOrder: foundDeliveryOrder,
441
+ // orderInventories
442
+ // })
443
+ // } catch (error) {
444
+ // logger.error(`delivery-order-mutation[dispatchDeliveryOrder]: ${error}`)
445
+ // }
446
+ // }
447
+ // }
448
+ // break
449
+
450
+ // default:
451
+ // break
452
+ // }
453
+
424
454
  return foundDeliveryOrder
425
455
  } catch (e) {
426
456
  throw e
@@ -195,7 +195,6 @@ export class DraftReleaseGoodMutation {
195
195
  relations: [
196
196
  'orderProducts',
197
197
  'orderProducts.product',
198
- 'orderProducts.productDetail',
199
198
  'orderProducts.productBundle',
200
199
  'shippingOrder',
201
200
  'bizplace',
@@ -264,7 +263,10 @@ export class DraftReleaseGoodMutation {
264
263
  draftOrder.orderProducts = draftOrder.orderProducts.map(itm => {
265
264
  let foundProductInv = productInventory.items.find(
266
265
  i =>
267
- (i.productDetailId == itm?.productDetail?.id || i.productId == itm?.productBundle?.id) &&
266
+ (i.productId == itm?.product?.id || i.productId == itm?.productBundle?.id) &&
267
+ i.packingType == itm.packingType &&
268
+ i.packingSize == itm.packingSize &&
269
+ i.uom == itm.uom &&
268
270
  itm.releaseQty <= i.remainQty
269
271
  )
270
272
  return {
@@ -658,7 +660,6 @@ export async function upsertDraftReleaseGoodProducts(
658
660
  relations: [
659
661
  'orderProducts',
660
662
  'orderProducts.product',
661
- 'orderProducts.productDetail',
662
663
  'orderProducts.productBundle',
663
664
  'orderProducts.creator',
664
665
  'orderProducts.updater'
@@ -1,16 +1,20 @@
1
- import { Arg, Args, Ctx, Directive, Query, Resolver } from 'type-graphql'
2
- import { EntityManager, getRepository, In, SelectQueryBuilder } from 'typeorm'
1
+ import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root, Directive } from 'type-graphql'
2
+ import { getRepository, SelectQueryBuilder, EntityManager, In, getManager } from 'typeorm'
3
3
 
4
- import { Attachment } from '@things-factory/attachment-base'
5
- import { User } from '@things-factory/auth-base'
6
- import { Bizplace, getPermittedBizplaceIds, getPermittedBizplaces } from '@things-factory/biz-base'
7
- import { buildQuery, Domain, ListParam } from '@things-factory/shell'
4
+ import { checkUserBelongsDomain, User } from '@things-factory/auth-base'
5
+ import { Bizplace, getPermittedBizplaces, getPermittedBizplaceIds } from '@things-factory/biz-base'
6
+ import { buildQuery, Domain, ListParam, Filter, Pagination, Sorting } from '@things-factory/shell'
8
7
 
9
- import { ATTACHMENT_TYPE, DRAFT_RELEASE_ORDER_STATUS } from '../../constants'
10
- import { InventoryUtil } from '../../utils'
8
+ import { DRAFT_RELEASE_ORDER_STATUS, ORDER_STATUS } from '../../constants'
11
9
  import { DraftReleaseGood } from './draft-release-good'
12
10
  import { DraftReleaseGoodList } from './draft-release-good-type'
13
11
 
12
+ import { Attachment } from '@things-factory/attachment-base'
13
+ import { ATTACHMENT_TYPE } from '../../constants'
14
+
15
+ import { InventoryUtil } from '../../utils'
16
+ import { OrderProduct } from '../order-product/order-product'
17
+
14
18
  @Resolver(DraftReleaseGood)
15
19
  export class DraftReleaseGoodQuery {
16
20
  @Query(returns => DraftReleaseGood, { description: 'To fetch a DraftReleaseGood' })
@@ -110,10 +114,10 @@ export class DraftReleaseGoodQuery {
110
114
  where drg1.status ='DRAFT' AND drg1.domain_id = $1
111
115
  AND NOT EXISTS (
112
116
  SELECT * FROM warehouse_bizplace_onhand_inventories wboi
113
- where (wboi."product_id" = op.product_id or wboi."product_bundle_id" = op.product_id)
114
- and wboi."domain_id" = op.domain_id
115
- and wboi."bizplace_id" = op.bizplace_id
116
- AND wboi."remain_qty" >= op.release_qty
117
+ where (wboi."productId" = op.product_id or wboi."productBundleId" = op.product_id)
118
+ and wboi."domainId" = op.domain_id
119
+ and wboi."bizplaceId" = op.bizplace_id
120
+ AND wboi."remainQty" >= op.release_qty
117
121
  ) GROUP BY drg1.id
118
122
  )
119
123
  `,
@@ -251,7 +255,6 @@ export async function getDraftReleaseGoodFunction(_: any, name: any, context: an
251
255
  'releaseGood',
252
256
  'orderProducts',
253
257
  'orderProducts.product',
254
- 'orderProducts.productDetail',
255
258
  'orderProducts.productBundle',
256
259
  'shippingOrder',
257
260
  'bizplace',
@@ -313,7 +316,11 @@ export async function getDraftReleaseGoodFunction(_: any, name: any, context: an
313
316
 
314
317
  result.orderProducts = result.orderProducts.map(itm => {
315
318
  let foundProductInv = productInventory?.items.find(
316
- i => i.productDetailId == itm?.productDetail?.id || i.productId == itm?.productBundle?.id
319
+ i =>
320
+ (i.productId == itm?.product?.id || i.productId == itm?.productBundle?.id) &&
321
+ i.packingType == itm.packingType &&
322
+ i.packingSize == itm.packingSize &&
323
+ i.uom == itm.uom
317
324
  )
318
325
  return {
319
326
  ...itm,
@@ -323,9 +330,6 @@ export async function getDraftReleaseGoodFunction(_: any, name: any, context: an
323
330
  brand: foundProductInv.productBrand,
324
331
  sku: foundProductInv.productSKU
325
332
  },
326
- productDetail: itm.productDetail || {
327
- id: foundProductInv.productDetailId
328
- },
329
333
  groupType: foundProductInv ? foundProductInv.groupType : 'SINGLE',
330
334
  remainQty: foundProductInv ? foundProductInv.remainQty : 0,
331
335
  remainUomValue: foundProductInv ? foundProductInv.remainUomValue : 0,
@@ -1,10 +1,14 @@
1
+ import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
2
+ import { EntityManager, getRepository, In, Repository } from 'typeorm'
3
+
1
4
  import { User } from '@things-factory/auth-base'
2
5
  import { Bizplace } from '@things-factory/biz-base'
6
+ // import { logger } from '@things-factory/env'
3
7
  import { generateId } from '@things-factory/id-rule-base'
8
+ // import { Account, AccountingAPI } from '@things-factory/integration-accounting'
4
9
  import { Setting } from '@things-factory/setting-base'
5
10
  import { Domain } from '@things-factory/shell'
6
- import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
7
- import { EntityManager, getRepository, In, Repository } from 'typeorm'
11
+
8
12
  import { ArrivalNotice, NewGoodsReceivalNote } from '../'
9
13
  import { GRN_STATUS, ORDER_NUMBER_RULE_TYPE, ORDER_NUMBER_SETTING_KEY } from '../../constants'
10
14
  import { OrderNoGenerator } from '../../utils/order-no-generator'
@@ -97,7 +101,10 @@ export async function generateGoodsReceivalNote(
97
101
  let orderNo: string = ''
98
102
 
99
103
  const bizplace: Bizplace = await bizplaceRepo.findOne({ where: { id: grn.customer } })
100
- const arrivalNotice: ArrivalNotice = await ganRepo.findOne({ where: { domain, name: grn.refNo } })
104
+ const arrivalNotice: ArrivalNotice = await ganRepo.findOne({
105
+ where: { domain, name: grn.refNo },
106
+ relations: ['bizplace', 'bizplace.domain', 'orderProducts', 'orderProducts.productDetail']
107
+ })
101
108
  const grnNoSetting: Setting = await settingRepo.findOne({
102
109
  where: {
103
110
  domain,
@@ -111,7 +118,7 @@ export async function generateGoodsReceivalNote(
111
118
  orderNo = OrderNoGenerator.goodsReceiveNote()
112
119
  }
113
120
 
114
- return await grnRepo.save({
121
+ const goodReceiveNote: GoodsReceivalNote = await grnRepo.save({
115
122
  ...grn,
116
123
  name: orderNo,
117
124
  domain,
@@ -121,4 +128,31 @@ export async function generateGoodsReceivalNote(
121
128
  creator: user,
122
129
  updater: user
123
130
  })
131
+
132
+ // const orderSource: string = arrivalNotice.source
133
+ // switch (orderSource) {
134
+ // case ApplicationType.XILNEX:
135
+ // const xilnex: Account = await tx.getRepository(Account).findOne({
136
+ // domain: arrivalNotice.bizplace.domain,
137
+ // status: 'active',
138
+ // platform: 'xilnex'
139
+ // })
140
+
141
+ // if (xilnex) {
142
+ // try {
143
+ // await AccountingAPI.createGoodsReceivedNote(xilnex, {
144
+ // arrivalNotice,
145
+ // orderProducts: arrivalNotice.orderProducts
146
+ // })
147
+ // } catch (error) {
148
+ // logger.error(`goods-receival-note-mutation[generateGoodsReceivalNote]: ${error}`)
149
+ // }
150
+ // }
151
+ // break
152
+
153
+ // default:
154
+ // break
155
+ // }
156
+
157
+ return goodReceiveNote
124
158
  }
@@ -11,7 +11,7 @@ import {
11
11
  } from 'typeorm'
12
12
 
13
13
  import { User } from '@things-factory/auth-base'
14
- import { Product, ProductDetail } from '@things-factory/product-base'
14
+ import { Product } from '@things-factory/product-base'
15
15
  import { Domain } from '@things-factory/shell'
16
16
 
17
17
  import { Invoice } from '../invoice/invoice'
@@ -77,10 +77,6 @@ export class InvoiceProduct {
77
77
  @Field({ nullable: true })
78
78
  shippingFeePaidByCustomer: number
79
79
 
80
- @ManyToOne(type => ProductDetail, { nullable: true })
81
- @Field({ nullable: true })
82
- productDetail: ProductDetail
83
-
84
80
  @CreateDateColumn()
85
81
  @Field()
86
82
  createdAt: Date
@@ -286,7 +286,6 @@ export class OrderInventoryQuery {
286
286
  .leftJoinAndSelect('oi.bizplace', 'bizplace')
287
287
  .leftJoinAndSelect('oi.inventory', 'inventory')
288
288
  .leftJoinAndSelect('inventory.product', 'product')
289
- .leftJoinAndSelect('inventory.productDetail', 'productDetail')
290
289
  .leftJoinAndSelect('oi.creator', 'creator')
291
290
  .leftJoinAndSelect('oi.updater', 'updater')
292
291
 
@@ -300,7 +299,6 @@ export class OrderInventoryQuery {
300
299
  releaseGoodName: item.releaseGood.name,
301
300
  palletId: item.inventory.palletId,
302
301
  productId: item.inventory.product.id,
303
- productDetailId: item.inventory.productDetail.id,
304
302
  productName: item.inventory.product.name,
305
303
  productSKU: item.inventory.product.sku,
306
304
  productBrand: item.inventory.product.brand,
@@ -41,9 +41,6 @@ export class NewOrderInventory {
41
41
  @Field(type => NewProduct, { nullable: true })
42
42
  product: NewProduct
43
43
 
44
- @Field(type => ObjectRef, { nullable: true })
45
- productDetail: ObjectRef
46
-
47
44
  @Field({ nullable: true })
48
45
  productSKU: string
49
46
 
@@ -203,9 +200,6 @@ export class OrderInventoryPatch {
203
200
  @Field({ nullable: true })
204
201
  productId: string
205
202
 
206
- @Field({ nullable: true })
207
- productDetailId: string
208
-
209
203
  @Field({ nullable: true })
210
204
  orderProductId: string
211
205
 
@@ -13,7 +13,7 @@ import {
13
13
 
14
14
  import { User } from '@things-factory/auth-base'
15
15
  import { Bizplace } from '@things-factory/biz-base'
16
- import { Product, ProductDetail} from '@things-factory/product-base'
16
+ import { Product } from '@things-factory/product-base'
17
17
  import { Domain } from '@things-factory/shell'
18
18
  import { Inventory, Location } from '@things-factory/warehouse-base'
19
19
 
@@ -341,13 +341,6 @@ export class OrderInventory {
341
341
  @Field({ nullable: true })
342
342
  loadedAt: Date
343
343
 
344
- @ManyToOne(type => ProductDetail, { nullable: true })
345
- @Field({ nullable: true })
346
- productDetail: ProductDetail
347
-
348
- @Field({ nullable: true })
349
- productDetailId: String
350
-
351
344
  @Field({ nullable: true })
352
345
  dispatchedAt: Date
353
346
 
@@ -26,7 +26,6 @@ export class OrderProductQuery {
26
26
 
27
27
  let qb: SelectQueryBuilder<OrderProduct> = await getRepository(OrderProduct).createQueryBuilder('op')
28
28
  qb.leftJoinAndSelect('op.product', 'product')
29
- .leftJoinAndSelect('op.productDetail', 'productDetail')
30
29
  .leftJoinAndSelect('op.domain', 'domain')
31
30
  .leftJoinAndSelect('op.bizplace', 'bizplace')
32
31
  .leftJoinAndSelect('bizplace.company', 'company')
@@ -90,9 +90,6 @@ export class OrderProductPatch {
90
90
  @Field(type => ObjectRef, { nullable: true })
91
91
  toInventory: ObjectRef
92
92
 
93
- @Field(type => ObjectRef, { nullable: true })
94
- productDetail: ObjectRef
95
-
96
93
  @Field(type => InboundProduct, { nullable: true })
97
94
  product: InboundProduct
98
95
 
@@ -234,9 +231,6 @@ export class NewOrderProduct {
234
231
  @Field(type => ObjectRef, { nullable: true })
235
232
  toInventory: ObjectRef
236
233
 
237
- @Field(type => ObjectRef, { nullable: true })
238
- productDetail: ObjectRef
239
-
240
234
  @Field(type => InboundProduct, { nullable: true })
241
235
  product: InboundProduct
242
236
 
@@ -327,6 +327,10 @@ export class OrderProduct {
327
327
  @Field()
328
328
  status: string
329
329
 
330
+ @Column({ nullable: true })
331
+ @Field({ nullable: true })
332
+ refItemId: string
333
+
330
334
  @CreateDateColumn()
331
335
  @Field()
332
336
  createdAt: Date
@@ -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, ProductDetail } from '@things-factory/product-base'
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
 
@@ -200,10 +200,6 @@ export class OrderVas {
200
200
  @Field()
201
201
  updatedAt: Date
202
202
 
203
- @ManyToOne(type => ProductDetail, { nullable: true })
204
- @Field({ nullable: true })
205
- productDetail: ProductDetail
206
-
207
203
  @ManyToOne(type => User)
208
204
  @Field(type => User, { nullable: true })
209
205
  creator: User
@@ -217,5 +213,4 @@ export class OrderVas {
217
213
 
218
214
  @RelationId((orderVas: OrderVas) => orderVas.updater)
219
215
  updaterId: string
220
-
221
216
  }