@things-factory/operato-wms 4.0.29 → 4.0.30

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 (26) hide show
  1. package/client/fetch-setting-value.js +10 -2
  2. package/client/pages/bulk-operation/bulk-operation.js +33 -10
  3. package/client/pages/components/vas-templates/vas-pallet-add-popup.js +12 -11
  4. package/client/pages/components/vas-templates/vas-relabel.js +57 -34
  5. package/client/pages/components/vas-templates/vas-repack-relabel.js +56 -36
  6. package/client/pages/components/vas-templates/vas-repack.js +45 -31
  7. package/client/pages/components/vas-templates/vas-repalletizing.js +58 -39
  8. package/client/pages/components/vas-templates/vas-unpack.js +38 -24
  9. package/client/pages/order/arrival-notice/arrival-notice-detail.js +36 -44
  10. package/client/pages/order/arrival-notice/arrival-notice-list.js +2 -5
  11. package/client/pages/order/release-order/b2b/b2b-order-list.js +1 -5
  12. package/client/pages/order/release-order/batch-picking-popup.js +3 -2
  13. package/client/pages/order/release-order/release-extra-product-popup.js +7 -5
  14. package/client/pages/order/release-order/release-order-detail.js +28 -11
  15. package/client/pages/order/transport-order/delivery-note-popup.js +2 -2
  16. package/client/pages/outbound/packing-worksheet-list.js +64 -4
  17. package/client/pages/outbound/picking-product.js +9 -5
  18. package/client/pages/outbound/worksheet-batch-picking.js +1 -1
  19. package/client/pages/outbound/worksheet-picking.js +2 -2
  20. package/client/pages/vas/abstract-execute-vas.js +4 -1
  21. package/client/pages/vas/execute-pure-vas.js +3 -8
  22. package/package.json +52 -52
  23. package/translations/en.json +1 -0
  24. package/translations/ko.json +1 -0
  25. package/translations/ms.json +1 -0
  26. package/translations/zh.json +1 -0
@@ -3,7 +3,7 @@ import { SingleColumnFormStyles } from '@things-factory/form-ui'
3
3
  import '@things-factory/grist-ui'
4
4
  import { i18next, localize } from '@things-factory/i18n-base'
5
5
  import { client, CustomAlert } from '@things-factory/shell'
6
- import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
6
+ import { isMobileDevice } from '@things-factory/utils'
7
7
  import gql from 'graphql-tag'
8
8
  import { css, html } from 'lit-element'
9
9
  import { PALLET_TYPES, REUSABLE_PALLET } from '../../constants'
@@ -354,13 +354,13 @@ class VasRepalletizing extends localize(i18next)(VasTemplate) {
354
354
  this.stdQtyInput.focus()
355
355
  throw new Error(i18next.t('text.invalid_quantity_input'))
356
356
  }
