@things-factory/worksheet-base 4.0.36 → 4.0.40

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 (45) hide show
  1. package/dist-server/constants/template.js +1 -0
  2. package/dist-server/constants/template.js.map +1 -1
  3. package/dist-server/controllers/ecommerce/sellercraft-controller.js +32 -1
  4. package/dist-server/controllers/ecommerce/sellercraft-controller.js.map +1 -1
  5. package/dist-server/controllers/inbound/unloading-returning-worksheet-controller.js +1 -1
  6. package/dist-server/controllers/inbound/unloading-returning-worksheet-controller.js.map +1 -1
  7. package/dist-server/controllers/inbound/unloading-worksheet-controller.js +16 -12
  8. package/dist-server/controllers/inbound/unloading-worksheet-controller.js.map +1 -1
  9. package/dist-server/controllers/outbound/sorting-worksheet-controller.js +2 -0
  10. package/dist-server/controllers/outbound/sorting-worksheet-controller.js.map +1 -1
  11. package/dist-server/controllers/render-grn.js +1 -0
  12. package/dist-server/controllers/render-grn.js.map +1 -1
  13. package/dist-server/controllers/render-invoices.js +138 -0
  14. package/dist-server/controllers/render-invoices.js.map +1 -0
  15. package/dist-server/controllers/render-ro-do.js +5 -1
  16. package/dist-server/controllers/render-ro-do.js.map +1 -1
  17. package/dist-server/graphql/resolvers/worksheet/find-release-orders-by-task-no.js +5 -2
  18. package/dist-server/graphql/resolvers/worksheet/find-release-orders-by-task-no.js.map +1 -1
  19. package/dist-server/graphql/resolvers/worksheet/inventories-by-pallet.js +2 -2
  20. package/dist-server/graphql/resolvers/worksheet/inventories-by-pallet.js.map +1 -1
  21. package/dist-server/graphql/resolvers/worksheet/picking/complete-batch-picking.js +10 -1
  22. package/dist-server/graphql/resolvers/worksheet/picking/complete-batch-picking.js.map +1 -1
  23. package/dist-server/graphql/resolvers/worksheet/picking/complete-picking.js +90 -76
  24. package/dist-server/graphql/resolvers/worksheet/picking/complete-picking.js.map +1 -1
  25. package/dist-server/graphql/resolvers/worksheet/unloading/complete-unloading-partially.js.map +1 -1
  26. package/dist-server/graphql/resolvers/worksheet/unloading/complete-unloading.js +2 -1
  27. package/dist-server/graphql/resolvers/worksheet/unloading/complete-unloading.js.map +1 -1
  28. package/dist-server/routes.js +8 -0
  29. package/dist-server/routes.js.map +1 -1
  30. package/package.json +17 -17
  31. package/server/constants/template.ts +1 -0
  32. package/server/controllers/ecommerce/sellercraft-controller.ts +37 -1
  33. package/server/controllers/inbound/unloading-returning-worksheet-controller.ts +1 -1
  34. package/server/controllers/inbound/unloading-worksheet-controller.ts +21 -14
  35. package/server/controllers/outbound/sorting-worksheet-controller.ts +1 -0
  36. package/server/controllers/render-grn.ts +1 -0
  37. package/server/controllers/render-invoices.ts +154 -0
  38. package/server/controllers/render-ro-do.ts +6 -1
  39. package/server/graphql/resolvers/worksheet/find-release-orders-by-task-no.ts +11 -6
  40. package/server/graphql/resolvers/worksheet/inventories-by-pallet.ts +2 -2
  41. package/server/graphql/resolvers/worksheet/picking/complete-batch-picking.ts +12 -1
  42. package/server/graphql/resolvers/worksheet/picking/complete-picking.ts +96 -79
  43. package/server/graphql/resolvers/worksheet/unloading/complete-unloading-partially.ts +1 -1
  44. package/server/graphql/resolvers/worksheet/unloading/complete-unloading.ts +2 -2
  45. package/server/routes.ts +11 -0
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.completeUnloading = exports.completeUnloadingResolver = void 0;
4
+ const typeorm_1 = require("typeorm");
4
5
  const integration_marketplace_1 = require("@things-factory/integration-marketplace");
5
6
  const integration_sellercraft_1 = require("@things-factory/integration-sellercraft");
6
7
  const sales_base_1 = require("@things-factory/sales-base");
