@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
@@ -331,10 +331,16 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
331
331
  }
332
332
 
333
333
  get locationInput() {
334
- if (this.viewType === VIEW_TYPE.INVENTORY_SELECTED) {
335
- return this.renderRoot.querySelector('input[name=location]')
336
- } else {
334
+ // if (this.viewType === VIEW_TYPE.INVENTORY_SELECTED) {
335
+ // return this.renderRoot.querySelector('input[name=location]')
336
+ // } else {
337
+ // return this.renderRoot.querySelector('barcode-scanable-input[name=location]').renderRoot.querySelector('input')
338
+ // }
339
+
340
+ if (this.renderRoot.querySelector('barcode-scanable-input[name=location]').renderRoot.querySelector('input')) {
337
341
  return this.renderRoot.querySelector('barcode-scanable-input[name=location]').renderRoot.querySelector('input')
342
+ } else {
343
+ return this.renderRoot.querySelector('input[name=location]')
338
344
  }
339
345
  }
340
346
 
@@ -833,7 +839,7 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
833
839
 
834
840
  async addExtraPallet() {
835
841
  try {
836
- this.checkInputFormValidity()
842
+ await this.checkInputFormValidity()
837
843
 
838
844
  const palletId = this.palletIdInput.value
839
845
 
@@ -993,13 +999,25 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
993
999
  this.viewType = VIEW_TYPE.INVENTORY_SELECTED
994
1000
  this.updateContext(this.viewType)
995
1001
  this.selectedInventory = e.detail.recordInformation
996
- this.locationInput.value = e.detail.locationInput
997
1002
  await CustomAlert({
998
1003
  title: i18next.t('title.inventory_in_current_location'),
999
1004
  text: i18next.t('text.kindly_continue_inspect_the_inventory'),
1000
1005
  confirmButton: { text: i18next.t('button.okay') }
1001
1006
  })
1002
1007
  }}"
1008
+ @not-in-cc="${async e => {
1009
+ history.back()
1010
+ this.viewType = VIEW_TYPE.INVENTORY_SELECTED
1011
+ this.updateContext(this.viewType)
1012
+ await CustomAlert({
1013
+ title: i18next.t('title.inventory_not_found'),
1014
+ text: i18next.t('text.pallet_(x)_is_not_found_in_cycle_count_worksheet_(y)', {
1015
+ x: e.detail.palletId,
1016
+ y: e.detail.cycleCountNo
1017
+ }),
1018
+ confirmButton: { text: i18next.t('button.okay') }
1019
+ })
1020
+ }}"
1003
1021
  ></check-inventory-popup>
