@things-factory/operato-wms 4.3.643 → 4.3.644
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.
- package/client/pages/outbound/loading-v2/loading-execution-base.js +625 -153
- package/client/pages/outbound/loading-v2/loading-execution.js +239 -139
- package/client/pages/outbound/loading-v2/loading.js +297 -179
- package/client/pages/outbound/loading-v2/release-good-info.js +8 -8
- package/client/pages/outbound/picking-v2/picking.js +4 -0
- package/client/pages/outbound/show-ro-list-popup.js +17 -3
- package/client/pages/report/billing-module-report.js +421 -0
- package/client/route.js +4 -0
- package/dist-server/graphql/resolvers/outbound/complete-load.js +6 -1
- package/dist-server/graphql/resolvers/outbound/complete-load.js.map +1 -1
- package/dist-server/graphql/resolvers/outbound/find-loadable-release-good-by-bin.js +148 -0
- package/dist-server/graphql/resolvers/outbound/find-loadable-release-good-by-bin.js.map +1 -0
- package/dist-server/graphql/resolvers/outbound/find-loadable-release-good.js +67 -13
- package/dist-server/graphql/resolvers/outbound/find-loadable-release-good.js.map +1 -1
- package/dist-server/graphql/resolvers/outbound/get-delivery-orders.js +20 -3
- package/dist-server/graphql/resolvers/outbound/get-delivery-orders.js.map +1 -1
- package/dist-server/graphql/resolvers/outbound/index.js +2 -1
- package/dist-server/graphql/resolvers/outbound/index.js.map +1 -1
- package/dist-server/graphql/resolvers/outbound/load-by-qty.js +15 -3
- package/dist-server/graphql/resolvers/outbound/load-by-qty.js.map +1 -1
- package/dist-server/graphql/resolvers/outbound/loading-worksheet-v2.js +36 -15
- package/dist-server/graphql/resolvers/outbound/loading-worksheet-v2.js.map +1 -1
- package/dist-server/graphql/resolvers/outbound/sort-item.js +53 -52
- package/dist-server/graphql/resolvers/outbound/sort-item.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/billing-module-report.js +355 -0
- package/dist-server/graphql/resolvers/reports/billing-module-report.js.map +1 -0
- package/dist-server/graphql/resolvers/reports/index.js +2 -1
- package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +3 -0
- package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/pg-udf-query.js +5 -3
- package/dist-server/graphql/resolvers/reports/pg-udf-query.js.map +1 -1
- package/dist-server/graphql/resolvers/zone-worksheet/zone-picking.js +3 -3
- package/dist-server/graphql/types/outbound/index.js +2 -1
- package/dist-server/graphql/types/outbound/index.js.map +1 -1
- package/dist-server/graphql/types/reports/billing-module-report-list.js +14 -0
- package/dist-server/graphql/types/reports/billing-module-report-list.js.map +1 -0
- package/dist-server/graphql/types/reports/billing-module-report.js +15 -0
- package/dist-server/graphql/types/reports/billing-module-report.js.map +1 -0
- package/dist-server/graphql/types/reports/index.js +5 -0
- package/dist-server/graphql/types/reports/index.js.map +1 -1
- package/package.json +4 -4
- package/server/graphql/resolvers/outbound/complete-load.ts +6 -1
- package/server/graphql/resolvers/outbound/find-loadable-release-good-by-bin.ts +154 -0
- package/server/graphql/resolvers/outbound/find-loadable-release-good.ts +82 -16
- package/server/graphql/resolvers/outbound/get-delivery-orders.ts +27 -3
- package/server/graphql/resolvers/outbound/index.ts +2 -0
- package/server/graphql/resolvers/outbound/load-by-qty.ts +19 -7
- package/server/graphql/resolvers/outbound/loading-worksheet-v2.ts +116 -22
- package/server/graphql/resolvers/outbound/sort-item.ts +56 -58
- package/server/graphql/resolvers/reports/billing-module-report.ts +372 -0
- package/server/graphql/resolvers/reports/index.ts +2 -0
- package/server/graphql/resolvers/reports/outbound-order-details-report.ts +5 -8
- package/server/graphql/resolvers/reports/pg-udf-query.ts +15 -13
- package/server/graphql/resolvers/zone-worksheet/zone-picking.ts +3 -3
- package/server/graphql/types/outbound/index.ts +2 -1
- package/server/graphql/types/reports/billing-module-report-list.ts +8 -0
- package/server/graphql/types/reports/billing-module-report.ts +9 -0
- package/server/graphql/types/reports/index.ts +6 -0
- package/things-factory.config.js +4 -0
- package/translations/en.json +7 -0
- package/translations/ko.json +2 -0
- package/translations/ms.json +2 -0
- package/translations/zh.json +2 -0
|
@@ -2,37 +2,263 @@ import '@things-factory/barcode-ui'
|
|
|
2
2
|
import '@things-factory/grist-ui'
|
|
3
3
|
import './release-good-info'
|
|
4
4
|
import './delivery-order-info'
|
|
5
|
+
import '../show-ro-list-popup'
|
|
5
6
|
import '../transport-vehicles-popup'
|
|
6
7
|
import './load-by-qty'
|
|
7
8
|
import './warehouse-return-popup'
|
|
8
9
|
|
|
9
10
|
import { gql } from 'graphql-tag'
|
|
10
|
-
import {
|
|
11
|
-
import { i18next
|
|
11
|
+
import { html, LitElement } from 'lit-element'
|
|
12
|
+
import { i18next } from '@things-factory/i18n-base'
|
|
12
13
|
import { openPopup } from '@things-factory/layout-base'
|
|
13
|
-
import { client, CustomAlert, gqlContext
|
|
14
|
+
import { client, CustomAlert, gqlContext } from '@things-factory/shell'
|
|
14
15
|
import { CommonButtonStyles } from '@things-factory/styles'
|
|
15
16
|
import { WORKSHEET_STATUS } from '../../constants'
|
|
16
17
|
import { fetchSettingRule } from '../../../fetch-setting-value'
|
|
17
18
|
|
|
18
19
|
import { showToast } from '../../../util'
|
|
19
20
|
|
|
21
|
+
// Constants
|
|
22
|
+
const SETTINGS = {
|
|
23
|
+
QC_SKU: 'qc-sku',
|
|
24
|
+
DISABLE_QC: 'disable-QC-in-loading'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const TAB_TYPES = {
|
|
28
|
+
QC: 'QC',
|
|
29
|
+
LOADING: 'LOADING',
|
|
30
|
+
LOADED: 'LOADED'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// GraphQL Queries
|
|
34
|
+
const FIND_LOADABLE_RELEASE_GOOD = gql`
|
|
35
|
+
query findLoadableReleaseGood($orderNo: String!, $tabName: String!) {
|
|
36
|
+
findLoadableReleaseGood(orderNo: $orderNo, tabName: $tabName) {
|
|
37
|
+
id
|
|
38
|
+
name
|
|
39
|
+
refNo
|
|
40
|
+
refNo2
|
|
41
|
+
status
|
|
42
|
+
district
|
|
43
|
+
attentionCompany
|
|
44
|
+
sortedBy {
|
|
45
|
+
name
|
|
46
|
+
}
|
|
47
|
+
itemCounts {
|
|
48
|
+
total
|
|
49
|
+
pending
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`
|
|
54
|
+
|
|
55
|
+
const FIND_LOADABLE_RELEASE_GOOD_BY_BIN = gql`
|
|
56
|
+
query findLoadableReleaseGoodByBin($orderNo: String!) {
|
|
57
|
+
findLoadableReleaseGoodByBin(orderNo: $orderNo) {
|
|
58
|
+
worksheetDetailInfos {
|
|
59
|
+
id
|
|
60
|
+
name
|
|
61
|
+
batchId
|
|
62
|
+
releaseQty
|
|
63
|
+
pickedQty
|
|
64
|
+
sortedQty
|
|
65
|
+
status
|
|
66
|
+
packingType
|
|
67
|
+
packingSize
|
|
68
|
+
expirationDate
|
|
69
|
+
binLocation {
|
|
70
|
+
name
|
|
71
|
+
}
|
|
72
|
+
productName
|
|
73
|
+
productSku
|
|
74
|
+
relatedOrderInv {
|
|
75
|
+
id
|
|
76
|
+
batchId
|
|
77
|
+
packingType
|
|
78
|
+
product {
|
|
79
|
+
id
|
|
80
|
+
sku
|
|
81
|
+
name
|
|
82
|
+
}
|
|
83
|
+
productDetail {
|
|
84
|
+
id
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`
|
|
91
|
+
|
|
92
|
+
const LOADING_WORKSHEET_V2 = gql`
|
|
93
|
+
query loadingWorksheetv2($orderNo: String!, $filter: String) {
|
|
94
|
+
loadingWorksheetv2(orderNo: $orderNo, filter: $filter) {
|
|
95
|
+
worksheetInfo {
|
|
96
|
+
worksheet {
|
|
97
|
+
id
|
|
98
|
+
name
|
|
99
|
+
type
|
|
100
|
+
status
|
|
101
|
+
}
|
|
102
|
+
bizplaceName
|
|
103
|
+
startedAt
|
|
104
|
+
releaseGood {
|
|
105
|
+
id
|
|
106
|
+
name
|
|
107
|
+
attentionCompany
|
|
108
|
+
status
|
|
109
|
+
refNo
|
|
110
|
+
refNo2
|
|
111
|
+
refNo3
|
|
112
|
+
remark
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
worksheetDetailInfos {
|
|
116
|
+
id
|
|
117
|
+
name
|
|
118
|
+
batchId
|
|
119
|
+
releaseQty
|
|
120
|
+
pickedQty
|
|
121
|
+
sortedQty
|
|
122
|
+
status
|
|
123
|
+
packingType
|
|
124
|
+
packingSize
|
|
125
|
+
expirationDate
|
|
126
|
+
binLocation {
|
|
127
|
+
name
|
|
128
|
+
}
|
|
129
|
+
productName
|
|
130
|
+
productSku
|
|
131
|
+
relatedOrderInv {
|
|
132
|
+
id
|
|
133
|
+
batchId
|
|
134
|
+
packingType
|
|
135
|
+
product {
|
|
136
|
+
id
|
|
137
|
+
sku
|
|
138
|
+
name
|
|
139
|
+
}
|
|
140
|
+
productDetail {
|
|
141
|
+
id
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
`
|
|
148
|
+
|
|
149
|
+
const GET_DELIVERY_ORDERS = gql`
|
|
150
|
+
query getDeliveryOrders($releaseGoodNo: String!) {
|
|
151
|
+
getDeliveryOrders(releaseGoodNo: $releaseGoodNo) {
|
|
152
|
+
completable
|
|
153
|
+
deliveryOrders {
|
|
154
|
+
id
|
|
155
|
+
name
|
|
156
|
+
truckNo
|
|
157
|
+
orderInventories {
|
|
158
|
+
batchId
|
|
159
|
+
packingSize
|
|
160
|
+
packingType
|
|
161
|
+
pickedQty
|
|
162
|
+
product {
|
|
163
|
+
name
|
|
164
|
+
sku
|
|
165
|
+
}
|
|
166
|
+
inventory {
|
|
167
|
+
expirationDate
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
`
|
|
174
|
+
|
|
175
|
+
const SORT_ITEM = gql`
|
|
176
|
+
mutation sortItem($releaseGoodNo: String!, $productBarcode: String!, $qty: Float!, $worksheetDetails: [Object!]) {
|
|
177
|
+
sortItem(
|
|
178
|
+
releaseGoodNo: $releaseGoodNo
|
|
179
|
+
productBarcode: $productBarcode
|
|
180
|
+
qty: $qty
|
|
181
|
+
worksheetDetails: $worksheetDetails
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
`
|
|
185
|
+
|
|
186
|
+
const COMPLETE_LOAD = gql`
|
|
187
|
+
mutation completeLoad($orderId: String!, $worksheetId: String!) {
|
|
188
|
+
completeLoad(orderId: $orderId, worksheetId: $worksheetId)
|
|
189
|
+
}
|
|
190
|
+
`
|
|
191
|
+
|
|
192
|
+
const COMPLETE_LOAD_PARTIALLY = gql`
|
|
193
|
+
mutation completeLoadPartially($orderId: String!, $worksheetId: String!) {
|
|
194
|
+
completeLoadPartially(orderId: $orderId, worksheetId: $worksheetId)
|
|
195
|
+
}
|
|
196
|
+
`
|
|
197
|
+
|
|
20
198
|
export class LoadingExecutionBase extends LitElement {
|
|
21
199
|
static get properties() {
|
|
22
200
|
return {
|
|
23
201
|
parent: Object,
|
|
24
202
|
state: Object,
|
|
25
|
-
worksheet:
|
|
203
|
+
worksheet: {
|
|
204
|
+
type: Object,
|
|
205
|
+
hasChanged: (newVal, oldVal) => {
|
|
206
|
+
if (!newVal && !oldVal) return true
|
|
207
|
+
if (!oldVal && newVal) return true
|
|
208
|
+
if (oldVal && !newVal) return false
|
|
209
|
+
|
|
210
|
+
const oldData = JSON.stringify(oldVal)
|
|
211
|
+
const newData = JSON.stringify(newVal)
|
|
212
|
+
return newData.length > oldData.length
|
|
213
|
+
}
|
|
214
|
+
},
|
|
26
215
|
worksheetDetails: Object,
|
|
27
216
|
deliveryOrdersInfo: Object,
|
|
28
217
|
qcData: Array,
|
|
29
218
|
loadingData: Array,
|
|
30
219
|
loadedData: Array,
|
|
31
220
|
_executionData: Object,
|
|
32
|
-
_disableQC: Boolean
|
|
221
|
+
_disableQC: Boolean,
|
|
222
|
+
_useQcSku: Boolean
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
constructor() {
|
|
227
|
+
super()
|
|
228
|
+
this._useQcSku = false
|
|
229
|
+
this._worksheetState = null
|
|
230
|
+
this._executionData = {
|
|
231
|
+
ownCollection: false,
|
|
232
|
+
orderId: null,
|
|
233
|
+
worksheetId: null
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
set worksheet(value) {
|
|
238
|
+
if (
|
|
239
|
+
!this._worksheetState ||
|
|
240
|
+
(value && JSON.stringify(value).length > JSON.stringify(this._worksheetState).length)
|
|
241
|
+
) {
|
|
242
|
+
this._worksheetState = value
|
|
243
|
+
this.requestUpdate('worksheet', this.worksheet)
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
get worksheet() {
|
|
248
|
+
return this._worksheetState
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
updated(changedProperties) {
|
|
252
|
+
if (changedProperties.has('worksheet')) {
|
|
253
|
+
this._currentReleaseGood = {
|
|
254
|
+
releaseGood: this.worksheet?.releaseGood,
|
|
255
|
+
bizplaceName: this.worksheet?.bizplaceName,
|
|
256
|
+
startedAt: this.worksheet?.startedAt
|
|
257
|
+
}
|
|
33
258
|
}
|
|
34
259
|
}
|
|
35
260
|
|
|
261
|
+
// Button Configurations
|
|
36
262
|
get backButton() {
|
|
37
263
|
return {
|
|
38
264
|
title: i18next.t('button.back'),
|
|
@@ -48,7 +274,6 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
48
274
|
title: i18next.t('button.complete'),
|
|
49
275
|
action: async () => {
|
|
50
276
|
await this.completeLoad()
|
|
51
|
-
resetContext(this.parent)
|
|
52
277
|
},
|
|
53
278
|
...CommonButtonStyles.submit
|
|
54
279
|
}
|
|
@@ -84,6 +309,43 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
84
309
|
}
|
|
85
310
|
}
|
|
86
311
|
|
|
312
|
+
get orderListButton() {
|
|
313
|
+
return {
|
|
314
|
+
title: i18next.t('button.order_list'),
|
|
315
|
+
action: async () => {
|
|
316
|
+
try {
|
|
317
|
+
const orderNo = this._useQcSku ? this.worksheet?.binLocationName : this.worksheet?.releaseGood?.name
|
|
318
|
+
|
|
319
|
+
if (!orderNo) {
|
|
320
|
+
throw new Error(i18next.t('text.no_order_selected'))
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
const response = await client.query({
|
|
324
|
+
query: FIND_LOADABLE_RELEASE_GOOD,
|
|
325
|
+
variables: {
|
|
326
|
+
orderNo,
|
|
327
|
+
tabName: this.state?.activeTab || TAB_TYPES.LOADING
|
|
328
|
+
},
|
|
329
|
+
context: gqlContext()
|
|
330
|
+
})
|
|
331
|
+
|
|
332
|
+
if (!response.errors) {
|
|
333
|
+
const orders = response.data.findLoadableReleaseGood
|
|
334
|
+
if (orders.length) {
|
|
335
|
+
await this.selectReleaseOrderPopup(orders, this.state?.activeTab)
|
|
336
|
+
} else {
|
|
337
|
+
throw new Error(i18next.t('text.no_release_order_found'))
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
} catch (e) {
|
|
341
|
+
showToast(e)
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
...CommonButtonStyles.edit
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Input Getters
|
|
87
349
|
get productBarcodeInput() {
|
|
88
350
|
return this.shadowRoot
|
|
89
351
|
.querySelector('barcode-scanable-input[name=productBarcode]')
|
|
@@ -114,45 +376,184 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
114
376
|
return this.shadowRoot.querySelector('product-list-view#qc')
|
|
115
377
|
}
|
|
116
378
|
|
|
379
|
+
// Core Methods
|
|
117
380
|
async openTab(e, tabName) {
|
|
118
381
|
this.state = { ...this.state, activeTab: tabName }
|
|
382
|
+
await this.updateComplete
|
|
383
|
+
|
|
384
|
+
if (tabName === TAB_TYPES.QC) {
|
|
385
|
+
const qcData = await this.fetchData(
|
|
386
|
+
this._useQcSku ? this.worksheet?.binLocationName : this.worksheet?.releaseGood?.name,
|
|
387
|
+
'qc',
|
|
388
|
+
this._useQcSku
|
|
389
|
+
)
|
|
390
|
+
this.qcData = qcData.filter(data => data?.sortedQty != data?.pickedQty) || []
|
|
391
|
+
} else if (tabName === TAB_TYPES.LOADING) {
|
|
392
|
+
if (this._useQcSku && this.worksheet?.binLocationName) {
|
|
393
|
+
const response = await client.query({
|
|
394
|
+
query: FIND_LOADABLE_RELEASE_GOOD,
|
|
395
|
+
variables: {
|
|
396
|
+
orderNo: this.worksheet?.binLocationName,
|
|
397
|
+
tabName: this.state?.activeTab || TAB_TYPES.LOADING
|
|
398
|
+
},
|
|
399
|
+
context: gqlContext()
|
|
400
|
+
})
|
|
401
|
+
|
|
402
|
+
if (!response.errors) {
|
|
403
|
+
let records = response.data.findLoadableReleaseGood
|
|
404
|
+
if (records.length) {
|
|
405
|
+
await this.selectReleaseOrderPopup(records, this.state?.activeTab)
|
|
406
|
+
if (this.state.activeTab !== TAB_TYPES.LOADING) {
|
|
407
|
+
this.state = { ...this.state, activeTab: TAB_TYPES.LOADING }
|
|
408
|
+
await this.updateComplete
|
|
409
|
+
}
|
|
410
|
+
} else {
|
|
411
|
+
throw new Error(i18next.t('text.no_release_order_found'))
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
} else {
|
|
415
|
+
this.loadingData = await this.fetchData(this.worksheet?.releaseGood?.name, 'loading', this._useQcSku)
|
|
416
|
+
}
|
|
417
|
+
} else if (tabName === TAB_TYPES.LOADED) {
|
|
418
|
+
if (!this._currentReleaseGood?.releaseGood?.name || this._useQcSku) {
|
|
419
|
+
if (!this.worksheet?.binLocationName) {
|
|
420
|
+
throw new Error(i18next.t('text.no_bin_location_selected'))
|
|
421
|
+
}
|
|
119
422
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
423
|
+
const response = await client.query({
|
|
424
|
+
query: FIND_LOADABLE_RELEASE_GOOD,
|
|
425
|
+
variables: {
|
|
426
|
+
orderNo: this.worksheet.binLocationName,
|
|
427
|
+
tabName: this.state?.activeTab || TAB_TYPES.LOADED
|
|
428
|
+
},
|
|
429
|
+
context: gqlContext()
|
|
430
|
+
})
|
|
431
|
+
|
|
432
|
+
if (!response.errors) {
|
|
433
|
+
let records = response.data.findLoadableReleaseGood
|
|
434
|
+
if (records.length) {
|
|
435
|
+
await this.selectReleaseOrderPopup(records, this.state?.activeTab)
|
|
436
|
+
if (this._currentReleaseGood?.releaseGood?.name) {
|
|
437
|
+
this.loadedData = await fetchDeliveryOrders(this._currentReleaseGood?.releaseGood?.name)
|
|
438
|
+
if (!this.worksheet?.worksheet?.id) {
|
|
439
|
+
await this.fetchData(this._currentReleaseGood.releaseGood.name, 'loading', this._useQcSku)
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
} else {
|
|
443
|
+
throw new Error(i18next.t('text.no_release_order_found'))
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
} else {
|
|
447
|
+
this.loadedData = await fetchDeliveryOrders(this._currentReleaseGood?.releaseGood?.name)
|
|
448
|
+
if (!this.worksheet?.worksheet?.id) {
|
|
449
|
+
await this.fetchData(this._currentReleaseGood.releaseGood.name, 'loading', this._useQcSku)
|
|
450
|
+
}
|
|
451
|
+
}
|
|
126
452
|
}
|
|
127
453
|
|
|
128
454
|
this.getButton()
|
|
129
455
|
}
|
|
130
456
|
|
|
457
|
+
async selectReleaseOrderPopup(orders, tabName) {
|
|
458
|
+
let releaseGoods = orders.map(ro => ({
|
|
459
|
+
...ro,
|
|
460
|
+
sortedByUser: ro.sortedBy?.name
|
|
461
|
+
}))
|
|
462
|
+
|
|
463
|
+
openPopup(
|
|
464
|
+
html`
|
|
465
|
+
<show-ro-list-popup
|
|
466
|
+
.releaseOrders=${releaseGoods}
|
|
467
|
+
.sorting=${false}
|
|
468
|
+
@ro-selected-loading=${async e => {
|
|
469
|
+
const selectedRO = e.detail.ro
|
|
470
|
+
|
|
471
|
+
this.worksheet = {
|
|
472
|
+
...this.worksheet,
|
|
473
|
+
releaseGood: selectedRO,
|
|
474
|
+
binLocationName: this.worksheet?.binLocationName
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
this._currentReleaseGood = {
|
|
478
|
+
releaseGood: selectedRO,
|
|
479
|
+
bizplaceName: this.worksheet?.bizplaceName,
|
|
480
|
+
startedAt: this.worksheet?.startedAt
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
this._executionData = {
|
|
484
|
+
...this._executionData,
|
|
485
|
+
orderId: selectedRO.id
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
this.state = { ...this.state, activeTab: tabName }
|
|
489
|
+
await this.updateComplete
|
|
490
|
+
|
|
491
|
+
if (tabName === TAB_TYPES.LOADING) {
|
|
492
|
+
this.loadingData = await this.fetchData(selectedRO.name, 'loading', false)
|
|
493
|
+
} else if (tabName === TAB_TYPES.LOADED) {
|
|
494
|
+
this.loadedData = await fetchDeliveryOrders(selectedRO.name)
|
|
495
|
+
if (!this.worksheet?.worksheet?.id) {
|
|
496
|
+
await this.fetchData(selectedRO.name, 'loading', this._useQcSku)
|
|
497
|
+
}
|
|
498
|
+
} else if (tabName === TAB_TYPES.QC) {
|
|
499
|
+
this.qcData = await this.fetchData(selectedRO.name, 'qc', this._useQcSku)
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
await this.updateComplete
|
|
503
|
+
this.getButton()
|
|
504
|
+
}}
|
|
505
|
+
></show-ro-list-popup>
|
|
506
|
+
`,
|
|
507
|
+
{
|
|
508
|
+
backdrop: true,
|
|
509
|
+
size: 'medium',
|
|
510
|
+
title: i18next.t('title.release_orders')
|
|
511
|
+
}
|
|
512
|
+
)
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// Helper Methods
|
|
131
516
|
_focusOnProductBarcodeInput() {
|
|
132
517
|
if (this.productBarcodeInput) {
|
|
133
518
|
setTimeout(() => this.productBarcodeInput.focus(), 50)
|
|
134
519
|
}
|
|
135
520
|
}
|
|
136
521
|
|
|
137
|
-
|
|
138
|
-
this.
|
|
522
|
+
_focusOnQtyInput() {
|
|
523
|
+
if (this.qtyInput) {
|
|
524
|
+
setTimeout(() => this.qtyInput.focus(), 50)
|
|
525
|
+
}
|
|
526
|
+
}
|
|
139
527
|
|
|
140
|
-
|
|
528
|
+
async resetView() {
|
|
529
|
+
this._disableQC = await fetchSettingRule(SETTINGS.DISABLE_QC)
|
|
530
|
+
this._useQcSku = await fetchSettingRule(SETTINGS.QC_SKU)
|
|
141
531
|
|
|
142
|
-
|
|
143
|
-
|
|
532
|
+
let activeTab = TAB_TYPES.QC
|
|
533
|
+
if (this._disableQC && !this._useQcSku) {
|
|
534
|
+
activeTab = TAB_TYPES.LOADING
|
|
144
535
|
}
|
|
145
536
|
|
|
146
|
-
this.state = { ...this.state, activeTab
|
|
537
|
+
this.state = { ...this.state, activeTab }
|
|
538
|
+
|
|
539
|
+
const currentWorksheet = this.worksheet
|
|
147
540
|
|
|
148
541
|
this.qcData = this.worksheetDetails.filter(data => data?.sortedQty != data?.pickedQty) || []
|
|
149
542
|
this.loadingData =
|
|
150
543
|
this.worksheetDetails.filter(data => data?.sortedQty > 0 && data.status != WORKSHEET_STATUS.DONE.value) || []
|
|
151
544
|
this.loadedData = this.deliveryOrdersInfo || []
|
|
545
|
+
|
|
152
546
|
this._executionData = {
|
|
153
547
|
...this._executionData,
|
|
154
|
-
orderId:
|
|
155
|
-
worksheetId:
|
|
548
|
+
orderId: currentWorksheet?.releaseGood?.id,
|
|
549
|
+
worksheetId: currentWorksheet?.worksheet?.id
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
if (!this.worksheet && this.worksheetDetails?.length > 0) {
|
|
553
|
+
this.worksheet = {
|
|
554
|
+
...currentWorksheet,
|
|
555
|
+
binLocationName: this.worksheetDetails[0]?.binLocation?.name
|
|
556
|
+
}
|
|
156
557
|
}
|
|
157
558
|
|
|
158
559
|
this.getButton()
|
|
@@ -162,15 +563,24 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
162
563
|
let activeTab = this.state?.activeTab
|
|
163
564
|
|
|
164
565
|
let buttons = [this.backButton]
|
|
165
|
-
if (activeTab
|
|
566
|
+
if (activeTab === TAB_TYPES.LOADING) {
|
|
166
567
|
if (this.loadingData?.length > 0) {
|
|
568
|
+
if (this._useQcSku) {
|
|
569
|
+
buttons.unshift(this.orderListButton)
|
|
570
|
+
}
|
|
167
571
|
buttons.unshift(this.warehouseReturnButton)
|
|
168
572
|
buttons.unshift(this.loadButton)
|
|
169
573
|
}
|
|
170
|
-
} else if (activeTab
|
|
574
|
+
} else if (activeTab === TAB_TYPES.LOADED) {
|
|
575
|
+
if (this._useQcSku) {
|
|
576
|
+
buttons.unshift(this.orderListButton)
|
|
577
|
+
}
|
|
171
578
|
if (this.loadedData?.completable) {
|
|
172
579
|
buttons.unshift(this.completeButton)
|
|
173
|
-
} else if (
|
|
580
|
+
} else if (
|
|
581
|
+
this.loadedData?.deliveryOrders.length > 0 &&
|
|
582
|
+
this._currentReleaseGood?.releaseGood?.status !== 'LOADING'
|
|
583
|
+
) {
|
|
174
584
|
buttons.unshift(this.partialButton)
|
|
175
585
|
}
|
|
176
586
|
}
|
|
@@ -182,17 +592,18 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
182
592
|
let activeTab = this.state?.activeTab
|
|
183
593
|
let total = 0
|
|
184
594
|
|
|
185
|
-
if (activeTab
|
|
595
|
+
if (activeTab === TAB_TYPES.QC) {
|
|
186
596
|
total = this.qcData?.length
|
|
187
|
-
} else if (activeTab
|
|
597
|
+
} else if (activeTab === TAB_TYPES.LOADING) {
|
|
188
598
|
total = this.loadingData?.length
|
|
189
|
-
} else if (activeTab
|
|
599
|
+
} else if (activeTab === TAB_TYPES.LOADED) {
|
|
190
600
|
total = this.loadedData?.deliveryOrders?.length
|
|
191
601
|
}
|
|
192
602
|
|
|
193
603
|
return total
|
|
194
604
|
}
|
|
195
605
|
|
|
606
|
+
// UI Methods
|
|
196
607
|
selectWarehouseTruck() {
|
|
197
608
|
openPopup(
|
|
198
609
|
html`
|
|
@@ -214,8 +625,8 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
214
625
|
await openPopup(
|
|
215
626
|
html`
|
|
216
627
|
<release-good-info
|
|
217
|
-
.data
|
|
218
|
-
.releaseGoodNo
|
|
628
|
+
.data=${this._currentReleaseGood}
|
|
629
|
+
.releaseGoodNo=${this._currentReleaseGood?.releaseGood?.name}
|
|
219
630
|
></release-good-info>
|
|
220
631
|
`,
|
|
221
632
|
{
|
|
@@ -236,7 +647,7 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
236
647
|
.data="${targetDO}"
|
|
237
648
|
@undo=${async e => {
|
|
238
649
|
showToast({ type: 'success', message: 'undo loading completed' })
|
|
239
|
-
this.loadedData = await fetchDeliveryOrders(this.
|
|
650
|
+
this.loadedData = await fetchDeliveryOrders(this._currentReleaseGood.releaseGood.name)
|
|
240
651
|
}}
|
|
241
652
|
></delivery-order-info>
|
|
242
653
|
`,
|
|
@@ -248,32 +659,18 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
248
659
|
)
|
|
249
660
|
}
|
|
250
661
|
|
|
662
|
+
// Action Methods
|
|
251
663
|
async _sort(e) {
|
|
252
664
|
if (e.keyCode !== 13) return
|
|
253
665
|
e.preventDefault()
|
|
254
666
|
try {
|
|
255
667
|
await this.validateSorting()
|
|
256
|
-
//get selected if any
|
|
257
668
|
let selectedData = this.qcData.filter(data => this.qcDataView.selectedItems.includes(data.id))
|
|
258
669
|
|
|
259
670
|
const response = await client.mutate({
|
|
260
|
-
mutation:
|
|
261
|
-
mutation sortItem(
|
|
262
|
-
$releaseGoodNo: String!
|
|
263
|
-
$productBarcode: String!
|
|
264
|
-
$qty: Float!
|
|
265
|
-
$worksheetDetails: [Object!]
|
|
266
|
-
) {
|
|
267
|
-
sortItem(
|
|
268
|
-
releaseGoodNo: $releaseGoodNo
|
|
269
|
-
productBarcode: $productBarcode
|
|
270
|
-
qty: $qty
|
|
271
|
-
worksheetDetails: $worksheetDetails
|
|
272
|
-
)
|
|
273
|
-
}
|
|
274
|
-
`,
|
|
671
|
+
mutation: SORT_ITEM,
|
|
275
672
|
variables: {
|
|
276
|
-
releaseGoodNo: this.worksheet?.releaseGood?.name,
|
|
673
|
+
releaseGoodNo: this._useQcSku ? this.worksheet?.binLocationName : this.worksheet?.releaseGood?.name,
|
|
277
674
|
productBarcode: this.productBarcodeInput.value,
|
|
278
675
|
qty: parseFloat(this.qtyInput.value),
|
|
279
676
|
worksheetDetails: selectedData
|
|
@@ -284,7 +681,14 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
284
681
|
this.productBarcodeInput.value = ''
|
|
285
682
|
this.qtyInput.value = ''
|
|
286
683
|
this._focusOnProductBarcodeInput()
|
|
287
|
-
|
|
684
|
+
|
|
685
|
+
const updatedData = await this.fetchData(
|
|
686
|
+
this._useQcSku ? this.worksheet?.binLocationName : this.worksheet?.releaseGood?.name,
|
|
687
|
+
'qc',
|
|
688
|
+
this._useQcSku
|
|
689
|
+
)
|
|
690
|
+
|
|
691
|
+
this.qcData = updatedData.filter(data => data?.sortedQty < data?.pickedQty) || []
|
|
288
692
|
}
|
|
289
693
|
} catch (e) {
|
|
290
694
|
showToast(e)
|
|
@@ -294,6 +698,8 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
294
698
|
async validateSorting() {
|
|
295
699
|
if (!this.productBarcodeInput.value) {
|
|
296
700
|
throw new Error(i18next.t('text.product_barcode_is_empty'))
|
|
701
|
+
} else {
|
|
702
|
+
this._focusOnQtyInput()
|
|
297
703
|
}
|
|
298
704
|
if (!this.qtyInput.value || parseFloat(this.qtyInput.value) <= 0) {
|
|
299
705
|
throw new Error(i18next.t('text.invalid_qty'))
|
|
@@ -303,30 +709,19 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
303
709
|
async load() {
|
|
304
710
|
try {
|
|
305
711
|
let data = this.loadingData.filter(data => this.loadingDataView.selectedItems.includes(data.id))
|
|
306
|
-
|
|
307
712
|
if (data.length < 1) data = this.loadingData
|
|
308
713
|
|
|
309
|
-
const ownCollection = this.
|
|
714
|
+
const ownCollection = this._currentReleaseGood?.ownCollection ? true : false
|
|
715
|
+
let vehicleNo = ownCollection ? this.truckNoInput?.value || '' : this.warehouseTruckInput?.value || ''
|
|
310
716
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
if (this.truckNoInput) {
|
|
314
|
-
vehicleNo = this.truckNoInput.value
|
|
315
|
-
} else {
|
|
316
|
-
vehicleNo = ''
|
|
317
|
-
}
|
|
318
|
-
} else {
|
|
319
|
-
if (this.warehouseTruckInput) {
|
|
320
|
-
vehicleNo = this.warehouseTruckInput.value
|
|
321
|
-
} else {
|
|
322
|
-
vehicleNo = ''
|
|
323
|
-
}
|
|
717
|
+
if (!this._currentReleaseGood?.releaseGood?.name) {
|
|
718
|
+
throw new Error(i18next.t('text.no_release_order_selected'))
|
|
324
719
|
}
|
|
325
720
|
|
|
326
721
|
const loadData = {
|
|
327
|
-
releaseGoodNo: this.
|
|
328
|
-
vehicleNo
|
|
329
|
-
ownCollection
|
|
722
|
+
releaseGoodNo: this._currentReleaseGood.releaseGood.name,
|
|
723
|
+
vehicleNo,
|
|
724
|
+
ownCollection,
|
|
330
725
|
totalPalletQty: parseInt(this.totalPalletQtyInput ? this.totalPalletQtyInput.value : 0)
|
|
331
726
|
}
|
|
332
727
|
|
|
@@ -337,7 +732,11 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
337
732
|
._executionData=${loadData}
|
|
338
733
|
@loading=${async e => {
|
|
339
734
|
showToast({ type: 'success', message: 'loaded successfully' })
|
|
340
|
-
this.loadingData = await fetchData(
|
|
735
|
+
this.loadingData = await this.fetchData(
|
|
736
|
+
this._currentReleaseGood.releaseGood.name,
|
|
737
|
+
'loading',
|
|
738
|
+
this._useQcSku
|
|
739
|
+
)
|
|
341
740
|
}}
|
|
342
741
|
></load-by-qty>
|
|
343
742
|
`,
|
|
@@ -354,6 +753,14 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
354
753
|
|
|
355
754
|
async completeLoad() {
|
|
356
755
|
try {
|
|
756
|
+
if (!this._executionData?.worksheetId) {
|
|
757
|
+
console.error('Missing worksheetId in completeLoad:', {
|
|
758
|
+
executionData: this._executionData,
|
|
759
|
+
worksheet: this.worksheet
|
|
760
|
+
})
|
|
761
|
+
throw new Error('Worksheet ID is required for completing load')
|
|
762
|
+
}
|
|
763
|
+
|
|
357
764
|
const result = await CustomAlert({
|
|
358
765
|
title: i18next.t('title.are_you_sure'),
|
|
359
766
|
text: i18next.t('text.complete_loading'),
|
|
@@ -364,19 +771,50 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
364
771
|
if (!result.value) return
|
|
365
772
|
|
|
366
773
|
const response = await client.mutate({
|
|
367
|
-
mutation:
|
|
368
|
-
mutation completeLoad($orderId: String!, $worksheetId: String!) {
|
|
369
|
-
completeLoad(orderId: $orderId, worksheetId: $worksheetId)
|
|
370
|
-
}
|
|
371
|
-
`,
|
|
774
|
+
mutation: COMPLETE_LOAD,
|
|
372
775
|
variables: {
|
|
373
|
-
orderId: this.
|
|
776
|
+
orderId: this._currentReleaseGood?.releaseGood.id,
|
|
374
777
|
worksheetId: this._executionData.worksheetId
|
|
375
778
|
}
|
|
376
779
|
})
|
|
377
780
|
|
|
378
781
|
if (!response.errors) {
|
|
379
782
|
showToast({ type: 'success', message: i18next.t('text.loading_completed') })
|
|
783
|
+
|
|
784
|
+
// --- Clear previous order and UI data ---
|
|
785
|
+
this._currentReleaseGood = null;
|
|
786
|
+
this.loadedData = [];
|
|
787
|
+
|
|
788
|
+
setTimeout(async () => {
|
|
789
|
+
try {
|
|
790
|
+
const orderNo = this._useQcSku ? this.worksheet?.binLocationName : this.worksheet?.releaseGood?.name
|
|
791
|
+
if (!orderNo) {
|
|
792
|
+
resetContext(this.parent)
|
|
793
|
+
return
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
const response = await client.query({
|
|
797
|
+
query: FIND_LOADABLE_RELEASE_GOOD,
|
|
798
|
+
variables: {
|
|
799
|
+
orderNo,
|
|
800
|
+
tabName: this.state?.activeTab || TAB_TYPES.LOADING
|
|
801
|
+
},
|
|
802
|
+
context: gqlContext()
|
|
803
|
+
})
|
|
804
|
+
|
|
805
|
+
if (!response.errors) {
|
|
806
|
+
const orders = response.data.findLoadableReleaseGood
|
|
807
|
+
if (orders.length) {
|
|
808
|
+
await this.selectReleaseOrderPopup(orders, this.state?.activeTab)
|
|
809
|
+
} else {
|
|
810
|
+
resetContext(this.parent)
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
} catch (e) {
|
|
814
|
+
console.error('Error finding next release order:', e)
|
|
815
|
+
resetContext(this.parent)
|
|
816
|
+
}
|
|
817
|
+
}, 3000)
|
|
380
818
|
}
|
|
381
819
|
} catch (e) {
|
|
382
820
|
showToast(e)
|
|
@@ -385,6 +823,14 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
385
823
|
|
|
386
824
|
async partialLoad() {
|
|
387
825
|
try {
|
|
826
|
+
if (!this._executionData?.worksheetId) {
|
|
827
|
+
console.error('Missing worksheetId in partialLoad:', {
|
|
828
|
+
executionData: this._executionData,
|
|
829
|
+
worksheet: this.worksheet
|
|
830
|
+
})
|
|
831
|
+
throw new Error('Worksheet ID is required for partial loading')
|
|
832
|
+
}
|
|
833
|
+
|
|
388
834
|
const result = await CustomAlert({
|
|
389
835
|
title: i18next.t('title.are_you_sure'),
|
|
390
836
|
text: i18next.t('text.complete_loading'),
|
|
@@ -395,19 +841,50 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
395
841
|
if (!result.value) return
|
|
396
842
|
|
|
397
843
|
const response = await client.mutate({
|
|
398
|
-
mutation:
|
|
399
|
-
mutation completeLoadPartially($orderId: String!, $worksheetId: String!) {
|
|
400
|
-
completeLoadPartially($orderId: String!, worksheetId: $worksheetId)
|
|
401
|
-
}
|
|
402
|
-
`,
|
|
844
|
+
mutation: COMPLETE_LOAD_PARTIALLY,
|
|
403
845
|
variables: {
|
|
404
|
-
orderId: this.
|
|
846
|
+
orderId: this._currentReleaseGood?.releaseGood.id,
|
|
405
847
|
worksheetId: this._executionData.worksheetId
|
|
406
848
|
}
|
|
407
849
|
})
|
|
408
850
|
|
|
409
851
|
if (!response.errors) {
|
|
410
852
|
showToast({ type: 'success', message: i18next.t('text.loading_completed_partially') })
|
|
853
|
+
|
|
854
|
+
// --- Clear previous order and UI data ---
|
|
855
|
+
this._currentReleaseGood = null;
|
|
856
|
+
this.loadedData = [];
|
|
857
|
+
|
|
858
|
+
setTimeout(async () => {
|
|
859
|
+
try {
|
|
860
|
+
const orderNo = this._useQcSku ? this.worksheet?.binLocationName : this.worksheet?.releaseGood?.name
|
|
861
|
+
if (!orderNo) {
|
|
862
|
+
resetContext(this.parent)
|
|
863
|
+
return
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
const response = await client.query({
|
|
867
|
+
query: FIND_LOADABLE_RELEASE_GOOD,
|
|
868
|
+
variables: {
|
|
869
|
+
orderNo,
|
|
870
|
+
tabName: this.state?.activeTab || TAB_TYPES.LOADING
|
|
871
|
+
},
|
|
872
|
+
context: gqlContext()
|
|
873
|
+
})
|
|
874
|
+
|
|
875
|
+
if (!response.errors) {
|
|
876
|
+
const orders = response.data.findLoadableReleaseGood
|
|
877
|
+
if (orders.length) {
|
|
878
|
+
await this.selectReleaseOrderPopup(orders, this.state?.activeTab)
|
|
879
|
+
} else {
|
|
880
|
+
resetContext(this.parent)
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
} catch (e) {
|
|
884
|
+
console.error('Error finding next release order:', e)
|
|
885
|
+
resetContext(this.parent)
|
|
886
|
+
}
|
|
887
|
+
}, 3000)
|
|
411
888
|
}
|
|
412
889
|
} catch (e) {
|
|
413
890
|
showToast(e)
|
|
@@ -416,16 +893,16 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
416
893
|
|
|
417
894
|
async warehouseReturn() {
|
|
418
895
|
let data = this.loadingData.filter(data => this.loadingDataView.selectedItems.includes(data.id))
|
|
419
|
-
|
|
420
896
|
if (data.length < 1) data = this.loadingData
|
|
897
|
+
|
|
421
898
|
openPopup(
|
|
422
899
|
html`
|
|
423
900
|
<warehouse-return-popup
|
|
424
901
|
._data=${data}
|
|
425
|
-
._releaseGoodNo=${this.worksheet
|
|
902
|
+
._releaseGoodNo=${this.worksheet?.releaseGood?.name}
|
|
426
903
|
@warehouse-return=${async e => {
|
|
427
904
|
showToast({ type: 'success', message: 'Returning worksheet generated' })
|
|
428
|
-
this.loadingData = await fetchData(this.worksheet
|
|
905
|
+
this.loadingData = await this.fetchData(this.worksheet?.releaseGood?.name, 'loading', this._useQcSku)
|
|
429
906
|
}}
|
|
430
907
|
></warehouse-return-popup>
|
|
431
908
|
`,
|
|
@@ -436,91 +913,86 @@ export class LoadingExecutionBase extends LitElement {
|
|
|
436
913
|
}
|
|
437
914
|
)
|
|
438
915
|
}
|
|
916
|
+
|
|
917
|
+
async fetchData(orderNo, tab, useQcSku) {
|
|
918
|
+
try {
|
|
919
|
+
if (tab === 'qc' && useQcSku) {
|
|
920
|
+
const response = await client.query({
|
|
921
|
+
query: FIND_LOADABLE_RELEASE_GOOD_BY_BIN,
|
|
922
|
+
variables: { orderNo }
|
|
923
|
+
})
|
|
924
|
+
|
|
925
|
+
if (!response.errors) {
|
|
926
|
+
const data = response.data.findLoadableReleaseGoodByBin.worksheetDetailInfos
|
|
927
|
+
return combineSameProducts(data)
|
|
928
|
+
}
|
|
929
|
+
} else {
|
|
930
|
+
const response = await client.query({
|
|
931
|
+
query: LOADING_WORKSHEET_V2,
|
|
932
|
+
variables: { orderNo, filter: tab }
|
|
933
|
+
})
|
|
934
|
+
|
|
935
|
+
if (!response.errors) {
|
|
936
|
+
const worksheetInfo = response.data.loadingWorksheetv2.worksheetInfo
|
|
937
|
+
|
|
938
|
+
if (!worksheetInfo?.worksheet?.id) {
|
|
939
|
+
console.error('Missing worksheet ID in API response:', worksheetInfo)
|
|
940
|
+
throw new Error('Worksheet information is incomplete')
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
this.worksheet = {
|
|
944
|
+
...this.worksheet,
|
|
945
|
+
releaseGood: worksheetInfo.releaseGood,
|
|
946
|
+
bizplaceName: worksheetInfo.bizplaceName,
|
|
947
|
+
startedAt: worksheetInfo.startedAt,
|
|
948
|
+
worksheet: worksheetInfo.worksheet,
|
|
949
|
+
binLocationName: this.worksheet?.binLocationName || orderNo
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
this._executionData = {
|
|
953
|
+
...this._executionData,
|
|
954
|
+
orderId: worksheetInfo.releaseGood?.id,
|
|
955
|
+
worksheetId: worksheetInfo.worksheet.id
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
return response.data.loadingWorksheetv2.worksheetDetailInfos
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
} catch (e) {
|
|
962
|
+
showToast(e)
|
|
963
|
+
}
|
|
964
|
+
}
|
|
439
965
|
}
|
|
440
966
|
|
|
967
|
+
// Helper Functions
|
|
441
968
|
function resetContext(target) {
|
|
442
969
|
target._data = null
|
|
443
970
|
target.configContext()
|
|
444
971
|
}
|
|
445
972
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
const response = await client.query({
|
|
449
|
-
query: gql`
|
|
450
|
-
query loadingWorksheetv2($orderNo: String!, $filter: String) {
|
|
451
|
-
loadingWorksheetv2(orderNo: $orderNo, filter: $filter) {
|
|
452
|
-
worksheetDetailInfos {
|
|
453
|
-
id
|
|
454
|
-
name
|
|
455
|
-
batchId
|
|
456
|
-
releaseQty
|
|
457
|
-
pickedQty
|
|
458
|
-
sortedQty
|
|
459
|
-
status
|
|
460
|
-
packingType
|
|
461
|
-
packingSize
|
|
462
|
-
expirationDate
|
|
463
|
-
binLocation {
|
|
464
|
-
name
|
|
465
|
-
}
|
|
466
|
-
productName
|
|
467
|
-
productSku
|
|
468
|
-
relatedOrderInv {
|
|
469
|
-
id
|
|
470
|
-
batchId
|
|
471
|
-
packingType
|
|
472
|
-
product {
|
|
473
|
-
id
|
|
474
|
-
sku
|
|
475
|
-
name
|
|
476
|
-
}
|
|
477
|
-
productDetail {
|
|
478
|
-
id
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
`,
|
|
485
|
-
variables: { orderNo, filter: tab }
|
|
486
|
-
})
|
|
973
|
+
function combineSameProducts(data) {
|
|
974
|
+
const combinedMap = new Map()
|
|
487
975
|
|
|
488
|
-
|
|
489
|
-
|
|
976
|
+
data.forEach(item => {
|
|
977
|
+
const key = `${item.relatedOrderInv?.product?.sku}_${item.batchId}_${item.expirationDate}`
|
|
978
|
+
|
|
979
|
+
if (combinedMap.has(key)) {
|
|
980
|
+
const existing = combinedMap.get(key)
|
|
981
|
+
existing.releaseQty += item.releaseQty
|
|
982
|
+
existing.pickedQty += item.pickedQty
|
|
983
|
+
existing.sortedQty += item.sortedQty
|
|
984
|
+
} else {
|
|
985
|
+
combinedMap.set(key, { ...item })
|
|
490
986
|
}
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
|
|
987
|
+
})
|
|
988
|
+
|
|
989
|
+
return Array.from(combinedMap.values())
|
|
494
990
|
}
|
|
495
991
|
|
|
496
992
|
async function fetchDeliveryOrders(releaseGoodName) {
|
|
497
993
|
try {
|
|
498
994
|
const response = await client.query({
|
|
499
|
-
query:
|
|
500
|
-
query getDeliveryOrders($releaseGoodNo: String!) {
|
|
501
|
-
getDeliveryOrders(releaseGoodNo: $releaseGoodNo) {
|
|
502
|
-
completable
|
|
503
|
-
deliveryOrders {
|
|
504
|
-
id
|
|
505
|
-
name
|
|
506
|
-
truckNo
|
|
507
|
-
orderInventories {
|
|
508
|
-
batchId
|
|
509
|
-
packingSize
|
|
510
|
-
packingType
|
|
511
|
-
pickedQty
|
|
512
|
-
product {
|
|
513
|
-
name
|
|
514
|
-
sku
|
|
515
|
-
}
|
|
516
|
-
inventory {
|
|
517
|
-
expirationDate
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
`,
|
|
995
|
+
query: GET_DELIVERY_ORDERS,
|
|
524
996
|
variables: { releaseGoodNo: releaseGoodName }
|
|
525
997
|
})
|
|
526
998
|
|
|
@@ -528,6 +1000,6 @@ async function fetchDeliveryOrders(releaseGoodName) {
|
|
|
528
1000
|
return response.data.getDeliveryOrders
|
|
529
1001
|
}
|
|
530
1002
|
} catch (e) {
|
|
531
|
-
|
|
1003
|
+
showToast(e)
|
|
532
1004
|
}
|
|
533
1005
|
}
|