@things-factory/worksheet-base 4.3.550 → 4.3.552

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 (37) hide show
  1. package/dist-server/controllers/ecommerce/sellercraft-controller.js +6 -2
  2. package/dist-server/controllers/ecommerce/sellercraft-controller.js.map +1 -1
  3. package/dist-server/controllers/outbound/picking-worksheet-controller.js +5 -5
  4. package/dist-server/controllers/outbound/picking-worksheet-controller.js.map +1 -1
  5. package/dist-server/controllers/replenishment/replenishment-worksheet-controller.js +28 -19
  6. package/dist-server/controllers/replenishment/replenishment-worksheet-controller.js.map +1 -1
  7. package/dist-server/controllers/worksheet-controller.js +3 -11
  8. package/dist-server/controllers/worksheet-controller.js.map +1 -1
  9. package/dist-server/graphql/resolvers/worksheet/cancel-replenishment.js +2 -2
  10. package/dist-server/graphql/resolvers/worksheet/cancel-replenishment.js.map +1 -1
  11. package/dist-server/graphql/resolvers/worksheet/picking/replenishment-picking.js +1 -1
  12. package/dist-server/graphql/resolvers/worksheet/picking/replenishment-picking.js.map +1 -1
  13. package/dist-server/graphql/resolvers/worksheet/picking-worksheet.js +1 -1
  14. package/dist-server/graphql/resolvers/worksheet/picking-worksheet.js.map +1 -1
  15. package/dist-server/graphql/resolvers/worksheet/putaway/replenishment-putaway.js +4 -4
  16. package/dist-server/graphql/resolvers/worksheet/putaway/replenishment-putaway.js.map +1 -1
  17. package/dist-server/graphql/resolvers/worksheet/putaway-replenishment-worksheet.js +8 -4
  18. package/dist-server/graphql/resolvers/worksheet/putaway-replenishment-worksheet.js.map +1 -1
  19. package/dist-server/graphql/types/worksheet/index.js +2 -1
  20. package/dist-server/graphql/types/worksheet/index.js.map +1 -1
  21. package/dist-server/graphql/types/worksheet/worksheet-detail-info.js +1 -0
  22. package/dist-server/graphql/types/worksheet/worksheet-detail-info.js.map +1 -1
  23. package/dist-server/graphql/types/worksheet-detail/worksheet-detail.js +1 -0
  24. package/dist-server/graphql/types/worksheet-detail/worksheet-detail.js.map +1 -1
  25. package/package.json +4 -4
  26. package/server/controllers/ecommerce/sellercraft-controller.ts +6 -2
  27. package/server/controllers/outbound/picking-worksheet-controller.ts +5 -5
  28. package/server/controllers/replenishment/replenishment-worksheet-controller.ts +49 -30
  29. package/server/controllers/worksheet-controller.ts +3 -12
  30. package/server/graphql/resolvers/worksheet/cancel-replenishment.ts +19 -5
  31. package/server/graphql/resolvers/worksheet/picking/replenishment-picking.ts +6 -6
  32. package/server/graphql/resolvers/worksheet/picking-worksheet.ts +17 -8
  33. package/server/graphql/resolvers/worksheet/putaway/replenishment-putaway.ts +5 -4
  34. package/server/graphql/resolvers/worksheet/putaway-replenishment-worksheet.ts +8 -4
  35. package/server/graphql/types/worksheet/index.ts +2 -1
  36. package/server/graphql/types/worksheet/worksheet-detail-info.ts +1 -0
  37. package/server/graphql/types/worksheet-detail/worksheet-detail.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/worksheet/index.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AACnE,2EAAmE;AACnE,6DAAuD;AACvD,mEAA6D;AAC7D,mDAA8C;AAC9C,+DAAyD;AACzD,2DAAqD;AACrD,6DAAwD;AACxD,+DAA0D;AAC1D,qFAA4E;AAC5E,+DAAyD;AACzD,2EAAqE;AACrE,uEAAiE;AACjE,uDAAkD;AAClD,uFAAgF;AAChF,iFAA0E;AAC1E,mDAA8C;AAC9C,iDAA4C;AAC5C,2EAAqE;AACrE,uDAAkD;AAClD,yDAAoD;AACpD,qEAA+D;AAC/D,qEAA+D;AAC/D,iEAA4D;AAC5D,+DAAyD;AACzD,2DAAsD;AACtD,2CAAuC;AACvC,mEAA6D;AAC7D,qDAAgD;AAChD,qDAAgD;AAChD,uDAAkD;AAClD,2EAAqE;AAExD,QAAA,QAAQ,GAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAypBnC,CAAA;AAEU,QAAA,KAAK,GAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwKlC,CAAA;AAEY,QAAA,KAAK,GAAiB;IACjC,qBAAS;IACT,0CAAmB;IACnB,gCAAc;IACd,oCAAgB;IAChB,4BAAY;IACZ,gCAAc;IACd,8BAAa;IACb,iDAAsB;IACtB,6CAAoB;IACpB,2CAAmB;IACnB,6CAAoB;IACpB,mDAAuB;IACvB,uCAAiB;IACjB,uCAAiB;IACjB,qCAAgB;IAChB,uCAAiB;IACjB,8BAAa;IACb,4BAAY;IACZ,sCAAiB;IACjB,2CAAmB;IACnB,0BAAW;IACX,wCAAkB;IAClB,+CAAqB;IACrB,kCAAe;IACf,mDAAuB;IACvB,mDAAuB;IACvB,wDAAyB;IACzB,0DAAyB;IACzB,mCAAe;IACf,iDAAqB;IACrB,8DAA4B;IAC5B,gCAAc;CACf,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/types/worksheet/index.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AACnE,2EAAmE;AACnE,6DAAuD;AACvD,mEAA6D;AAC7D,mDAA8C;AAC9C,+DAAyD;AACzD,2DAAqD;AACrD,6DAAwD;AACxD,+DAA0D;AAC1D,qFAA4E;AAC5E,+DAAyD;AACzD,2EAAqE;AACrE,uEAAiE;AACjE,uDAAkD;AAClD,uFAAgF;AAChF,iFAA0E;AAC1E,mDAA8C;AAC9C,iDAA4C;AAC5C,2EAAqE;AACrE,uDAAkD;AAClD,yDAAoD;AACpD,qEAA+D;AAC/D,qEAA+D;AAC/D,iEAA4D;AAC5D,+DAAyD;AACzD,2DAAsD;AACtD,2CAAuC;AACvC,mEAA6D;AAC7D,qDAAgD;AAChD,qDAAgD;AAChD,uDAAkD;AAClD,2EAAqE;AAExD,QAAA,QAAQ,GAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0pBnC,CAAA;AAEU,QAAA,KAAK,GAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwKlC,CAAA;AAEY,QAAA,KAAK,GAAiB;IACjC,qBAAS;IACT,0CAAmB;IACnB,gCAAc;IACd,oCAAgB;IAChB,4BAAY;IACZ,gCAAc;IACd,8BAAa;IACb,iDAAsB;IACtB,6CAAoB;IACpB,2CAAmB;IACnB,6CAAoB;IACpB,mDAAuB;IACvB,uCAAiB;IACjB,uCAAiB;IACjB,qCAAgB;IAChB,uCAAiB;IACjB,8BAAa;IACb,4BAAY;IACZ,sCAAiB;IACjB,2CAAmB;IACnB,0BAAW;IACX,wCAAkB;IAClB,+CAAqB;IACrB,kCAAe;IACf,mDAAuB;IACvB,mDAAuB;IACvB,wDAAyB;IACzB,0DAAyB;IACzB,mCAAe;IACf,iDAAqB;IACrB,8DAA4B;IAC5B,gCAAc;CACf,CAAA"}
