@things-factory/operato-wms 4.0.41 → 4.0.45

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.
@@ -1,8 +1,9 @@
1
1
  import '@things-factory/barcode-ui'
2
2
  import '@things-factory/grist-ui'
3
- import './scan-inventory-popup'
3
+ import './undo-putaway-popup'
4
4
  import './select-location-popup'
5
5
  import '../components/worksheet-information-popup'
6
+ import './putaway-same-carton-popup'
6
7
 
7
8
  import gql from 'graphql-tag'
8
9
  import { css, html } from 'lit-element'
@@ -46,7 +47,9 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
46
47
  _productSku: String,
47
48
  _selectedTaskStatus: String,
48
49
  _scanning: Boolean,
49
- _worksheetInfo: Object
50
+ _worksheetInfo: Object,
51
+ _records: Array,
52
+ _selectedLocation: String
50
53
  }
51
54
  }
52
55
 
@@ -130,7 +133,7 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
130
133
  }
131
134
 
132
135
  get locationInput() {
133
- return this.shadowRoot.querySelector('barcode-scanable-input[name=locationCode]').shadowRoot.querySelector('input')
136
+ return this.shadowRoot.querySelector('barcode-scanable-input[name=locationCode]')?.shadowRoot.querySelector('input')
134
137
  }
135
138
 
136
139
  get newLocationInput() {
@@ -187,6 +190,8 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
187
190
  e.preventDefault()
188
191
  if (this.orderNoInput.value) {
189
192
  this._fetchProducts(this.orderNoInput.value)
193
+ this.incompleteLocationName = false
194
+ this.updateContext()
190
195
  }
191
196
  }
192
197
  }}"
@@ -194,7 +199,7 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
194
199
  </fieldset>
195
200
  </form>
196
201
 
197
- <form id="input-form" class="multi-column-form" @keypress="${this._transactionHandler.bind(this)}">
202
+ <form id="input-form" class="multi-column-form" @keypress="${this._putaway.bind(this)}">
198
203
  <fieldset>
199
204
  ${this.recommendLocationName
200
205
  ? html` <label>${i18next.t('label.recommend_location')}</label>
@@ -210,12 +215,32 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
210
215
  <barcode-scanable-input name="palletId" .value=${this._pallet} custom-input></barcode-scanable-input>
211
216
  `}
212
217
  ${this._operationType === OPERATION_TYPE.PUTAWAY
213
- ? html` <label>${i18next.t('label.location')}</label>
214
- <barcode-scanable-input
215
- name="locationCode"
216
- .value=${this._location}
217
- custom-input
218
- ></barcode-scanable-input>`
218
+ ? html`
219
+ ${!this.incompleteLocationName
220
+ ? html` <label>${i18next.t('label.location')}</label>
221
+ <barcode-scanable-input
222
+ name="locationCode"
223
+ .value=${this._location}
224
+ custom-input
225
+ ></barcode-scanable-input>`
226
+ : ''}
227
+ <select
228
+ ?hidden="${!this.incompleteLocationName}"
229
+ name="newLocationCode"
230
+ @change="${e => (this._selectedLocation = e.currentTarget.value)}"
231
+ >
232
+ <option value="">-- ${i18next.t('text.please_select_the_location')} --</option>
233
+ ${(this.locations || []).map(
234
+ location =>
235
+ html`
236
+ <option value="${location && location.name}">
237
+ ${location && location.name}
238
+ ${location && location.status ? ` (${location && location.status})` : ''}
239
+ </option>
240
+ `
241
+ )}
242
+ </select>
243
+ `
219
244
  : ''}
