@things-factory/operato-wms 4.3.239 → 4.3.242
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/components/vas-templates/vas-pallet-add-popup.js +1 -0
- package/client/pages/components/vas-templates/vas-relabel.js +1 -0
- package/client/pages/components/vas-templates/vas-repack-relabel.js +1 -0
- package/client/pages/components/vas-templates/vas-repack.js +1 -0
- package/client/pages/components/vas-templates/vas-repalletizing.js +1 -0
- package/client/pages/components/vas-templates/vas-template.js +1 -0
- package/client/pages/components/vas-templates/vas-unpack.js +1 -0
- package/client/pages/constants/vas-target-type.js +1 -0
- package/client/pages/constants/worksheet.js +4 -0
- package/client/pages/inbound/adjust-pallet-qty.js +1 -1
- package/client/pages/inbound/inbound-worksheet.js +1 -0
- package/client/pages/inbound/palletizing-pallets-popup.js +1 -1
- package/client/pages/inbound/unload-product.js +1 -0
- package/client/pages/inbound/vas-selector.js +1 -0
- package/client/pages/inbound/worksheet-putaway.js +1 -0
- package/client/pages/inbound/worksheet-unloading.js +1 -0
- package/client/pages/order/arrival-notice/arrival-notice-detail.js +1 -0
- package/client/pages/order/arrival-notice/assign-buffer-location.js +1 -0
- package/client/pages/order/arrival-notice/check-arrived-notice.js +1 -0
- package/client/pages/order/arrival-notice/create-arrival-notice.js +1 -0
- package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +1 -0
- package/client/pages/order/arrival-notice/receive-arrival-notice.js +1 -0
- package/client/pages/order/arrival-notice/rejected-arrival-notice.js +1 -0
- package/client/pages/order/release-order/create-release-order.js +713 -84
- package/client/pages/order/release-order/receive-release-order-request.js +1 -0
- package/client/pages/order/release-order/rejected-release-order.js +1 -0
- package/client/pages/order/release-order/release-order-detail.js +1020 -388
- package/client/pages/order/return-order/check-return-order.js +1 -0
- package/client/pages/order/return-order/rejected-return-order.js +2 -0
- package/client/pages/order/return-order/return-order-assign-buffer-location.js +1 -0
- package/client/pages/order/return-order/return-order-detail.js +1 -0
- package/client/pages/order/reverse-kitting-order/reverse-kitting-pallet-label-popup.js +1 -0
- package/client/pages/order/transfer-order/rejected-transfer-order.js +1 -0
- package/client/pages/order/vas-order/create-vas-order.js +1 -0
- package/client/pages/order/vas-order/popup/abastract-vas-create-form.js +1 -0
- package/client/pages/order/vas-order/popup/select-vas-popup.js +220 -0
- package/client/pages/order/vas-order/popup/vas-create-batch-product-type-form.js +1 -0
- package/client/pages/order/vas-order/popup/vas-create-batch-type-form.js +1 -0
- package/client/pages/order/vas-order/popup/vas-create-etc-type-form.js +1 -0
- package/client/pages/order/vas-order/popup/vas-create-popup.js +1 -0
- package/client/pages/order/vas-order/popup/vas-create-product-type-form.js +1 -0
- package/client/pages/order/vas-order/popup/vas-target-product-popup.js +644 -0
- package/client/pages/order/vas-order/receive-vas-order.js +1 -0
- package/client/pages/order/vas-order/vas-order-detail.js +1 -0
- package/client/pages/order/vas-order/vas-order-list.js +1 -0
- package/client/pages/order/vas-order/vas-order-requests.js +1 -0
- package/client/pages/outbound/loading-product.js +109 -14
- package/client/pages/outbound/picking-product.js +59 -1
- package/client/pages/outbound/vas-list-popup.js +367 -0
- package/client/pages/outbound/worksheet-loading.js +13 -8
- package/client/pages/outbound/worksheet-picking.js +4 -0
- package/client/pages/report/vas-report.js +534 -0
- package/client/pages/vas/abstract-execute-vas.js +2 -1
- package/client/pages/vas/execute-pure-vas.js +1 -0
- package/client/pages/vas/execute-ref-vas.js +1 -0
- package/client/pages/vas/execute-vas.js +2 -2
- package/client/pages/vas/related-vas-list.js +1 -0
- package/client/pages/vas/vas-execution-page.js +469 -0
- package/client/pages/vas/vas-pallet-label-popup.js +1 -0
- package/client/pages/vas/vas-worksheet-list.js +1 -0
- package/client/pages/vas/worksheet-ref-vas.js +97 -36
- package/client/pages/vas/worksheet-vas.js +1 -0
- package/client/route.js +9 -0
- package/config.development.js +67 -86
- 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/vas-report.js +118 -0
- package/dist-server/graphql/resolvers/reports/vas-report.js.map +1 -0
- package/dist-server/graphql/types/reports/index.js +6 -1
- package/dist-server/graphql/types/reports/index.js.map +1 -1
- package/dist-server/graphql/types/reports/vas-report-list.js +14 -0
- package/dist-server/graphql/types/reports/vas-report-list.js.map +1 -0
- package/dist-server/graphql/types/reports/vas-report.js +18 -0
- package/dist-server/graphql/types/reports/vas-report.js.map +1 -0
- package/package.json +5 -5
- package/server/graphql/resolvers/reports/index.ts +3 -1
- package/server/graphql/resolvers/reports/vas-report.ts +135 -0
- package/server/graphql/types/reports/index.ts +7 -1
- package/server/graphql/types/reports/vas-report-list.ts +8 -0
- package/server/graphql/types/reports/vas-report.ts +12 -0
- package/things-factory.config.js +11 -0
- package/translations/en.json +30 -5
- package/translations/ko.json +26 -1
- package/translations/ms.json +26 -1
- package/translations/zh.json +26 -1
|
@@ -0,0 +1,644 @@
|
|
|
1
|
+
import '@things-factory/grist-ui'
|
|
2
|
+
import '@things-factory/import-ui'
|
|
3
|
+
import '../../../components/vas-templates'
|
|
4
|
+
import './vas-create-batch-product-type-form'
|
|
5
|
+
import './vas-create-batch-type-form'
|
|
6
|
+
import './vas-create-etc-type-form'
|
|
7
|
+
import './vas-create-product-type-form'
|
|
8
|
+
|
|
9
|
+
import { css, html, LitElement } from 'lit-element'
|
|
10
|
+
|
|
11
|
+
import { MultiColumnFormStyles } from '@things-factory/form-ui'
|
|
12
|
+
import { i18next, localize } from '@things-factory/i18n-base'
|
|
13
|
+
import { isMobileDevice } from '@things-factory/utils'
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
VAS_BATCH_AND_PRODUCT_TYPE,
|
|
17
|
+
VAS_BATCH_NO_TYPE,
|
|
18
|
+
VAS_ETC_TYPE,
|
|
19
|
+
VAS_PRODUCT_TYPE,
|
|
20
|
+
VAS_SPECIAL_TYPE,
|
|
21
|
+
VAS_TARGET_TYPES
|
|
22
|
+
} from '../../../constants'
|
|
23
|
+
|
|
24
|
+
//vas --inbound. Inbound still use this popup.
|
|
25
|
+
export class VasTargetproductPopup extends localize(i18next)(LitElement) {
|
|
26
|
+
static get styles() {
|
|
27
|
+
return [
|
|
28
|
+
MultiColumnFormStyles,
|
|
29
|
+
css`
|
|
30
|
+
:host {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
background-color: white;
|
|
35
|
+
}
|
|
36
|
+
.grist {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
flex: 1;
|
|
40
|
+
overflow-y: auto;
|
|
41
|
+
}
|
|
42
|
+
.grist-container {
|
|
43
|
+
overflow-y: hidden;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex: 1;
|
|
46
|
+
}
|
|
47
|
+
data-grist {
|
|
48
|
+
overflow-y: hidden;
|
|
49
|
+
flex: 1;
|
|
50
|
+
}
|
|
51
|
+
h2 {
|
|
52
|
+
padding: var(--subtitle-padding);
|
|
53
|
+
font: var(--subtitle-font);
|
|
54
|
+
color: var(--subtitle-text-color);
|
|
55
|
+
border-bottom: var(--subtitle-border-bottom);
|
|
56
|
+
}
|
|
57
|
+
.grist h2 {
|
|
58
|
+
font: var(--grist-title-font);
|
|
59
|
+
}
|
|
60
|
+
.button-container {
|
|
61
|
+
padding: var(--button-container-padding);
|
|
62
|
+
margin: var(--button-container-margin);
|
|
63
|
+
text-align: var(--button-container-align);
|
|
64
|
+
background-color: var(--button-container-background);
|
|
65
|
+
height: var(--button-container-height);
|
|
66
|
+
}
|
|
67
|
+
.button-container button {
|
|
68
|
+
background-color: var(--button-container-button-background-color);
|
|
69
|
+
border-radius: var(--button-container-button-border-radius);
|
|
70
|
+
height: var(--button-container-button-height);
|
|
71
|
+
border: var(--button-container-button-border);
|
|
72
|
+
margin: var(--button-container-button-margin);
|
|
73
|
+
|
|
74
|
+
padding: var(--button-padding);
|
|
75
|
+
color: var(--theme-white-color);
|
|
76
|
+
font: var(--button-font);
|
|
77
|
+
text-transform: var(--button-text-transform);
|
|
78
|
+
}
|
|
79
|
+
.button-container button:hover,
|
|
80
|
+
.button-container button:active {
|
|
81
|
+
background-color: var(--button-background-focus-color);
|
|
82
|
+
}
|
|
83
|
+
.vas-container {
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: row;
|
|
86
|
+
flex: 1;
|
|
87
|
+
overflow-y: auto;
|
|
88
|
+
padding-bottom: 10px;
|
|
89
|
+
}
|
|
90
|
+
.vas-column {
|
|
91
|
+
flex: 1;
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
overflow: auto;
|
|
95
|
+
}
|
|
96
|
+
`
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static get properties() {
|
|
101
|
+
return {
|
|
102
|
+
_template: Object,
|
|
103
|
+
bizplaceId: Object,
|
|
104
|
+
record: Object,
|
|
105
|
+
selectedPackingType: String,
|
|
106
|
+
selectedTargetType: String,
|
|
107
|
+
targetGristConfig: Object,
|
|
108
|
+
targetData: Object,
|
|
109
|
+
targetList: Array,
|
|
110
|
+
vasGristConfig: Object,
|
|
111
|
+
vasGristData: Object,
|
|
112
|
+
vasList: Array
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
get targetGrist() {
|
|
117
|
+
return this.shadowRoot.querySelector('#target-grist')
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
get vasGrist() {
|
|
121
|
+
return this.shadowRoot.querySelector('#vas-grist')
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
get targetTypeForm() {
|
|
125
|
+
return this.shadowRoot.querySelector('form#target-type')
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
get batchTypeInput() {
|
|
129
|
+
return this.shadowRoot.querySelector('input#batchId')
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
get productTypeInput() {
|
|
133
|
+
return this.shadowRoot.querySelector('input#product')
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
get etcTypeInput() {
|
|
137
|
+
return this.shadowRoot.querySelector('input#etc')
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
get targetForm() {
|
|
141
|
+
return this.shadowRoot.querySelector('.vas-create-form')
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
get targetInfo() {
|
|
145
|
+
if (this.selectedTargetType === VAS_BATCH_AND_PRODUCT_TYPE || this.selectedTargetType === VAS_SPECIAL_TYPE) {
|
|
146
|
+
if (this.targetGrist?.selected && this.targetGrist.selected.some(record => record.assignedUomValue > 0)) {
|
|
147
|
+
return this.targetGrist.selected
|
|
148
|
+
.filter(
|
|
149
|
+
record =>
|
|
150
|
+
(record.assignedPackQty && record.assignedPackQty <= record.packQty) ||
|
|
151
|
+
(record.assignedUomValue && record.assignedUomValue <= record.totalUomValue)
|
|
152
|
+
)
|
|
153
|
+
.map(record => {
|
|
154
|
+
return {
|
|
155
|
+
targetType: this.selectedTargetType,
|
|
156
|
+
targetDisplay: `${record.batchId} - ${record.product.name} ${
|
|
157
|
+
record.product.description ? '(' + record.product.description + ')' : ''
|
|
158
|
+
}`,
|
|
159
|
+
target: { batchId: record.batchId, productId: record.product.id },
|
|
160
|
+
packingType: record.packingType,
|
|
161
|
+
packingSize: record.packingSize,
|
|
162
|
+
qty: record.assignedPackQty,
|
|
163
|
+
uomValue: (record.totalUomValue / record.packQty) * record.assignedPackQty
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
if (this.targetForm && this.targetForm.checkValidity()) {
|
|
169
|
+
return [
|
|
170
|
+
{
|
|
171
|
+
targetType: this.selectedTargetType,
|
|
172
|
+
targetDisplay: this.targetForm.targetDisplay,
|
|
173
|
+
target: this.targetForm.target,
|
|
174
|
+
packingType: this.targetForm.selectedPackingType,
|
|
175
|
+
qty: (this.targetForm.qty && parseInt(this.targetForm.qty)) || '',
|
|
176
|
+
uomValue: (this.targetForm.uomValue && parseFloat(this.targetForm.uomValue)) || ''
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
render() {
|
|
184
|
+
return html`
|
|
185
|
+
<search-form
|
|
186
|
+
id="search-form"
|
|
187
|
+
.fields=${this.searchFields}
|
|
188
|
+
@submit=${() => this.searchProduct()}>
|
|
189
|
+
</search-form>
|
|
190
|
+
|
|
191
|
+
<div class="grist-container">
|
|
192
|
+
<div class="grist">
|
|
193
|
+
<h2>${i18next.t('title.target_product')}</h2>
|
|
194
|
+
<data-grist
|
|
195
|
+
id="target-grist"
|
|
196
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
197
|
+
.config=${this.targetGristConfig}
|
|
198
|
+
.data="${this.targetData}"
|
|
199
|
+
@field-change="${this._calculateData.bind(this)}"
|
|
200
|
+
></data-grist>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
|
|
204
|
+
${this._template ? html`<div class="vas-column">${this._template}</div>` : ''}
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
<div class="button-container">
|
|
208
|
+
<mwc-button raised danger @click="${this.selectHandler.bind(this)}">${i18next.t('button.select')}</mwc-button>
|
|
209
|
+
</div>
|
|
210
|
+
`
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
constructor() {
|
|
214
|
+
super()
|
|
215
|
+
this.vasGristData = { records: [] }
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
updated(changedProps) {
|
|
219
|
+
if (changedProps.has('selectedTargetType')) {
|
|
220
|
+
this._template = null
|
|
221
|
+
this.vasGristData = { ...this.vasGristData, records: [] }
|
|
222
|
+
this._updateTargetGristConfig()
|
|
223
|
+
this.setVasQueryFilter()
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
firstUpdated() {
|
|
228
|
+
this.targetData = { records: [...this.targetList] }
|
|
229
|
+
this.searchFields = [
|
|
230
|
+
{
|
|
231
|
+
label: i18next.t('field.product_info'),
|
|
232
|
+
name: 'product_info',
|
|
233
|
+
props: { searchOper: 'eq' }
|
|
234
|
+
}
|
|
235
|
+
]
|
|
236
|
+
this.targetGristConfig = {
|
|
237
|
+
list: {
|
|
238
|
+
fields: ['batchId', 'product', 'packingType', 'packQty', 'assignedPackQty', 'totalUomValue', 'assignedUomValue']
|
|
239
|
+
},
|
|
240
|
+
pagination: { infinite: true },
|
|
241
|
+
rows: { appendable: false, selectable: { multiple: true } },
|
|
242
|
+
columns: [
|
|
243
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
244
|
+
{
|
|
245
|
+
type: 'gutter',
|
|
246
|
+
gutterName: 'row-selector',
|
|
247
|
+
multiple: true
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
type: 'string',
|
|
251
|
+
name: 'batchId',
|
|
252
|
+
header: i18next.t('field.batch_id'),
|
|
253
|
+
width: 150
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
type: 'string',
|
|
257
|
+
name: 'productName',
|
|
258
|
+
header: i18next.t('field.product'),
|
|
259
|
+
width: 350
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
type: 'string',
|
|
263
|
+
name: 'productSKU',
|
|
264
|
+
header: i18next.t('field.sku'),
|
|
265
|
+
width: 150
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
type: 'string',
|
|
269
|
+
name: 'packingType',
|
|
270
|
+
header: i18next.t('field.packing_type'),
|
|
271
|
+
width: 150
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
type: 'string',
|
|
275
|
+
name: 'uom',
|
|
276
|
+
header: i18next.t('field.uom'),
|
|
277
|
+
width: 80
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
type: 'float',
|
|
281
|
+
name: 'releaseUomValue',
|
|
282
|
+
header: i18next.t('field.uom_value'),
|
|
283
|
+
width: 120
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
type: 'integer',
|
|
287
|
+
name: 'releaseQty',
|
|
288
|
+
header: i18next.t('field.available_release_qty'),
|
|
289
|
+
record: { editable: false },
|
|
290
|
+
width: 150
|
|
291
|
+
}
|
|
292
|
+
]
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
this.vasGristConfig = {
|
|
296
|
+
list: { fields: ['ready', 'vas', 'batchId', 'remark'] },
|
|
297
|
+
pagination: { infinite: true },
|
|
298
|
+
rows: {
|
|
299
|
+
selectable: { multiple: true },
|
|
300
|
+
handlers: {
|
|
301
|
+
click: (columns, data, column, record, rowIndex) => {
|
|
302
|
+
if (!this.targetInfo || !this.targetInfo?.length) {
|
|
303
|
+
this._showToast({
|
|
304
|
+
message: i18next.t('text.vas_target_does_not_specified')
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
return
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (
|
|
311
|
+
this.targetGrist &&
|
|
312
|
+
this.targetGrist.selected &&
|
|
313
|
+
this.targetGrist.selected.length !==
|
|
314
|
+
this.targetGrist.dirtyData.records.filter(record => record.assignedUomValue > 0).length
|
|
315
|
+
) {
|
|
316
|
+
this._showToast({
|
|
317
|
+
message: i18next.t('text.please_check_your_vas_target')
|
|
318
|
+
})
|
|
319
|
+
|
|
320
|
+
return
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (record && record.vas && record.vas.operationGuideType === 'template' && record.vas.operationGuide) {
|
|
324
|
+
this._template = document.createElement(record.vas.operationGuide)
|
|
325
|
+
this._template.record = record
|
|
326
|
+
this._template.targetInfo = this.targetInfo
|
|
327
|
+
this._template.bizplaceId = this.bizplaceId
|
|
328
|
+
} else {
|
|
329
|
+
this._template = null
|
|
330
|
+
}
|
|
331
|
+
this._selectedVasRecord = record
|
|
332
|
+
this._selectedVasRecordIdx = rowIndex
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
columns: [
|
|
337
|
+
{
|
|
338
|
+
type: 'gutter',
|
|
339
|
+
gutterName: 'button',
|
|
340
|
+
icon: 'close',
|
|
341
|
+
handlers: {
|
|
342
|
+
click: (columns, data, column, record, rowIndex) => {
|
|
343
|
+
this.vasGristData = { ...this.vasGristData, records: data.records.filter((_, idx) => idx !== rowIndex) }
|
|
344
|
+
this.setVasQueryFilter()
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
type: 'boolean',
|
|
350
|
+
name: 'ready',
|
|
351
|
+
header: i18next.t('field.ready'),
|
|
352
|
+
width: 40
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
type: 'object',
|
|
356
|
+
name: 'vas',
|
|
357
|
+
header: i18next.t('field.vas'),
|
|
358
|
+
record: {
|
|
359
|
+
editable: true,
|
|
360
|
+
align: 'center',
|
|
361
|
+
options: {
|
|
362
|
+
queryName: 'vass',
|
|
363
|
+
select: [
|
|
364
|
+
{ name: 'id', hidden: true },
|
|
365
|
+
{ name: 'name', width: 160 },
|
|
366
|
+
{ name: 'description', width: 200 },
|
|
367
|
+
{ name: 'operationGuide', hidden: true },
|
|
368
|
+
{ name: 'operationGuideType', hidden: true }
|
|
369
|
+
],
|
|
370
|
+
list: { fields: ['name', 'description'] }
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
width: 250
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
type: 'string',
|
|
377
|
+
name: 'remark',
|
|
378
|
+
header: i18next.t('field.remark'),
|
|
379
|
+
record: { editable: true },
|
|
380
|
+
width: 300
|
|
381
|
+
}
|
|
382
|
+
]
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (this.record && this.record.orderVass && this.record.orderVass.length) {
|
|
386
|
+
this.selectedTargetType = this.record.targetType
|
|
387
|
+
this.vasGristData = { records: this.record.orderVass }
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
_onTypeFormchangeHandler(e) {
|
|
392
|
+
this.selectedTargetType = e.target.value
|
|
393
|
+
|
|
394
|
+
this.vasGristData = { records: [] }
|
|
395
|
+
this._setOperationGuideFilter()
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
_updateTargetGristConfig() {
|
|
399
|
+
const config = this.targetGristConfig
|
|
400
|
+
const rows = config.rows
|
|
401
|
+
const columns = config.columns.filter(column => column.type != 'gutter' && column.name != 'row-selector')
|
|
402
|
+
|
|
403
|
+
this.targetData = {
|
|
404
|
+
...this.targetData
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
this.targetGristConfig = {
|
|
408
|
+
...config,
|
|
409
|
+
rows: {
|
|
410
|
+
...rows,
|
|
411
|
+
selectable: {
|
|
412
|
+
multiple: true
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
columns: [{ type: 'gutter', gutterName: 'row-selector', multiple: true }, ...columns]
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
_onFieldChange(e) {
|
|
420
|
+
if (e.detail.column.name === 'vas') {
|
|
421
|
+
this._template = null
|
|
422
|
+
delete this.vasGrist.dirtyData.records[e.detail.row].operationGuide
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
this.vasGristData = {
|
|
426
|
+
...this.vasGrist.dirtyData,
|
|
427
|
+
records: this.vasGrist.dirtyData.records.map(record => {
|
|
428
|
+
return {
|
|
429
|
+
...record,
|
|
430
|
+
ready: this._isReadyToCreate(record)
|
|
431
|
+
}
|
|
432
|
+
})
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
this.setVasQueryFilter()
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
_setOperationGuideFilter() {
|
|
439
|
+
if (this.selectedTargetType === VAS_SPECIAL_TYPE) {
|
|
440
|
+
const columns = this.vasGristConfig.columns.map(column => {
|
|
441
|
+
if (
|
|
442
|
+
column.name &&
|
|
443
|
+
column.name === 'vas' &&
|
|
444
|
+
column.record &&
|
|
445
|
+
column.record.options &&
|
|
446
|
+
column.record.options.basicArgs
|
|
447
|
+
) {
|
|
448
|
+
column.record.options.basicArgs.filters = column.record.options.basicArgs.filters.filter(
|
|
449
|
+
x => x.name !== 'operationGuideType'
|
|
450
|
+
)
|
|
451
|
+
}
|
|
452
|
+
return column
|
|
453
|
+
})
|
|
454
|
+
|
|
455
|
+
this.vasGristConfig = {
|
|
456
|
+
...this.vasGristConfig,
|
|
457
|
+
columns
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
_calculateData(e) {
|
|
463
|
+
const { after, column, record, row } = e.detail
|
|
464
|
+
|
|
465
|
+
let assignedPackQty, assignedUomValue
|
|
466
|
+
|
|
467
|
+
if (column.name == 'assignedPackQty') {
|
|
468
|
+
if (!after || after > record.packQty) {
|
|
469
|
+
this._showToast({
|
|
470
|
+
message: i18next.t('text.invalid_value_in_list')
|
|
471
|
+
})
|
|
472
|
+
} else {
|
|
473
|
+
assignedPackQty = after
|
|
474
|
+
assignedUomValue = Math.round((record.totalUomValue / record.packQty) * assignedPackQty * 100) / 100
|
|
475
|
+
}
|
|
476
|
+
} else if (column.name == 'assignedUomValue') {
|
|
477
|
+
if (!after || after > record.totalUomValue) {
|
|
478
|
+
this._showToast({
|
|
479
|
+
message: i18next.t('text.invalid_value_in_list')
|
|
480
|
+
})
|
|
481
|
+
} else {
|
|
482
|
+
assignedUomValue = after
|
|
483
|
+
assignedPackQty = ''
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
this.targetData = {
|
|
488
|
+
...this.targetData,
|
|
489
|
+
records: this.targetData.records.map((targetRecord, idx) => {
|
|
490
|
+
if (idx == row) {
|
|
491
|
+
return { ...record, assignedPackQty, assignedUomValue }
|
|
492
|
+
} else return targetRecord
|
|
493
|
+
})
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
this._setOperationGuideFilter()
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
_calculateData2() {
|
|
500
|
+
this.targetData = {
|
|
501
|
+
...this.targetData,
|
|
502
|
+
records: this.targetGrist.dirtyData.records.map(record => {
|
|
503
|
+
let assignedPackQty = 0
|
|
504
|
+
let assignedUomValue = 0
|
|
505
|
+
|
|
506
|
+
if (record.assignedPackQty > record.packQty || record.assignedPackQty < 0) {
|
|
507
|
+
this._showToast({
|
|
508
|
+
message: i18next.t('text.assigned_pack_qty_is_invalid')
|
|
509
|
+
})
|
|
510
|
+
} else {
|
|
511
|
+
assignedPackQty = record.assignedPackQty || 0
|
|
512
|
+
assignedUomValue = Math.round((record.totalUomValue / record.packQty) * assignedPackQty * 100) / 100
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
if (assignedPackQty && assignedPackQty > 0)
|
|
516
|
+
return {
|
|
517
|
+
...record,
|
|
518
|
+
assignedPackQty,
|
|
519
|
+
assignedUomValue
|
|
520
|
+
}
|
|
521
|
+
else return record
|
|
522
|
+
})
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
this._setOperationGuideFilter()
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
_isReadyToCreate(record) {
|
|
529
|
+
if (record.vas && record.vas.operationGuideType) {
|
|
530
|
+
return Boolean(record.operationGuide && record.remark)
|
|
531
|
+
} else if (record.vas && !record.vas.operationGuideType) {
|
|
532
|
+
return Boolean(record.vas && record.remark)
|
|
533
|
+
} else {
|
|
534
|
+
return false
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
searchProduct() {
|
|
539
|
+
const productInfo = this.shadowRoot
|
|
540
|
+
.querySelector('search-form')
|
|
541
|
+
.queryFilters.find(search => search.name == 'product_info')
|
|
542
|
+
|
|
543
|
+
if (productInfo) {
|
|
544
|
+
let found = []
|
|
545
|
+
this.targetList.find(data => {
|
|
546
|
+
if (
|
|
547
|
+
data.productName.toLowerCase().includes(productInfo.value.toLowerCase()) ||
|
|
548
|
+
data.productSKU.toLowerCase().includes(productInfo.value.toLowerCase()) ||
|
|
549
|
+
data.batchId.toLowerCase().includes(productInfo.value.toLowerCase())
|
|
550
|
+
) {
|
|
551
|
+
found.push(data)
|
|
552
|
+
}
|
|
553
|
+
})
|
|
554
|
+
this.targetData.records = found
|
|
555
|
+
this._updateTargetGristConfig()
|
|
556
|
+
} else {
|
|
557
|
+
this.targetData.records = this.targetList
|
|
558
|
+
this._updateTargetGristConfig()
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
selectHandler() {
|
|
563
|
+
try {
|
|
564
|
+
if (this.targetGrist.selected.length < 1) {
|
|
565
|
+
throw new Error(i18next.t('text.nothing_selected'))
|
|
566
|
+
}
|
|
567
|
+
this.dispatchEvent(
|
|
568
|
+
new CustomEvent('selected', {
|
|
569
|
+
detail: this.targetGrist.selected
|
|
570
|
+
})
|
|
571
|
+
)
|
|
572
|
+
history.back()
|
|
573
|
+
} catch (e) {
|
|
574
|
+
this._showToast(e)
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
resetVasTemplates() {
|
|
579
|
+
this._template = null
|
|
580
|
+
|
|
581
|
+
this.vasGrist.data = {
|
|
582
|
+
...this.vasGrist.data,
|
|
583
|
+
records: this.vasGrist.data.records.map(record => {
|
|
584
|
+
if (record && record.operationGuide) {
|
|
585
|
+
delete record.operationGuide
|
|
586
|
+
record.ready = false
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
return record
|
|
590
|
+
})
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
async setVasQueryFilter() {
|
|
595
|
+
if (!this.selectedTargetType) return
|
|
596
|
+
await this.updateComplete
|
|
597
|
+
|
|
598
|
+
let vasIds = []
|
|
599
|
+
if (this.vasGristData && this.vasGristData.records && this.vasGristData.records.length) {
|
|
600
|
+
vasIds = this.vasGristData.records.filter(record => record.vas && record.vas.id).map(record => record.vas.id)
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
const selectedVasFilter = { name: 'id', operator: 'notin', value: vasIds }
|
|
604
|
+
const specialVasFilter = {
|
|
605
|
+
name: 'operationGuide',
|
|
606
|
+
value: ['vas-repack', 'vas-repalletizing', 'vas-relabel', 'vas-unpack', 'vas-repack-relabel']
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
const columns = this.vasGristConfig.columns.map(column => {
|
|
610
|
+
if (column.name && column.name === 'vas' && column.record && column.record.options) {
|
|
611
|
+
if (vasIds.length) {
|
|
612
|
+
column.record.options.basicArgs =
|
|
613
|
+
this.selectedTargetType === VAS_SPECIAL_TYPE
|
|
614
|
+
? { filters: [{ ...specialVasFilter, operator: 'in' }, selectedVasFilter] }
|
|
615
|
+
: { filters: [{ ...specialVasFilter, operator: 'notin_with_null' }, selectedVasFilter] }
|
|
616
|
+
} else {
|
|
617
|
+
column.record.options.basicArgs =
|
|
618
|
+
this.selectedTargetType === VAS_SPECIAL_TYPE
|
|
619
|
+
? { filters: [{ ...specialVasFilter, operator: 'in' }] }
|
|
620
|
+
: { filters: [{ ...specialVasFilter, operator: 'notin_with_null' }] }
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
return column
|
|
624
|
+
})
|
|
625
|
+
|
|
626
|
+
this.vasGristConfig = {
|
|
627
|
+
...this.vasGristConfig,
|
|
628
|
+
columns
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
_showToast({ type, message }) {
|
|
633
|
+
document.dispatchEvent(
|
|
634
|
+
new CustomEvent('notify', {
|
|
635
|
+
detail: {
|
|
636
|
+
type,
|
|
637
|
+
message
|
|
638
|
+
}
|
|
639
|
+
})
|
|
640
|
+
)
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
window.customElements.define('vas-target-product-popup', VasTargetproductPopup)
|
|
@@ -169,6 +169,7 @@ class VasOrderList extends localize(i18next)(PageView) {
|
|
|
169
169
|
return this.config.columns
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
//vas
|
|
172
173
|
async fetchHandler({ page, limit, sorters = [{ name: 'createdAt', desc: true }] }) {
|
|
173
174
|
const response = await client.query({
|
|
174
175
|
query: gql`
|
|
@@ -171,6 +171,7 @@ class VasOrderRequests extends localize(i18next)(PageView) {
|
|
|
171
171
|
return this.config.columns
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
//vas
|
|
174
175
|
async fetchHandler({ page, limit, sorters = [{ name: 'updatedAt', desc: true }] }) {
|
|
175
176
|
const response = await client.query({
|
|
176
177
|
query: gql`
|