@@ -77,6 +77,7 @@ exports.WorksheetDetailInfo = (0, apollo_server_koa_1.gql) `
77
77
  expirationPeriod: Int
78
78
  productDetail: ProductDetail
79
79
  originLocation: Location
80
+ customerCompanyDomainId: String
80
81
  grossWeight: Float
81
82
  }
82
83
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"worksheet-detail-info.js","sourceRoot":"","sources":["../../../../server/graphql/types/worksheet/worksheet-detail-info.ts"],"names":[],"mappings":";;;AAAA,yDAAuC;AAE1B,QAAA,mBAAmB,GAAG,IAAA,uBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6ErC,CAAA"}
1
+ {"version":3,"file":"worksheet-detail-info.js","sourceRoot":"","sources":["../../../../server/graphql/types/worksheet/worksheet-detail-info.ts"],"names":[],"mappings":";;;AAAA,yDAAuC;AAE1B,QAAA,mBAAmB,GAAG,IAAA,uBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8ErC,CAAA"}
@@ -28,6 +28,7 @@ exports.WorksheetDetail = (0, apollo_server_koa_1.gql) `
28
28
  updater: User
29
29
  createdAt: String
30
30
  updatedAt: String
31
+ customerCompanyDomainId: String
31
32
  }
32
33
  `;
33
34
  //# sourceMappingURL=worksheet-detail.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worksheet-detail.js","sourceRoot":"","sources":["../../../../server/graphql/types/worksheet-detail/worksheet-detail.ts"],"names":[],"mappings":";;;AAAA,yDAAuC;AAE1B,QAAA,eAAe,GAAG,IAAA,uBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BjC,CAAA"}
1
+ {"version":3,"file":"worksheet-detail.js","sourceRoot":"","sources":["../../../../server/graphql/types/worksheet-detail/worksheet-detail.ts"],"names":[],"mappings":";;;AAAA,yDAAuC;AAE1B,QAAA,eAAe,GAAG,IAAA,uBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BjC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/worksheet-base",
3
- "version": "4.3.550",
3
+ "version": "4.3.552",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -36,14 +36,14 @@
36
36
  "@things-factory/integration-sftp": "^4.3.550",
37
37
  "@things-factory/marketplace-base": "^4.3.544",
38
38
  "@things-factory/notification": "^4.3.535",
39
- "@things-factory/sales-base": "^4.3.550",
39
+ "@things-factory/sales-base": "^4.3.552",
40
40
  "@things-factory/setting-base": "^4.3.535",
41
41
  "@things-factory/shell": "^4.3.535",
42
42
  "@things-factory/transport-base": "^4.3.535",
43
- "@things-factory/warehouse-base": "^4.3.544",
43
+ "@things-factory/warehouse-base": "^4.3.551",
44
44
  "jspdf": "2.5.1",
45
45
  "puppeteer": "21.0.3",
46
46
  "uuid": "^9.0.0"
47
47
  },
48
- "gitHead": "34019fe138cf7053de639857ba7a4e3fb08665b9"
48
+ "gitHead": "c952a94b1ed99834abad268e1401a133e2772375"
49
49
  }
@@ -83,7 +83,7 @@ export class SellercraftController extends WorksheetController {
83
83
  const { sku, qty, product, releaseQty } = itm
84
84
  const idx = orderProducts.findIndex(op => op.product.sku == sku || op.product.sku == product?.sku)
85
85
 
86
- const matchedOrderProduct = idx !== -1 ? orderProducts[idx] : undefined
86
+ const matchedOrderProduct = idx !== -1 ? { ...orderProducts[idx] } : undefined
87
87
 
88
88
  const matchedOrderPackageItem: OrderPackageItem = orderPackage?.orderPackageItems?.find(
89
89
  itm => itm.orderProductId === matchedOrderProduct?.id
@@ -121,7 +121,11 @@ export class SellercraftController extends WorksheetController {
121
121
  return {
122
122
  ...commonProperties,
123
123
  name: OrderNoGenerator.orderPackageItem(),
124
- releaseQty: qty || releaseQty
124
+ releaseQty: releaseQty
125
+ ? releaseQty
126
+ : qty > matchedOrderProduct.releaseQty
127
+ ? matchedOrderProduct.releaseQty
128
+ : qty
125
129
  }
126
130
  })
127
131
  .filter(item => item != null)
@@ -403,7 +403,7 @@ export class PickingWorksheetController extends VasWorksheetController {
403
403
  packageId: null,
404
404
  trackingNo: null,
405
405
  transporter: null,
406
- airwayBill: releaseGood?.airwayBill,
406
+ airwayBill: releaseGood?.airwayBill || null,
407
407
  invoice: releaseGood?.invoice,
408
408
  status: ORDER_STATUS.PROCESSING,
409
409
  releaseGood,
@@ -668,7 +668,7 @@ export class PickingWorksheetController extends VasWorksheetController {
668
668
  packageId: null,
669
669
  trackingNo: null,
670
670
  transporter: null,
671
- airwayBill: releaseGood?.airwayBill,
671
+ airwayBill: releaseGood?.airwayBill || null,
672
672
  invoice: releaseGood?.invoice,
673
673
  status: ORDER_STATUS.PROCESSING,
674
674
  releaseGood,
@@ -2818,7 +2818,7 @@ export class PickingWorksheetController extends VasWorksheetController {
2818
2818
  packageId: null,
2819
2819
  trackingNo: null,
2820
2820
  transporter: null,
2821
- airwayBill: releaseGood?.airwayBill,
2821
+ airwayBill: releaseGood?.airwayBill || null,
2822
2822
  invoice: releaseGood?.invoice,
2823
2823
  status: ORDER_STATUS.PROCESSING,
2824
2824
  releaseGood,
@@ -2935,7 +2935,7 @@ export async function splitOrderConsignment(
2935
2935
  packageId: null,
2936
2936
  trackingNo: null,
2937
2937
  transporter: null,
2938
- airwayBill: releaseGood?.airwayBill,
2938
+ airwayBill: releaseGood?.airwayBill || null,
2939
2939
  invoice: releaseGood?.invoice,
2940
2940
  status: ORDER_STATUS.PROCESSING,
2941
2941
  releaseGood,
@@ -3119,7 +3119,7 @@ export async function createConsignmentPackage(
3119
3119
  packageId: null,
3120
3120
  trackingNo: null,
3121
3121
  transporter: null,
3122
- airwayBill: releaseGood?.airwayBill,
3122
+ airwayBill: releaseGood?.airwayBill || null,
3123
3123
  invoice: releaseGood?.invoice,
3124
3124
  status: ORDER_STATUS.PROCESSING,
3125
3125
  releaseGood,
@@ -109,11 +109,11 @@ export class ReplenishmentWorksheetController extends WorksheetController {
109
109
  async replenishmentPicking(
110
110
  worksheetDetailName: string,
111
111
  worksheetType: string,
112
- productBarcode: string,
113
112
  cartonId: string,
113
+ pickedQty: number,
114
+ productBarcode?: string,
114
115
  binLocation?: string,
115
- serialNumber?: string,
116
- pickedQty: number = 1
116
+ serialNumber?: string
117
117
  ): Promise<WorksheetDetail> {
118
118
  try {
119
119
  //find existing worksheet detail
@@ -150,25 +150,28 @@ export class ReplenishmentWorksheetController extends WorksheetController {
150
150
  if (targetInventory?.status != ORDER_INVENTORY_STATUS.PICKING)
151
151
  throw new Error(this.ERROR_MSG.VALIDITY.CANT_PROCEED_STEP_BY('picking', `is done`))
152
152
 
153
- if (!productBarcodes.find(itm => itm.gtin == productBarcode) && product?.isRequireSerialNumberScanningOutbound) {
154
- throw new Error(this.ERROR_MSG.FIND.NO_RESULT(productBarcode))
153
+ // for enable product scanning
154
+ if (productBarcode) {
155
+ if (!productBarcodes.find(itm => itm.gtin == productBarcode) && product?.isRequireSerialNumberScanningOutbound) {
156
+ throw new Error(this.ERROR_MSG.FIND.NO_RESULT(productBarcode))
157
+ }
158
+
159
+ matchingProduct = await this.getDirectQty(
160
+ {
161
+ ...productDetail,
162
+ product: targetInventory?.product
163
+ },
164
+ productBarcode,
165
+ pickedQty
166
+ )
167
+
168
+ //validate matching product details based on scanned barcode
169
+ if (!matchingProduct) throw new Error(this.ERROR_MSG.FIND.NO_RESULT(productBarcode))
170
+
171
+ pickedQty = matchingProduct.qty
172
+ pickedUomValue = matchingProduct.uomValue
155
173
  }
156
174
 
157
- matchingProduct = await this.getDirectQty(
158
- {
159
- ...productDetail,
160
- product: targetInventory?.product
161
- },
162
- productBarcode,
163
- pickedQty
164
- )
165
-
166
- //validate matching product details based on scanned barcode
167
- if (!matchingProduct) throw new Error(this.ERROR_MSG.FIND.NO_RESULT(productBarcode))
168
-
169
- pickedQty = matchingProduct.qty
170
- pickedUomValue = matchingProduct.uomValue
171
-
172
175
  //validation to prevent over release
173
176
  if (
174
177
  !worksheetDetail?.targetInventory ||
@@ -393,7 +396,7 @@ export class ReplenishmentWorksheetController extends WorksheetController {
393
396
  domain: this.domain,
394
397
  name: replenishmentNo
395
398
  },
396
- ['orderInventories', 'orderInventories.inventory']
399
+ ['orderInventories', 'orderInventories.inventory', 'orderInventories.bizplace']
397
400
  )
398
401
  let orderInventories: OrderInventory[] = replenishment.orderInventories
399
402
 
@@ -430,7 +433,8 @@ export class ReplenishmentWorksheetController extends WorksheetController {
430
433
  worksheetDetailName: [string],
431
434
  cartonId: string,
432
435
  locationName: string,
433
- actualQty: number
436
+ actualQty: number,
437
+ productBarcode: string
434
438
  ): Promise<void> {
435
439
  const worksheetDetails: WorksheetDetail[] = await this.findExecutableWorksheetDetailByNames(
436
440
  worksheetDetailName,
@@ -453,7 +457,23 @@ export class ReplenishmentWorksheetController extends WorksheetController {
453
457
  let targetInventory: OrderInventory = worksheetDetail.targetInventory
454
458
  let inventory: Inventory = targetInventory.inventory
455
459
 
456
- if (inventory.cartonId !== cartonId) {
460
+ if (productBarcode) {
461
+ let matchingProduct = await this.getDirectQty(
462
+ {
463
+ ...inventory.productDetail,
464
+ product: inventory?.product
465
+ },
466
+ productBarcode,
467
+ actualQty
468
+ )
469
+
470
+ //validate matching product details based on scanned barcode
471
+ if (!matchingProduct) throw new Error(this.ERROR_MSG.FIND.NO_RESULT(productBarcode))
472
+
473
+ actualQty = matchingProduct.qty
474
+ }
475
+
476
+ if (!productBarcode && inventory.cartonId !== cartonId) {
457
477
  throw new Error(this.ERROR_MSG.VALIDITY.UNEXPECTED_FIELD_VALUE('cartonId', cartonId, inventory.cartonId))
458
478
  }
459
479
 
@@ -467,11 +487,7 @@ export class ReplenishmentWorksheetController extends WorksheetController {
467
487
  name: locationName,
468
488
  type: In([
469
489
  LOCATION_TYPE.SHELF,
470
- LOCATION_TYPE.BUFFER,
471
- LOCATION_TYPE.FLOOR,
472
- LOCATION_TYPE.BIN,
473
- LOCATION_TYPE.QUARANTINE,
474
- LOCATION_TYPE.RESERVE
490
+ LOCATION_TYPE.FLOOR
475
491
  ])
476
492
  },
477
493
  relations: ['warehouse']
@@ -537,6 +553,7 @@ export class ReplenishmentWorksheetController extends WorksheetController {
537
553
  newInventory.lockedUomValue = 0
538
554
  newInventory.transferUomValue = 0
539
555
  newInventory.refOrderId = replenishment.id
556
+ newInventory.refInventory = inventory
540
557
 
541
558
  await this.trxMgr.getRepository(Inventory).save(newInventory)
542
559
 
@@ -593,9 +610,10 @@ export class ReplenishmentWorksheetController extends WorksheetController {
593
610
  const targetInventory: OrderInventory = worksheetDetail.targetInventory
594
611
 
595
612
  let inventories: Inventory[] = await this.trxMgr.getRepository(Inventory).find({
596
- where: { domain: this.domain, cartonId, refOrderId: replenishment.id }
613
+ where: { domain: this.domain, cartonId, refOrderId: replenishment.id, refInventory: {id: targetInventory.inventory.id} }
597
614
  })
598
615
 
616
+ let totalUndoPackQty = 0
599
617
  for (const inventory of inventories) {
600
618
  let inventoryItems: InventoryItem = await this.trxMgr
601
619
  .getRepository(InventoryItem)
@@ -610,6 +628,7 @@ export class ReplenishmentWorksheetController extends WorksheetController {
610
628
 
611
629
  await this.trxMgr.getRepository(InventoryItem).save(inventoryItems)
612
630
  }
631
+ totalUndoPackQty += inventory.qty
613
632
 
614
633
  await this.checkReleaseTarget(inventory)
615
634
 
@@ -633,7 +652,7 @@ export class ReplenishmentWorksheetController extends WorksheetController {
633
652
  .where('id = :id', { id: targetInventory.inventory.id })
634
653
  .execute()
635
654
 
636
- targetInventory.actualPackQty = 0
655
+ targetInventory.actualPackQty = targetInventory.actualPackQty - totalUndoPackQty
637
656
  targetInventory.status = ORDER_PRODUCT_STATUS.PUTTING_AWAY
638
657
  targetInventory.updater = this.user
639
658
  await this.updateOrderTargets([targetInventory])
@@ -263,7 +263,7 @@ export class WorksheetController {
263
263
  break
264
264
 
265
265
  case ReferenceOrderFields.Replenishment:
266
- refOrder = await this.findRefOrder(Replenishment, refOrder)
266
+ refOrder = await this.findRefOrder(Replenishment, refOrder, ['bizplace'])
267
267
  break
268
268
  }
269
269
  }
@@ -412,10 +412,7 @@ export class WorksheetController {
412
412
  additionalProps: Partial<Worksheet> = {}
413
413
  ): Promise<Worksheet> {
414
414
  let refOrderType: string = await this.getRefOrderField(refOrder)
415
- let bizplace: Bizplace
416
- if (refOrderType !== 'replenishment') {
417
- bizplace = await this.extractBizplaceFromRefOrder(refOrder)
418
- }
415
+ let bizplace: Bizplace = await this.extractBizplaceFromRefOrder(refOrder)
419
416
 
420
417
  let existingWorksheet: Worksheet
421
418
  try {
@@ -487,13 +484,7 @@ export class WorksheetController {
487
484
  orderTargets: OrderTargetTypes[],
488
485
  additionalProps: Partial<WorksheetDetail> = {}
489
486
  ): Promise<WorksheetDetail[]> {
490
- if (
491
- !worksheet.bizplace?.id &&
492
- type !== WORKSHEET_TYPE.PICKING_REPLENISHMENT &&
493
- type !== WORKSHEET_TYPE.PUTAWAY_REPLENISHMENT
494
- ) {
495
- worksheet = await this.findWorksheetById(worksheet.id, ['bizplace'])
496
- }
487
+ worksheet = await this.findWorksheetById(worksheet.id, ['bizplace'])
497
488
  const bizplace: Bizplace = worksheet.bizplace
498
489
 
499
490
  const worksheetDetails: Partial<WorksheetDetail>[] = orderTargets.map((orderTarget: OrderTargetTypes) => {
@@ -1,9 +1,23 @@
1
- import { In, Not, EntityManager } from 'typeorm'
1
+ import {
2
+ EntityManager,
3
+ In,
4
+ Not
5
+ } from 'typeorm'
6
+
7
+ import { User } from '@things-factory/auth-base'
8
+ import {
9
+ ORDER_INVENTORY_STATUS,
10
+ ORDER_STATUS,
11
+ OrderInventory,
12
+ Replenishment
13
+ } from '@things-factory/sales-base'
2
14
  import { Domain } from '@things-factory/shell'
3
15
  import { Inventory } from '@things-factory/warehouse-base'
4
- import { ORDER_INVENTORY_STATUS, ORDER_STATUS, OrderInventory, Replenishment } from '@things-factory/sales-base'
5
- import { User } from '@things-factory/auth-base'
6
- import { Worksheet, WorksheetDetail } from '../../../entities'
16
+
17
+ import {
18
+ Worksheet,
19
+ WorksheetDetail
20
+ } from '../../../entities'
7
21
 
8
22
  export const cancelReplenishment = {
9
23
  async cancelReplenishment(_: any, { name }, context: any) {
@@ -64,6 +78,6 @@ export const cancelReplenishment = {
64
78
  .getRepository(Replenishment)
65
79
  .update({ id: replenishment.id }, { status: ORDER_STATUS.CANCELLED, updater: this.user })
66
80
 
67
- return worksheet
81
+ return true
68
82
  }
69
83
  }
@@ -1,9 +1,9 @@
1
+ import { EntityManager } from 'typeorm'
2
+
1
3
  import { User } from '@things-factory/auth-base'
2
4
  import { Domain } from '@things-factory/shell'
3
- import { EntityManager } from 'typeorm'
4
- import { ReplenishmentWorksheetController } from '../../../../controllers'
5
5
 
6
- import { pickingWorksheet } from '../picking-worksheet'
6
+ import { ReplenishmentWorksheetController } from '../../../../controllers'
7
7
 
8
8
  export const replenishmentPickingResolver = {
9
9
  async replenishmentPicking(
@@ -17,11 +17,11 @@ export const replenishmentPickingResolver = {
17
17
  let ws = await worksheetController.replenishmentPicking(
18
18
  worksheetDetailName,
19
19
  worksheetType,
20
- productBarcode,
21
20
  cartonId,
21
+ pickingQty,
22
+ productBarcode,
22
23
  binLocation,
23
- serialNumber,
24
- pickingQty
24
+ serialNumber
25
25
  )
26
26
  }
27
27
  }
@@ -1,20 +1,29 @@
1
- import { EntityManager, In, SelectQueryBuilder } from 'typeorm'
1
+ import {
2
+ EntityManager,
3
+ In,
4
+ SelectQueryBuilder
5
+ } from 'typeorm'
2
6
 
3
7
  import {
4
8
  ORDER_INVENTORY_STATUS,
5
9
  OrderInventory,
6
10
  ReleaseGood,
7
- ShippingOrder,
8
- Replenishment
11
+ Replenishment,
12
+ ShippingOrder
9
13
  } from '@things-factory/sales-base'
10
14
  import { Domain } from '@things-factory/shell'
11
- import { Inventory, Location, InventoryChange } from '@things-factory/warehouse-base'
15
+ import {
16
+ Inventory,
17
+ InventoryChange,
18
+ Location
19
+ } from '@things-factory/warehouse-base'
12
20
 
13
- import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../../../constants'
21
+ import {
22
+ WORKSHEET_STATUS,
23
+ WORKSHEET_TYPE
24
+ } from '../../../constants'
14
25
  import { WorksheetDetail } from '../../../entities'
15
26
  import { fetchExecutingWorksheet } from '../../../utils'
16
- import { VasOrderWorksheet } from 'server/graphql/types/worksheet/vas-order-worksheet'
17
- import { ReplenishmentWorksheetController } from 'server/controllers'
18
27
 
19
28
  export const pickingWorksheetResolver = {
20
29
  async pickingWorksheet(_: any, { orderNo, locationSortingRules }, context: any) {
@@ -169,7 +178,7 @@ async function replenishmentWorksheet(orderNo: String, tx, domain, locationSorti
169
178
  if (replenishment) {
170
179
  const worksheet = await fetchExecutingWorksheet(
171
180
  domain,
172
- null,
181
+ replenishment.bizplaceId,
173
182
  [],
174
183
  WORKSHEET_TYPE.PICKING_REPLENISHMENT,
175
184
  replenishment,
@@ -6,9 +6,9 @@ import { Domain } from '@things-factory/shell'
6
6
  import { ReplenishmentWorksheetController } from '../../../../controllers'
7
7
 
8
8
  export const replenishmentPutawayResolver = {
9
- async replenishmentPutaway(_: any, { worksheetDetailName, cartonId, toLocation, actualQty }, context: any) {
9
+ async replenishmentPutaway(_: any, { worksheetDetailName, cartonId, toLocation, actualQty, productBarcode }, context: any) {
10
10
  const { tx, domain, user }: { tx: EntityManager; domain: Domain; user: User } = context.state
11
- await replenishmentPutaway(tx, domain, user, worksheetDetailName, cartonId, toLocation, actualQty)
11
+ await replenishmentPutaway(tx, domain, user, worksheetDetailName, cartonId, toLocation, actualQty, productBarcode)
12
12
  }
13
13
  }
14
14
 
@@ -19,8 +19,9 @@ async function replenishmentPutaway(
19
19
  worksheetDetailName: [string],
20
20
  cartonId: string,
21
21
  locationName: string,
22
- actualQty: number
22
+ actualQty: number,
23
+ productBarcode: string
23
24
  ) {
24
25
  const worksheetController: ReplenishmentWorksheetController = new ReplenishmentWorksheetController(tx, domain, user)
25
- await worksheetController.replenishmentPutaway(worksheetDetailName, cartonId, locationName, actualQty)
26
+ await worksheetController.replenishmentPutaway(worksheetDetailName, cartonId, locationName, actualQty, productBarcode)
26
27
  }
@@ -37,7 +37,7 @@ export const putawayReplenishmentWorksheetResolver = {
37
37
  where: { domain, name: replenishmentNo }
38
38
  })
39
39
 
40
- if (!binLocation) throw new Error(`Replenishment dosen't exist.`)
40
+ if (!binLocation) throw new Error(`Replenishment doesn't exist.`)
41
41
 