220
245
  ${this._operationType === OPERATION_TYPE.TRANSFER
221
246
  ? html` <label>${i18next.t('label.to_lot_barcode')}</label>
@@ -262,6 +287,7 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
262
287
  this._expirationPeriod = 0
263
288
  this._expirationDate = 0
264
289
  this._locationType = ''
290
+ this._records = []
265
291
  }
266
292
 
267
293
  get completed() {
@@ -710,68 +736,58 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
710
736
  if (this._scanning === false) {
711
737
  this._scanning = true
712
738
  try {
713
- await this._validatePutaway()
714
- if (!this.incompleteLocationName) {
715
- let worksheetDetailNames = []
716
- const locationDetails = await this._fetchLocation(this.locationInput.value.trim())
739
+ const locationDetails = await this._fetchLocation(
740
+ this.locationInput ? this.locationInput.value.trim() : this._selectedLocation.trim()
741
+ )
717
742
 
718
- if (this._enableCartonLabel) {
719
- let worksheetDetails = this._getSelectedOrderProducts(this.cartonInput.value)
720
- worksheetDetails.forEach(itm => {
721
- worksheetDetailNames.push(itm.name)
722
- })
723
- if (worksheetDetails.find(itm => itm.expirationDate)) {
724
- let answer = await this._checkExpiry(worksheetDetails, locationDetails.type)
725
- if (!answer?.value) return (this._scanning = false)
726
- }
727
- } else {
728
- worksheetDetailNames.push(this._selectedOrderProduct.name)
729
- if (this._selectedOrderProduct.expirationDate) {
730
- let answer = await this._checkExpiry(this._selectedOrderProduct, locationDetails.type)
731
- if (!answer?.value) return (this._scanning = false)
732
- }
733
- }
743
+ let worksheetDetailNames = await this._getWorksheetDetailNames(locationDetails)
734
744
 
735
- const response = await client.mutate({
736
- mutation: gql`
737
- mutation putaway(
738
- $worksheetDetailName: [String]!
739
- $palletId: String
740
- $cartonId: String
741
- $toLocation: String!
742
- ) {
743
- putaway(
744
- worksheetDetailName: $worksheetDetailName
745
- palletId: $palletId
746
- cartonId: $cartonId
747
- toLocation: $toLocation
748
- )
749
- }
750
- `,
751
- variables: {
752
- worksheetDetailName: worksheetDetailNames,
753
- palletId: this._enableCartonLabel ? null : this.palletInput.value,
754
- cartonId: this._enableCartonLabel ? this.cartonInput.value : null,
755
- toLocation: this.locationInput.value
756
- }
757
- })
745
+ if (!worksheetDetailNames) {
746
+ return (this._scanning = false)
747
+ }
758
748
 
759
- if (!response.errors) {
760
- this._fetchProducts(this._orderNo)
761
- if (this._enableCartonLabel) {
762
- this.cartonInput.value = ''
763
- this._focusOnCartonInput()
764
- } else {
765
- this.palletInput.value = ''
766
- this._focusOnPalletInput()
749
+ const response = await client.mutate({
750
+ mutation: gql`
751
+ mutation putaway(
752
+ $worksheetDetailName: [String]!
753
+ $palletId: String
754
+ $cartonId: String
755
+ $toLocation: String!
756
+ ) {
757
+ putaway(
758
+ worksheetDetailName: $worksheetDetailName
759
+ palletId: $palletId
760
+ cartonId: $cartonId
761
+ toLocation: $toLocation
762
+ )
767
763
  }
768
- this._selectedTaskStatus = null
769
- this._selectedOrderProduct = null
770
- this.recommendLocationName = null
764
+ `,
765
+ variables: {
766
+ worksheetDetailName: worksheetDetailNames,
767
+ palletId: this._enableCartonLabel ? null : this.palletInput.value,
768
+ cartonId: this._enableCartonLabel ? this.cartonInput.value : null,
769
+ toLocation: this.locationInput ? this.locationInput.value : this._selectedLocation
770
+ }
771
+ })
772
+
773
+ if (!response.errors) {
774
+ this._fetchProducts(this._orderNo)
775
+ if (this._enableCartonLabel) {
776
+ this.cartonInput.value = ''
777
+ this._focusOnCartonInput()
778
+ } else {
779
+ this.palletInput.value = ''
780
+ this._focusOnPalletInput()
781
+ }
782
+ this.incompleteLocationName = false
783
+ this._selectedTaskStatus = null
784
+ this._selectedOrderProduct = null
785
+ this.recommendLocationName = null
786
+ if (this.locationInput) {
771
787
  this.locationInput.value = ''
788
+ } else {
789
+ this._selectedLocation = ''
772
790
  }
773
- } else {
774
- this._openSelectLocationPopup()
775
791
  }
776
792
  } catch (e) {
777
793
  this._showToast(e)
@@ -787,69 +803,58 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
787
803
  if (this._scanning === false) {
788
804
  this._scanning = true
789
805
  try {
790
- await this._validatePutaway()
791
- if (!this.incompleteLocationName) {
792
- let worksheetDetailNames = []
793
- const locationDetails = await this._fetchLocation(this.locationInput.value.trim())
806
+ const locationDetails = await this._fetchLocation(
807
+ this.locationInput ? this.locationInput.value.trim() : this._selectedLocation.trim()
808
+ )
794
809
 
795
- if (this._enableCartonLabel) {
796
- let worksheetDetails = this._getSelectedOrderProducts(this.cartonInput.value)
797
- worksheetDetails.forEach(itm => {
798
- worksheetDetailNames.push(itm.name)
799
- })
800
- if (worksheetDetails.find(itm => itm.expirationDate)) {
801
- let answer = await this._checkExpiry(worksheetDetails, locationDetails.type)
802
- if (!answer?.value) return (this._scanning = false)
803
- }
804
- } else {
805
- worksheetDetailNames.push(this._selectedOrderProduct.name)
806
- if (this._selectedOrderProduct.expirationDate) {
807
- let answer = await this._checkExpiry(this._selectedOrderProduct, locationDetails.type)
808
- if (!answer?.value) return (this._scanning = false)
809
- }
810
- }
810
+ let worksheetDetailNames = await this._getWorksheetDetailNames(locationDetails)
811
811
 
812
- const response = await client.mutate({
813
- mutation: gql`
814
- mutation putawayReturn(
815
- $worksheetDetailName: [String]!
816
- $palletId: String
817
- $cartonId: String
818
- $toLocation: String!
819
- ) {
820
- putawayReturn(
821
- worksheetDetailName: $worksheetDetailName
822
- palletId: $palletId
823
- cartonId: $cartonId
824
- toLocation: $toLocation
825
- )
826
- }
827
- `,
828
- variables: {
829
- worksheetDetailName: worksheetDetailNames,
830
- palletId: this._enableCartonLabel ? null : this.palletInput.value,
831
- cartonId: this._enableCartonLabel ? this.cartonInput.value : null,
832
- toLocation: this.locationInput.value
833
- }
834
- })
812
+ if (!worksheetDetailNames) {
813
+ return (this._scanning = false)
814
+ }
835
815
 
836
- if (!response.errors) {
837
- this._fetchProducts(this._orderNo)
838
- if (this._enableCartonLabel) {
839
- this.cartonInput.value = ''
840
- this._focusOnCartonInput()
841
- } else {
842
- this.palletInput.value = ''
843
- this._focusOnPalletInput()
816
+ const response = await client.mutate({
817
+ mutation: gql`
818
+ mutation putawayReturn(
819
+ $worksheetDetailName: [String]!
820
+ $palletId: String
821
+ $cartonId: String
822
+ $toLocation: String!
823
+ ) {
824
+ putawayReturn(
825
+ worksheetDetailName: $worksheetDetailName
826
+ palletId: $palletId
827
+ cartonId: $cartonId
828
+ toLocation: $toLocation
829
+ )
844
830
  }
831
+ `,
832
+ variables: {
833
+ worksheetDetailName: worksheetDetailNames,
834
+ palletId: this._enableCartonLabel ? null : this.palletInput.value,
835
+ cartonId: this._enableCartonLabel ? this.cartonInput.value : null,
836
+ toLocation: this.locationInput ? this.locationInput.value : this._selectedLocation
837
+ }
838
+ })
845
839
 
846
- this._selectedTaskStatus = null
847
- this._selectedOrderProduct = null
848
- this.recommendLocationName = null
840
+ if (!response.errors) {
841
+ this._fetchProducts(this._orderNo)
842
+ if (this._enableCartonLabel) {
843
+ this.cartonInput.value = ''
844
+ this._focusOnCartonInput()
845
+ } else {
846
+ this.palletInput.value = ''
847
+ this._focusOnPalletInput()
848
+ }
849
+ this.incompleteLocationName = false
850
+ this._selectedTaskStatus = null
851
+ this._selectedOrderProduct = null
852
+ this.recommendLocationName = null
853
+ if (this.locationInput) {
849
854
  this.locationInput.value = ''
855
+ } else {
856
+ this._selectedLocation = ''
850
857
  }
851
- } else {
852
- this._openSelectLocationPopup()
853
858
  }
854
859
  } catch (e) {
855
860
  this._showToast(e)
@@ -878,57 +883,46 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
878
883
  if (this._scanning === false) {
879
884
  this._scanning = true
880
885
  try {
881
- await this._validatePutaway()
882
- if (!this.incompleteLocationName) {
883
- let worksheetDetailNames = []
884
- if (this._enableCartonLabel) {
885
- let worksheetDetails = this._getSelectedOrderProducts(this.cartonInput.value)
886
- worksheetDetails.forEach(itm => {
887
- worksheetDetailNames.push(itm.name)
888
- })
889
- } else worksheetDetailNames.push(this._selectedOrderProduct.name)
890
-
891
- const response = await client.mutate({
892
- mutation: gql`
893
- mutation returning(
894
- $worksheetDetailName: [String]!
895
- $palletId: String
896
- $cartonId: String
897
- $toLocation: String!
898
- ) {
899
- returning(
900
- worksheetDetailName: $worksheetDetailName
901
- palletId: $palletId
902
- cartonId: $cartonId
903
- toLocation: $toLocation
904
- )
905
- }
906
- `,
907
- variables: {
908
- worksheetDetailName: worksheetDetailNames,
909
- palletId: this._enableCartonLabel ? null : this.palletInput.value,
910
- cartonId: this._enableCartonLabel ? this.cartonInput.value : null,
911
- toLocation: this.locationInput.value
912
- }
913
- })
914
-
915
- if (!response.errors) {
916
- this._fetchProducts(this._orderNo)
917
- if (this._enableCartonLabel) {
918
- this.cartonInput.value = ''
919
- this._focusOnCartonInput()
920
- } else {
921
- this.palletInput.value = ''
922
- this._focusOnPalletInput()
886
+ let worksheetDetailNames = await this._getWorksheetDetailNames()
887
+
888
+ const response = await client.mutate({
889
+ mutation: gql`
890
+ mutation returning(
891
+ $worksheetDetailName: [String]!
892
+ $palletId: String
893
+ $cartonId: String
894
+ $toLocation: String!
895
+ ) {
896
+ returning(
897
+ worksheetDetailName: $worksheetDetailName
898
+ palletId: $palletId
899
+ cartonId: $cartonId
900
+ toLocation: $toLocation
901
+ )
923
902
  }
903
+ `,
904
+ variables: {
905
+ worksheetDetailName: worksheetDetailNames,
906
+ palletId: this._enableCartonLabel ? null : this.palletInput.value,
907
+ cartonId: this._enableCartonLabel ? this.cartonInput.value : null,
908
+ toLocation: this.locationInput ? this.locationInput.value : this._selectedLocation
909
+ }
910
+ })
924
911
 
925
- this._selectedTaskStatus = null
926
- this._selectedOrderProduct = null
927
- this.recommendLocationName = null
928
- this.locationInput.value = ''
912
+ if (!response.errors) {
913
+ this._fetchProducts(this._orderNo)
914
+ if (this._enableCartonLabel) {
915
+ this.cartonInput.value = ''
916
+ this._focusOnCartonInput()
917
+ } else {
918
+ this.palletInput.value = ''
919
+ this._focusOnPalletInput()
929
920
  }
930
- } else {
931
- this._openSelectLocationPopup()
921
+
922
+ this._selectedTaskStatus = null
923
+ this._selectedOrderProduct = null
924
+ this.recommendLocationName = null
925
+ this.locationInput.value = ''
932
926
  }
933
927
  } catch (e) {
934
928
  this._showToast(e)
@@ -982,17 +976,76 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
982
976
  return answer
983
977
  }
984
978
 
985
- _getSelectedOrderProducts(scannedCartonId) {
986
- return this.data.records
987
- .filter(record => record.cartonId === scannedCartonId)
988
- .map(record => {
989
- return {
990
- name: record.name,
991
- expirationDate: record.expirationDate,
992
- expirationPeriod: record.product.expirationPeriod,
993
- palletId: record.palletId
994
- }
979
+ async _getWorksheetDetailNames(locationDetails) {
980
+ let worksheetDetailNames = []
981
+ if (this._enableCartonLabel) {
982
+ this._records.forEach(itm => {
983
+ worksheetDetailNames.push(itm.name)
995
984
  })
985
+ if (this._records.find(itm => itm.expirationDate) && locationDetails) {
986
+ let answer = await this._checkExpiry(this._records, locationDetails.type)
987
+ if (answer) {
988
+ if (!answer?.value) return false
989
+ }
990
+ }
991
+ } else {
992
+ worksheetDetailNames.push(this._selectedOrderProduct.name)
993
+ if (this._selectedOrderProduct.expirationDate && locationDetails) {
994
+ let answer = await this._checkExpiry(this._selectedOrderProduct, locationDetails.type)
995
+ if (answer) {
996
+ if (!answer?.value) return false
997
+ }
998
+ }
999
+ }
1000
+ return worksheetDetailNames
1001
+ }
1002
+
1003
+ async _putaway(e) {
1004
+ if (e.keyCode === 13) {
1005
+ try {
1006
+ await this._validatePutaway()
1007
+ let records = this.data.records
1008
+ .filter(record => record.cartonId === this.cartonInput.value && record.status !== 'DONE')
1009
+ .map(record => {
1010
+ return {
1011
+ name: record.name,
1012
+ expirationDate: record.expirationDate,
1013
+ expirationPeriod: record.product.expirationPeriod,
1014
+ palletId: record.palletId
1015
+ }
1016
+ })
1017
+ if (records.length > 1) {
1018
+ this._openPutawaySameCartonPopup(this.cartonInput.value)
1019
+ } else {
1020
+ this._records = records
1021
+ this._transactionHandler(e)
1022
+ }
1023
+ } catch (e) {
1024
+ this._showToast(e)
1025
+ }
1026
+ }
1027
+ }
1028
+
1029
+ _openPutawaySameCartonPopup(scannedCartonId) {
1030
+ openPopup(
1031
+ html`
1032
+ <putaway-same-carton-popup
1033
+ .putawayInventories="${this.data.records.filter(
1034
+ record => record.cartonId === scannedCartonId && record.completed === false
1035
+ )}"
1036
+ @selections="${e => {
1037
+ this._records = e.detail
1038
+ e.keyCode = 13
1039
+ this._transactionHandler(e)
1040
+ }}"
1041
+ ></putaway-same-carton-popup>
1042
+ `,
1043
+ {
1044
+ backdrop: true,
1045
+ size: 'medium',
1046
+ title: i18next.t('title.select_product_batch')
1047
+ }
1048
+ )
996
1049
  }
997
1050
 
998
1051
  async _validatePutaway() {
@@ -1026,21 +1079,27 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
1026
1079
  }
1027
1080
 
1028
1081
  // 4. location code existing
1029
- if (!this.locationInput.value) {
1082
+ if (!this.locationInput?.value && !this._selectedLocation) {
1030
1083
  this._focusOnLocationInput()
1031
1084
  throw new Error(i18next.t('text.location_code_is_empty'))
1032
- } else if (this.locationInput.value) {
1085
+ } else if (this.locationInput?.value && !this.selectedLocation) {
1033
1086
  const foundLocation = await this._fetchLocation(this.locationInput.value.trim())
1034
1087
  if (!foundLocation) {
1035
1088
  const locationNameSplit = this.locationInput.value.split('-')
1036
1089
  if (locationNameSplit.length !== 3) throw new Error(i18next.t('text.invalid_format_of_location_id'))
1037
-
1090
+ this._focusOnNewLocationInput()
1038
1091
  const zonePortions = locationNameSplit[0].match(/[a-zA-Z0-9]+/g)
1039
1092
  const rowPortions = locationNameSplit[1].match(/[a-zA-Z0-9]+/g)
1040
1093
  const columnPortions = locationNameSplit[2].match(/[a-zA-Z0-9]+/g)
1041
1094
 
1042
1095
  this.incompleteLocationName = true
1043
1096
  this.locations = await this._fetchLocations(zonePortions[0], rowPortions[0], columnPortions[0])
1097
+ if (this.locations.length > 0) {
1098
+ this.incompleteLocationName = true
1099
+ throw new Error(i18next.t('text.please_select_the_location_again'))
1100
+ } else {
1101
+ throw new Error(i18next.t('text.invalid_return_location'))
1102
+ }
1044
1103
  } else {
1045
1104
  this.incompleteLocationName = false
1046
1105
  }
@@ -1060,8 +1119,9 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
1060
1119
  }
1061
1120
  }
1062
1121
  }
1063
-
1064
- return this._expiryAlert(expiringProducts.toString())
1122
+ if (expiringProducts.length > 0) {
1123
+ return this._expiryAlert(expiringProducts.toString())
1124
+ }
1065
1125
  }
1066
1126
 
1067
1127
  _validateTransfer() {
@@ -1191,120 +1251,41 @@ class PutawayProduct extends connect(store)(localize(i18next)(PageView)) {
1191
1251
  _openUndoPopup() {
1192
1252
  openPopup(
1193
1253
  html`
