@things-factory/operato-wms 4.3.108 → 4.3.110

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 (66) hide show
  1. package/client/pages/bulk-operation/bulk-operation.js +15 -9
  2. package/client/pages/components/select-inventory-popup.js +1 -7
  3. package/client/pages/components/select-product-popup.js +2 -31
  4. package/client/pages/inbound/undo-putaway-popup.js +9 -5
  5. package/client/pages/inbound/undo-unload-popup.js +2 -15
  6. package/client/pages/inbound/unload-product.js +67 -72
  7. package/client/pages/inventory/inventory-adjustment-approval.js +5 -4
  8. package/client/pages/inventory/inventory-adjustment.js +2 -9
  9. package/client/pages/inventory/inventory-by-product-detail.js +13 -13
  10. package/client/pages/inventory-check/check-inventory-popup.js +3 -14
  11. package/client/pages/inventory-check/create-cycle-count.js +3 -2
  12. package/client/pages/inventory-check/inspecting-product.js +7 -25
  13. package/client/pages/inventory-check/inventory-check-list.js +10 -94
  14. package/client/pages/manifest/loading-manifest-detail.js +4 -7
  15. package/client/pages/master/generate-location-list.js +22 -30
  16. package/client/pages/master/location-list.js +71 -134
  17. package/client/pages/master/pallet-list.js +58 -137
  18. package/client/pages/master/product/product-details-popup.js +3 -3
  19. package/client/pages/master/tote-list.js +27 -40
  20. package/client/pages/master/transport-driver.js +41 -50
  21. package/client/pages/master/transport-vehicle.js +41 -45
  22. package/client/pages/master/warehouse-list.js +34 -56
  23. package/client/pages/order/arrival-notice/arrival-notice-detail.js +25 -36
  24. package/client/pages/order/arrival-notice/create-arrival-notice.js +32 -53
  25. package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +0 -2
  26. package/client/pages/order/arrival-notice/edit-product-popup.js +7 -9
  27. package/client/pages/order/draft-release-good/draft-release-good-detail.js +4 -79
  28. package/client/pages/order/release-order/create-release-order.js +5 -22
  29. package/client/pages/order/release-order/release-extra-product-popup.js +1 -4
  30. package/client/pages/order/release-order/release-order-detail.js +0 -24
  31. package/client/pages/order/return-order/create-return-order.js +0 -5
  32. package/client/pages/order/return-order/return-order-inventory-popup.js +0 -1
  33. package/client/pages/order/transport-order/delivery-order-list.js +0 -26
  34. package/client/pages/outbound/inventory-reassign-popup.js +0 -6
  35. package/client/pages/outbound/packing-product.js +5 -5
  36. package/client/pages/outbound/packing-worksheet-list.js +1 -3
  37. package/client/pages/outbound/picking-product.js +7 -18
  38. package/client/pages/outbound/show-my-worksheet-list-popup.js +3 -12
  39. package/client/pages/report/custom-elccl/elccl-daily-collection-report.js +2 -5
  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 +8 -48
  42. package/client/pages/report/custom-elccl/elccl-inventory-pallet-detail-report.js +4 -42
  43. package/client/pages/vas/print-product-label.js +11 -13
  44. package/config.development.js +1 -1
  45. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js +5 -6
  46. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js.map +1 -1
  47. package/dist-server/graphql/resolvers/other/add-release-good-products.js +11 -7
  48. package/dist-server/graphql/resolvers/other/add-release-good-products.js.map +1 -1
  49. package/dist-server/graphql/resolvers/reports/costing-report.js +24 -18
  50. package/dist-server/graphql/resolvers/reports/costing-report.js.map +1 -1
  51. package/dist-server/graphql/resolvers/reports/inbound-order-details-report.js +6 -6
  52. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +6 -5
  53. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
  54. package/dist-server/graphql/resolvers/reports/release-inventory-report.js +3 -3
  55. package/dist-server/graphql/resolvers/reports/release-inventory-report.js.map +1 -1
  56. package/package.json +50 -50
  57. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.ts +5 -6
  58. package/server/graphql/resolvers/other/add-release-good-products.ts +12 -8
  59. package/server/graphql/resolvers/reports/costing-report.ts +24 -18
  60. package/server/graphql/resolvers/reports/inbound-order-details-report.ts +6 -6
  61. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +6 -5
  62. package/server/graphql/resolvers/reports/release-inventory-report.ts +4 -6
  63. package/translations/en.json +13 -43
  64. package/translations/ko.json +11 -33
  65. package/translations/ms.json +11 -33
  66. package/translations/zh.json +4 -26