42
42
  const qb: SelectQueryBuilder<OrderInventory> = getRepository(OrderInventory).createQueryBuilder('orderInventory')
43
43
  qb.innerJoinAndSelect('orderInventory.replenishment', 'replenishment')
@@ -56,13 +56,14 @@ export const putawayReplenishmentWorksheetResolver = {
56
56
  }
57
57
  }
58
58
 
59
- if (!replenishment) throw new Error(`Replenishment dosen't exist.`)
59
+ if (!replenishment) throw new Error(`Replenishment doesn't exist.`)
60
60
 
61
61
  const worksheet: Worksheet = await fetchExecutingWorksheet(
62
62
  domain,
63
- null,
63
+ replenishment.bizplaceId,
64
64
  [
65
65
  'bizplace',
66
+ 'bizplace.company',
66
67
  'replenishment',
67
68
  'worksheetDetails',
68
69
  'worksheetDetails.targetInventory',
@@ -77,17 +78,20 @@ export const putawayReplenishmentWorksheetResolver = {
77
78
 
78
79
  return {
79
80
  worksheetInfo: {
81
+ bizplaceName: worksheet.bizplace.name,
80
82
  status: worksheet.status,
81
83
  replenishment: {
82
84
  id: replenishment.id,
83
85
  name: replenishment.name
84
- }
86
+ },
87
+ customerCompanyDomainId: worksheet.bizplace.company.domainId
85
88
  },
86
89
  worksheetDetailInfos: worksheet.worksheetDetails.map(async (putawayWSD: WorksheetDetail) => {
87
90
  const targetInventory: OrderInventory = putawayWSD.targetInventory
88
91
  const inventory: Inventory = targetInventory.inventory
89
92
  return {
90
93
  name: putawayWSD.name,
94
+ inventory: inventory,
91
95
  palletId: inventory.palletId,
92
96
  cartonId: inventory.cartonId,
93
97
  batchId: inventory.batchId,
@@ -305,6 +305,7 @@ export const Mutation = /* GraphQL */ `
305
305
  cartonId: String
306
306
  toLocation: String!
307
307
  actualQty: Int!
308
+ productBarcode: String
308
309
  ): Boolean @privilege(category: "worksheet_execute", privilege: "mutation") @transaction
309
310
 
310
311
  putawayReturn (
@@ -398,7 +399,7 @@ export const Mutation = /* GraphQL */ `
398
399
  replenishmentPicking (
399
400
  worksheetDetailName: String!
400
401
  worksheetType: String!
401
- productBarcode: String!
402
+ productBarcode: String
402
403
  cartonId: String!
403
404
  binLocation: String
404
405
  serialNumber: String
@@ -75,6 +75,7 @@ export const WorksheetDetailInfo = gql`
75
75
  expirationPeriod: Int
76
76
  productDetail: ProductDetail
77
77
  originLocation: Location
78
+ customerCompanyDomainId: String
78
79
  grossWeight: Float
79
80
  }
80
81
  `
@@ -26,5 +26,6 @@ export const WorksheetDetail = gql`
26
26
  updater: User
27
27
  createdAt: String
28
28
  updatedAt: String
29
+ customerCompanyDomainId: String
29
30
  }
30
31
  `