@things-factory/worksheet-base 4.3.387 → 4.3.390

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 (28) hide show
  1. package/dist-server/controllers/ecommerce/ecommerce-controller.js +4 -2
  2. package/dist-server/controllers/ecommerce/ecommerce-controller.js.map +1 -1
  3. package/dist-server/controllers/ecommerce/sellercraft-controller.js +2 -1
  4. package/dist-server/controllers/ecommerce/sellercraft-controller.js.map +1 -1
  5. package/dist-server/controllers/inspect/cycle-count-worksheet-controller.js +164 -38
  6. package/dist-server/controllers/inspect/cycle-count-worksheet-controller.js.map +1 -1
  7. package/dist-server/graphql/resolvers/worksheet/cycle-count-adjustment.js +35 -5
  8. package/dist-server/graphql/resolvers/worksheet/cycle-count-adjustment.js.map +1 -1
  9. package/dist-server/graphql/resolvers/worksheet/cycle-count-worksheet-for-carton.js +3 -1
  10. package/dist-server/graphql/resolvers/worksheet/cycle-count-worksheet-for-carton.js.map +1 -1
  11. package/dist-server/graphql/resolvers/worksheet/cycle-count-worksheet-for-pallet.js +8 -2
  12. package/dist-server/graphql/resolvers/worksheet/cycle-count-worksheet-for-pallet.js.map +1 -1
  13. package/dist-server/graphql/resolvers/worksheet/packing-worksheet.js +6 -18
  14. package/dist-server/graphql/resolvers/worksheet/packing-worksheet.js.map +1 -1
  15. package/dist-server/graphql/types/worksheet/worksheet-detail-info.js +1 -0
  16. package/dist-server/graphql/types/worksheet/worksheet-detail-info.js.map +1 -1
  17. package/dist-server/utils/lmd-util.js +1 -1
  18. package/dist-server/utils/lmd-util.js.map +1 -1
  19. package/package.json +9 -9
  20. package/server/controllers/ecommerce/ecommerce-controller.ts +3 -2
  21. package/server/controllers/ecommerce/sellercraft-controller.ts +2 -1
  22. package/server/controllers/inspect/cycle-count-worksheet-controller.ts +245 -57
  23. package/server/graphql/resolvers/worksheet/cycle-count-adjustment.ts +47 -6
  24. package/server/graphql/resolvers/worksheet/cycle-count-worksheet-for-carton.ts +6 -1
  25. package/server/graphql/resolvers/worksheet/cycle-count-worksheet-for-pallet.ts +11 -2
  26. package/server/graphql/resolvers/worksheet/packing-worksheet.ts +6 -19
  27. package/server/graphql/types/worksheet/worksheet-detail-info.ts +1 -0
  28. package/server/utils/lmd-util.ts +1 -1