@@ -331,16 +331,10 @@ 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 {
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')) {
341
- return this.renderRoot.querySelector('barcode-scanable-input[name=location]').renderRoot.querySelector('input')
342
- } else {
334
+ if (this.viewType === VIEW_TYPE.INVENTORY_SELECTED) {
343
335
  return this.renderRoot.querySelector('input[name=location]')
336
+ } else {
337
+ return this.renderRoot.querySelector('barcode-scanable-input[name=location]').renderRoot.querySelector('input')
344
338
  }
345
339
  }
346
340
 
@@ -839,7 +833,7 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
839
833
 
840
834
  async addExtraPallet() {
841
835
  try {
842
- await this.checkInputFormValidity()
836
+ this.checkInputFormValidity()
843
837
 
844
838
  const palletId = this.palletIdInput.value
845
839
 
@@ -999,25 +993,13 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
999
993
  this.viewType = VIEW_TYPE.INVENTORY_SELECTED
1000
994
  this.updateContext(this.viewType)
1001
995
  this.selectedInventory = e.detail.recordInformation
996
+ this.locationInput.value = e.detail.locationInput
1002
997
  await CustomAlert({
1003
998
  title: i18next.t('title.inventory_in_current_location'),
1004
999
  text: i18next.t('text.kindly_continue_inspect_the_inventory'),
1005
1000
  confirmButton: { text: i18next.t('button.okay') }
1006
1001
  })
1007
1002
  }}"
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
- }}"
1021
1003
  ></check-inventory-popup>
