@things-factory/operato-wms 4.3.107 → 4.3.108

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 (65) hide show
  1. package/client/pages/bulk-operation/bulk-operation.js +9 -15
  2. package/client/pages/components/select-inventory-popup.js +7 -1
  3. package/client/pages/components/select-product-popup.js +31 -2
  4. package/client/pages/inbound/undo-putaway-popup.js +5 -9
  5. package/client/pages/inbound/undo-unload-popup.js +15 -2
  6. package/client/pages/inbound/unload-product.js +72 -67
  7. package/client/pages/inventory/inventory-adjustment-approval.js +4 -5
  8. package/client/pages/inventory/inventory-adjustment.js +9 -2
  9. package/client/pages/inventory/inventory-by-product-detail.js +13 -13
  10. package/client/pages/inventory-check/check-inventory-popup.js +14 -3
  11. package/client/pages/inventory-check/create-cycle-count.js +2 -3
  12. package/client/pages/inventory-check/inspecting-product.js +25 -7
  13. package/client/pages/inventory-check/inventory-check-list.js +94 -10
  14. package/client/pages/manifest/loading-manifest-detail.js +7 -4
  15. package/client/pages/master/generate-location-list.js +30 -22
  16. package/client/pages/master/location-list.js +134 -71
  17. package/client/pages/master/pallet-list.js +137 -58
  18. package/client/pages/master/product/product-details-popup.js +3 -3
  19. package/client/pages/master/tote-list.js +40 -27
  20. package/client/pages/master/transport-driver.js +50 -41
  21. package/client/pages/master/transport-vehicle.js +45 -41
  22. package/client/pages/master/warehouse-list.js +56 -34
  23. package/client/pages/order/arrival-notice/arrival-notice-detail.js +36 -25
  24. package/client/pages/order/arrival-notice/create-arrival-notice.js +53 -32
  25. package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +2 -0
  26. package/client/pages/order/arrival-notice/edit-product-popup.js +9 -7
  27. package/client/pages/order/draft-release-good/draft-release-good-detail.js +79 -4
  28. package/client/pages/order/release-order/create-release-order.js +22 -5
  29. package/client/pages/order/release-order/release-extra-product-popup.js +4 -1
  30. package/client/pages/order/release-order/release-order-detail.js +24 -0
  31. package/client/pages/order/return-order/create-return-order.js +5 -0
  32. package/client/pages/order/return-order/return-order-inventory-popup.js +1 -0
  33. package/client/pages/order/transport-order/delivery-order-list.js +26 -0
  34. package/client/pages/outbound/inventory-reassign-popup.js +6 -0
  35. package/client/pages/outbound/packing-product.js +5 -5
  36. package/client/pages/outbound/packing-worksheet-list.js +3 -1
  37. package/client/pages/outbound/picking-product.js +18 -7
  38. package/client/pages/outbound/show-my-worksheet-list-popup.js +12 -3
  39. package/client/pages/report/custom-elccl/elccl-daily-collection-report.js +5 -2
  40. package/client/pages/report/custom-elccl/elccl-daily-order-inventory-report.js +2 -2
  41. package/client/pages/report/custom-elccl/elccl-delivery-order-summary.js +48 -8
  42. package/client/pages/report/custom-elccl/elccl-inventory-pallet-detail-report.js +42 -4
  43. package/client/pages/vas/print-product-label.js +9 -11
  44. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js +6 -5
  45. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js.map +1 -1
  46. package/dist-server/graphql/resolvers/other/add-release-good-products.js +7 -11
  47. package/dist-server/graphql/resolvers/other/add-release-good-products.js.map +1 -1
  48. package/dist-server/graphql/resolvers/reports/costing-report.js +18 -24
  49. package/dist-server/graphql/resolvers/reports/costing-report.js.map +1 -1
  50. package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js +6 -6
  51. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +5 -6
  52. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
  53. package/dist-server/graphql/resolvers/reports/release-inventory-report.js +3 -3
  54. package/dist-server/graphql/resolvers/reports/release-inventory-report.js.map +1 -1
  55. package/package.json +50 -50
  56. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.ts +6 -5
  57. package/server/graphql/resolvers/other/add-release-good-products.ts +8 -12
  58. package/server/graphql/resolvers/reports/costing-report.ts +18 -24
  59. package/server/graphql/resolvers/reports/inbound-order-details-report.ts +6 -6
  60. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +5 -6
  61. package/server/graphql/resolvers/reports/release-inventory-report.ts +6 -4
  62. package/translations/en.json +43 -13
  63. package/translations/ko.json +33 -11
  64. package/translations/ms.json +33 -11
  65. package/translations/zh.json +26 -4