1194
- <scan-inventory-popup
1195
- .inventories="${this.data.records}"
1196
- .hasCartonLabel="${this._enableCartonLabel}"
1197
- @barcode-validated="${e => {
1198
- this._undoHandler(e.detail)
1254
+ <undo-putaway-popup
1255
+ .enableCartonLabel="${this._enableCartonLabel}"
1256
+ .orderType="${this.refOrderType}"
1257
+ .orderNo="${this._orderNo}"
1258
+ .putawayInventories="${this.data.records.filter(itm => itm.status == 'DONE')}"
1259
+ @undo-inventory="${async e => {
1260
+ history.back()
1261
+ await this._fetchProducts(this._orderNo)
1262
+ if (this._enableCartonLabel) {
1263
+ this.cartonInput.value = ''
1264
+ this._focusOnCartonInput()
1265
+ } else {
1266
+ this.palletInput.value = ''
1267
+ this._focusOnPalletInput()
1268
+ }
1269
+ this._selectedTaskStatus = null
1270
+ this._selectedOrderProduct = null
1271
+ this.recommendLocationName = null
1272
+ if (this.locationInput) {
1273
+ this.locationInput.value = ''
1274
+ } else {
1275
+ this._selectedLocation = ''
1276
+ }
1277
+ this._showToast({ message: i18next.t('text.inventory_undo_successfully') })
1199
1278
  }}"
