@things-factory/operato-wms 4.3.355 → 4.3.357
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/select-cc-product-popup.js +321 -0
- package/client/pages/constants/order.js +15 -0
- package/client/pages/inventory-check/add-extra-inventory-popup.js +306 -0
- package/client/pages/inventory-check/check-inventory-popup.js +183 -167
- package/client/pages/inventory-check/create-cycle-count.js +292 -141
- package/client/pages/inventory-check/cycle-count-inventory-details-popup.js +282 -0
- package/client/pages/inventory-check/cycle-count-recheck-popup.js +129 -31
- package/client/pages/inventory-check/cycle-count-report.js +425 -306
- package/client/pages/inventory-check/cycle-count-review.js +742 -0
- package/client/pages/inventory-check/cycle-count-worksheet-list.js +476 -0
- package/client/pages/inventory-check/inspecting-product.js +954 -1029
- package/client/pages/inventory-check/inventory-check-detail.js +378 -0
- package/client/pages/inventory-check/inventory-check-list.js +35 -109
- package/client/pages/inventory-check/relocate-inventory-popup.js +222 -0
- package/client/pages/inventory-check/search-popup.js +1 -1
- package/client/pages/inventory-check/select-cc-location-popup.js +230 -0
- package/client/pages/inventory-check/worksheet-cycle-count.js +112 -90
- package/client/pages/outbound/route-label-popup.js +16 -0
- package/client/route.js +8 -0
- package/dist-server/graphql/resolvers/reports/cycle-count-report.js +244 -0
- package/dist-server/graphql/resolvers/reports/cycle-count-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/types/reports/cycle-count-report-list.js +14 -0
- package/dist-server/graphql/types/reports/cycle-count-report-list.js.map +1 -0
- package/dist-server/graphql/types/reports/cycle-count-report.js +25 -0
- package/dist-server/graphql/types/reports/cycle-count-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 +6 -6
- package/server/graphql/resolvers/reports/cycle-count-report.ts +267 -0
- package/server/graphql/resolvers/reports/index.ts +3 -4
- package/server/graphql/types/reports/cycle-count-report-list.ts +8 -0
- package/server/graphql/types/reports/cycle-count-report.ts +19 -0
- package/server/graphql/types/reports/index.ts +7 -8
- package/things-factory.config.js +8 -0
- package/translations/en.json +34 -0
- package/translations/ko.json +34 -0
- package/translations/ms.json +35 -1
- package/translations/zh.json +37 -3
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import '@things-factory/grist-ui'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
import { css, html, LitElement } from 'lit-element'
|
|
5
|
+
|
|
6
|
+
import { i18next, localize } from '@things-factory/i18n-base'
|
|
7
|
+
import { client } from '@things-factory/shell'
|
|
8
|
+
import { ScrollbarStyles } from '@things-factory/styles'
|
|
9
|
+
import { isMobileDevice } from '@things-factory/utils'
|
|
10
|
+
|
|
11
|
+
class SelectCcProductPopup extends localize(i18next)(LitElement) {
|
|
12
|
+
static get properties() {
|
|
13
|
+
return {
|
|
14
|
+
productConfig: Object,
|
|
15
|
+
productDetailConfig: Object,
|
|
16
|
+
data: Object,
|
|
17
|
+
bizplaceId: String,
|
|
18
|
+
searchFields: Array,
|
|
19
|
+
_productName: String,
|
|
20
|
+
productDetailData: Array,
|
|
21
|
+
selectMultipleProducts: Boolean
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static get styles() {
|
|
26
|
+
return [
|
|
27
|
+
ScrollbarStyles,
|
|
28
|
+
css`
|
|
29
|
+
:host {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
background-color: white;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
search-form {
|
|
37
|
+
overflow: visible;
|
|
38
|
+
}
|
|
39
|
+
.grist {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
flex: 1;
|
|
43
|
+
overflow-y: auto;
|
|
44
|
+
}
|
|
45
|
+
.grist-container {
|
|
46
|
+
overflow-y: hidden;
|
|
47
|
+
display: flex;
|
|
48
|
+
flex: 1;
|
|
49
|
+
}
|
|
50
|
+
data-grist {
|
|
51
|
+
overflow-y: hidden;
|
|
52
|
+
flex: 1;
|
|
53
|
+
}
|
|
54
|
+
h2 {
|
|
55
|
+
padding: var(--subtitle-padding);
|
|
56
|
+
font: var(--subtitle-font);
|
|
57
|
+
color: var(--subtitle-text-color);
|
|
58
|
+
border-bottom: var(--subtitle-border-bottom);
|
|
59
|
+
}
|
|
60
|
+
.grist h2 {
|
|
61
|
+
font: var(--grist-title-font);
|
|
62
|
+
}
|
|
63
|
+
.button-container {
|
|
64
|
+
padding: var(--button-container-padding);
|
|
65
|
+
margin: var(--button-container-margin);
|
|
66
|
+
text-align: var(--button-container-align);
|
|
67
|
+
background-color: var(--button-container-background);
|
|
68
|
+
height: var(--button-container-height);
|
|
69
|
+
}
|
|
70
|
+
`
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
render() {
|
|
75
|
+
return html`
|
|
76
|
+
<search-form
|
|
77
|
+
id="search-form"
|
|
78
|
+
.fields=${this.searchFields}
|
|
79
|
+
@submit=${() => this.productGrist.fetch()}
|
|
80
|
+
></search-form>
|
|
81
|
+
|
|
82
|
+
<div class="grist-container">
|
|
83
|
+
<div class="grist">
|
|
84
|
+
<data-grist
|
|
85
|
+
id="product"
|
|
86
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
87
|
+
.config=${this.productConfig}
|
|
88
|
+
.fetchHandler=${this.fetchProducts.bind(this)}
|
|
89
|
+
></data-grist>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
<div class="button-container">
|
|
94
|
+
<mwc-button
|
|
95
|
+
@click="${this.selectProduct.bind(this)}"
|
|
96
|
+
label="${`${i18next.t('button.select')}`}"
|
|
97
|
+
raised
|
|
98
|
+
></mwc-button>
|
|
99
|
+
</div>
|
|
100
|
+
`
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
get productGrist() {
|
|
104
|
+
return this.shadowRoot.querySelector('data-grist#product')
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
get searchForm() {
|
|
108
|
+
return this.shadowRoot.querySelector('search-form')
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
firstUpdated() {
|
|
112
|
+
this.searchFields = [
|
|
113
|
+
{
|
|
114
|
+
label: i18next.t('field.product_info'),
|
|
115
|
+
name: 'product_info',
|
|
116
|
+
props: { searchOper: 'i_like' }
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
|
|
120
|
+
this.productConfig = {
|
|
121
|
+
pagination: { pages: [10, 20, 50, 100] },
|
|
122
|
+
list: { fields: ['sku', 'name', 'packingType'] },
|
|
123
|
+
rows: {
|
|
124
|
+
appendable: false,
|
|
125
|
+
selectable: { multiple: false },
|
|
126
|
+
handlers: { dblclick: this._dblClickHandler.bind(this) }
|
|
127
|
+
},
|
|
128
|
+
columns: [
|
|
129
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
130
|
+
{
|
|
131
|
+
type: 'gutter',
|
|
132
|
+
gutterName: 'row-selector',
|
|
133
|
+
multiple: false
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
type: 'string',
|
|
137
|
+
name: 'productId',
|
|
138
|
+
hidden: true
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
type: 'string',
|
|
142
|
+
name: 'sku',
|
|
143
|
+
header: i18next.t('field.sku'),
|
|
144
|
+
width: 120
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
type: 'string',
|
|
148
|
+
name: 'name',
|
|
149
|
+
header: i18next.t('field.name'),
|
|
150
|
+
width: 180
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: 'string',
|
|
154
|
+
name: 'brand',
|
|
155
|
+
header: i18next.t('field.brand'),
|
|
156
|
+
width: 120
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
type: 'string',
|
|
160
|
+
name: 'description',
|
|
161
|
+
header: i18next.t('field.description'),
|
|
162
|
+
width: 220
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
type: 'string',
|
|
166
|
+
name: 'packingType',
|
|
167
|
+
header: i18next.t('field.packing_type'),
|
|
168
|
+
width: 180
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
type: 'float',
|
|
172
|
+
name: 'packingSize',
|
|
173
|
+
header: i18next.t('field.packing_size'),
|
|
174
|
+
width: 100
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
type: 'string',
|
|
178
|
+
name: 'uom',
|
|
179
|
+
header: i18next.t('field.uom'),
|
|
180
|
+
width: 120
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
type: 'string',
|
|
184
|
+
name: 'uomValue',
|
|
185
|
+
header: i18next.t('field.uom_value'),
|
|
186
|
+
width: 120
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
type: 'float',
|
|
190
|
+
name: 'costPrice',
|
|
191
|
+
header: i18next.t('field.unit_cost'),
|
|
192
|
+
width: 120
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
async fetchProducts({ page, limit, sorters = [] }) {
|
|
199
|
+
const filters = [
|
|
200
|
+
...this.searchForm.queryFilters,
|
|
201
|
+
{ name: 'bizplace_id', operator: 'eq', value: this.bizplaceId },
|
|
202
|
+
{ name: 'create_arrival_notice', operator: 'eq', value: true }
|
|
203
|
+
]
|
|
204
|
+
const pagination = { page, limit }
|
|
205
|
+
const sortings = sorters
|
|
206
|
+
|
|
207
|
+
const response = await client.query({
|
|
208
|
+
query: gql`
|
|
209
|
+
query productDetails($filters: [Filter!]!, $pagination: Pagination, $sortings: [Sorting!]!) {
|
|
210
|
+
productDetails(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
211
|
+
items {
|
|
212
|
+
id
|
|
213
|
+
name
|
|
214
|
+
packingType
|
|
215
|
+
packingSize
|
|
216
|
+
uom
|
|
217
|
+
uomValue
|
|
218
|
+
costPrice
|
|
219
|
+
product {
|
|
220
|
+
id
|
|
221
|
+
name
|
|
222
|
+
sku
|
|
223
|
+
brand
|
|
224
|
+
description
|
|
225
|
+
type
|
|
226
|
+
costPrice
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
total
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
`,
|
|
233
|
+
variables: { filters, pagination, sortings }
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
if (!response.errors) {
|
|
237
|
+
return {
|
|
238
|
+
total: response.data.productDetails.total || 0,
|
|
239
|
+
records:
|
|
240
|
+
response.data.productDetails.items.map(item => {
|
|
241
|
+
return {
|
|
242
|
+
...item,
|
|
243
|
+
sku: item.product.sku,
|
|
244
|
+
productName: item.product.name,
|
|
245
|
+
productId: item.product.id,
|
|
246
|
+
brand: item.product.brand,
|
|
247
|
+
name: item.name,
|
|
248
|
+
description: item.product.description,
|
|
249
|
+
costPrice: (item.costPrice = (item?.costPrice || 0).toFixed(2))
|
|
250
|
+
}
|
|
251
|
+
}) || []
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
_dblClickHandler(columns, data, column, record, rowIndex, target) {
|
|
257
|
+
if (this.selectMultipleProducts) return
|
|
258
|
+
this.dispatchEvent(
|
|
259
|
+
new CustomEvent('selected', {
|
|
260
|
+
detail: {
|
|
261
|
+
productDetailId: record.id,
|
|
262
|
+
packingType: record.packingType,
|
|
263
|
+
uom: record.uom,
|
|
264
|
+
uomValue: record.uomValue,
|
|
265
|
+
productName: `${record.name}(${record.description}(${record.sku}))`,
|
|
266
|
+
isError: false,
|
|
267
|
+
productBrand: record.brand,
|
|
268
|
+
unitPrice: parseFloat(record.costPrice).toFixed(2),
|
|
269
|
+
product: {
|
|
270
|
+
id: record.productId,
|
|
271
|
+
name: record.name,
|
|
272
|
+
sku: record.sku,
|
|
273
|
+
packingType: record.packingType,
|
|
274
|
+
packingSize: record.packingSize,
|
|
275
|
+
primaryUnit: record.uom,
|
|
276
|
+
primaryValue: record.uomValue,
|
|
277
|
+
costPrice: parseFloat(record.costPrice).toFixed(2)
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
})
|
|
281
|
+
)
|
|
282
|
+
history.back()
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
selectProduct(record) {
|
|
286
|
+
const selectedProduct = this.productGrist.selected[0]
|
|
287
|
+
if (selectedProduct) {
|
|
288
|
+
this.dispatchEvent(
|
|
289
|
+
new CustomEvent('selected', {
|
|
290
|
+
detail: {
|
|
291
|
+
productDetailId: selectedProduct.id,
|
|
292
|
+
packingType: selectedProduct.packingType,
|
|
293
|
+
uom: selectedProduct.uom,
|
|
294
|
+
uomValue: selectedProduct.uomValue,
|
|
295
|
+
productName: `${selectedProduct.name}(${selectedProduct.description}(${selectedProduct.sku}))`,
|
|
296
|
+
isError: false,
|
|
297
|
+
productBrand: selectedProduct.brand,
|
|
298
|
+
unitPrice: parseFloat(selectedProduct.costPrice).toFixed(2),
|
|
299
|
+
product: {
|
|
300
|
+
id: selectedProduct.productId,
|
|
301
|
+
name: selectedProduct.name,
|
|
302
|
+
sku: selectedProduct.sku,
|
|
303
|
+
packingType: selectedProduct.packingType,
|
|
304
|
+
packingSize: selectedProduct.packingSize,
|
|
305
|
+
primaryUnit: selectedProduct.uom,
|
|
306
|
+
primaryValue: selectedProduct.uomValue,
|
|
307
|
+
costPrice: parseFloat(selectedProduct.costPrice).toFixed(2)
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
})
|
|
311
|
+
)
|
|
312
|
+
history.back()
|
|
313
|
+
} else {
|
|
314
|
+
document.dispatchEvent(
|
|
315
|
+
new CustomEvent('notify', { detail: { message: i18next.t('text.product_is_not_selected') } })
|
|
316
|
+
)
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
window.customElements.define('select-cc-product-popup', SelectCcProductPopup)
|
|
@@ -181,3 +181,18 @@ export const TRANSFER_TYPES = {
|
|
|
181
181
|
DIRECT: { name: 'direct', value: 'DIRECT' },
|
|
182
182
|
RETURN: { name: 'return', value: 'RETURN' }
|
|
183
183
|
}
|
|
184
|
+
|
|
185
|
+
export const INVENTORY_CHECK_ITEM_STATUS = {
|
|
186
|
+
PENDING: { name: 'inventory_status_pending', value: 'PENDING' },
|
|
187
|
+
INSPECTING: { name: 'inventory_status_inspecting', value: 'INSPECTING' },
|
|
188
|
+
INSPECTED: { name: 'inventory_status_inspected', value: 'INSPECTED' },
|
|
189
|
+
NOT_TALLY: { name: 'inventory_status_not_tally', value: 'NOT_TALLY' },
|
|
190
|
+
MISSING: { name: 'inventory_status_missing', value: 'MISSING' },
|
|
191
|
+
EXTRA: { name: 'inventory_status_extra', value: 'EXTRA' },
|
|
192
|
+
RELOCATED: { name: 'inventory_status_relocated', value: 'RELOCATED' },
|
|
193
|
+
ADDED: { name: 'inventory_status_added', value: 'ADDED' },
|
|
194
|
+
TERMINATED: { name: 'inventory_status_terminated', value: 'TERMINATED' },
|
|
195
|
+
CANCELLED: { name: 'inventory_status_cancelled', value: 'CANCELLED' },
|
|
196
|
+
PENDING_CANCEL: { name: 'inventory_status_pending_cancel', value: 'PENDING_CANCEL' },
|
|
197
|
+
DONE: { name: 'inventory_status_done', value: 'DONE' }
|
|
198
|
+
}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import '@things-factory/barcode-ui'
|
|
2
|
+
import { SingleColumnFormStyles } from '@things-factory/form-ui'
|
|
3
|
+
import { client } from '@things-factory/shell'
|
|
4
|
+
import gql from 'graphql-tag'
|
|
5
|
+
import { i18next, localize } from '@things-factory/i18n-base'
|
|
6
|
+
import { css, html, LitElement } from 'lit-element'
|
|
7
|
+
import { openPopup } from '@things-factory/layout-base'
|
|
8
|
+
import '../components/select-cc-product-popup'
|
|
9
|
+
|
|
10
|
+
class AddExtraInventoryPopup extends localize(i18next)(LitElement) {
|
|
11
|
+
static get properties() {
|
|
12
|
+
return {
|
|
13
|
+
bizplaceId: String,
|
|
14
|
+
bizplaceName: String,
|
|
15
|
+
cycleCountNo: String,
|
|
16
|
+
countNo: Number,
|
|
17
|
+
productDetailId: String,
|
|
18
|
+
productId: String,
|
|
19
|
+
config: Object,
|
|
20
|
+
data: Object
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static get styles() {
|
|
25
|
+
return [
|
|
26
|
+
SingleColumnFormStyles,
|
|
27
|
+
css`
|
|
28
|
+
:host {
|
|
29
|
+
padding: 10px;
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
overflow-x: overlay;
|
|
33
|
+
background-color: var(--main-section-background-color);
|
|
34
|
+
}
|
|
35
|
+
.grist {
|
|
36
|
+
background-color: var(--main-section-background-color);
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
flex: 1;
|
|
40
|
+
overflow-y: auto;
|
|
41
|
+
}
|
|
42
|
+
data-grist {
|
|
43
|
+
overflow-y: hidden;
|
|
44
|
+
flex: 1;
|
|
45
|
+
}
|
|
46
|
+
.input-container {
|
|
47
|
+
display: flex;
|
|
48
|
+
}
|
|
49
|
+
.button-container {
|
|
50
|
+
padding: var(--button-container-padding);
|
|
51
|
+
margin: var(--button-container-margin);
|
|
52
|
+
text-align: var(--button-container-align);
|
|
53
|
+
background-color: var(--button-container-background);
|
|
54
|
+
height: var(--button-container-height);
|
|
55
|
+
}
|
|
56
|
+
.button-container button {
|
|
57
|
+
background-color: var(--button-container-button-background-color);
|
|
58
|
+
border-radius: var(--button-container-button-border-radius);
|
|
59
|
+
height: var(--button-container-button-height);
|
|
60
|
+
border: var(--button-container-button-border);
|
|
61
|
+
margin: var(--button-container-button-margin);
|
|
62
|
+
padding: var(--button-padding);
|
|
63
|
+
color: var(--theme-white-color);
|
|
64
|
+
font: var(--button-font);
|
|
65
|
+
text-transform: var(--button-text-transform);
|
|
66
|
+
}
|
|
67
|
+
.button-container button:hover,
|
|
68
|
+
.button-container button:active {
|
|
69
|
+
background-color: var(--button-background-focus-color);
|
|
70
|
+
}
|
|
71
|
+
.button-container > barcode-scanable-input {
|
|
72
|
+
margin: auto;
|
|
73
|
+
}
|
|
74
|
+
`
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async firstUpdated() {
|
|
79
|
+
await this.updateComplete
|
|
80
|
+
|
|
81
|
+
if (this.skuInput) this.skuInput.value = ''
|
|
82
|
+
if (this.inspectedLocationInput) this.inspectedLocationInput.value = ''
|
|
83
|
+
if (this.inspectedBatchNoInput) this.inspectedBatchNoInput.value = ''
|
|
84
|
+
if (this.inspectedQtyInput) this.inspectedQtyInput.value = ''
|
|
85
|
+
if (this.inspectedUomValueInput) this.inspectedUomValueInput.value = ''
|
|
86
|
+
this.productDetailId = ''
|
|
87
|
+
this.productId = ''
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
get palletIdInput() {
|
|
91
|
+
return this.shadowRoot.querySelector('barcode-scanable-input[name=palletId]').shadowRoot.querySelector('input')
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
get skuInput() {
|
|
95
|
+
return this.shadowRoot.querySelector('input[name=sku]')
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
get inspectedLocationInput() {
|
|
99
|
+
return this.shadowRoot
|
|
100
|
+
.querySelector('barcode-scanable-input[name=inspectedLocation]')
|
|
101
|
+
.shadowRoot.querySelector('input')
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
get inspectedBatchNoInput() {
|
|
105
|
+
return this.shadowRoot.querySelector('input[name=inspectedBatchNo]')
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
get inspectedQtyInput() {
|
|
109
|
+
return this.shadowRoot.querySelector('input[name=inspectedQty]')
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
get inspectedUomValueInput() {
|
|
113
|
+
return this.shadowRoot.querySelector('input[name=inspectedUomValue]')
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
render() {
|
|
117
|
+
return html`
|
|
118
|
+
<form
|
|
119
|
+
id="input-form"
|
|
120
|
+
class="single-column-form"
|
|
121
|
+
@keypress="${async e => {
|
|
122
|
+
if (e.keyCode === 13) {
|
|
123
|
+
e.preventDefault()
|
|
124
|
+
this._checkPalletId()
|
|
125
|
+
}
|
|
126
|
+
}}"
|
|
127
|
+
>
|
|
128
|
+
<fieldset>
|
|
129
|
+
<label>${i18next.t('label.location')}</label>
|
|
130
|
+
<barcode-scanable-input name="inspectedLocation" custom-input></barcode-scanable-input>
|
|
131
|
+
<label>${i18next.t('label.sku')}</label>
|
|
132
|
+
<input name="sku" type="text" .value=${this.sku} custom-input @click="${this._openProductSelection}" />
|
|
133
|
+
<label>${i18next.t('label.inspected_batch_no')}</label>
|
|
134
|
+
<input name="inspectedBatchNo" type="text" .value=${this.inspectedBatchNo} custom-input />
|
|
135
|
+
<label>${i18next.t('label.inspected_qty')}</label>
|
|
136
|
+
<input name="inspectedQty" type="text" .value=${this.inspectedQty} custom-input />
|
|
137
|
+
${!this.enableCartonLabel
|
|
138
|
+
? html`
|
|
139
|
+
<label>${i18next.t('label.inspected_uom_value')}</label>
|
|
140
|
+
<input name="inspectedUomValue" type="text" .value=${this.inspectedUomValue} custom-input />
|
|
141
|
+
`
|
|
142
|
+
: ''}
|
|
143
|
+
</fieldset>
|
|
144
|
+
</form>
|
|
145
|
+
<div class="button-container">
|
|
146
|
+
<mwc-button raised @click="${this._submitInventory}" label="${i18next.t('button.confirm')}"></mwc-button>
|
|
147
|
+
</div>
|
|
148
|
+
`
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
focusOnPalletInput() {
|
|
152
|
+
this.palletIdInput.focus()
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
focusOnInspectedLocationInput() {
|
|
156
|
+
this.inspectedLocationInput.focus()
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
_openProductSelection() {
|
|
160
|
+
openPopup(
|
|
161
|
+
html`
|
|
162
|
+
<select-cc-product-popup
|
|
163
|
+
.bizplaceId="${this.bizplaceId}"
|
|
164
|
+
@selected="${e => {
|
|
165
|
+
// e.detail will contain the data about the selected product
|
|
166
|
+
if (e.detail) {
|
|
167
|
+
this.productDetailId = e.detail.productDetailId
|
|
168
|
+
this.sku = e.detail.product.sku
|
|
169
|
+
this.productId = e.detail.product.id
|
|
170
|
+
this.requestUpdate()
|
|
171
|
+
}
|
|
172
|
+
}}"
|
|
173
|
+
></select-cc-product-popup>
|
|
174
|
+
`,
|
|
175
|
+
{
|
|
176
|
+
backdrop: true,
|
|
177
|
+
size: 'large',
|
|
178
|
+
title: i18next.t('title.select_item')
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
async _submitInventory() {
|
|
184
|
+
try {
|
|
185
|
+
await this._validateInput()
|
|
186
|
+
let inspectedBatchNo = this.inspectedBatchNoInput.value
|
|
187
|
+
let inspectedQty = Number(this.inspectedQtyInput.value)
|
|
188
|
+
let inspectedUomValue = this.enableCartonLabel ? inspectedQty : Number(this.inspectedUomValueInput.value)
|
|
189
|
+
let inspectedLocation = this.inspectedLocationInput.value
|
|
190
|
+
let productDetailId = this.productDetailId
|
|
191
|
+
let productId = this.productId
|
|
192
|
+
let countNo = this.countNo
|
|
193
|
+
|
|
194
|
+
const response = await client.mutate({
|
|
195
|
+
mutation: gql`
|
|
196
|
+
mutation addExtraInventory(
|
|
197
|
+
$cycleCountNo: String!
|
|
198
|
+
$inspectedLocation: String!
|
|
199
|
+
$productDetailId: String!
|
|
200
|
+
$productId: String!
|
|
201
|
+
$inspectedBatchNo: String!
|
|
202
|
+
$inspectedQty: Int!
|
|
203
|
+
$inspectedUomValue: Float!
|
|
204
|
+
$countNo: Int!
|
|
205
|
+
) {
|
|
206
|
+
addExtraInventory(
|
|
207
|
+
cycleCountNo: $cycleCountNo
|
|
208
|
+
inspectedLocation: $inspectedLocation
|
|
209
|
+
productDetailId: $productDetailId
|
|
210
|
+
productId: $productId
|
|
211
|
+
inspectedBatchNo: $inspectedBatchNo
|
|
212
|
+
inspectedQty: $inspectedQty
|
|
213
|
+
inspectedUomValue: $inspectedUomValue
|
|
214
|
+
countNo: $countNo
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
`,
|
|
218
|
+
variables: {
|
|
219
|
+
cycleCountNo: this.cycleCountNo,
|
|
220
|
+
inspectedLocation,
|
|
221
|
+
productDetailId,
|
|
222
|
+
productId,
|
|
223
|
+
inspectedBatchNo,
|
|
224
|
+
inspectedQty,
|
|
225
|
+
inspectedUomValue,
|
|
226
|
+
countNo
|
|
227
|
+
}
|
|
228
|
+
})
|
|
229
|
+
this.dispatchEvent(new CustomEvent('add-inventory', {}))
|
|
230
|
+
this._showToast({ message: i18next.t('text.the_inventory_has_been_added') })
|
|
231
|
+
} catch (e) {
|
|
232
|
+
this._showToast({ type: 'error', message: e.message })
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
async _validateInput() {
|
|
237
|
+
const inspectedBatchNo = this.inspectedBatchNoInput.value
|
|
238
|
+
if (!inspectedBatchNo) {
|
|
239
|
+
this.selectOnInput(this.inspectedBatchNoInput)
|
|
240
|
+
throw new Error(i18next.t('text.invalid_x', { state: { x: i18next.t('field.inspected_batch_no') } }))
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const inspectedQty = this.inspectedQtyInput.value
|
|
244
|
+
if (!inspectedQty) {
|
|
245
|
+
this.selectOnInput(this.inspectedQtyInput)
|
|
246
|
+
throw new Error(i18next.t('text.invalid_x', { state: { x: i18next.t('field.inspected_qty') } }))
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (inspectedQty <= 0) {
|
|
250
|
+
throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('field.inspected_qty') } }))
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const locationName = this.inspectedLocationInput.value
|
|
254
|
+
if (!locationName) {
|
|
255
|
+
this.selectOnInput(this.inspectedLocationInput)
|
|
256
|
+
throw new Error(i18next.t('text.invalid_x', { state: { x: i18next.t('label.location') } }))
|
|
257
|
+
} else {
|
|
258
|
+
const foundLocation = await this._fetchLocation(locationName)
|
|
259
|
+
if (!foundLocation) {
|
|
260
|
+
throw new Error(i18next.t('text.location_not_found'))
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
async _fetchLocation(locationName) {
|
|
266
|
+
if (locationName) {
|
|
267
|
+
const response = await client.query({
|
|
268
|
+
query: gql`
|
|
269
|
+
query location($name: String!) {
|
|
270
|
+
location(name: $name) {
|
|
271
|
+
id
|
|
272
|
+
name
|
|
273
|
+
zone
|
|
274
|
+
row
|
|
275
|
+
column
|
|
276
|
+
shelf
|
|
277
|
+
type
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
`,
|
|
281
|
+
variables: { name: locationName }
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
if (!response.errors) {
|
|
285
|
+
return response.data.location
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
selectOnInput(input) {
|
|
291
|
+
setTimeout(() => input.select(), 100)
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
_showToast({ type, message }) {
|
|
295
|
+
document.dispatchEvent(
|
|
296
|
+
new CustomEvent('notify', {
|
|
297
|
+
detail: {
|
|
298
|
+
type,
|
|
299
|
+
message
|
|
300
|
+
}
|
|
301
|
+
})
|
|
302
|
+
)
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
window.customElements.define('add-extra-inventory-popup', AddExtraInventoryPopup)
|