@@ -10,6 +10,7 @@ import { openPopup } from '@things-factory/layout-base'
10
10
  import { client, CustomAlert, PageView } from '@things-factory/shell'
11
11
  import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
12
12
  import { isMobileDevice } from '@things-factory/utils'
13
+ import { showToast } from '../../util/index'
13
14
 
14
15
  class TransportVehicle extends localize(i18next)(PageView) {
15
16
  static get styles() {
@@ -114,6 +115,7 @@ class TransportVehicle extends localize(i18next)(PageView) {
114
115
  list: {
115
116
  fields: ['name', 'description', 'updatedAt']
116
117
  },
118
+ pagination: { limit: 50, pages: [50, 100, 200, 500] },
117
119
  columns: [
118
120
  { type: 'gutter', gutterName: 'dirty' },
119
121
  { type: 'gutter', gutterName: 'sequence' },
@@ -121,7 +123,7 @@ class TransportVehicle extends localize(i18next)(PageView) {
121
123
  {
122
124
  type: 'string',
123
125
  name: 'name',
124
- header: i18next.t('field.name'),
126
+ header: i18next.t('field.reg_number'),
125
127
  record: { editable: true },
126
128
  imex: { header: i18next.t('field.name'), key: 'name', width: 50, type: 'string' },
127
129
  sortable: true,
@@ -239,47 +241,60 @@ class TransportVehicle extends localize(i18next)(PageView) {
239
241
  }
240
242
 
241
243
  async importHandler(patches) {
242
- const response = await client.mutate({
243
- mutation: gql`
244
- mutation updateMultipleTransportVehicle($patches: [TransportVehiclePatch!]!) {
245
- updateMultipleTransportVehicle(patches: $patches) {
246
- name
247
- }
248
- }
249
- `,
250
- variables: { patches }
251
- })
244
+ try {
245
+ if (patches.some(p => (!p.name || !p.size || !p.status) && p.cuFlag == '+'))
246
+ throw new Error(i18next.t('text.empty_value_in_list'))
252
247
 
253
- if (!response.errors) {
254
- history.back()
255
- this.dataGrist.fetch()
256
- this._showToast({ message: i18next.t('text.data_imported_successfully') })
257
- }
258
- }
259
-
260
- async _saveTransportVehicle() {
261
- let patches = this.dataGrist.exportPatchList({ flagName: 'cuFlag' })
262
- if (!patches?.length) {
263
- CustomAlert({
264
- title: i18next.t('text.nothing_changed'),
265
- text: i18next.t('text.there_is_nothing_to_save')
248
+ patches = patches.map(p => {
249
+ return { ...p, cuFlag: '' }
266
250
  })
267
- } else {
268
251
  const response = await client.mutate({
269
252
  mutation: gql`
270
253
  mutation updateMultipleTransportVehicle($patches: [TransportVehiclePatch!]!) {
271
- updateMultipleTransportVehicle(patches: $patches) {
272
- name
273
- }
254
+ updateMultipleTransportVehicle(patches: $patches)
274
255
  }
275
256
  `,
276
257
  variables: { patches }
277
258
  })
278
259
 
279
260
  if (!response.errors) {
261
+ history.back()
280
262
  this.dataGrist.fetch()
281
- this._showToast({ message: i18next.t('text.data_updated_successfully') })
263
+ showToast({ message: i18next.t('text.data_imported_successfully') })
282
264
  }
265
+ } catch (e) {
266
+ showToast(e)
267
+ }
268
+ }
269
+
270
+ async _saveTransportVehicle() {
271
+ try {
272
+ let patches = this.dataGrist.exportPatchList({ flagName: 'cuFlag' })
273
+ if (!patches?.length) {
274
+ CustomAlert({
275
+ title: i18next.t('text.nothing_changed'),
276
+ text: i18next.t('text.there_is_nothing_to_save')
277
+ })
278
+ } else {
279
+ if (patches.some(p => (!p.name || !p.size || !p.status) && p.cuFlag == '+'))
280
+ throw new Error(i18next.t('text.empty_value_in_list'))
281
+
282
+ const response = await client.mutate({
283
+ mutation: gql`
284
+ mutation updateMultipleTransportVehicle($patches: [TransportVehiclePatch!]!) {
285
+ updateMultipleTransportVehicle(patches: $patches)
286
+ }
287
+ `,
288
+ variables: { patches }
289
+ })
290
+
291
+ if (!response.errors) {
292
+ this.dataGrist.fetch()
293
+ showToast({ message: i18next.t('text.data_updated_successfully') })
294
+ }
295
+ }
296
+ } catch (e) {
297
+ showToast(e)
283
298
  }
284
299
  }
285
300
 
@@ -312,7 +327,7 @@ class TransportVehicle extends localize(i18next)(PageView) {
312
327
 
313
328
  if (!response.errors) {
314
329
  this.dataGrist.fetch()
315
- this._showToast({ message: i18next.t('text.data_deleted_successfully') })
330
+ showToast({ message: i18next.t('text.data_deleted_successfully') })
316
331
  }
317
332
  }
318
333
  }
@@ -351,17 +366,6 @@ class TransportVehicle extends localize(i18next)(PageView) {
351
366
 
352
367
  return { header: headerSetting, data: data }
353
368
  }
354
-
355
- _showToast({ type, message }) {
356
- document.dispatchEvent(
357
- new CustomEvent('notify', {
358
- detail: {
359
- type,
360
- message
361
- }
362
- })
363
- )
364
- }
365
369
  }
366
370
 
367
371
  window.customElements.define('transport-vehicle', TransportVehicle)
@@ -9,6 +9,7 @@ import { ScrollbarStyles, CommonButtonStyles } from '@things-factory/styles'
9
9
  import { isMobileDevice } from '@things-factory/utils'
10
10
  import gql from 'graphql-tag'
11
11
  import { css, html } from 'lit-element'
12
+ import { showToast } from '../../util'
12
13
 
13
14
  class WarehouseList extends localize(i18next)(PageView) {
14
15
  static get styles() {
@@ -264,41 +265,14 @@ class WarehouseList extends localize(i18next)(PageView) {
264
265
  }
265
266
 
266
267
  async importHandler(patches) {
267
- const response = await client.query({
268
- query: gql`
269
- mutation updateMultipleWarehouse($patches: [WarehousePatch!]!) {
270
- updateMultipleWarehouse(patches: $patches) {
271
- name
272
- }
273
- }
274
- `,
275
- variables: {
276
- patches
268
+ try {
269
+ if (patches.some(p => (!p.name || !p.type) && p.cuFlag == '+')) {
270
+ throw new Error(i18next.t('text.empty_value_in_list'))
277
271
  }
278
- })
279
-
280
- if (!response.errors) {
281
- history.back()
282
- this.dataGrist.fetch()
283
- document.dispatchEvent(
284
- new CustomEvent('notify', {
285
- detail: {
286
- message: i18next.t('text.data_imported_successfully')
287
- }
288
- })
289
- )
290
- }
291
- }
292
-
293
- async _saveWarehouse() {
294
- let patches = this.dataGrist.exportPatchList({ flagName: 'cuFlag' })
295
- if (patches && patches.length) {
296
- const response = await client.mutate({
297
- mutation: gql`
272
+ const response = await client.query({
273
+ query: gql`
298
274
  mutation updateMultipleWarehouse($patches: [WarehousePatch!]!) {
299
- updateMultipleWarehouse(patches: $patches) {
300
- name
301
- }
275
+ updateMultipleWarehouse(patches: $patches)
302
276
  }
303
277
  `,
304
278
  variables: {
@@ -307,15 +281,58 @@ class WarehouseList extends localize(i18next)(PageView) {
307
281
  })
308
282
 
309
283
  if (!response.errors) {
284
+ history.back()
310
285
  this.dataGrist.fetch()
311
286
  document.dispatchEvent(
312
287
  new CustomEvent('notify', {
313
288
  detail: {
314
- message: i18next.t('text.data_updated_successfully')
289
+ message: i18next.t('text.data_imported_successfully')
315
290
  }
316
291
  })
317
292
  )
318
293
  }
294
+ } catch (e) {
295
+ showToast(e)
296
+ }
297
+ }
298
+
299
+ async _saveWarehouse() {
300
+ try {
301
+ let patches = this.dataGrist.exportPatchList({ flagName: 'cuFlag' })
302
+ if (patches.some(p => (!p.name || !p.type) && p.cuFlag == '+')) {
303
+ throw new Error(i18next.t('text.empty_value_in_list'))
304
+ }
305
+
306
+ if (!patches?.length) {
307
+ CustomAlert({
308
+ title: i18next.t('text.nothing_changed'),
309
+ text: i18next.t('text.there_is_nothing_to_save')
310
+ })
311
+ } else {
312
+ const response = await client.mutate({
313
+ mutation: gql`
314
+ mutation updateMultipleWarehouse($patches: [WarehousePatch!]!) {
315
+ updateMultipleWarehouse(patches: $patches)
316
+ }
317
+ `,
318
+ variables: {
319
+ patches
320
+ }
321
+ })
322
+
323
+ if (!response.errors) {
324
+ this.dataGrist.fetch()
325
+ document.dispatchEvent(
326
+ new CustomEvent('notify', {
327
+ detail: {
328
+ message: i18next.t('text.data_updated_successfully')
329
+ }
330
+ })
331
+ )
332
+ }
333
+ }
334
+ } catch (e) {
335
+ showToast(e)
319
336
  }
320
337
  }
321
338
 
@@ -349,6 +366,11 @@ class WarehouseList extends localize(i18next)(PageView) {
349
366
  })
350
367
  )
351
368
  }
369
+ } else {
370
+ CustomAlert({
371
+ title: i18next.t('text.nothing_selected'),
372
+ text: i18next.t('text.there_is_nothing_to_delete')
373
+ })
352
374
  }
353
375
  }
354
376
  }
@@ -7,6 +7,7 @@ import '../../inbound/pallet-label-popup'
7
7
  import './edit-product-popup'
8
8
  import './proceed-edit-product-popup'
9
9
  import './view-product-changes-popup'
10
+ import { BufferLocationSelector } from '@things-factory/warehouse-ui'
10
11
 
11
12
  import gql from 'graphql-tag'
12
13
  import { css, html } from 'lit-element'
@@ -19,7 +20,6 @@ import { openPopup } from '@things-factory/layout-base'
19
20
  import { client, CustomAlert, navigate, PageView } from '@things-factory/shell'
20
21
  import { CommonButtonStyles } from '@things-factory/styles'
21
22
  import { isMobileDevice } from '@things-factory/utils'
22
- import { BufferLocationSelector } from '@things-factory/warehouse-ui'
23
23
  import { fetchSettingRule } from '../../../fetch-setting-value'
24
24
 
25
25
  import {
@@ -929,6 +929,9 @@ class ArrivalNoticeDetail extends localize(i18next)(PageView) {
929
929
  sku
930
930
  brand
931
931
  }
932
+ productDetail {
933
+ id
934
+ }
932
935
  remark
933
936
  unitPrice
934
937
  adjustedUnitPrice
@@ -1080,37 +1083,45 @@ class ArrivalNoticeDetail extends localize(i18next)(PageView) {
1080
1083
  }
1081
1084
 
1082
1085
  async _updateArrivalNotice() {
1083
- const arrivalNoticeInfo = this._getFormInfo()
1086
+ try {
1087
+ const arrivalNoticeInfo = this._getFormInfo()
1084
1088
 
1085
- arrivalNoticeInfo.name = this._ganNo
1086
- delete arrivalNoticeInfo.bizplaceName
1089
+ if (arrivalNoticeInfo.container) {
1090
+ if (!arrivalNoticeInfo.containerNo || arrivalNoticeInfo?.containerNo == '')
1091
+ throw new Error(i18next.t('text.container_no_is_empty'))
1087
1092
 
1088
- if (!arrivalNoticeInfo.container) {
1089
- arrivalNoticeInfo.containerNo = ''
1090
- arrivalNoticeInfo.containerSize = ''
1091
- } else if (arrivalNoticeInfo.warehouseTransport) {
1092
- arrivalNoticeInfo.deliveryOrderNo = ''
1093
- arrivalNoticeInfo.truckNo = ''
1094
- }
1093
+ if (!arrivalNoticeInfo.containerSize || this.arrivalNoticeForm?.containerSize == '')
1094
+ throw new Error(i18next.t('text.please_select_container_size'))
1095
+ }
1095
1096
 
1096
- delete arrivalNoticeInfo.warehouseTransport
1097
- delete arrivalNoticeInfo['buffer-location']
1097
+ arrivalNoticeInfo.name = this._ganNo
1098
+ delete arrivalNoticeInfo.bizplaceName
1098
1099
 
1099
- if (this._warehouseTransport) {
1100
- arrivalNoticeInfo.truckNo = ''
1101
- arrivalNoticeInfo.deliveryOrderNo = ''
1102
- }
1100
+ if (!arrivalNoticeInfo.container) {
1101
+ arrivalNoticeInfo.containerNo = ''
1102
+ arrivalNoticeInfo.containerSize = ''
1103
+ } else if (arrivalNoticeInfo.warehouseTransport) {
1104
+ arrivalNoticeInfo.deliveryOrderNo = ''
1105
+ arrivalNoticeInfo.truckNo = ''
1106
+ }
1103
1107
 
1104
- const result = await CustomAlert({
1105
- title: i18next.t('title.are_you_sure'),
1106
- text: i18next.t('text.update_arrival_notice_details'),
1107
- confirmButton: { text: i18next.t('button.submit') },
1108
- cancelButton: { text: i18next.t('button.cancel') }
1109
- })
1108
+ delete arrivalNoticeInfo.warehouseTransport
1109
+ delete arrivalNoticeInfo['buffer-location']
1110
1110
 
1111
- if (!result.value) return
1111
+ if (this._warehouseTransport) {
1112
+ arrivalNoticeInfo.truckNo = ''
1113
+ arrivalNoticeInfo.deliveryOrderNo = ''
1114
+ }
1115
+
1116
+ const result = await CustomAlert({
1117
+ title: i18next.t('title.are_you_sure'),
1118
+ text: i18next.t('text.update_arrival_notice_details'),
1119
+ confirmButton: { text: i18next.t('button.submit') },
1120
+ cancelButton: { text: i18next.t('button.cancel') }
1121
+ })
1122
+
1123
+ if (!result.value) return
1112
1124
 
1113
- try {
1114
1125
  const response = await client.mutate({
1115
1126
  mutation: gql`
1116
1127
  mutation updateArrivalNoticeDetails($arrivalNotice: ArrivalNoticePatch!) {
@@ -872,7 +872,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
872
872
 
873
873
  if (changedColumn === 'unitPrice') {
874
874
  let unitPrice = changeRecord.unitPrice
875
- if (typeof unitPrice === undefined || unitPrice < 0) {
875
+ if (typeof unitPrice === undefined || unitPrice < 0 || isNaN(unitPrice)) {
876
876
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.unit_price') } }))
877
877
  }
878
878
  }
@@ -1210,7 +1210,12 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1210
1210
  _validateForm() {
1211
1211
  if (!this.arrivalNoticeForm.checkValidity()) throw new Error(i18next.t('text.arrival_notice_form_invalid'))
1212
1212
 
1213
- if (this._hasContainer) if (!this.containerNo.value) throw new Error(i18next.t('text.container_no_is_empty'))
1213
+ if (this._hasContainer) {
1214
+ if (!this.containerNo.value) throw new Error(i18next.t('text.container_no_is_empty'))
1215
+
1216
+ if (!this.arrivalNoticeForm?.containerSize?.value || this.arrivalNoticeForm?.containerSize?.value == '')
1217
+ throw new Error(i18next.t('text.please_select_container_size'))
1218
+ }
1214
1219
 
1215
1220
  if (this._ownTransport && this._warehouseTransport)
1216
1221
  throw new Error(i18next.t('text.you_can_only_select_one_transport_type'))
@@ -1218,9 +1223,9 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1218
1223
  throw new Error(i18next.t('text.please_select_transport_type'))
1219
1224
  }
1220
1225
 
1221
- _validateProducts() {
1226
+ _validateProducts(records = []) {
1222
1227
  // no records
1223
- const records = this.productGrist.dirtyData.records
1228
+ if (!records?.length) records = this.productGrist.dirtyData.records
1224
1229
  if (!records?.length) throw new Error(i18next.t('text.no_products'))
1225
1230
 
1226
1231
  this._checkProductDuplication()
@@ -1233,6 +1238,10 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1233
1238
  throw new Error(i18next.t('text.empty_value_in_list'))
1234
1239
  }
1235
1240
 
1241
+ if (records.some(({ unitPrice }) => unitPrice < 0)) {
1242
+ throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.unit_price') } }))
1243
+ }
1244
+
1236
1245
  if (records.some(({ packQty }) => packQty < 0)) {
1237
1246
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.pack_qty') } }))
1238
1247
  }
@@ -1352,6 +1361,7 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1352
1361
  batchId: record.batchId,
1353
1362
  batchIdRef: record?.batchIdRef ? record.batchIdRef : null,
1354
1363
  product: { id: record.product.id },
1364
+ productDetail: record?.productDetail?.id ? record.productDetail : { id: record.productDetailId },
1355
1365
  packingType: record.packingType,
1356
1366
  packingSize: record.packingSize || record.product.packingSize,
1357
1367
  uomValue: record?.uomValue ? record.uomValue : 0,
@@ -1698,6 +1708,9 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1698
1708
  primaryUnit
1699
1709
  primaryValue
1700
1710
  }
1711
+ productDetail {
1712
+ id
1713
+ }
1701
1714
  }
1702
1715
  }
1703
1716
  `,
@@ -1727,40 +1740,46 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1727
1740
  }
1728
1741
 
1729
1742
  this.productGrist.fetch()
1743
+ } else {
1744
+ throw response.errors
1730
1745
  }
1731
1746
  }
1732
1747
 
1733
1748
  async importHandler(patches) {
1734
- patches.map(itm => {
1735
- itm.unitPrice = parseFloat(itm.unitPrice) || ''
1736
- if (itm.manufactureDate) {
1737
- let mdt = new Date(itm.manufactureDate)
1738
- itm.manufactureDate =
1739
- mdt < new Date() ? `${mdt.getFullYear()}-${mdt.getMonth() + 1}-${mdt.getDate()}` || '' : ''
1740
- } else {
1741
- delete itm.manufactureDate
1742
- }
1743
- itm.uomValue = parseFloat(itm.uomValue) || ''
1744
- itm.packQty = parseFloat(itm.packQty) || ''
1745
- itm.palletQty = parseFloat(itm.palletQty) || ''
1746
- })
1747
-
1748
- this.productData = {
1749
- records: [...patches]
1750
- }
1749
+ try {
1750
+ patches.map(itm => {
1751
+ itm.unitPrice = parseFloat(itm.unitPrice) || ''
1752
+ if (itm.manufactureDate) {
1753
+ let mdt = new Date(itm.manufactureDate)
1754
+ itm.manufactureDate =
1755
+ mdt < new Date() ? `${mdt.getFullYear()}-${mdt.getMonth() + 1}-${mdt.getDate()}` || '' : ''
1756
+ } else {
1757
+ delete itm.manufactureDate
1758
+ }
1759
+ itm.uomValue = parseFloat(itm.uomValue) || ''
1760
+ itm.packQty = parseInt(itm.packQty) || ''
1761
+ itm.palletQty = parseInt(itm.palletQty) || ''
1762
+ })
1751
1763
 
1752
- const orderProducts = patches.map(patch => {
1753
- delete patch.cuFlag
1754
- return {
1755
- ...patch,
1756
- unitPrice: parseFloat(patch.unitPrice) || 0,
1757
- uomValue: parseFloat(patch.uomValue) || 0,
1758
- packQty: parseFloat(patch.packQty) || 0,
1759
- palletQty: parseFloat(patch.palletQty) || 0
1764
+ const orderProducts = patches.map(patch => {
1765
+ delete patch.cuFlag
1766
+ return {
1767
+ ...patch,
1768
+ unitPrice: parseFloat(patch.unitPrice) || 0,
1769
+ uomValue: parseFloat(patch.uomValue) || 0,
1770
+ packQty: parseInt(patch.packQty) || 0,
1771
+ palletQty: parseInt(patch.palletQty) || 0
1772
+ }
1773
+ })
1774
+ this.productData = {
1775
+ records: [...patches]
1760
1776
  }
1761
- })
1762
- await this.bulkUploadValidateOrderProducts(orderProducts)
1763
- history.back()
1777
+ await this.bulkUploadValidateOrderProducts(orderProducts)
1778
+ history.back()
1779
+ } catch (e) {
1780
+ history.back()
1781
+ return
1782
+ }
1764
1783
  }
1765
1784
 
1766
1785
  async _importableData(records) {
@@ -1774,6 +1793,8 @@ class CreateArrivalNotice extends localize(i18next)(PageView) {
1774
1793
  }
1775
1794
  })
1776
1795
 
1796
+ this._validateProducts(records)
1797
+
1777
1798
  openPopup(
1778
1799
  html`
1779
1800
  <import-pop-up
@@ -1425,6 +1425,7 @@ class DuplicateArrivalNotice extends localize(i18next)(PageView) {
1425
1425
  batchId: record.batchId,
1426
1426
  batchIdRef: record?.batchIdRef ? record.batchIdRef : null,
1427
1427
  product: { id: record.product.id },
1428
+ productDetail: { id: record.productDetailId },
1428
1429
  packingType: record.packingType,
1429
1430
  packingSize: record?.product?.packingSize ? record.product.packingSize : record.packingSize,
1430
1431
  uomValue: record?.uomValue ? record.uomValue : 0,
@@ -1480,6 +1481,7 @@ class DuplicateArrivalNotice extends localize(i18next)(PageView) {
1480
1481
  } else if (record.targetType === VAS_BATCH_AND_PRODUCT_TYPE) {
1481
1482
  result.targetBatchId = record.target.batchId
1482
1483
  result.targetProduct = { id: record.target.productId }
1484
+ result.targetProductDetail = { id: record.target.productDetailId }
1483
1485
  result.packingType = record.packingType
1484
1486
  result.qty = record.qty
1485
1487
  result.uomValue = record.uomValue
@@ -406,7 +406,7 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
406
406
  return this.shadowRoot.querySelector('data-grist#addProduct')
407
407
  }
408
408
 
409
- _onProductChangeHandler(event) {
409
+ async _onProductChangeHandler(event) {
410
410
  try {
411
411
  this._checkProductDuplication()
412
412
  let changeRecord = event.detail.after
@@ -423,9 +423,9 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
423
423
 
424
424
  const amountRelatedColumns = ['uomValue', 'uom', 'packQty']
425
425
  if (amountRelatedColumns.indexOf(changedColumn) >= 0) {
426
- const calcedAmount = this._calcAmount(changedColumn, changeRecord)
426
+ const calcedAmount = await this._calcAmount(changedColumn, changeRecord)
427
427
  for (let key in calcedAmount) {
428
- changeRecord[key] = calcedAmount[key]
428
+ changeRecord[key] = key == 'packQty' ? Math.ceil(calcedAmount[key]) : calcedAmount[key]
429
429
  }
430
430
  }
431
431
 
@@ -596,8 +596,8 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
596
596
  let existingOrderProducts = []
597
597
  let newOrderProducts = []
598
598
 
599
- existingOrderProducts = this._getExistingOrderProducts()
600
- newOrderProducts = this._getNewOrderProducts()
599
+ existingOrderProducts = await this._getExistingOrderProducts()
600
+ newOrderProducts = await this._getNewOrderProducts()
601
601
 
602
602
  if (existingOrderProducts?.length || newOrderProducts?.length) {
603
603
  const result = await CustomAlert({
@@ -624,8 +624,8 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
624
624
  `,
625
625
  variables: {
626
626
  ganNo: this.ganNo,
627
- newOrderProducts: this._getNewOrderProducts(),
628
- existingOrderProducts: this._getExistingOrderProducts()
627
+ newOrderProducts,
628
+ existingOrderProducts
629
629
  }
630
630
  })
631
631
 
@@ -650,6 +650,7 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
650
650
  palletQty: 0,
651
651
  adjustedPalletQty: record?.palletQty ? record.palletQty : null,
652
652
  product: { id: record.product.id },
653
+ productDetail: { id: record.productDetailId },
653
654
  packingType: 'N/A',
654
655
  adjustedPackingType: record.packingType,
655
656
  uomValue: 0,
@@ -682,6 +683,7 @@ export class EditProductPopup extends localize(i18next)(LitElement) {
682
683
  adjustedBatchIdRef: record.batchIdRef === record.__origin__.batchIdRef ? null : record.batchIdRef,
683
684
  adjustedPalletQty: record.palletQty == record.__origin__.palletQty ? null : record.palletQty,
684
685
  product: { id: record.product.id },
686
+ productDetail: { id: record.productDetail.id },
685
687
  adjustedPackingType: record.packingType === record.__origin__.packingType ? null : record.packingType,
686
688
  adjustedUomValue: record.uomValue == record.__origin__.uomValue ? null : record.uomValue,
687
689
  adjustedUom: record.uom === record.__origin__.uom ? null : record.uom,