1200
- ></scan-inventory-popup>
1279
+ ></undo-putaway-popup>
1201
1280
  `,
1202
1281
  {
1203
1282
  backdrop: true,
1204
- size: 'small',
1205
- title: i18next.t('title.scan_barcode')
1283
+ size: 'large',
1284
+ title: i18next.t('title.undo_putaway')
1206
1285
  }
1207
1286
  )
1208
1287
  }
1209
1288
 
1210
- async _undoHandler(selectedInventories) {
1211
- if (this.refOrderType === AVAIL_ORDER_TYPES.ARRIVAL_NOTICE.value) {
1212
- this._undoArrivalNoticePutaway(selectedInventories)
1213
- } else if (this.refOrderType === AVAIL_ORDER_TYPES.CUSTOMER_RETURN.value) {
1214
- this._undoCustomerReturnPutaway(selectedInventories)
1215
- }
1216
- }
1217
-
1218
- async _undoArrivalNoticePutaway(selectedInventories) {
1219
- try {
1220
- const result = await CustomAlert({
1221
- title: i18next.t('title.are_you_sure'),
1222
- text: i18next.t('text.undo_putaway'),
1223
- confirmButton: { text: i18next.t('button.confirm') },
1224
- cancelButton: { text: i18next.t('button.cancel') }
1225
- })
1226
-
1227
- if (!result.value) {
1228
- return
1229
- }
1230
-
1231
- const response = await client.mutate({
1232
- mutation: gql`
1233
- mutation undoPutaway($worksheetDetailName: [String]!, $palletId: String, $cartonId: String) {
1234
- undoPutaway(worksheetDetailName: $worksheetDetailName, palletId: $palletId, cartonId: $cartonId)
1235
- }
1236
- `,
1237
- variables: {
1238
- worksheetDetailName: selectedInventories.map(inventory => inventory.name),
1239
- palletId: this._enableCartonLabel ? null : selectedInventories[0].palletId,
1240
- cartonId: this._enableCartonLabel ? selectedInventories[0].cartonId : null
1241
- }
1242
- })
1243
-
1244
- if (!response.errors) {
1245
- this._fetchProducts(this._orderNo)
1246
- if (this._enableCartonLabel) {
1247
- this.cartonInput.value = ''
1248
- this._focusOnCartonInput()
1249
- } else {
1250
- this.palletInput.value = ''
1251
- this._focusOnPalletInput()
1252
- }
1253
- this._selectedTaskStatus = null
1254
- this._selectedOrderProduct = null
1255
- this.recommendLocationName = null
1256
- this.locationInput.value = ''
1257
- }
1258
- } catch (e) {
1259
- this._showToast(e)
1260
- }
1261
- }
1262
-
1263
- async _undoCustomerReturnPutaway(selectedInventories) {
1264
- try {
1265
- const result = await CustomAlert({
1266
- title: i18next.t('title.are_you_sure'),
1267
- text: i18next.t('text.undo_putaway'),
1268
- confirmButton: { text: i18next.t('button.confirm') },
1269
- cancelButton: { text: i18next.t('button.cancel') }
1270
- })
1271
-
1272
- if (!result.value) {
1273
- return
1274
- }
1275
-
1276
- const response = await client.mutate({
1277
- mutation: gql`
1278
- mutation undoPutawayReturn($worksheetDetailName: [String]!, $palletId: String, $cartonId: String) {
1279
- undoPutawayReturn(worksheetDetailName: $worksheetDetailName, palletId: $palletId, cartonId: $cartonId)
1280
- }
1281
- `,
1282
- variables: {
1283
- worksheetDetailName: selectedInventories.map(inventory => inventory.name),
1284
- palletId: this._enableCartonLabel ? null : selectedInventories[0].palletId,
1285
- cartonId: this._enableCartonLabel ? selectedInventories[0].cartonId : null
1286
- }
1287
- })
1288
-
1289
- if (!response.errors) {
1290
- this._fetchProducts(this._orderNo)
1291
- if (this._enableCartonLabel) {
1292
- this.cartonInput.value = ''
1293
- this._focusOnCartonInput()
1294
- } else {
1295
- this.palletInput.value = ''
1296
- this._focusOnPalletInput()
1297
- }
1298
- this._selectedTaskStatus = null
1299
- this._selectedOrderProduct = null
1300
- this.recommendLocationName = null
1301
- this.locationInput.value = ''
1302
- }
1303
- } catch (e) {
1304
- this._showToast(e)
1305
- }
1306
- }
1307
-
1308
1289
  async _completeHandler() {
1309
1290
  if (!this.data.records.every(record => record.completed)) return
1310
1291
  this.updateContext()