1004
1022
  `,
1005
1023
  {
@@ -1276,7 +1294,7 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
1276
1294
  return response.data.checkInventoryOwner
1277
1295
  }
1278
1296
  } catch (e) {
1279
- this.showToast(e)
1297
+ return false
1280
1298
  }
1281
1299
  }
1282
1300
 
@@ -1348,7 +1366,7 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
1348
1366
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('field.inspected_uom_value') } }))
1349
1367
  }
1350
1368
 
1351
- const locationName = this.locationInput.value
1369
+ const locationName = this.locationInput?.value
1352
1370
  if (!locationName) {
1353
1371
  this.selectOnInput(this.locationInput)
1354
1372
  throw new Error(i18next.t('text.invalid_x', { state: { x: i18next.t('label.location') } }))
@@ -170,56 +170,105 @@ class InventoryCheckList extends localize(i18next)(PageView) {
170
170
  name: 'inventoryCheck',
171
171
  header: i18next.t('field.inventory_check_no'),
172
172
  sortable: true,
173
- width: 150
173
+ width: 150,
174
+ imex: {
175
+ header: i18next.t('field.inventory_check_no'),
176
+ key: 'inventoryCheck.name',
177
+ width: 50,
178
+ type: 'string'
179
+ }
174
180
  },
175
181
  {
176
182
  type: 'object',
177
183
  name: 'bizplace',
178
184
  header: i18next.t('field.company'),
179
185
  sortable: true,
180
- width: 250
186
+ width: 250,
187
+ imex: {
188
+ header: i18next.t('field.company'),
189
+ key: 'bizplace.name',
190
+ width: 30,
191
+ type: 'array',
192
+ arrData: []
193
+ }
181
194
  },
182
195
  {
183
196
  type: 'date',
184
197
  name: 'executionDate',
185
198
  header: i18next.t('field.execution_date'),
186
199
  sortable: true,
187
- width: 120
200
+ width: 120,
201
+ imex: {
202
+ header: i18next.t('field.execution_date'),
203
+ key: 'executionDate',
204
+ width: 30,
205
+ type: 'string'
206
+ }
188
207
  },
189
208
  {
190
209
  type: 'string',
191
210
  name: 'inventoryCheckStatus',
192
211
  header: i18next.t('field.order_status'),
193
212
  sortable: true,
194
- width: 120
213
+ width: 120,
214
+ imex: {
215
+ header: i18next.t('field.order_status'),
216
+ key: 'inventoryCheckStatus',
217
+ width: 20,
218
+ type: 'string'
219
+ }
195
220
  },
196
221
  {
197
222
  type: 'string',
198
223
  name: 'status',
199
224
  header: i18next.t('field.task_status'),
200
225
  sortable: true,
201
- width: 120
226
+ width: 120,
227
+ imex: {
228
+ header: i18next.t('field.task_status'),
229
+ key: 'status',
230
+ width: 20,
231
+ type: 'string'
232
+ }
202
233
  },
203
234
  {
204
235
  type: 'datetime',
205
236
  name: 'startedAt',
206
237
  header: i18next.t('field.started_at'),
207
238
  sortable: true,
208
- width: 160
239
+ width: 160,
240
+ imex: {
241
+ header: i18next.t('field.started_at'),
242
+ key: 'startedAt',
243
+ width: 30,
244
+ type: 'datetime'
245
+ }
209
246
  },
210
247
  {
211
248
  type: 'datetime',
212
249
  name: 'endedAt',
213
250
  header: i18next.t('field.ended_at'),
214
251
  sortable: true,
215
- width: 160
252
+ width: 160,
253
+ imex: {
254
+ header: i18next.t('field.ended_at'),
255
+ key: 'endedAt',
256
+ width: 30,
257
+ type: 'datetime'
258
+ }
216
259
  },
217
260
  {
218
261
  type: 'object',
219
262
  name: 'updater',
220
263
  header: i18next.t('field.updater'),
221
264
  sortable: true,
222
- width: 150
265
+ width: 150,
266
+ imex: {
267
+ header: i18next.t('field.updater'),
268
+ key: 'updater.name',
269
+ width: 30,
270
+ type: 'object'
271
+ }
223
272
  }
224
273
  ]
225
274
  }
@@ -373,8 +422,43 @@ class InventoryCheckList extends localize(i18next)(PageView) {
373
422
  return this.config.columns
374
423
  }
375
424
 
376
- _exportableData() {
377
- return this.dataGrist.exportRecords()
425
+ async _exportableData() {
426
+ let records = []
427
+ records = this.dataGrist.data.records
428
+
429
+ const fetchBizplaces = await this._fetchBizplaceList()
430
+
431
+ var headerSetting = this.dataGrist._config.columns
432
+ .filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
433
+ .map(column => {
434
+ if (column.imex.key == 'bizplace.name') {
435
+ column.imex.arrData = fetchBizplaces.map(item => {
436
+ return {
437
+ id: item.id,
438
+ name: item.name
439
+ }
440
+ })
441
+ }
442
+ return column.imex
443
+ })
444
+
445
+ var data = records.map(item => {
446
+ return {
447
+ id: item.id,
448
+ ...this.config.columns
449
+ .filter(column => column.type !== 'gutter' /* && column.record !== undefined */ && column.imex !== undefined)
450
+ .reduce((record, column) => {
451
+ record[column.imex.key] = column.imex.key
452
+ .split('.')
453
+ .reduce((obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), item)
454
+ if (column.type === 'datetime' && record[column.imex.key] !== '' && record[column.imex.key] !== null) {
455
+ record[column.imex.key] = new Date(parseInt(record[column.imex.key])).toLocaleString()
456
+ }
457
+ return record
458
+ }, {})
459
+ }
460
+ })
461
+ return { header: headerSetting, data: data }
378
462
  }
379
463
  }
380
464
 
@@ -503,10 +503,10 @@ class LoadingManifestDetail extends localize(i18next)(PageView) {
503
503
  }
504
504
 
505
505
  async _validateOrderStatus() {
506
- let foundCancelOrder = this.shippingData.records.filter(
507
- itm => itm.orderStatus == ORDER_STATUS.PENDING_CANCEL || itm.orderStatus == ORDER_STATUS.CANCELLED
506
+ let foundCancelOrder = this.shippingData.records.some(
507
+ itm => itm.orderStatus == ORDER_STATUS.PENDING_CANCEL.value || itm.orderStatus == ORDER_STATUS.CANCELLED.value
508
508
  )
509
- if (foundCancelOrder?.length > 0) {
509
+ if (foundCancelOrder) {
510
510
  const answer = await CustomAlert({
511
511
  title: i18next.t('title.do_you_wish_to_proceed'),
512
512
  text: i18next.t('text.parcels_are_found_with_cancelled_or_pending_cancelled_status'),
@@ -543,7 +543,10 @@ class LoadingManifestDetail extends localize(i18next)(PageView) {
543
543
  if (!response.error) {
544
544
  let releaseGood = response.data.releaseGood
545
545
 
546
- if (releaseGood?.status === ORDER_STATUS.CANCELLED || releaseGood?.status === ORDER_STATUS.PENDING_CANCEL) {
546
+ if (
547
+ releaseGood?.status === ORDER_STATUS.CANCELLED.value ||
548
+ releaseGood?.status === ORDER_STATUS.PENDING_CANCEL.value
549
+ ) {
547
550
  let answer = await CustomAlert({
548
551
  type: 'warning',
549
552
  title: i18next.t('title.order(s)_is_at_pending_cancelled_or_cancelled'),
@@ -6,6 +6,7 @@ import { i18next, localize } from '@things-factory/i18n-base'
6
6
  import { isMobileDevice } from '@things-factory/utils'
7
7
  import { ScrollbarStyles } from '@things-factory/styles'
8
8
  import { css, html, LitElement } from 'lit-element'
9
+ import { showToast } from '../../util'
9
10
 
10
11
  export class GenerateLocationList extends localize(i18next)(LitElement) {
11
12
  static get properties() {
@@ -337,39 +338,46 @@ export class GenerateLocationList extends localize(i18next)(LitElement) {
337
338
  }
338
339
 
339
340
  _validateGenerator() {
340
- let dataFromGrist = this.data.records
341
- let validationError = false
342
- for (let x = 1; x < dataFromGrist.length; x++) {
343
- if (dataFromGrist[x].start <= dataFromGrist[x - 1].end) {
341
+ try {
342
+ if (!this._selectedFormat) {
343
+ throw new Error(i18next.t('text.select_location_format'))
344
+ }
345
+ let dataFromGrist = this.data.records
346
+ let validationError = false
347
+ for (let x = 1; x < dataFromGrist.length; x++) {
348
+ if (dataFromGrist[x].start <= dataFromGrist[x - 1].end) {
349
+ document.dispatchEvent(
350
+ new CustomEvent('notify', {
351
+ detail: {
352
+ level: 'error',
353
+ message: i18next.t('text.already_existed', {
354
+ state: {
355
+ text: dataFromGrist[x].start
356
+ }
357
+ })
358
+ }
359
+ })
360
+ )
361
+ validationError = true
362
+ }
363
+ }
364
+
365
+ if (this._zoneName === '') {
344
366
  document.dispatchEvent(
345
367
  new CustomEvent('notify', {
346
368
  detail: {
347
369
  level: 'error',
348
- message: i18next.t('text.already_existed', {
349
- state: {
350
- text: dataFromGrist[x].start
351
- }
352
- })
370
+ message: i18next.t('text.missing_zone_name')
353
371
  }
354
372
  })
355
373
  )
356
374
  validationError = true
357
375
  }
358
- }
359
376
 
360
- if (this._zoneName === '') {
361
- document.dispatchEvent(
362
- new CustomEvent('notify', {
363
- detail: {
364
- level: 'error',
365
- message: i18next.t('text.missing_zone_name')
366
- }
367
- })
368
- )
369
- validationError = true
377
+ if (!validationError) this._generateLocationList()
378
+ } catch (e) {
379
+ showToast(e)
370
380
  }
371
-
372
- if (!validationError) this._generateLocationList()
373
381
  }
374
382
 
375
383
  async _generateLocationList() {
@@ -7,6 +7,7 @@ import './print-location-label'
7
7
  import gql from 'graphql-tag'
8
8
  import { css, html } from 'lit-element'
9
9
  import { connect } from 'pwa-helpers/connect-mixin'
10
+ import isEmpty from 'lodash-es/isEmpty'
10
11
 
11
12
  import { DirectPrinter } from '@things-factory/barcode-base'
12
13
  import { i18next, localize } from '@things-factory/i18n-base'
@@ -15,7 +16,9 @@ import { client, CustomAlert, PageView, store } from '@things-factory/shell'
15
16
  import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
16
17
  import { isMobileDevice } from '@things-factory/utils'
17
18
 
19
+ import { getCodeByName } from '@things-factory/code-base'
18
20
  import { LOCATION_LABEL_SETTING_KEY, LOCATION_STATUS, LOCATION_TYPE } from '../constants'
21
+ import { showToast } from '../../util'
19
22
 
20
23
  class LocationList extends connect(store)(localize(i18next)(PageView)) {
21
24
  static get styles() {
@@ -151,25 +154,25 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
151
154
  label: i18next.t('field.zone'),
152
155
  name: 'zone',
153
156
  type: 'text',
154
- props: { searchOper: 'eq' }
157
+ props: { searchOper: 'i_like' }
155
158
  },
156
159
  {
157
160
  label: i18next.t('field.row'),
158
161
  name: 'row',
159
162
  type: 'text',
160
- props: { searchOper: 'eq' }
163
+ props: { searchOper: 'i_like' }
161
164
  },
162
165
  {
163
166
  label: i18next.t('field.column'),
164
167
  name: 'column',
165
168
  type: 'text',
166
- props: { searchOper: 'eq' }
169
+ props: { searchOper: 'i_like' }
167
170
  },
168
171
  {
169
172
  label: i18next.t('field.shelf'),
170
173
  name: 'shelf',
171
174
  type: 'text',
172
- props: { searchOper: 'eq' }
175
+ props: { searchOper: 'i_like' }
173
176
  },
174
177
  {
175
178
  label: i18next.t('field.status'),
@@ -191,8 +194,8 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
191
194
  ]
192
195
 
193
196
  this.config = {
194
- pagination: { pages: [20, 50, 100, 200] },
195
197
  rows: { selectable: { multiple: true } },
198
+ pagination: { limit: 50, pages: [50, 100, 200, 500] },
196
199
  list: {
197
200
  fields: ['name', 'type', 'status']
198
201
  },
@@ -222,7 +225,17 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
222
225
  .sort()
223
226
  ]
224
227
  },
225
- imex: { header: i18next.t('field.type'), key: 'type', width: 50, type: 'string' },
228
+ imex: {
229
+ header: i18next.t('field.type'),
230
+ key: 'type',
231
+ width: 50,
232
+ type: 'array',
233
+ arrData: Object.values(LOCATION_TYPE).map(type => {
234
+ return {
235
+ name: type.name
236
+ }
237
+ })
238
+ },
226
239
  sortable: true,
227
240
  width: 150
228
241
  },
@@ -276,7 +289,17 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
276
289
  .sort()
277
290
  ]
278
291
  },
279
- imex: { header: i18next.t('field.status'), key: 'status', width: 50, type: 'string' },
292
+ imex: {
293
+ header: i18next.t('field.status'),
294
+ key: 'status',
295
+ width: 50,
296
+ type: 'array',
297
+ arrData: Object.values(LOCATION_STATUS).map(type => {
298
+ return {
299
+ name: type.name
300
+ }
301
+ })
302
+ },
280
303
  sortable: true,
281
304
  width: 80
282
305
  },
@@ -392,55 +415,41 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
392
415
  }
393
416
 
394
417
  async importHandler(patches) {
395
- if (patches && patches.length) {
396
- patches = patches.map(patch => {
397
- if (this._warehouseId) {
398
- patch.warehouse = { id: this._warehouseId }
418
+ try {
419
+ let records = this.dataGrist.data.records
420
+ const locationType = await getCodeByName('LOCATION_TYPE')
421
+ const locationStatus = await getCodeByName('LOCATION_STATUS')
422
+ patches = patches.map(itm => {
423
+ // Error if there is an empty value
424
+ if (isEmpty(itm.name) || isEmpty(itm.type) || isEmpty(itm.zone) || isEmpty(itm.column) || isEmpty(itm.shelf) || isEmpty(itm.status) || '')
425
+ {
426
+ throw new Error(i18next.t('text.empty_value_in_list'))
399
427
  }
400
- return patch
401
- })
402
- const response = await client.mutate({
403
- mutation: gql`
404
- mutation updateMultipleLocation($patches: [LocationPatch!]!) {
405
- updateMultipleLocation(patches: $patches) {
406
- name
407
- }
408
- }
409
- `,
410
- variables: {
411
- patches
428
+ // Error if location name is already existed
429
+ if (records.find(exist => exist.name == itm.name)) {
430
+ throw new Error(i18next.t('text.location_name(s)_already_existed'))
412
431
  }
413
- })
414
-
415
- if (!response.errors) {
416
- history.back()
417
- this._clearTempLocation()
418
- document.dispatchEvent(
419
- new CustomEvent('notify', {
420
- detail: {
421
- message: i18next.t('text.data_imported_successfully')
422
- }
423
- })
424
- )
425
- }
426
- }
427
- }
428
-
429
- async _saveLocation() {
430
- let patches = this.dataGrist.exportPatchList({ flagName: 'cuFlag' })
431
- if (patches && patches.length) {
432
- patches = patches.map(patch => {
433
- if (this._warehouseId && !patch.warehouse) {
434
- patch.warehouse = { id: this._warehouseId }
432
+ // Error if location status does not exist
433
+ let foundLocationType = locationType.find(exist => exist.name == itm.type)
434
+ if (!foundLocationType) {
435
+ throw new Error(i18next.t('text.location_type_does_not_exist'))
436
+ }
437
+ // Error if location type does not exist
438
+ let foundLocationStatus = locationStatus.find(exist => exist.name == itm.status)
439
+ if (!foundLocationStatus) {
440
+ throw new Error(i18next.t('text.location_status_does_not_exist'))
435
441
  }
436
- return patch
442
+ return itm
437
443
  })
438
-
439
- try {
440
- this.dataGrist.showSpinner()
441
-
442
- const response = await client.query({
443
- query: gql`
444
+ if (patches && patches.length) {
445
+ patches = patches.map(patch => {
446
+ if (this._warehouseId) {
447
+ patch.warehouse = { id: this._warehouseId }
448
+ }
449
+ return patch
450
+ })
451
+ const response = await client.mutate({
452
+ mutation: gql`
444
453
  mutation updateMultipleLocation($patches: [LocationPatch!]!) {
445
454
  updateMultipleLocation(patches: $patches) {
446
455
  name
@@ -453,27 +462,82 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
453
462
  })
454
463
 
455
464
  if (!response.errors) {
465
+ history.back()
456
466
  this._clearTempLocation()
457
467
  document.dispatchEvent(
458
468
  new CustomEvent('notify', {
459
469
  detail: {
460
- message: i18next.t('text.data_updated_successfully')
470
+ message: i18next.t('text.data_imported_successfully')
461
471
  }
462
472
  })
463
473
  )
464
474
  }
465
- } catch (e) {
466
- document.dispatchEvent(
467
- new CustomEvent('notify', {
468
- detail: {
469
- level: error,
470
- message: e
475
+ }
476
+ } catch (e) {
477
+ showToast(e)
478
+ }
479
+ }
480
+
481
+ async _saveLocation() {
482
+ try {
483
+ let patches = this.dataGrist.exportPatchList({ flagName: 'cuFlag' })
484
+
485
+ if (
486
+ patches.some(
487
+ p => (!p.name || !p.type || !p.zone || !p.row || !p.column || !p.shelf || !p.status) && p.cuFlag == '+'
488
+ )
489
+ ) {
490
+ throw new Error(i18next.t('text.empty_value_in_list'))
491
+ }
492
+ if (patches && patches.length) {
493
+ patches = patches.map(patch => {
494
+ if (this._warehouseId && !patch.warehouse) {
495
+ patch.warehouse = { id: this._warehouseId }
496
+ }
497
+ return patch
498
+ })
499
+
500
+ try {
501
+ this.dataGrist.showSpinner()
502
+
503
+ const response = await client.query({
504
+ query: gql`
505
+ mutation updateMultipleLocation($patches: [LocationPatch!]!) {
506
+ updateMultipleLocation(patches: $patches) {
507
+ name
508
+ }
509
+ }
510
+ `,
511
+ variables: {
512
+ patches
471
513
  }
472
514
  })
473
- )
474
- } finally {
475
- this.dataGrist.hideSpinner()
515
+
516
+ if (!response.errors) {
517
+ this._clearTempLocation()
518
+ document.dispatchEvent(
519
+ new CustomEvent('notify', {
520
+ detail: {
521
+ message: i18next.t('text.data_updated_successfully')
522
+ }
523
+ })
524
+ )
525
+ }
526
+ } catch (e) {
527
+ document.dispatchEvent(
528
+ new CustomEvent('notify', {
529
+ detail: {
530
+ level: error,
531
+ message: e
532
+ }
533
+ })
534
+ )
535
+ } finally {
536
+ this.dataGrist.hideSpinner()
537
+ }
476
538
  }
539
+ } catch (e) {
540
+ showToast(e)
477
541
  }
478
542
  }
479
543
 
@@ -506,15 +570,12 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
506
570
  ids = []
507
571
  this._clearTempLocation()
508
572
  }
509
- } else
510
- document.dispatchEvent(
511
- new CustomEvent('notify', {
512
- detail: {
513
- level: 'error',
514
- message: `${i18next.t('text.cannot_delete_unsaved_location(s)')}`
515
- }
516
- })
517
- )
573
+ } else {
574
+ CustomAlert({
575
+ title: i18next.t('text.nothing_selected'),
576
+ text: i18next.t('text.there_is_nothing_to_delete')
577
+ })
578
+ }
518
579
  }
519
580
  }
520
581
  })
@@ -555,6 +616,7 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
555
616
  text: i18next.t('text.you_wont_be_able_to_revert_this'),
556
617
  type: 'warning',
557
618
  confirmButton: { text: i18next.t('button.delete_all'), color: '#22a6a7' },
619
+
558
620
  cancelButton: { text: i18next.t('button.cancel'), color: '#cfcfcf' },
559
621
  callback: async result => {
560
622
  if (result.value && name !== '') {
@@ -567,6 +629,7 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
567
629
  variables: { warehouseId: this._warehouseId }
568
630
  })
569
631
  if (!response.errors) this._clearTempLocation()
632
+ this.showToast({ message: i18next.t('text.all_locations_are_deleted') })
570
633
  }
571
634
  }
572
635
  })