357
- if (stdQty > this.targetInfo.qty) {
358
- this.stdQtyInput.value = this.targetInfo.qty
357
+ if (stdQty > this.targetInfo[0].qty) {
358
+ this.stdQtyInput.value = this.targetInfo[0].qty
359
359
  this.stdQtyInput.focus()
360
360
  throw new Error(i18next.t('text.qty_exceed_limit'))
361
361
  }
362
362
 
363
- if (this.targetInfo.qty % stdQty) {
363
+ if (this.targetInfo[0].qty % stdQty) {
364
364
  this.stdQtyInput.value = 1
365
365
  this.stdQtyInput.focus()
366
366
  throw new Error(i18next.t('text.qty_cannot_be_divided_completely'))
@@ -369,7 +369,7 @@ class VasRepalletizing extends localize(i18next)(VasTemplate) {
369
369
 
370
370
  adjustPalletQty() {
371
371
  const stdQty = Number(this.stdQtyInput.value)
372
- let maxPalletQtyByStd = this.targetInfo.qty / stdQty
372
+ let maxPalletQtyByStd = this.targetInfo[0].qty / stdQty
373
373
 
374
374
  if (maxPalletQtyByStd < 0) {
375
375
  this.stdQtyInput.value = ''
@@ -397,14 +397,15 @@ class VasRepalletizing extends localize(i18next)(VasTemplate) {
397
397
 
398
398
  const response = await client.query({
399
399
  query: gql`
400
- query {
401
- locationByName(${gqlBuilder.buildArgs({
402
- name: locationName
403
- })}) {
400
+ query locationByName($name: String!) {
401
+ locationByName(name: $name) {
404
402
  id
405
403
  }
406
404
  }
407
- `
405
+ `,
406
+ variables: {
407
+ name: locationName
408
+ }
408
409
  })
409
410
 
410
411
  if (!response.errors) {
@@ -420,19 +421,21 @@ class VasRepalletizing extends localize(i18next)(VasTemplate) {
420
421
  async fetchAvailablePalletQty() {
421
422
  const response = await client.query({
422
423
  query: gql`
423
- query {
424
- pallets(${gqlBuilder.buildArgs({
425
- filters: [
426
- {
427
- name: 'inventory',
428
- operator: 'is_null'
429
- }
430
- ]
431
- })}) {
424
+ query pallets($filters: [Filter!]) {
425
+ pallets(filters: $filters) {
432
426
  total
433
427
  }
434
428
  }
435
- `
429
+ `,
430
+ variables: {
431
+ filters: [
432
+ {
433
+ name: 'inventory',
434
+ operator: 'is_null',
435
+ value: ''
436
+ }
437
+ ]
438
+ }
436
439
  })
437
440
 
438
441
  if (!response.errors) {
@@ -443,17 +446,28 @@ class VasRepalletizing extends localize(i18next)(VasTemplate) {
443
446
  async repallet() {
444
447
  try {
445
448
  this._checkRepalletizable()
446
- await client.query({
447
- query: gql`
448
- mutation {
449
- repalletizing(${gqlBuilder.buildArgs({
450
- worksheetDetailName: this.record.name,
451
- fromPalletId: this.fromPalletIdInput.value,
452
- toPalletId: this.toPalletIdInput.value,
453
- locationName: this.locationInput.value
454
- })})
449
+ await client.mutate({
450
+ mutation: gql`
451
+ mutation repalletizing(
452
+ $worksheetDetailName: String!
453
+ $fromPalletId: String!
454
+ $toPalletId: String!
455
+ $locationName: String!
456
+ ) {
457
+ repalletizing(
458
+ worksheetDetailName: $worksheetDetailName
459
+ fromPalletId: $fromPalletId
460
+ toPalletId: $toPalletId
461
+ locationName: $locationName
462
+ )
455
463
  }
456
- `
464
+ `,
465
+ variables: {
466
+ worksheetDetailName: this.record.name,
467
+ fromPalletId: this.fromPalletIdInput.value,
468
+ toPalletId: this.toPalletIdInput.value,
469
+ locationName: this.locationInput.value
470
+ }
457
471
  })
458
472
 
459
473
  this.dispatchEvent(
@@ -469,16 +483,21 @@ class VasRepalletizing extends localize(i18next)(VasTemplate) {
469
483
 
470
484
  async undoRepallet(worksheetDetailName, toPalletId) {
471
485
  try {
472
- await client.query({
473
- query: gql`
474
- mutation {
475
- undoRepalletizing(${gqlBuilder.buildArgs({
476
- worksheetDetailName,
477
- fromPalletId: this.fromPalletIdInput.value,
478
- toPalletId
479
- })})
486
+ await client.mutate({
487
+ mutation: gql`
488
+ mutation undoRepalletizing($worksheetDetailName: String!, $fromPalletId: String!, $toPalletId: String!) {
489
+ undoRepalletizing(
490
+ worksheetDetailName: $worksheetDetailName
491
+ fromPalletId: $fromPalletId
492
+ toPalletId: $toPalletId
493
+ )
480
494
  }
481
- `
495
+ `,
496
+ variables: {
497
+ worksheetDetailName,
498
+ fromPalletId: this.fromPalletIdInput.value,
499
+ toPalletId
500
+ }
482
501
  })
483
502
 
484
503
  this.dispatchEvent(
@@ -2,8 +2,7 @@ import '@things-factory/barcode-ui'
2
2
  import { SingleColumnFormStyles } from '@things-factory/form-ui'
3
3
  import '@things-factory/grist-ui'
4
4
  import { i18next, localize } from '@things-factory/i18n-base'
5
- import { client, CustomAlert } from '@things-factory/shell'
6
- import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
5
+ import { client } from '@things-factory/shell'
7
6
  import gql from 'graphql-tag'
8
7
  import { css, html } from 'lit-element'
9
8
  import { ORDER_TYPES } from '../../constants'
@@ -182,10 +181,8 @@ class VasUnpack extends localize(i18next)(VasTemplate) {
182
181
 
183
182
  const response = await client.query({
184
183
  query: gql`
185
- query {
186
- products(${gqlBuilder.buildArgs({
187
- filters
188
- })}) {
184
+ query products($filters: [Filter!]) {
185
+ products(filters: $filters) {
189
186
  items {
190
187
  id
191
188
  name
@@ -198,7 +195,10 @@ class VasUnpack extends localize(i18next)(VasTemplate) {
198
195
  total
199
196
  }
200
197
  }
201
- `
198
+ `,
199
+ variables: {
200
+ filters
201
+ }
202
202
  })
203
203
 
204
204
  if (response && !response.errors) {
@@ -211,10 +211,8 @@ class VasUnpack extends localize(i18next)(VasTemplate) {
211
211
 
212
212
  const response = await client.query({
213
213
  query: gql`
214
- query {
215
- products(${gqlBuilder.buildArgs({
216
- filters
217
- })}) {
214
+ query products($filters: [Filter!]) {
215
+ products(filters: $filters) {
218
216
  items {
219
217
  id
220
218
  name
@@ -227,7 +225,8 @@ class VasUnpack extends localize(i18next)(VasTemplate) {
227
225
  total
228
226
  }
229
227
  }
230
- `
228
+ `,
229
+ variables: { filters }
231
230
  })
232
231
 
233
232
  if (response && !response.errors) {
@@ -238,19 +237,34 @@ class VasUnpack extends localize(i18next)(VasTemplate) {
238
237
  async unpack() {
239
238
  try {
240
239
  this._checkUnpackable()
241
- await client.query({
242
- query: gql`
243
- mutation {
244
- unpacking(${gqlBuilder.buildArgs({
245
- worksheetDetailName: this.record.name,
246
- childProductId: this.childProductSelector.value,
247
- unpackQty: parseInt(this.unpackQtyInput.value || 0),
248
- unpackUomValue: parseFloat(this.unpackUomValueInput.value || 0),
249
- palletId: this.palletInput.value,
250
- locationName: this.locationInput.value
251
- })})
240
+ await client.mutate({
241
+ mutation: gql`
242
+ mutation unpacking(
243
+ $worksheetDetailName: String!
244
+ $childProductId: String!
245
+ $unpackQty: Int!
246
+ $unpackUomValue: Float!
247
+ $palletId: String
248
+ $locationName: String
249
+ ) {
250
+ unpacking(
251
+ worksheetDetailName: $worksheetDetailName
252
+ childProductId: $childProductId
253
+ unpackQty: $unpackQty
254
+ unpackUomValue: $unpackUomValue
255
+ palletId: $palletId
256
+ locationName: $locationName
257
+ )
252
258
  }
253
- `
259
+ `,
260
+ variables: {
261
+ worksheetDetailName: this.record.name,
262
+ childProductId: this.childProductSelector.value,
263
+ unpackQty: parseInt(this.unpackQtyInput.value || 0),
264
+ unpackUomValue: parseFloat(this.unpackUomValueInput.value || 0),
265
+ palletId: this.palletInput.value,
266
+ locationName: this.locationInput.value
267
+ }
254
268
  })
255
269
 
256
270
  this.dispatchEvent(
@@ -173,6 +173,7 @@ class ArrivalNoticeDetail extends localize(i18next)(PageView) {
173
173
  get context() {
174
174
  var titleName = i18next.t('title.arrival_notice_detail')
175
175
  this._vasExpanded = false
176
+ this._showAssignWarehouse = false
176
177
  var actions = [
177
178
  {
178
179
  title: i18next.t('button.back'),
@@ -251,55 +252,46 @@ class ArrivalNoticeDetail extends localize(i18next)(PageView) {
251
252
  action: this._assignBufferLocation.bind(this),
252
253
  ...CommonButtonStyles.warehouse
253
254
  })
255
+ this._showAssignWarehouse = true
256
+ } else if (
257
+ this._status === ORDER_STATUS.PENDING_APPROVAL.value &&
258
+ this.productData.records.some(
259
+ product =>
260
+ product.status === ORDER_PRODUCT_STATUS.ADDED.value || product.status === ORDER_PRODUCT_STATUS.EDITED.value
261
+ )
262
+ ) {
263
+ actions.push({
264
+ title: i18next.t('button.product_changes'),
265
+ action: this.openProductChangesPopup.bind(this),
266
+ ...CommonButtonStyles.inspect
267
+ })
254
268
  }
255
- }
256
-
257
- if (this._status === ORDER_STATUS.ARRIVED.value && this.isUserBelongsDomain) {
258
- this._showAssignWarehouse = true
259
269
  } else {
260
- this._showAssignWarehouse = false
261
- }
262
-
263
- if (
264
- !this.isUserBelongsDomain &&
265
- this._status === ORDER_STATUS.PENDING_APPROVAL.value &&
266
- this.productData.records.some(
267
- product =>
268
- product.status === ORDER_PRODUCT_STATUS.ADDED.value || product.status === ORDER_PRODUCT_STATUS.EDITED.value
269
- )
270
- ) {
271
- actions.push({
272
- title: i18next.t('button.inspect_changes'),
273
- action: this.openApproveProductPopup.bind(this),
274
- ...CommonButtonStyles.approve
275
- })
276
- }
270
+ if (
271
+ this._status === ORDER_STATUS.PENDING_APPROVAL.value &&
272
+ this.productData.records.some(
273
+ product =>
274
+ product.status === ORDER_PRODUCT_STATUS.ADDED.value || product.status === ORDER_PRODUCT_STATUS.EDITED.value
275
+ )
276
+ ) {
277
+ actions.push({
278
+ title: i18next.t('button.inspect_changes'),
279
+ action: this.openApproveProductPopup.bind(this),
280
+ ...CommonButtonStyles.approve
281
+ })
282
+ }
277
283
 
278
- if (
279
- this.isUserBelongsDomain &&
280
- this._status === ORDER_STATUS.PENDING_APPROVAL.value &&
281
- this.productData.records.some(
282
- product =>
283
- product.status === ORDER_PRODUCT_STATUS.ADDED.value || product.status === ORDER_PRODUCT_STATUS.EDITED.value
284
- )
285
- ) {
286
- actions.push({
287
- title: i18next.t('button.product_changes'),
288
- action: this.openProductChangesPopup.bind(this),
289
- ...CommonButtonStyles.inspect
290
- })
284
+ if (this._status !== ORDER_STATUS.PENDING.value && this._status !== ORDER_STATUS.PENDING_APPROVAL.value) {
285
+ actions.push({
286
+ title: i18next.t('button.duplicate'),
287
+ action: () => window.open(`duplicate_arrival_notice/${this._ganNo}`),
288
+ ...CommonButtonStyles.copy
289
+ })
290
+ }
291
291
  }
292
292
 
293
- if (
294
- !this.isUserBelongsDomain &&
295
- this._status !== ORDER_STATUS.PENDING.value &&
296
- this._status !== ORDER_STATUS.PENDING_APPROVAL.value
297
- ) {
298
- actions.push({
299
- title: i18next.t('button.duplicate'),
300
- action: () => window.open(`duplicate_arrival_notice/${this._ganNo}`),
301
- ...CommonButtonStyles.copy
302
- })
293
+ if (this._status === ORDER_STATUS.REJECTED.value) {
294
+ titleName = i18next.t('title.rejected_arrival_notice_detail')
303
295
  }
304
296
 
305
297
  return {
@@ -234,11 +234,8 @@ class ArrivalNoticeList extends localize(i18next)(PageView) {
234
234
  handlers: {
235
235
  click: (columns, data, column, record, rowIndex) => {
236
236
  const status = record.status
237
- if (status === ORDER_STATUS.REJECTED.value) {
238
- navigate(`rejected_arrival_notice/${record.name}`) // 1. move to rejected detail page
239
- } else {
240
- navigate(`arrival_notice_detail/${record.name}`)
241
- }
237
+
238
+ navigate(`arrival_notice_detail/${record.name}`)
242
239
  }
243
240
  }
244
241
  },
@@ -420,11 +420,7 @@ class B2bOrderList extends localize(i18next)(PageView) {
420
420
  }
421
421
  `,
422
422
  variables: {
423
- filters: [
424
- ...(await this.searchForm.getQueryFilters()),
425
- { name: 'type', operator: 'eq', value: 'b2b' },
426
- { name: 'status', operator: 'notin', value: '' }
427
- ],
423
+ filters: [...(await this.searchForm.getQueryFilters()), { name: 'type', operator: 'eq', value: 'b2b' }],
428
424
  pagination: { page, limit },
429
425
  sortings: sorters
430
426
  }
@@ -8,6 +8,7 @@ import { css, html, LitElement } from 'lit-element'
8
8
  import gql from 'graphql-tag'
9
9
  import { ScrollbarStyles } from '@things-factory/styles'
10
10
  import { ORDER_STATUS, RO_TYPES } from '../../constants'
11
+ import { fetchSettingRule } from '../../../fetch-setting-value'
11
12
  import '@things-factory/biz-ui'
12
13
 
13
14
  class BatchPickingPopup extends localize(i18next)(LitElement) {
@@ -152,7 +153,6 @@ class BatchPickingPopup extends localize(i18next)(LitElement) {
152
153
  name: 'type',
153
154
  type: 'select',
154
155
  options: Object.keys(RO_TYPES).map(map => {
155
- debugger
156
156
  return { name: RO_TYPES[map].name, value: RO_TYPES[map].value }
157
157
  }),
158
158
  props: { searchOper: 'eq' }
@@ -292,7 +292,8 @@ class BatchPickingPopup extends localize(i18next)(LitElement) {
292
292
  { name: 'bizplaceId', operator: 'eq', value: this.partnerBizplace.id }
293
293
  ]
294
294
 
295
- const pagination = { page, limit }
295
+ let batchLimit = await fetchSettingRule('batch-picking-limit')
296
+ const pagination = { page, limit: batchLimit && !!parseInt(batchLimit) ? parseInt(batchLimit) : 20 }
296
297
  const sortings = sorters
297
298
 
298
299
  const response = await client.query({
@@ -120,7 +120,7 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
120
120
  .mode="${isMobileDevice() ? 'LIST' : 'GRID'}"
121
121
  .config="${this.existingInventoryGristConfig}"
122
122
  .data="${this.existingInventoryData}"
123
- @record-change="${this._onProductChangeHandler.bind(this)}"
123
+ @record-change="${this._onProductChangeHandler.bind(this, 'existing')}"
124
124
  @field-change="${this._onExistingInventoryFieldChanged.bind(this)}"
125
125
  ></data-grist>
126
126
  </div>
@@ -136,7 +136,7 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
136
136
  .mode="${isMobileDevice() ? 'LIST' : 'GRID'}"
137
137
  .config="${this.inventoryGristConfig}"
138
138
  .data="${this.inventoryData}"
139
- @record-change="${this._onProductChangeHandler.bind(this)}"
139
+ @record-change="${this._onProductChangeHandler.bind(this, 'new')}"
140
140
  @field-change="${this._onInventoryFieldChanged.bind(this)}"
141
141
  ></data-grist>
142
142
  </div>
@@ -700,15 +700,17 @@ export class ReleaseExtraProductPopup extends localize(i18next)(LitElement) {
700
700
  }
701
701
  }
702
702
 
703
- _onProductChangeHandler(event) {
703
+ _onProductChangeHandler(gristType, event) {
704
704
  const changeRecord = event.detail.after
705
705
  const beforeRecord = event.detail.before
706
706
  const changedColumn = event.detail.column.name
707
707
  var totalAvailableQty = 0
708
708
  var totalAvailableUomValue = 0
709
709
 
710
- totalAvailableQty = beforeRecord.addableQty + beforeRecord.releaseQty
711
- totalAvailableUomValue = beforeRecord.addableUomValue + beforeRecord.releaseUomValue
710
+ if (gristType == 'existing') {
711
+ totalAvailableQty = beforeRecord.addableQty + beforeRecord.releaseQty
712
+ totalAvailableUomValue = beforeRecord.addableUomValue + beforeRecord.releaseUomValue
713
+ }
712
714
 
713
715
  try {
714
716
  if (changedColumn === 'releaseQty') {
@@ -195,6 +195,8 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
195
195
  } else {
196
196
  this._warehouseTransportInput.checked = true
197
197
  this._warehouseTransport = true
198
+ this._exportInput = false
199
+ this._exportOption = false
198
200
  }
199
201
  this._validateTransport()
200
202
  }}"
@@ -212,6 +214,8 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
212
214
  if (this._warehouseTransport) {
213
215
  this._ownTransportInput.checked = false
214
216
  this._ownTransport = false
217
+ this._exportInput.checked = false
218
+ this._exportOption = false
215
219
  } else {
216
220
  this._ownTransportInput.checked = true
217
221
  this._ownTransport = true
@@ -247,6 +251,16 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
247
251
  ?disabled="${!this?._editable}"
248
252
  @change="${e => {
249
253
  this._exportOption = e.currentTarget.checked
254
+ if (this._exportOption == true) {
255
+ this._warehouseTransportInput.checked = false
256
+ this._warehouseTransport = false
257
+ this._ownTransportInput.checked = true
258
+ this._ownTransport = true
259
+ }
260
+ if (this._warehouseTransport) {
261
+ this._exportInput.checked = false
262
+ this._exportOption = false
263
+ }
250
264
  }}"
251
265
  />
252
266
  <label for="exportOption">${i18next.t('label.export')}</label>
@@ -345,8 +359,8 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
345
359
  .value="${this._containerArrivalDate}"
346
360
  @change="${e => {
347
361
  this._containerLeavingDateInput.setAttribute('min', e.currentTarget.value)
348
- required
349
362
  }}"
363
+ required
350
364
  />
351
365
 
352
366
  <label>${i18next.t('label.container_leaving_date')}</label>
@@ -357,8 +371,8 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
357
371
  .value="${this._containerLeavingDate}"
358
372
  @change="${e => {
359
373
  this._containerArrivalDateInput.setAttribute('max', e.currentTarget.value)
360
- required
361
374
  }}"
375
+ required
362
376
  />
363
377
 
364
378
  <label>${i18next.t('label.ship_name')}</label>
@@ -415,10 +429,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
415
429
  }
416
430
 
417
431
  get context() {
418
- this._vasExpanded = false
419
- let userIsOfficeAdmin = this._userRoles
420
- ? this._userRoles.find(x => x.name?.toLowerCase() === 'office admin')
421
- : false
432
+ this._vasExpanded = false ? this._userRoles.find(x => x.name?.toLowerCase() === 'office admin') : false
422
433
 
423
434
  var actions = [
424
435
  {
@@ -545,6 +556,10 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
545
556
  return this.shadowRoot.querySelector('input[name=warehouseTransport]')
546
557
  }
547
558
 
559
+ get _exportInput() {
560
+ return this.shadowRoot.querySelector('input[name=exportOption]')
561
+ }
562
+
548
563
  get _containerArrivalDateInput() {
549
564
  return this.shadowRoot.querySelector('input[name=containerArrivalDate]')
550
565
  }
@@ -917,11 +932,6 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
917
932
  this._releaseOrderId = releaseOrder.id
918
933
  this.partnerBizplaceId = releaseOrder.bizplace.id
919
934
  this._exportOption = releaseOrder.exportOption
920
- if (this._exportOption) {
921
- this._ownTransport = true
922
- } else if (!this._exportOption) {
923
- this._ownTransport = releaseOrder.ownTransport
924
- }
925
935
 
926
936
  this._courierOption = releaseOrder.courierOption
927
937
  this._packingOption = releaseOrder.packingOption
@@ -942,6 +952,13 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
942
952
  this._fillupSOForm(shippingOrder)
943
953
  }
944
954
 
955
+ if (this._exportOption) {
956
+ this._ownTransport = true
957
+ this._ownTransportInput.checked = true
958
+ } else if (!this._exportOption) {
959
+ this._ownTransport = releaseOrder.ownTransport
960
+ }
961
+
945
962
  if (releaseOrder && releaseOrder?.attachment) {
946
963
  this._attachments = releaseOrder && releaseOrder.attachment
947
964
  }
@@ -520,7 +520,7 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
520
520
  if (this.manualDo) {
521
521
  response = await client.mutate({
522
522
  mutation: gql`
523
- mutation dispatchManualDeliveryOrder($orderInfo: DeliveryOrderPatch, $orderItems: [OrderInventoryPatch]) {
523
+ mutation dispatchManualDeliveryOrder($orderInfo: DeliveryOrderPatch, $orderItems: [OrderInventoryPatch!]) {
524
524
  dispatchManualDeliveryOrder(orderInfo: $orderInfo, orderItems: $orderItems) {
525
525
  id
526
526
  name
@@ -537,7 +537,7 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
537
537
  } else {
538
538
  response = await client.mutate({
539
539
  mutation: gql`
540
- mutation dispatchDeliveryOrder($orderInfo: DeliveryOrderPatch, $orderItems: [OrderInventoryPatch]) {
540
+ mutation dispatchDeliveryOrder($orderInfo: DeliveryOrderPatch, $orderItems: [OrderInventoryPatch!]) {
541
541
  dispatchDeliveryOrder(orderInfo: $orderInfo, orderItems: $orderItems) {
542
542
  id
543
543
  name
@@ -6,8 +6,8 @@ import { css, html } from 'lit-element'
6
6
 
7
7
  import { getCodeByName } from '@things-factory/code-base'
8
8
  import { i18next, localize } from '@things-factory/i18n-base'
9
- import { client, navigate, PageView } from '@things-factory/shell'
10
- import { ScrollbarStyles } from '@things-factory/styles'
9
+ import { client, navigate, PageView, CustomAlert } from '@things-factory/shell'
10
+ import { ScrollbarStyles, CommonButtonStyles } from '@things-factory/styles'
11
11
  import { isMobileDevice } from '@things-factory/utils'
12
12
 
13
13
  import { WORKSHEET_TYPE } from '../constants'
@@ -57,6 +57,13 @@ class PackingWorksheetList extends localize(i18next)(PageView) {
57
57
  get context() {
58
58
  return {
59
59
  title: i18next.t('title.packing_worksheet_list'),
60
+ actions: [
61
+ {
62
+ title: i18next.t('button.activate'),
63
+ action: this._activateWorksheet.bind(this),
64
+ ...CommonButtonStyles.activate
65
+ }
66
+ ],
60
67
  exportable: {
61
68
  name: i18next.t('title.packing_worksheet_list'),
62
69
  data: this._exportableData.bind(this)
@@ -159,11 +166,11 @@ class PackingWorksheetList extends localize(i18next)(PageView) {
159
166
  list: {
160
167
  fields: ['releaseGood', 'bizplace', 'type', 'releaseRefNo', 'status', 'startedAt', 'endedAt']
161
168
  },
162
- rows: { appendable: false },
169
+ rows: { appendable: false, selectable: { multiple: true } },
163
170
  pagination: { limit: 100, pages: [20, 50, 100, 200, 500] },
164
171
  columns: [
165
- { type: 'gutter', gutterName: 'dirty' },
166
172
  { type: 'gutter', gutterName: 'sequence' },
173
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
167
174
  {
168
175
  type: 'gutter',
169
176
  gutterName: 'button',
@@ -344,6 +351,48 @@ class PackingWorksheetList extends localize(i18next)(PageView) {
344
351
  }
345
352
  }
346
353
 
354
+ async _activateWorksheet() {
355
+ try {
356
+ let selectedItem = this.dataGrist.selected.filter(i => i.status == 'DEACTIVATED')
357
+ if (selectedItem.length > 0) {
358
+ const result = await CustomAlert({
359
+ title: i18next.t('title.are_you_sure'),
360
+ text: i18next.t('text.activate_packing_worksheet'),
361
+ confirmButton: { text: i18next.t('button.confirm') },
362
+ cancelButton: { text: i18next.t('button.cancel') }
363
+ })
364
+
365
+ if (!result.value) {
366
+ return
367
+ }
368
+
369
+ const response = await client.mutate({
370
+ mutation: gql`
371
+ mutation activatePacking($worksheetNo: [String!]!) {
372
+ activatePacking(worksheetNo: $worksheetNo) {
373
+ id
374
+ name
375
+ }
376
+ }
377
+ `,
378
+ variables: {
379
+ worksheetNo: selectedItem.map(itm => {
380
+ return itm.name
381
+ })
382
+ }
383
+ })
384
+
385
+ if (!response.errors) {
386
+ this._showToast({ message: i18next.t('text.worksheet_activated') })
387
+ }
388
+ }
389
+ } catch (e) {
390
+ this._showToast(e)
391
+ } finally {
392
+ this.dataGrist.fetch()
393
+ }
394
+ }
395
+
347
396
  _modifyDateRange(e) {
348
397
  const fromDate = e.currentTarget.value
349
398
 
@@ -409,6 +458,17 @@ class PackingWorksheetList extends localize(i18next)(PageView) {
409
458
  })
410
459
  return { header: headerSetting, data: data }
411
460
  }
461
+
462
+ _showToast({ type, message }) {
463
+ document.dispatchEvent(
464
+ new CustomEvent('notify', {
465
+ detail: {
466
+ type,
467
+ message
468
+ }
469
+ })
470
+ )
471
+ }
412
472
  }
413
473
 
414
474
  window.customElements.define('packing-worksheet-list', PackingWorksheetList)