@things-factory/worksheet-base 4.3.24 → 4.3.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/worksheet-base",
3
- "version": "4.3.24",
3
+ "version": "4.3.25",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -29,16 +29,16 @@
29
29
  "@things-factory/document-template-base": "^4.3.23",
30
30
  "@things-factory/id-rule-base": "^4.3.24",
31
31
  "@things-factory/integration-lmd": "^4.3.24",
32
- "@things-factory/integration-marketplace": "^4.3.24",
33
- "@things-factory/integration-sellercraft": "^4.3.24",
34
- "@things-factory/integration-sftp": "^4.3.24",
35
- "@things-factory/marketplace-base": "^4.3.24",
32
+ "@things-factory/integration-marketplace": "^4.3.25",
33
+ "@things-factory/integration-sellercraft": "^4.3.25",
34
+ "@things-factory/integration-sftp": "^4.3.25",
35
+ "@things-factory/marketplace-base": "^4.3.25",
36
36
  "@things-factory/notification": "^4.3.24",
37
- "@things-factory/sales-base": "^4.3.24",
37
+ "@things-factory/sales-base": "^4.3.25",
38
38
  "@things-factory/setting-base": "^4.3.24",
39
39
  "@things-factory/shell": "^4.3.23",
40
40
  "@things-factory/transport-base": "^4.3.24",
41
- "@things-factory/warehouse-base": "^4.3.24"
41
+ "@things-factory/warehouse-base": "^4.3.25"
42
42
  },
43
- "gitHead": "43ba20d3476c8604e94f6a6b0bd7e84b6ec1bfd8"
43
+ "gitHead": "bdcecd8454d7a76df3c5676a39440d57bc21d5cb"
44
44
  }
@@ -71,6 +71,7 @@ export async function renderGRN({ grnNo, timezoneOffSet }, context: any) {
71
71
  .addGroupBy('batch_id')
72
72
  .addGroupBy('packing_type')
73
73
  .addGroupBy('uom')
74
+ .addGroupBy('expiration_date')
74
75
  .getRawMany()
75
76
 
76
77
  // 5. find domain contact point
@@ -168,11 +169,9 @@ export async function renderGRN({ grnNo, timezoneOffSet }, context: any) {
168
169
  })
169
170
 
170
171
  tempIndexArr.forEach((t, index) => {
171
- if (t >= 0)
172
- foundInventoryItem[t].totalQuantity = tempTotalQuantity[index]
172
+ if (t >= 0) foundInventoryItem[t].totalQuantity = tempTotalQuantity[index]
173
173
  })
174
174
 
175
-
176
175
  const data = {
177
176
  logo_url: logo,
178
177
  sign_url: signature,
@@ -208,40 +207,50 @@ export async function renderGRN({ grnNo, timezoneOffSet }, context: any) {
208
207
  account_no: foundPartnerCP ? foundPartnerCP.accountNo : '',
209
208
  unloaded_by: foundWS ? foundWS.updater.name : '',
210
209
  putaway_by: foundPutawayWS ? foundPutawayWS.updater.name : '',
211
- product_list: targetProducts.map((item, idx) => {
212
- let unloadInvHistory = inboundInventories.find(
213
- ih =>
214
- ih.productId == item.product.id &&
215
- ih.batchId == item.batchId &&
216
- ih.packingType == item.packingType &&
217
- ih.uom == item.uom
218
- )
219
-
220
- return {
221
- list_no: idx + 1,
222
- product_sku: `${item.product.sku}`,
223
- product_brand_sku: `${item.product.brandSku}`,
224
- product_name: `${item.product.name}(${item.product.description})`,
225
- product_desc: item.product.description,
226
- product_nameOnly: item.product.name,
227
- product_type: item.packingType,
228
- product_size: item.packingSize,
229
- product_batch: item.batchId,
230
- batch_id_ref: item?.batchIdRef ? item.batchIdRef : '',
231
- pallet_qty: item.actualPalletQty,
232
- product_qty: unloadInvHistory.qty || item.actualPackQty,
233
- product_unit_uom_value: `${Math.round(item.uomValue * 100) / 100}`,
234
- product_total_uom_value: `${Math.round((unloadInvHistory.uomValue || item.uomValue * item.actualPackQty) * 100) / 100
235
- }`,
236
- product_uom: `${unloadInvHistory.uom || item.uom}`,
237
- product_gross_weight: item.product.grossWeight || null,
238
- unit_price: item.unitPrice || null,
239
- expiry_date: unloadInvHistory.expiryDate || '',
240
- manufacture_date: item.manufactureDate,
241
- reusable_pallet_id: unloadInvHistory.reusablePalletId || '',
242
- remark: (item.remark ? item.remark : '') + (item.issue ? ' [Issue]: ' + item.issue : '')
243
- }
244
- }),
210
+ product_list: targetProducts
211
+ .reduce((acc, item) => {
212
+ acc.push(
213
+ ...inboundInventories
214
+ .filter(
215
+ ih =>
216
+ ih.productId == item.product.id &&
217
+ ih.batchId == item.batchId &&
218
+ ih.packingType == item.packingType &&
219
+ ih.uom == item.uom
220
+ )
221
+ .map(unloadInvHistory => {
222
+ return {
223
+ product_sku: `${item.product.sku}`,
224
+ product_brand_sku: `${item.product.brandSku}`,
225
+ product_name: `${item.product.name}(${item.product.description})`,
226
+ product_desc: item.product.description,
227
+ product_nameOnly: item.product.name,
228
+ product_type: item.packingType,
229
+ product_size: item.packingSize,
230
+ product_batch: item.batchId,
231
+ batch_id_ref: item?.batchIdRef ? item.batchIdRef : '',
232
+ pallet_qty: item.actualPalletQty,
233
+ product_qty: unloadInvHistory.qty || item.actualPackQty,
234
+ product_unit_uom_value: `${Math.round(item.uomValue * 100) / 100}`,
235
+ product_total_uom_value: `${
236
+ Math.round((unloadInvHistory.uomValue || item.uomValue * item.actualPackQty) * 100) / 100
237
+ }`,
238
+ product_uom: `${unloadInvHistory.uom || item.uom}`,
239
+ product_gross_weight: item.product.grossWeight || null,
240
+ unit_price: item.unitPrice || null,
241
+ expiry_date:
242
+ unloadInvHistory.expiryDate && unloadInvHistory.expiryDate != ''
243
+ ? new Date(unloadInvHistory.expiryDate).toISOString().split('T')[0]
244
+ : '',
245
+ manufacture_date: item.manufactureDate,
246
+ reusable_pallet_id: unloadInvHistory.reusablePalletId || '',
247
+ remark: (item.remark ? item.remark : '') + (item.issue ? ' [Issue]: ' + item.issue : '')
248
+ }
249
+ })
250
+ )
251
+ return acc
252
+ }, [])
253
+ .map((item, idx) => ({ list_no: idx + 1, ...item })),
245
254
  serialNumber: foundInventoryItem
246
255
  }
247
256