@@ -34,6 +34,7 @@ export const cycleCountWorksheetForCartonResolver = {
34
34
  qb.leftJoinAndSelect('WSD.targetInventoryCheckItem', 'T_INV')
35
35
  .leftJoinAndSelect('T_INV.inventory', 'INV')
36
36
  .leftJoinAndSelect('T_INV.inspectedLocation', 'INS_LOC')
37
+ .leftJoinAndSelect('T_INV.originLocation', 'ORG_LOC')
37
38
  .leftJoinAndSelect('INV.location', 'LOC_INV')
38
39
  .leftJoinAndSelect('T_INV.product', 'PROD')
39
40
  .leftJoinAndSelect('INV.product', 'PROD_INV')
@@ -51,7 +52,10 @@ export const cycleCountWorksheetForCartonResolver = {
51
52
  }
52
53
 
53
54
  if (locationName) {
54
- qb.andWhere('("LOC_INV"."name" = :locationName OR "INS_LOC"."name" = :locationName)', { locationName })
55
+ qb.andWhere(
56
+ '("ORG_LOC"."name" = :locationName OR "LOC_INV"."name" = :locationName OR "INS_LOC"."name" = :locationName',
57
+ { locationName }
58
+ )
55
59
  }
56
60
 
57
61
  if (cartonId) {
@@ -93,6 +97,7 @@ export const cycleCountWorksheetForCartonResolver = {
93
97
  qty: inventory?.qty,
94
98
  uomValue: inventory?.uomValue,
95
99
  uom: inventory?.uom,
100
+ originLocation: targetInventoryCheckItem?.originLocation,
96
101
  inspectedQty: targetInventoryCheckItem?.inspectedQty,
97
102
  inspectedUomValue: targetInventoryCheckItem?.inspectedUomValue,
98
103
  inspectedLocation: targetInventoryCheckItem?.inspectedLocation,
@@ -35,6 +35,7 @@ export const cycleCountWorksheetForPalletResolver = {
35
35
  qb.leftJoinAndSelect('WSD.targetInventoryCheckItem', 'T_INV')
36
36
  .leftJoinAndSelect('T_INV.inventory', 'INV')
37
37
  .leftJoinAndSelect('T_INV.inspectedLocation', 'INS_LOC')
38
+ .leftJoinAndSelect('T_INV.originLocation', 'ORG_LOC')
38
39
  .leftJoinAndSelect('INV.location', 'LOC_INV')
39
40
  .leftJoinAndSelect('T_INV.product', 'PROD')
40
41
  .leftJoinAndSelect('INV.product', 'PROD_INV')
@@ -52,7 +53,10 @@ export const cycleCountWorksheetForPalletResolver = {
52
53
  }
53
54
 
54
55
  if (locationName) {
55
- qb.andWhere('("LOC_INV"."name" = :locationName OR "INS_LOC"."name" = :locationName)', { locationName })
56
+ qb.andWhere(
57
+ '("ORG_LOC"."name" = :locationName OR "LOC_INV"."name" = :locationName OR "INS_LOC"."name" = :locationName',
58
+ { locationName }
59
+ )
56
60
  }
57
61
 
58
62
  if (cartonId) {
@@ -94,6 +98,7 @@ export const cycleCountWorksheetForPalletResolver = {
94
98
  qty: inventory?.qty,
95
99
  uomValue: inventory?.uomValue,
96
100
  uom: inventory?.uom,
101
+ originLocation: targetInventoryCheckItem?.originLocation,
97
102
  inspectedQty: targetInventoryCheckItem?.inspectedQty,
98
103
  inspectedUomValue: targetInventoryCheckItem?.inspectedUomValue,
99
104
  inspectedLocation: targetInventoryCheckItem?.inspectedLocation,
@@ -101,7 +106,11 @@ export const cycleCountWorksheetForPalletResolver = {
101
106
  status: cycleCountWSD.status,
102
107
  targetName: targetInventoryCheckItem?.name,
103
108
  packingType: inventory?.packingType ? inventory.packingType : productDetails.packingType,
104
- location: inventory?.location ? inventory.location : targetInventoryCheckItem.inspectedLocation,
109
+ location: targetInventoryCheckItem?.originLocation
110
+ ? targetInventoryCheckItem.originLocation
111
+ : inventory?.location
112
+ ? inventory.location
113
+ : targetInventoryCheckItem.inspectedLocation,
105
114
  relatedInvCheckItem: targetInventoryCheckItem
106
115
  }
107
116
  })
@@ -529,12 +529,12 @@ async function queryPackingWorksheet(tx, domain, assignee, binLocation) {
529
529
  .innerJoinAndSelect('rg.orderInventories', 'oi')
530
530
  .innerJoinAndSelect('oi.binLocation', 'l')
531
531
  .leftJoinAndSelect('rg.orderPackages', 'op')
532
- .innerJoinAndSelect('op.orderPackageItems', 'opi')
533
- .innerJoinAndSelect('opi.orderProduct', 'opr')
534
- .innerJoinAndSelect('opi.productDetail', 'pd')
535
- .innerJoinAndSelect('pd.product', 'p')
536
- .innerJoinAndSelect('p.productDetails', 'pd2')
537
- .innerJoinAndSelect('pd2.productBarcodes', 'pb')
532
+ .leftJoinAndSelect('op.orderPackageItems', 'opi')
533
+ .leftJoinAndSelect('opi.orderProduct', 'opr')
534
+ .leftJoinAndSelect('opi.productDetail', 'pd')
535
+ .leftJoinAndSelect('pd.product', 'p')
536
+ .leftJoinAndSelect('p.productDetails', 'pd2')
537
+ .leftJoinAndSelect('pd2.productBarcodes', 'pb')
538
538
  .innerJoin('worksheets', 'w', 'w.release_good_id = rg.id')
539
539
  .where('rg.domain_id = :domainId', { domainId: domain.id })
540
540
  .andWhere('oi.status IN (:...orderInventoryStatus)', {
@@ -555,19 +555,6 @@ async function queryPackingWorksheet(tx, domain, assignee, binLocation) {
555
555
  .addOrderBy('rg.status', 'ASC')
556
556
  .addOrderBy('w.created_at', 'ASC')
557
557
 
558
- if (assignee) {
559
- qb.andWhere('ws.assignee_id = :assigneeId', { assigneeId: assignee.id })
560
- } else {
561
- qb.andWhere('ws.assignee_id is null')
562
- }
563
-
564
- qb.orderBy('releaseGood.status', 'ASC')
565
- .addOrderBy('ws.created_at', 'ASC')
566
- .addOrderBy('releaseGood.name', 'ASC')
567
- .groupBy('ws.created_at')
568
- .addGroupBy('releaseGood.name')
569
- .addGroupBy('releaseGood.id')
570
-
571
558
  let releaseGood = await qb.getOne()
572
559
 
573
560
  if (!releaseGood) {
@@ -73,5 +73,6 @@ export const WorksheetDetailInfo = gql`
73
73
  reusablePalletName: String
74
74
  expirationPeriod: Int
75
75
  productDetail: ProductDetail
76
+ originLocation: Location
76
77
  }
77
78
  `
@@ -123,7 +123,7 @@ export async function createLmdParcel(releaseGoods, tx, domain, user, marketplac
123
123
  address3: releaseGood?.deliveryAddress3,
124
124
  ward: releaseGood?.ward?.toUpperCase(), //only for viettel lmd
125
125
  city: releaseGood.city?.toUpperCase(),
126
- postcode: releaseGood.postalCode,
126
+ postcode: releaseGood?.postalCode,
127
127
  district: releaseGood?.district?.toUpperCase() || releaseGood.city?.toUpperCase(),
128
128
  state:
129
129
  releaseGood?.state?.toUpperCase() ||