@@ -29,7 +30,7 @@ exports.completeUnloadingResolver = {
29
30
  const putawayWSCtrl = new controllers_1.PutawayWorksheetController(tx, domain, user);
30
31
  let putawayWorksheet;
31
32
  const inventories = await tx.getRepository(warehouse_base_1.Inventory).find({
32
- where: { domain, refOrderId: arrivalNotice.id, status: warehouse_base_1.INVENTORY_STATUS.UNLOADED }
33
+ where: { domain, refOrderId: arrivalNotice.id, status: (0, typeorm_1.In)([warehouse_base_1.INVENTORY_STATUS.UNLOADED, warehouse_base_1.INVENTORY_STATUS.CHECKED]) }
33
34
  });
34
35
  // search for any active marketplace connection
35
36
  const companyDomain = arrivalNotice.bizplace.company.domain;
@@ -1 +1 @@
1
- {"version":3,"file":"complete-unloading.js","sourceRoot":"","sources":["../../../../../server/graphql/resolvers/worksheet/unloading/complete-unloading.ts"],"names":[],"mappings":";;;AAIA,qFAA0E;AAC1E,qFAAwF;AACxF,2DAAqF;AAErF,mEAA4E;AAE5E,qDAAwD;AACxD,yDAAkG;AAClG,iEAA8F;AAGjF,QAAA,yBAAyB,GAAG;IACvC,KAAK,CAAC,iBAAiB,CAAC,CAAM,EAAE,EAAE,eAAe,EAAE,gBAAgB,EAAE,EAAE,OAAY;QACjF,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAsD,OAAO,CAAC,KAAK,CAAA;QAC7F,MAAM,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAA;QAE5E,MAAM,aAAa,GAAkB,MAAM,EAAE,CAAC,aAAa,CAAC,0BAAa,CAAC,CAAC,OAAO,CAAC;YACjF,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE;YACxC,SAAS,EAAE;gBACT,eAAe;gBACf,UAAU;gBACV,iBAAiB;gBACjB,kBAAkB;gBAClB,yBAAyB;gBACzB,eAAe;gBACf,uBAAuB;gBACvB,sCAAsC;gBACtC,yDAAyD;aAC1D;SACF,CAAC,CAAA;QAEF,MAAM,aAAa,GAA+B,IAAI,wCAA0B,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QAClG,IAAI,gBAA2B,CAAA;QAE/B,MAAM,WAAW,GAAgB,MAAM,EAAE,CAAC,aAAa,CAAC,0BAAS,CAAC,CAAC,IAAI,CAAC;YACt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Ae,CAAC,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAA;SAC9F;QAED,MAAM,UAAU,GAAa,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAA;QACtD,MAAM,IAAA,sCAAyB,EAAC,EAAE,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;QAEnG,MAAM,mBAAmB,GAAiC,IAAI,0CAA4B,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QAC5G,mBAAmB,CAAC,mBAAmB,CAAC;YACtC,KAAK,EAAE,wBAAwB,aAAa,CAAC,QAAQ,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI,GAAG;YACpF,IAAI,EAAE,GAAG,aAAa,CAAC,IAAI,uBAAuB;YAClD,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO;YAC3B,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE;SACtC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAEM,KAAK,UAAU,iBAAiB,CACrC,EAAiB,EACjB,MAAc,EACd,IAAU,EACV,eAAuB,EACvB,yBAAqD;IAErD,MAAM,mBAAmB,GAAiC,IAAI,0CAA4B,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;IAC5G,MAAM,mBAAmB,CAAC,iBAAiB,CAAC,eAAe,EAAE,yBAAyB,CAAC,CAAA;AACzF,CAAC;AATD,8CASC"}
@@ -10,6 +10,7 @@ const render_orientage_do_1 = require("./controllers/render-orientage-do");
10
10
  const render_orientage_grn_1 = require("./controllers/render-orientage-grn");
11
11
  const render_ro_do_1 = require("./controllers/render-ro-do");
12
12
  const render_seebuu_grn_1 = require("./controllers/render-seebuu-grn");
13
+ const render_invoices_1 = require("./controllers/render-invoices");
13
14
  process.on('bootstrap-module-domain-private-route', (app, routes) => {
14
15
  routes.get('/view_document_ro_do/:doNo', async (context, next) => {
15
16
  context.body = await (0, render_ro_do_1.renderRODO)(context.params, context);
@@ -41,5 +42,12 @@ process.on('bootstrap-module-domain-private-route', (app, routes) => {
41
42
  routes.get('/view_manifest/:manifestNo', async (context, next) => {
42
43
  context.body = await (0, render_manifest_1.renderManifest)(context.params, context);
43
44
  });
45
+ routes.post('/view_invoices/:timezoneOffSet', async (context, next) => {
46
+ let req = context.request.body || {};
47
+ let timezoneOffSet = context.params.timezoneOffSet || 0;
48
+ let data = await (0, render_invoices_1.renderInvoices)({ req, timezoneOffSet }, context);
49
+ context.type = 'application/json';
50
+ context.body = data;
51
+ });
44
52
  });
45
53
  //# sourceMappingURL=routes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":";;AAAA,qEAA+D;AAC/D,yDAAoD;AACpD,qEAA+D;AAC/D,uEAAiE;AACjE,mEAA8D;AAC9D,qEAA+D;AAC/D,2EAAqE;AACrE,6EAAuE;AACvE,6DAAuD;AACvD,uEAAiE;AAEjE,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;IACzE,MAAM,CAAC,GAAG,CAAC,4BAA4B,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC/D,OAAO,CAAC,IAAI,GAAG,MAAM,IAAA,yBAAU,EAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC1D,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,GAAG,CAAC,mCAAmC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACtE,OAAO,CAAC,IAAI,GAAG,MAAM,IAAA,uCAAiB,EAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjE,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,GAAG,CAAC,gCAAgC,EAAE,KAAK,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,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC3E,OAAO,CAAC,IAAI,GAAG,MAAM,IAAA,iCAAc,EAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9D,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,GAAG,CAAC,4BAA4B,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC/D,OAAO,CAAC,IAAI,GAAG,MAAM,IAAA,gCAAc,EAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9D,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,IAAI,CAAC,gCAAgC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACpE,IAAI,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAA;QACpC,IAAI,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,IAAI,CAAC,CAAA;QAEvD,IAAI,IAAI,GAAG,MAAM,IAAA,gCAAc,EAAC,EAAE,GAAG,EAAE,cAAc,EAAE,EAAE,OAAO,CAAC,CAAA;QAEjE,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAA;QACjC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAA;IACrB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/worksheet-base",
3
- "version": "4.0.36",
3
+ "version": "4.0.40",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -24,21 +24,21 @@
24
24
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
25
25
  },
26
26
  "dependencies": {
27
- "@things-factory/auth-base": "^4.0.36",
28
- "@things-factory/biz-base": "^4.0.36",
29
- "@things-factory/document-template-base": "^4.0.36",
30
- "@things-factory/id-rule-base": "^4.0.36",
31
- "@things-factory/integration-lmd": "^4.0.36",
32
- "@things-factory/integration-marketplace": "^4.0.36",
33
- "@things-factory/integration-sellercraft": "^4.0.36",
34
- "@things-factory/integration-sftp": "^4.0.36",
35
- "@things-factory/marketplace-base": "^4.0.36",
36
- "@things-factory/notification": "^4.0.36",
37
- "@things-factory/sales-base": "^4.0.36",
38
- "@things-factory/setting-base": "^4.0.36",
39
- "@things-factory/shell": "^4.0.36",
40
- "@things-factory/transport-base": "^4.0.36",
41
- "@things-factory/warehouse-base": "^4.0.36"
27
+ "@things-factory/auth-base": "^4.0.40",
28
+ "@things-factory/biz-base": "^4.0.40",
29
+ "@things-factory/document-template-base": "^4.0.40",
30
+ "@things-factory/id-rule-base": "^4.0.40",
31
+ "@things-factory/integration-lmd": "^4.0.40",
32
+ "@things-factory/integration-marketplace": "^4.0.40",
33
+ "@things-factory/integration-sellercraft": "^4.0.40",
34
+ "@things-factory/integration-sftp": "^4.0.40",
35
+ "@things-factory/marketplace-base": "^4.0.40",
36
+ "@things-factory/notification": "^4.0.40",
37
+ "@things-factory/sales-base": "^4.0.40",
38
+ "@things-factory/setting-base": "^4.0.40",
39
+ "@things-factory/shell": "^4.0.40",
40
+ "@things-factory/transport-base": "^4.0.40",
41
+ "@things-factory/warehouse-base": "^4.0.40"
42
42
  },
43
- "gitHead": "132ab9f8af8c34f73bcd81a9776769a6929e13ee"
43
+ "gitHead": "f0697b5ab411e4aa1a52de19a6c135f39686eca1"
44
44
  }
@@ -4,6 +4,7 @@ export const TEMPLATE_TYPE = {
4
4
  GRN_TEMPLATE: 'GRN_TEMPLATE',
5
5
  JOB_TEMPLATE: 'JOB_TEMPLATE',
6
6
  MANIFEST_TEMPLATE: 'MANIFEST_TEMPLATE',
7
+ INVOICE_TEMPLATE: 'INVOICE_TEMPLATE',
7
8
  COP: 'COP',
8
9
  SIGNATURE: 'SIGNATURE',
9
10
  LOGO: 'LOGO'
@@ -13,6 +13,32 @@ import { Inventory, INVENTORY_STATUS, LOCATION_TYPE } from '@things-factory/ware
13
13
  import { WorksheetController } from '../worksheet-controller'
14
14
 
15
15
  export class SellercraftController extends WorksheetController {
16
+ async packOrder(sellercraft: Sellercraft, releaseGood: ReleaseGood): Promise<ReleaseGood> {
17
+ const orderProducts: OrderProduct[] = releaseGood.orderProducts
18
+ let sellercraftOPs: any[] = []
19
+
20
+ sellercraftOPs = orderProducts.map(orderProduct => {
21
+ const product: Product = orderProduct.product
22
+
23
+ return {
24
+ sku: product.sku,
25
+ releaseQty: orderProduct.releaseQty,
26
+ uom: 'EA'
27
+ }
28
+ })
29
+
30
+ const orderInformation: any = {
31
+ accountId: sellercraft.accountId,
32
+ orderId: releaseGood.refNo2,
33
+ sellercraftOPs
34
+ }
35
+ const packageId: string = await SellercraftAPI.packMarketplaceOrder(sellercraft, { ...orderInformation })
36
+
37
+ releaseGood.packageId = packageId
38
+ releaseGood.updater = this.user
39
+ return releaseGood
40
+ }
41
+
16
42
  async registerProductInbound(sellercraft: Sellercraft, arrivalNotice: ArrivalNotice): Promise<void> {
17
43
  const orderProducts: OrderProduct[] = arrivalNotice.orderProducts
18
44
  const purchaseOrder: PurchaseOrder = arrivalNotice.purchaseOrder
@@ -87,12 +113,20 @@ export class SellercraftController extends WorksheetController {
87
113
 
88
114
  return {
89
115
  sku: product.sku,
116
+ productName: product.name,
117
+ gtin: defaultProductDetail.gtin,
90
118
  purchaseOrderQty: orderInventory.returnQty * packingSize,
91
119
  receivedQty: orderInventory.returnQty * packingSize,
92
120
  uom: 'EA',
93
121
  batchId: orderInventory.batchId,
94
122
  forceCreateProduct: false,
95
- expiryTime: 0
123
+ expiryTime: 0,
124
+ weight: defaultProductDetail.nettWeight < 1 ? 1 : defaultProductDetail.nettWeight,
125
+ packageDimension: {
126
+ length: defaultProductDetail.depth < 1 ? 1 : defaultProductDetail.depth,
127
+ width: defaultProductDetail.width < 1 ? 1 : defaultProductDetail.width,
128
+ height: defaultProductDetail.height < 1 ? 1 : defaultProductDetail.height
129
+ }
96
130
  }
97
131
  })
98
132
  )
@@ -174,6 +208,8 @@ export class SellercraftController extends WorksheetController {
174
208
  }
175
209
 
176
210
  async initiateOrderShipment(sellercraft: Sellercraft, releaseGood: ReleaseGood): Promise<ReleaseGood> {
211
+ if (!releaseGood?.packageId) throw new Error('Order package id is not found')
212
+
177
213
  const orderInformation: any = {
178
214
  accountId: sellercraft.accountId,
179
215
  orderId: releaseGood.refNo2,
@@ -222,7 +222,7 @@ export class UnloadingReturningWorksheetController extends VasWorksheetControlle
222
222
  where: {
223
223
  domain: this.domain,
224
224
  refOrderId: returnOrder.id,
225
- status: INVENTORY_STATUS.UNLOADED
225
+ status: In([INVENTORY_STATUS.UNLOADED, INVENTORY_STATUS.CHECKED])
226
226
  }
227
227
  })
228
228
 
@@ -578,7 +578,8 @@ export class UnloadingWorksheetController extends VasWorksheetController {
578
578
  oi =>
579
579
  oi.batchId == inventory.batchId &&
580
580
  oi.packingType == inventory.packingType &&
581
- oi.product.id == inventory.product.id
581
+ oi.product.id == inventory.product.id &&
582
+ oi.packingSize === inventory.packingSize
582
583
  )
583
584
  if (inventory.status == INVENTORY_STATUS.UNLOADED) {
584
585
  targetInventory.actualPackQty -= qty
@@ -621,6 +622,9 @@ export class UnloadingWorksheetController extends VasWorksheetController {
621
622
  inventory.qty = 0
622
623
  inventory.uomValue = 0
623
624
  inventory.updater = this.user
625
+ targetProduct.actualPalletQty--
626
+
627
+ await this.updateOrderTargets([targetProduct])
624
628
 
625
629
  await this.trxMgr.getRepository(InventoryHistory).update({ inventory }, { inventory: null })
626
630
 
@@ -822,7 +826,7 @@ export class UnloadingWorksheetController extends VasWorksheetController {
822
826
 
823
827
  async completeUnloadingPartially(
824
828
  arrivalNoticeNo: string,
825
- unloadingWorksheetDetail: Partial<WorksheetDetail>
829
+ unloadingWorksheetDetail: Partial<WorksheetDetail>[]
826
830
  ): Promise<Worksheet> {
827
831
  const arrivalNotice: ArrivalNotice = await this.findRefOrder(ArrivalNotice, {
828
832
  name: arrivalNoticeNo,
@@ -835,25 +839,28 @@ export class UnloadingWorksheetController extends VasWorksheetController {
835
839
  ])
836
840
  this.checkRecordValidity(worksheet, { status: WORKSHEET_STATUS.EXECUTING })
837
841
 
838
- let worksheetDetail: WorksheetDetail = worksheet.worksheetDetails.find(
839
- (wsd: WorksheetDetail) => wsd.name === unloadingWorksheetDetail.name
842
+ let worksheetDetails = worksheet.worksheetDetails.filter(({ name: itm1 }) =>
843
+ unloadingWorksheetDetail.some(({ name: itm2 }) => itm2 === itm1)
840
844
  )
841
- worksheetDetail.status = WORKSHEET_STATUS.PARTIALLY_UNLOADED
842
- worksheetDetail.issue = unloadingWorksheetDetail.issue || worksheetDetail.issue
843
- worksheetDetail.updater = this.user
844
- worksheetDetail = await this.trxMgr.getRepository(WorksheetDetail).save(worksheetDetail)
845
845
 
846
- let targetProduct: OrderProduct = worksheetDetail.targetProduct
847
- targetProduct.status = ORDER_PRODUCT_STATUS.PARTIALLY_UNLOADED
848
- targetProduct.issue = worksheetDetail.issue
849
- await this.updateOrderTargets([targetProduct])
846
+ worksheetDetails.forEach((wsds: WorksheetDetail) => {
847
+ wsds.status = WORKSHEET_STATUS.PARTIALLY_UNLOADED
848
+ wsds.updater = this.user
849
+ })
850
+
851
+ worksheetDetails = await this.trxMgr.getRepository(WorksheetDetail).save(worksheetDetails)
852
+
853
+ for (let i = 0; i < worksheetDetails.length; i++) {
854
+ worksheetDetails[i].targetProduct.status = ORDER_PRODUCT_STATUS.PARTIALLY_UNLOADED
855
+ worksheetDetails[i].targetProduct.remark = worksheetDetails[i].issue || worksheetDetails[i].targetProduct.remark
856
+ await this.updateOrderTargets([worksheetDetails[i].targetProduct])
857
+ }
850
858
 
851
859
  let inventories: Inventory[] = await this.trxMgr.getRepository(Inventory).find({
852
860
  where: {
853
861
  domain: this.domain,
854
862
  refOrderId: arrivalNotice.id,
855
- orderProductId: targetProduct.id,
856
- status: INVENTORY_STATUS.UNLOADED
863
+ status: In([INVENTORY_STATUS.UNLOADED, INVENTORY_STATUS.CHECKED])
857
864
  }
858
865
  })
859
866
 
@@ -90,6 +90,7 @@ export class SortingWorksheetController extends VasWorksheetController {
90
90
  const matchingProductDetail: ProductDetail = productDetails.find(
91
91
  (productDetail: ProductDetail) => productDetail.gtin === productBarcode
92
92
  )
93
+ if (!matchingProductDetail) throw new Error('Unable to find product barcode.')
93
94
  const packingType: string = matchingProductDetail.packingType
94
95
  const packingSize: number = matchingProductDetail.packingSize
95
96
  if (!matchingProductDetail)
@@ -194,6 +194,7 @@ export async function renderGRN({ grnNo, timezoneOffSet }, context: any) {
194
194
  product_type: item.packingType,
195
195
  product_size: item.packingSize,
196
196
  product_batch: item.batchId,
197
+ batch_id_ref: item?.batchIdRef ? item.batchIdRef : '',
197
198
  pallet_qty: item.actualPalletQty,
198
199
  product_qty: unloadInvHistory.qty || item.actualPackQty,
199
200
  product_unit_uom_value: `${Math.round(item.uomValue * 100) / 100}`,
@@ -0,0 +1,154 @@
1
+ import FormData from 'form-data'
2
+ import fetch from 'node-fetch'
3
+ import { getRepository } from 'typeorm'
4
+
5
+ import { Attachment, STORAGE } from '@things-factory/attachment-base'
6
+ import { Bizplace } from '@things-factory/biz-base'
7
+ import { config } from '@things-factory/env'
8
+ import { Invoice, ReleaseGood } from '@things-factory/sales-base'
9
+ import { Domain } from '@things-factory/shell'
10
+
11
+ import { TEMPLATE_TYPE } from '../constants'
12
+ import { DateTimeConverter } from '../utils/datetime-util'
13
+
14
+ const REPORT_API_URL = config.get('reportApiUrl', 'http://localhost:8888/rest/report/show_html')
15
+
16
+ export async function renderInvoices({ req, timezoneOffSet }, context: any) {
17
+ try {
18
+ const domain: Domain = await getRepository(Domain).findOne({
19
+ where: { id: context.state.domain.id }
20
+ })
21
+
22
+ let result = await Promise.all(
23
+ req.roIds.map(async roId => {
24
+ try {
25
+ const foundReleaseGoods: ReleaseGood = await getRepository(ReleaseGood).findOne({
26
+ where: { domain, id: roId },
27
+ relations: ['domain', 'bizplace', 'bizplace.domain', 'bizplace.company', 'bizplace.company.domain']
28
+ })
29
+
30
+ if (foundReleaseGoods) {
31
+ const foundInvoice: Invoice = await getRepository(Invoice).findOne({
32
+ where: { releaseGood: foundReleaseGoods },
33
+ relations: ['invoiceProducts', 'invoiceProducts.product', 'domain', 'creator', 'updater']
34
+ })
35
+
36
+ const partnerBiz: Bizplace = foundReleaseGoods.bizplace
37
+
38
+ const partnerCompanyDomain: Domain = foundReleaseGoods.bizplace.company.domain
39
+
40
+ const foundTemplate: Attachment = await getRepository(Attachment).findOne({
41
+ where: { domain: partnerCompanyDomain, category: TEMPLATE_TYPE.INVOICE_TEMPLATE }
42
+ })
43
+
44
+ const template = await STORAGE.readFile(foundTemplate.path, 'utf-8')
45
+
46
+ let fullBillingAddress = [
47
+ foundInvoice.billingAddress1,
48
+ foundInvoice.billingAddress2,
49
+ foundInvoice.billingAddress3,
50
+ foundInvoice.billingAddress4,
51
+ foundInvoice.billingAddress5
52
+ ]
53
+
54
+ let fullDeliveryAddress = [
55
+ foundInvoice.deliveryAddress1,
56
+ foundInvoice.deliveryAddress2,
57
+ foundInvoice.deliveryAddress3,
58
+ foundInvoice.deliveryAddress4,
59
+ foundInvoice.deliveryAddress5
60
+ ]
61
+
62
+ let date = DateTimeConverter.date(
63
+ new Date((foundInvoice.issuedOn || foundInvoice.createdAt) - timezoneOffSet)
64
+ )
65
+ const data = {
66
+ order_no: foundReleaseGoods.name,
67
+ ref_no: foundReleaseGoods.refNo,
68
+ deliver_to: foundInvoice.deliverTo,
69
+ deliver_to_phone: foundInvoice.deliverToPhone || '',
70
+ bill_to: foundInvoice.billTo,
71
+ bill_to_phone: foundInvoice.billToPhone || '',
72
+ customer_address: partnerBiz.address,
73
+ delivery_date: date,
74
+ store_name: foundInvoice.from,
75
+ billing_address_1: foundInvoice.billingAddress1,
76
+ billing_address_2: foundInvoice.billingAddress2,
77
+ billing_address_3: foundInvoice.billingAddress3,
78
+ billing_address_4: foundInvoice.billingAddress4,
79
+ billing_address_5: foundInvoice.billingAddress5,
80
+ billing_postcode: foundInvoice.billingPostcode,
81
+ billing_city: foundInvoice.billingCity,
82
+ billing_state: foundInvoice.billingState,
83
+ billing_country: foundInvoice.billingCountry,
84
+ full_billing_address: fullBillingAddress
85
+ .reduce((acc, itm) => {
86
+ if (itm && itm.trim() != '') {
87
+ acc.push(itm)
88
+ }
89
+
90
+ return acc
91
+ }, [])
92
+ .join(' '),
93
+ delivery_address_1: foundInvoice.deliveryAddress1,
94
+ delivery_address_2: foundInvoice.deliveryAddress2,
95
+ delivery_address_3: foundInvoice.deliveryAddress3,
96
+ delivery_address_4: foundInvoice.deliveryAddress4,
97
+ delivery_address_5: foundInvoice.deliveryAddress5,
98
+ delivery_postcode: foundInvoice.deliveryPostcode,
99
+ delivery_city: foundInvoice.deliveryCity,
100
+ delivery_state: foundInvoice.deliveryState,
101
+ delivery_country: foundInvoice.deliveryCountry,
102
+ full_delivery_address: fullDeliveryAddress
103
+ .reduce((acc, itm) => {
104
+ if (itm && itm.trim() != '') {
105
+ acc.push(itm)
106
+ }
107
+
108
+ return acc
109
+ }, [])
110
+ .join(' '),
111
+ product_list: foundInvoice.invoiceProducts.map((item, idx) => {
112
+ return {
113
+ list_no: idx + 1,
114
+ product_sku: item.sku,
115
+ product_name: item.name,
116
+ product_desc: item.description,
117
+ product_qty: item.qty,
118
+ product_other_charges: item.otherCharges,
119
+ product_paid_price: parseFloat(item.paidPrice || item.unitPrice).toFixed(2),
120
+ product_unit_price: parseFloat(item.unitPrice).toFixed(2),
121
+ product_total_paid_price: (
122
+ parseFloat(item.paidPrice || item.unitPrice) * parseFloat(item.qty)
123
+ ).toFixed(2),
124
+ product_total_unit_price: (parseFloat(item.unitPrice) * parseFloat(item.qty)).toFixed(2)
125
+ }
126
+ })
127
+ }
128
+
129
+ const formData = new FormData()
130
+ formData.append('template', template)
131
+ formData.append('jsonString', JSON.stringify(data))
132
+
133
+ const response = await fetch(REPORT_API_URL, {
134
+ method: 'POST',
135
+ body: formData
136
+ })
137
+
138
+ return await response.text()
139
+ }
140
+ return ''
141
+ } catch (ex) {
142
+ return ''
143
+ }
144
+ })
145
+ )
146
+
147
+ if (result.length <= 0) {
148
+ throw Error('No invoice found!')
149
+ }
150
+ return result.join()
151
+ } catch (ex) {
152
+ throw ex
153
+ }
154
+ }
@@ -143,6 +143,7 @@ export async function renderRODO({ doNo }, context: any) {
143
143
  product_type: inventory.packingType,
144
144
  product_size: matchedProductDetail ? matchedProductDetail.packingSize : inventory.packingSize,
145
145
  product_batch: inventory.batchId,
146
+ product_batch_ref: inventory.batchIdRef,
146
147
  product_qty: targetInventory.releaseQty,
147
148
  product_weight: targetInventory.releaseWeight,
148
149
  product_gross_weight: inventory.product.grossWeight,
@@ -159,6 +160,7 @@ export async function renderRODO({ doNo }, context: any) {
159
160
  newItem =>
160
161
  newItem.product_name === item.product_name &&
161
162
  newItem.product_batch === item.product_batch &&
163
+ newItem.product_batch_ref === item.product_batch_ref &&
162
164
  newItem.cross_docking === item.cross_docking &&
163
165
  newItem.pallet === item.pallet
164
166
  )
@@ -169,6 +171,7 @@ export async function renderRODO({ doNo }, context: any) {
169
171
  product_type: item.product_type,
170
172
  product_size: item.product_size,
171
173
  product_batch: item.product_batch,
174
+ product_batch_ref: item.product_batch_ref,
172
175
  product_qty: item.product_qty,
173
176
  product_weight: item.product_weight,
174
177
  product_gross_weight: item.product_gross_weight,
@@ -190,6 +193,7 @@ export async function renderRODO({ doNo }, context: any) {
190
193
  if (
191
194
  ni.product_name === item.product_name &&
192
195
  ni.product_batch === item.product_batch &&
196
+ ni.product_batch_ref === item.product_batch_ref &&
193
197
  ni.cross_docking === item.cross_docking &&
194
198
  ni.pallet === item.pallet
195
199
  ) {
@@ -268,7 +272,8 @@ export async function renderRODO({ doNo }, context: any) {
268
272
  : prod.pallet === ''
269
273
  ? `${prod.palletQty} PALLET(S)`
270
274
  : `${prod.palletQty} PALLET(S) (${prod.pallet})`,
271
- inventory_remark: prod?.inventory_remark ? prod.inventory_remark : ''
275
+ inventory_remark: prod?.inventory_remark ? prod.inventory_remark : '',
276
+ batch_id_ref: prod.product_batch_ref
272
277
  }
273
278
  })
274
279
  } //.. make data from do
@@ -1,17 +1,22 @@
1
- import { Domain } from '@things-factory/shell'
2
- import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../../../constants'
3
1
  import { EntityManager, SelectQueryBuilder } from 'typeorm'
4
- import { Worksheet as WorksheetEntity, WorksheetDetail as WorksheetDetailEntity } from '../../../entities'
2
+
5
3
  import {
6
- ReleaseGood as ReleaseGoodEntity,
4
+ ORDER_STATUS,
7
5
  OrderInventory as OrderInventoryEntity,
8
- ORDER_STATUS
6
+ ReleaseGood as ReleaseGoodEntity
9
7
  } from '@things-factory/sales-base'
8
+ import { Domain } from '@things-factory/shell'
9
+
10
+ import { WORKSHEET_STATUS, WORKSHEET_TYPE } from '../../../constants'
11
+ import { Worksheet as WorksheetEntity, WorksheetDetail as WorksheetDetailEntity } from '../../../entities'
10
12
 
11
13
  export const findReleaseOrdersByTaskNoResolver = {
12
14
  async findReleaseOrdersByTaskNo(_: any, { taskNo }, context: any) {
13
15
  const { domain, tx }: { domain: Domain; tx: EntityManager } = context.state
14
- if (!taskNo) throw new Error('Unable to find task no.')
16
+ let task = await tx.getRepository(WorksheetEntity).findOne({
17
+ where: { taskNo, status: WORKSHEET_STATUS.EXECUTING, type: WORKSHEET_TYPE.SORTING }
18
+ })
19
+ if (!task) throw new Error('Unable to find task no.')
15
20
 
16
21
  const qb: SelectQueryBuilder<WorksheetEntity> = tx
17
22
  .getRepository(WorksheetEntity)
@@ -125,7 +125,7 @@ export const inventoriesByPalletResolver = {
125
125
 
126
126
  async function getRemainAmount(inventory: Inventory): Promise<{ remainQty: number; remainUomValue: number }> {
127
127
  return {
128
- remainQty: inventory.qty - inventory.lockedQty,
129
- remainUomValue: inventory.uomValue - inventory.lockedUomValue
128
+ remainQty: inventory.qty - (inventory.lockedQty || 0),
129
+ remainUomValue: inventory.uomValue - (inventory.lockedUomValue || 0)
130
130
  }
131
131
  }
@@ -64,7 +64,18 @@ export async function completeBatchPicking(
64
64
  await Promise.all(
65
65
  uniqueReleaseGoods.map(async releaseGood => {
66
66
  const sellercraftCtrl: SellercraftController = new SellercraftController(tx, domain, user)
67
- await sellercraftCtrl.initiateOrderDocument(sellercraft, releaseGood)
67
+
68
+ let foundReleaseGood: ReleaseGood = await tx.getRepository(ReleaseGood).findOne({
69
+ where: { id: releaseGood.id },
70
+ relations: ['orderProducts', 'orderProducts.product', 'orderProducts.product.productDetails']
71
+ })
72
+
73
+ if (!foundReleaseGood?.packageId) {
74
+ foundReleaseGood = await sellercraftCtrl.packOrder(sellercraft, foundReleaseGood)
75
+ }
76
+
77
+ foundReleaseGood = await sellercraftCtrl.initiateOrderShipment(sellercraft, foundReleaseGood)
78
+ await sellercraftCtrl.initiateOrderDocument(sellercraft, foundReleaseGood)
68
79
  })
69
80
  )
70
81
  }