1022
1004
  `,
1023
1005
  {
@@ -1294,7 +1276,7 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
1294
1276
  return response.data.checkInventoryOwner
1295
1277
  }
1296
1278
  } catch (e) {
1297
- return false
1279
+ this.showToast(e)
1298
1280
  }
1299
1281
  }
1300
1282
 
@@ -1366,7 +1348,7 @@ class InspectingProduct extends connect(store)(localize(i18next)(PageView)) {
1366
1348
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('field.inspected_uom_value') } }))
1367
1349
  }
1368
1350
 
1369
- const locationName = this.locationInput?.value
1351
+ const locationName = this.locationInput.value
1370
1352
  if (!locationName) {
1371
1353
  this.selectOnInput(this.locationInput)
1372
1354
  throw new Error(i18next.t('text.invalid_x', { state: { x: i18next.t('label.location') } }))
@@ -170,105 +170,56 @@ 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,
174
- imex: {
175
- header: i18next.t('field.inventory_check_no'),
176
- key: 'inventoryCheck.name',
177
- width: 50,
178
- type: 'string'
179
- }
173
+ width: 150
180
174
  },
181
175
  {
182
176
  type: 'object',
183
177
  name: 'bizplace',
184
178
  header: i18next.t('field.company'),
185
179
  sortable: true,
186
- width: 250,
187
- imex: {
188
- header: i18next.t('field.company'),
189
- key: 'bizplace.name',
190
- width: 30,
191
- type: 'array',
192
- arrData: []
193
- }
180
+ width: 250
194
181
  },
195
182
  {
196
183
  type: 'date',
197
184
  name: 'executionDate',
198
185
  header: i18next.t('field.execution_date'),
199
186
  sortable: true,
200
- width: 120,
201
- imex: {
202
- header: i18next.t('field.execution_date'),
203
- key: 'executionDate',
204
- width: 30,
205
- type: 'string'
206
- }
187
+ width: 120
207
188
  },
208
189
  {
209
190
  type: 'string',
210
191
  name: 'inventoryCheckStatus',
211
192
  header: i18next.t('field.order_status'),
212
193
  sortable: true,
213
- width: 120,
214
- imex: {
215
- header: i18next.t('field.order_status'),
216
- key: 'inventoryCheckStatus',
217
- width: 20,
218
- type: 'string'
219
- }
194
+ width: 120
220
195
  },
221
196
  {
222
197
  type: 'string',
223
198
  name: 'status',
224
199
  header: i18next.t('field.task_status'),
225
200
  sortable: true,
226
- width: 120,
227
- imex: {
228
- header: i18next.t('field.task_status'),
229
- key: 'status',
230
- width: 20,
231
- type: 'string'
232
- }
201
+ width: 120
233
202
  },
234
203
  {
235
204
  type: 'datetime',
236
205
  name: 'startedAt',
237
206
  header: i18next.t('field.started_at'),
238
207
  sortable: true,
239
- width: 160,
240
- imex: {
241
- header: i18next.t('field.started_at'),
242
- key: 'startedAt',
243
- width: 30,
244
- type: 'datetime'
245
- }
208
+ width: 160
246
209
  },
247
210
  {
248
211
  type: 'datetime',
249
212
  name: 'endedAt',
250
213
  header: i18next.t('field.ended_at'),
251
214
  sortable: true,
252
- width: 160,
253
- imex: {
254
- header: i18next.t('field.ended_at'),
255
- key: 'endedAt',
256
- width: 30,
257
- type: 'datetime'
258
- }
215
+ width: 160
259
216
  },
260
217
  {
261
218
  type: 'object',
262
219
  name: 'updater',
263
220
  header: i18next.t('field.updater'),
264
221
  sortable: true,
265
- width: 150,
266
- imex: {
267
- header: i18next.t('field.updater'),
268
- key: 'updater.name',
269
- width: 30,
270
- type: 'object'
271
- }
222
+ width: 150
272
223
  }
273
224
  ]
274
225
  }
@@ -422,43 +373,8 @@ class InventoryCheckList extends localize(i18next)(PageView) {
422
373
  return this.config.columns
423
374
  }
424
375
 
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 }
376
+ _exportableData() {
377
+ return this.dataGrist.exportRecords()
462
378
  }
463
379
  }
464
380
 
@@ -503,10 +503,10 @@ class LoadingManifestDetail extends localize(i18next)(PageView) {
503
503
  }
504
504
 
505
505
  async _validateOrderStatus() {
506
- let foundCancelOrder = this.shippingData.records.some(
507
- itm => itm.orderStatus == ORDER_STATUS.PENDING_CANCEL.value || itm.orderStatus == ORDER_STATUS.CANCELLED.value
506
+ let foundCancelOrder = this.shippingData.records.filter(
507
+ itm => itm.orderStatus == ORDER_STATUS.PENDING_CANCEL || itm.orderStatus == ORDER_STATUS.CANCELLED
508
508
  )
509
- if (foundCancelOrder) {
509
+ if (foundCancelOrder?.length > 0) {
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,10 +543,7 @@ class LoadingManifestDetail extends localize(i18next)(PageView) {
543
543
  if (!response.error) {
544
544
  let releaseGood = response.data.releaseGood
545
545
 
546
- if (
547
- releaseGood?.status === ORDER_STATUS.CANCELLED.value ||
548
- releaseGood?.status === ORDER_STATUS.PENDING_CANCEL.value
549
- ) {
546
+ if (releaseGood?.status === ORDER_STATUS.CANCELLED || releaseGood?.status === ORDER_STATUS.PENDING_CANCEL) {
550
547
  let answer = await CustomAlert({
551
548
  type: 'warning',
552
549
  title: i18next.t('title.order(s)_is_at_pending_cancelled_or_cancelled'),
@@ -6,7 +6,6 @@ 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'
10
9
 
11
10
  export class GenerateLocationList extends localize(i18next)(LitElement) {
12
11
  static get properties() {
@@ -338,46 +337,39 @@ export class GenerateLocationList extends localize(i18next)(LitElement) {
338
337
  }
339
338
 
340
339
  _validateGenerator() {
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 === '') {
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) {
366
344
  document.dispatchEvent(
367
345
  new CustomEvent('notify', {
368
346
  detail: {
369
347
  level: 'error',
370
- message: i18next.t('text.missing_zone_name')
348
+ message: i18next.t('text.already_existed', {
349
+ state: {
350
+ text: dataFromGrist[x].start
351
+ }
352
+ })
371
353
  }
372
354
  })
373
355
  )
374
356
  validationError = true
375
357
  }
358
+ }
376
359
 
377
- if (!validationError) this._generateLocationList()
378
- } catch (e) {
379
- showToast(e)
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
380
370
  }
371
+
372
+ if (!validationError) this._generateLocationList()
381
373
  }
382
374
 
383
375
  async _generateLocationList() {
@@ -7,7 +7,6 @@ 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'
11
10
 
12
11
  import { DirectPrinter } from '@things-factory/barcode-base'
13
12
  import { i18next, localize } from '@things-factory/i18n-base'
@@ -16,9 +15,7 @@ import { client, CustomAlert, PageView, store } from '@things-factory/shell'
16
15
  import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
17
16
  import { isMobileDevice } from '@things-factory/utils'
18
17
 
19
- import { getCodeByName } from '@things-factory/code-base'
20
18
  import { LOCATION_LABEL_SETTING_KEY, LOCATION_STATUS, LOCATION_TYPE } from '../constants'
21
- import { showToast } from '../../util'
22
19
 
23
20
  class LocationList extends connect(store)(localize(i18next)(PageView)) {
24
21
  static get styles() {
@@ -154,25 +151,25 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
154
151
  label: i18next.t('field.zone'),
155
152
  name: 'zone',
156
153
  type: 'text',
157
- props: { searchOper: 'i_like' }
154
+ props: { searchOper: 'eq' }
158
155
  },
159
156
  {
160
157
  label: i18next.t('field.row'),
161
158
  name: 'row',
162
159
  type: 'text',
163
- props: { searchOper: 'i_like' }
160
+ props: { searchOper: 'eq' }
164
161
  },
165
162
  {
166
163
  label: i18next.t('field.column'),
167
164
  name: 'column',
168
165
  type: 'text',
169
- props: { searchOper: 'i_like' }
166
+ props: { searchOper: 'eq' }
170
167
  },
171
168
  {
172
169
  label: i18next.t('field.shelf'),
173
170
  name: 'shelf',
174
171
  type: 'text',
175
- props: { searchOper: 'i_like' }
172
+ props: { searchOper: 'eq' }
176
173
  },
177
174
  {
178
175
  label: i18next.t('field.status'),
@@ -194,8 +191,8 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
194
191
  ]
195
192
 
196
193
  this.config = {
194
+ pagination: { pages: [20, 50, 100, 200] },
197
195
  rows: { selectable: { multiple: true } },
198
- pagination: { limit: 50, pages: [50, 100, 200, 500] },
199
196
  list: {
200
197
  fields: ['name', 'type', 'status']
201
198
  },
@@ -225,17 +222,7 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
225
222
  .sort()
226
223
  ]
227
224
  },
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
- },
225
+ imex: { header: i18next.t('field.type'), key: 'type', width: 50, type: 'string' },
239
226
  sortable: true,
240
227
  width: 150
241
228
  },
@@ -289,17 +276,7 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
289
276
  .sort()
290
277
  ]
291
278
  },
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
- },
279
+ imex: { header: i18next.t('field.status'), key: 'status', width: 50, type: 'string' },
303
280
  sortable: true,
304
281
  width: 80
305
282
  },
@@ -415,41 +392,55 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
415
392
  }
416
393
 
417
394
  async importHandler(patches) {
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'))
427
- }
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'))
395
+ if (patches && patches.length) {
396
+ patches = patches.map(patch => {
397
+ if (this._warehouseId) {
398
+ patch.warehouse = { id: this._warehouseId }
431
399
  }
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'))
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
436
412
  }
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'))
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 }
441
435
  }
442
- return itm
436
+ return patch
443
437
  })
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`
438
+
439
+ try {
440
+ this.dataGrist.showSpinner()
441
+
442
+ const response = await client.query({
443
+ query: gql`
453
444
  mutation updateMultipleLocation($patches: [LocationPatch!]!) {
454
445
  updateMultipleLocation(patches: $patches) {
455
446
  name
@@ -462,82 +453,27 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
462
453
  })
463
454
 
464
455
  if (!response.errors) {
465
- history.back()
466
456
  this._clearTempLocation()
467
457
  document.dispatchEvent(
468
458
  new CustomEvent('notify', {
469
459
  detail: {
470
- message: i18next.t('text.data_imported_successfully')
460
+ message: i18next.t('text.data_updated_successfully')
471
461
  }
472
462
  })
473
463
  )
474
464
  }
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
465
+ } catch (e) {
466
+ document.dispatchEvent(
467
+ new CustomEvent('notify', {
468
+ detail: {
469
+ level: error,
470
+ message: e
513
471
  }
514
472
  })
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
- }
473
+ )
474
+ } finally {
475
+ this.dataGrist.hideSpinner()
538
476
  }
539
- } catch (e) {
540
- showToast(e)
541
477
  }
542
478
  }
543
479
 
@@ -570,12 +506,15 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
570
506
  ids = []
571
507
  this._clearTempLocation()
572
508
  }
573
- } else {
574
- CustomAlert({
575
- title: i18next.t('text.nothing_selected'),
576
- text: i18next.t('text.there_is_nothing_to_delete')
577
- })
578
- }
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
+ )
579
518
  }
580
519
  }
581
520
  })
@@ -616,7 +555,6 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
616
555
  text: i18next.t('text.you_wont_be_able_to_revert_this'),
617
556
  type: 'warning',
618
557
  confirmButton: { text: i18next.t('button.delete_all'), color: '#22a6a7' },
619
-
620
558
  cancelButton: { text: i18next.t('button.cancel'), color: '#cfcfcf' },
621
559
  callback: async result => {
622
560
  if (result.value && name !== '') {
@@ -629,7 +567,6 @@ class LocationList extends connect(store)(localize(i18next)(PageView)) {
629
567
  variables: { warehouseId: this._warehouseId }
630
568
  })
631
569
  if (!response.errors) this._clearTempLocation()
632
- this.showToast({ message: i18next.t('text.all_locations_are_deleted') })
633
570
  }
634
571
  }
635
572
  })