@things-factory/operato-wms 4.3.356 → 4.3.358
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
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import { MultiColumnFormStyles } from '@things-factory/form-ui'
|
|
2
2
|
import '@things-factory/grist-ui'
|
|
3
|
+
import { EXPORT } from '@things-factory/export-base'
|
|
4
|
+
import { store } from '@things-factory/shell'
|
|
3
5
|
import { i18next, localize } from '@things-factory/i18n-base'
|
|
4
6
|
import { openPopup } from '@things-factory/layout-base'
|
|
5
|
-
import { client,
|
|
7
|
+
import { client, PageView } from '@things-factory/shell'
|
|
8
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
6
9
|
import { CommonButtonStyles } from '@things-factory/styles'
|
|
7
10
|
import { isMobileDevice } from '@things-factory/utils'
|
|
8
11
|
import gql from 'graphql-tag'
|
|
9
12
|
import { css, html } from 'lit-element'
|
|
10
13
|
import { ORDER_STATUS, WORKSHEET_STATUS, WORKSHEET_TYPE } from '../constants'
|
|
14
|
+
import { fetchSettingRule } from '../../fetch-setting-value'
|
|
11
15
|
import './cycle-count-recheck-popup'
|
|
16
|
+
import './cycle-count-inventory-details-popup'
|
|
12
17
|
|
|
13
|
-
class CycleCountReport extends localize(i18next)(PageView) {
|
|
18
|
+
class CycleCountReport extends connect(store)(localize(i18next)(PageView)) {
|
|
14
19
|
static get properties() {
|
|
15
20
|
return {
|
|
16
21
|
_worksheetNo: String,
|
|
17
22
|
_reportStatus: String,
|
|
18
23
|
_cycleCountNo: String,
|
|
24
|
+
_enableCartonLabel: Boolean,
|
|
19
25
|
cycleCountType: String,
|
|
20
26
|
customerId: String,
|
|
21
27
|
inventoryAccuracy: String,
|
|
@@ -81,27 +87,15 @@ class CycleCountReport extends localize(i18next)(PageView) {
|
|
|
81
87
|
title: i18next.t('button.back'),
|
|
82
88
|
action: () => history.back(),
|
|
83
89
|
...CommonButtonStyles.back
|
|
90
|
+
},
|
|
91
|
+
// export as xlsx
|
|
92
|
+
{
|
|
93
|
+
title: i18next.t('button.inventory_audit_overview'),
|
|
94
|
+
action: this._exportInventoryAuditOverview.bind(this),
|
|
95
|
+
...CommonButtonStyles.export
|
|
84
96
|
}
|
|
85
97
|
]
|
|
86
98
|
|
|
87
|
-
if (this._reportStatus === ORDER_STATUS.PENDING_REVIEW.value) {
|
|
88
|
-
if (this.isUserBelongsDomain) {
|
|
89
|
-
actions.push({
|
|
90
|
-
title: i18next.t('button.adjust_inventory'),
|
|
91
|
-
action: this._adjustInventory.bind(this),
|
|
92
|
-
...CommonButtonStyles.edit
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
if (this.cycleCountType === WORKSHEET_TYPE.CYCLE_COUNT.value) {
|
|
96
|
-
actions.push({
|
|
97
|
-
title: i18next.t('button.reject'),
|
|
98
|
-
action: this.openCycleCountRecheckPopup.bind(this),
|
|
99
|
-
...CommonButtonStyles.reject
|
|
100
|
-
})
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
99
|
return {
|
|
106
100
|
title: i18next.t('title.cycle_count_report'),
|
|
107
101
|
actions,
|
|
@@ -124,13 +118,13 @@ class CycleCountReport extends localize(i18next)(PageView) {
|
|
|
124
118
|
<fieldset>
|
|
125
119
|
<legend>${i18next.t('title.cycle_count')}</legend>
|
|
126
120
|
<label>${i18next.t('label.company')}</label>
|
|
127
|
-
<input name="
|
|
128
|
-
<label>${i18next.t('label.
|
|
121
|
+
<input name="company" readonly />
|
|
122
|
+
<label>${i18next.t('label.inventory_check_no')}</label>
|
|
129
123
|
<input name="cycleCountNo" readonly />
|
|
130
124
|
<label>${i18next.t('label.execute_date')}</label>
|
|
131
125
|
<input name="executionDate" readonly />
|
|
132
126
|
<label>${i18next.t('label.inventory_accuracy')}</label>
|
|
133
|
-
<input name="inventoryAccuracy"
|
|
127
|
+
<input name="inventoryAccuracy" readonly />
|
|
134
128
|
<label>${i18next.t('label.status')}</label>
|
|
135
129
|
<select name="status" disabled>
|
|
136
130
|
${Object.keys(ORDER_STATUS).map(
|
|
@@ -148,19 +142,25 @@ class CycleCountReport extends localize(i18next)(PageView) {
|
|
|
148
142
|
id="grist"
|
|
149
143
|
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
150
144
|
.config=${this.config}
|
|
151
|
-
.fetchHandler="${this.
|
|
145
|
+
.fetchHandler="${this.fetchCycleCountReport.bind(this)}"
|
|
152
146
|
></data-grist>
|
|
153
147
|
</div>
|
|
154
148
|
`
|
|
155
149
|
}
|
|
156
150
|
|
|
151
|
+
constructor() {
|
|
152
|
+
super()
|
|
153
|
+
this._enableCartonLabel = false
|
|
154
|
+
}
|
|
155
|
+
|
|
157
156
|
async pageUpdated(changes) {
|
|
158
|
-
if (this.active && (changes.resourceId || this.
|
|
157
|
+
if (this.active && (changes.resourceId || this._cycleCountNo)) {
|
|
159
158
|
if (changes.resourceId) {
|
|
160
|
-
this.
|
|
159
|
+
this._cycleCountNo = changes.resourceId
|
|
161
160
|
}
|
|
161
|
+
|
|
162
162
|
this.grist.fetch()
|
|
163
|
-
await this.
|
|
163
|
+
await this.fetchCycleCountReport()
|
|
164
164
|
this.updateContext()
|
|
165
165
|
}
|
|
166
166
|
}
|
|
@@ -178,45 +178,47 @@ class CycleCountReport extends localize(i18next)(PageView) {
|
|
|
178
178
|
}
|
|
179
179
|
},
|
|
180
180
|
list: {
|
|
181
|
-
fields: [
|
|
182
|
-
'batchId',
|
|
183
|
-
'inspectedBatchNo',
|
|
184
|
-
'palletId',
|
|
185
|
-
'product',
|
|
186
|
-
'packingType',
|
|
187
|
-
'inspectedStatus',
|
|
188
|
-
'inspectedLocation',
|
|
189
|
-
'inspectedQty',
|
|
190
|
-
'inspectedUomValue',
|
|
191
|
-
'status'
|
|
192
|
-
]
|
|
181
|
+
fields: ['cartonId', 'palletId', 'sku', 'productName', 'packingType']
|
|
193
182
|
},
|
|
183
|
+
pagination: { infinite: true },
|
|
194
184
|
columns: [
|
|
185
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
195
186
|
{
|
|
196
187
|
type: 'gutter',
|
|
197
|
-
gutterName: '
|
|
188
|
+
gutterName: 'button',
|
|
189
|
+
icon: 'reorder',
|
|
190
|
+
handlers: {
|
|
191
|
+
click: this._showInventoryDetailsPopup.bind(this)
|
|
192
|
+
}
|
|
198
193
|
},
|
|
199
194
|
{
|
|
200
195
|
type: 'string',
|
|
201
|
-
name: '
|
|
202
|
-
|
|
203
|
-
width: 100
|
|
196
|
+
name: 'inventoryId',
|
|
197
|
+
hidden: true
|
|
204
198
|
},
|
|
205
199
|
{
|
|
206
200
|
type: 'string',
|
|
207
|
-
name: '
|
|
208
|
-
header: i18next.t('field.
|
|
209
|
-
width:
|
|
201
|
+
name: 'cartonId',
|
|
202
|
+
header: i18next.t('field.carton_id'),
|
|
203
|
+
width: 120,
|
|
204
|
+
hidden: !this._enableCartonLabel
|
|
210
205
|
},
|
|
211
206
|
{
|
|
212
207
|
type: 'string',
|
|
213
208
|
name: 'palletId',
|
|
214
209
|
header: i18next.t('field.lot_id'),
|
|
210
|
+
width: 120,
|
|
211
|
+
hidden: this._enableCartonLabel
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
type: 'string',
|
|
215
|
+
name: 'sku',
|
|
216
|
+
header: i18next.t('field.sku'),
|
|
215
217
|
width: 150
|
|
216
218
|
},
|
|
217
219
|
{
|
|
218
|
-
type: '
|
|
219
|
-
name: '
|
|
220
|
+
type: 'string',
|
|
221
|
+
name: 'productName',
|
|
220
222
|
header: i18next.t('field.product'),
|
|
221
223
|
width: 350
|
|
222
224
|
},
|
|
@@ -233,57 +235,55 @@ class CycleCountReport extends localize(i18next)(PageView) {
|
|
|
233
235
|
width: 100
|
|
234
236
|
},
|
|
235
237
|
{
|
|
236
|
-
type: '
|
|
237
|
-
name: '
|
|
238
|
-
header: i18next.t('field.
|
|
239
|
-
width:
|
|
238
|
+
type: 'boolean',
|
|
239
|
+
name: 'batchNoVariance',
|
|
240
|
+
header: i18next.t('field.batch_no_variance'),
|
|
241
|
+
width: 150,
|
|
242
|
+
renderer: value => {
|
|
243
|
+
return `<input type="checkbox" ${value ? 'checked' : ''} disabled/>`
|
|
244
|
+
}
|
|
240
245
|
},
|
|
241
246
|
{
|
|
242
|
-
type: '
|
|
243
|
-
name: '
|
|
244
|
-
header: i18next.t('field.
|
|
245
|
-
width:
|
|
247
|
+
type: 'boolean',
|
|
248
|
+
name: 'locationVariance',
|
|
249
|
+
header: i18next.t('field.location_variance'),
|
|
250
|
+
width: 150,
|
|
251
|
+
renderer: value => {
|
|
252
|
+
return `<input type="checkbox" ${value ? 'checked' : ''} disabled/>`
|
|
253
|
+
}
|
|
246
254
|
},
|
|
247
255
|
{
|
|
248
|
-
type: '
|
|
249
|
-
name: '
|
|
250
|
-
header: i18next.t('field.
|
|
251
|
-
width:
|
|
256
|
+
type: 'boolean',
|
|
257
|
+
name: 'uomValueVariance',
|
|
258
|
+
header: i18next.t('field.uom_value_variance'),
|
|
259
|
+
width: 150,
|
|
260
|
+
renderer: value => {
|
|
261
|
+
return `<input type="checkbox" ${value ? 'checked' : ''} disabled/>`
|
|
262
|
+
},
|
|
263
|
+
hidden: this._enableCartonLabel
|
|
252
264
|
},
|
|
253
265
|
{
|
|
254
266
|
type: 'integer',
|
|
255
|
-
name: '
|
|
267
|
+
name: 'originQty',
|
|
256
268
|
header: i18next.t('field.system_qty'),
|
|
257
269
|
width: 100
|
|
258
270
|
},
|
|
259
271
|
{
|
|
260
|
-
type: '
|
|
261
|
-
name: '
|
|
262
|
-
header: i18next.t('field.
|
|
263
|
-
width: 100
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
type: 'float',
|
|
267
|
-
name: 'uomValue',
|
|
268
|
-
header: i18next.t('field.system_uom_value'),
|
|
269
|
-
width: 100
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
type: 'float',
|
|
273
|
-
name: 'inspectedUomValue',
|
|
274
|
-
header: i18next.t('field.inspected_uom_value'),
|
|
272
|
+
type: 'string',
|
|
273
|
+
name: 'finalCount',
|
|
274
|
+
header: i18next.t('field.final_count'),
|
|
275
275
|
width: 100
|
|
276
276
|
},
|
|
277
277
|
{
|
|
278
278
|
type: 'string',
|
|
279
|
-
name: '
|
|
280
|
-
header: i18next.t('field.
|
|
279
|
+
name: 'countVariance',
|
|
280
|
+
header: i18next.t('field.count_variance'),
|
|
281
281
|
width: 100
|
|
282
282
|
},
|
|
283
283
|
{
|
|
284
284
|
type: 'string',
|
|
285
|
-
name: '
|
|
286
|
-
header: i18next.t('field.
|
|
285
|
+
name: 'countStatus',
|
|
286
|
+
header: i18next.t('field.count_status'),
|
|
287
287
|
width: 100
|
|
288
288
|
}
|
|
289
289
|
]
|
|
@@ -298,192 +298,293 @@ class CycleCountReport extends localize(i18next)(PageView) {
|
|
|
298
298
|
return this.shadowRoot.querySelector('data-grist')
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
async
|
|
302
|
-
if (!this.
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
name
|
|
312
|
-
executionDate
|
|
313
|
-
status
|
|
314
|
-
}
|
|
315
|
-
bizplace {
|
|
316
|
-
id
|
|
317
|
-
name
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
worksheetDetails {
|
|
321
|
-
name
|
|
322
|
-
status
|
|
323
|
-
description
|
|
324
|
-
targetInventory {
|
|
325
|
-
status
|
|
326
|
-
id
|
|
327
|
-
inspectedBatchNo
|
|
328
|
-
inspectedQty
|
|
329
|
-
inspectedUomValue
|
|
330
|
-
inspectedLocation {
|
|
331
|
-
id
|
|
301
|
+
async fetchCycleCountReport() {
|
|
302
|
+
if (!this._cycleCountNo) return
|
|
303
|
+
let total
|
|
304
|
+
try {
|
|
305
|
+
const response = await client.query({
|
|
306
|
+
query: gql`
|
|
307
|
+
query cycleCountReport($name: String!) {
|
|
308
|
+
cycleCountReport(name: $name) {
|
|
309
|
+
items {
|
|
310
|
+
inventoryCheck {
|
|
332
311
|
name
|
|
333
|
-
|
|
312
|
+
executionDate
|
|
313
|
+
status
|
|
314
|
+
}
|
|
315
|
+
inventoryCheckItem {
|
|
316
|
+
originBatchNo
|
|
317
|
+
inspectedBatchNo
|
|
318
|
+
originUomValue
|
|
319
|
+
inspectedUomValue
|
|
320
|
+
originQty
|
|
321
|
+
inspectedQty
|
|
334
322
|
}
|
|
335
323
|
inventory {
|
|
324
|
+
id
|
|
325
|
+
cartonId
|
|
336
326
|
palletId
|
|
337
|
-
|
|
327
|
+
}
|
|
328
|
+
product {
|
|
329
|
+
sku
|
|
330
|
+
name
|
|
331
|
+
brand
|
|
338
332
|
packingType
|
|
339
|
-
qty
|
|
340
|
-
uomValue
|
|
341
|
-
uom
|
|
342
|
-
location {
|
|
343
|
-
id
|
|
344
|
-
name
|
|
345
|
-
description
|
|
346
|
-
}
|
|
347
|
-
product {
|
|
348
|
-
name
|
|
349
|
-
description
|
|
350
|
-
}
|
|
351
333
|
}
|
|
334
|
+
countData
|
|
335
|
+
batchNoVariance
|
|
336
|
+
locationVariance
|
|
337
|
+
uomValueVariance
|
|
338
|
+
countVariance
|
|
339
|
+
countStatus
|
|
340
|
+
company
|
|
341
|
+
finalCount
|
|
342
|
+
partnerDomainId
|
|
352
343
|
}
|
|
344
|
+
total
|
|
353
345
|
}
|
|
354
|
-
total
|
|
355
346
|
}
|
|
347
|
+
`,
|
|
348
|
+
variables: {
|
|
349
|
+
name: this._cycleCountNo
|
|
356
350
|
}
|
|
357
|
-
|
|
358
|
-
variables: { name: this._worksheetNo, pagination: {} }
|
|
359
|
-
})
|
|
351
|
+
})
|
|
360
352
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
353
|
+
if (!response.errors) {
|
|
354
|
+
const firstItem = response.data.cycleCountReport.items[0]
|
|
355
|
+
if (!firstItem) return
|
|
356
|
+
|
|
357
|
+
const {
|
|
358
|
+
inventoryCheck: { name: inventoryCheckName, executionDate, status },
|
|
359
|
+
company,
|
|
360
|
+
partnerDomainId
|
|
361
|
+
} = firstItem
|
|
362
|
+
|
|
363
|
+
this._enableCartonLabel = await fetchSettingRule('enable-carton-label', partnerDomainId)
|
|
364
|
+
await this.updateComplete
|
|
365
|
+
|
|
366
|
+
let records =
|
|
367
|
+
response.data.cycleCountReport.items.map((item, idx) => {
|
|
368
|
+
const {
|
|
369
|
+
inventory,
|
|
370
|
+
inventoryCheck: { name: inventoryCheckName },
|
|
371
|
+
inventoryCheckItem,
|
|
372
|
+
product: { sku, name: productName, brand, packingType }
|
|
373
|
+
} = item
|
|
374
|
+
|
|
375
|
+
// Parsing countData from string to object & convert to int or replace with "-"
|
|
376
|
+
let countData = JSON.parse(item.countData)
|
|
377
|
+
Object.keys(countData).forEach(key => {
|
|
378
|
+
if (key.startsWith('count_')) {
|
|
379
|
+
countData[key] =
|
|
380
|
+
!isNaN(parseFloat(countData[key])) && isFinite(countData[key]) ? parseInt(countData[key], 10) : '-'
|
|
381
|
+
}
|
|
382
|
+
})
|
|
383
|
+
|
|
384
|
+
// Calculate the latest count key and finalCount
|
|
385
|
+
const latestCountKey = [...Object.keys(countData)]
|
|
386
|
+
.filter(key => key.startsWith('count_') && countData[key] !== '-')
|
|
387
|
+
.pop()
|
|
388
|
+
|
|
389
|
+
// Calculate finalCount based on the latest count
|
|
390
|
+
const finalCount = latestCountKey ? countData[latestCountKey] : inventoryCheckItem.originQty
|
|
391
|
+
|
|
392
|
+
// Calculate countVariance
|
|
393
|
+
const countVariance = finalCount - inventoryCheckItem.originQty
|
|
394
|
+
|
|
395
|
+
// Calculate countStatus
|
|
396
|
+
let countStatus
|
|
397
|
+
const {
|
|
398
|
+
inspectedBatchNo,
|
|
399
|
+
inspectedQty,
|
|
400
|
+
inspectedUomValue,
|
|
401
|
+
inspectedLocationId,
|
|
402
|
+
originBatchNo,
|
|
403
|
+
originQty,
|
|
404
|
+
originUomValue,
|
|
405
|
+
originLocationId
|
|
406
|
+
} = inventoryCheckItem
|
|
407
|
+
const { id: inventoryId, cartonId, palletId } = inventory
|
|
408
|
+
|
|
409
|
+
if (
|
|
410
|
+
inspectedBatchNo === null &&
|
|
411
|
+
inspectedQty === 0 &&
|
|
412
|
+
inspectedUomValue === null &&
|
|
413
|
+
inspectedLocationId === null
|
|
414
|
+
) {
|
|
415
|
+
countStatus = 'MISSING'
|
|
416
|
+
} else if (
|
|
417
|
+
originBatchNo === null &&
|
|
418
|
+
originQty === null &&
|
|
419
|
+
originUomValue === null &&
|
|
420
|
+
originLocationId === null
|
|
421
|
+
) {
|
|
422
|
+
countStatus = 'NEW'
|
|
423
|
+
} else if (finalCount === originQty) {
|
|
424
|
+
countStatus = 'HIT'
|
|
425
|
+
} else if (finalCount < originQty) {
|
|
426
|
+
countStatus = 'SHORT'
|
|
427
|
+
} else {
|
|
428
|
+
countStatus = 'EXCESS'
|
|
429
|
+
}
|
|
366
430
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
431
|
+
return {
|
|
432
|
+
...countData,
|
|
433
|
+
inventoryId,
|
|
434
|
+
cartonId,
|
|
435
|
+
palletId,
|
|
436
|
+
name: inventoryCheckName,
|
|
437
|
+
executionDate,
|
|
438
|
+
originBatchNo,
|
|
439
|
+
inspectedBatchNo,
|
|
440
|
+
originUomValue,
|
|
441
|
+
inspectedUomValue,
|
|
442
|
+
originQty,
|
|
443
|
+
inspectedQty,
|
|
444
|
+
sku,
|
|
445
|
+
productName,
|
|
446
|
+
brand,
|
|
447
|
+
packingType,
|
|
448
|
+
runningNo: idx + 1,
|
|
449
|
+
batchNoVariance: item.batchNoVariance,
|
|
450
|
+
locationVariance: item.locationVariance,
|
|
451
|
+
uomValueVariance: item.uomValueVariance,
|
|
452
|
+
countVariance,
|
|
453
|
+
countStatus,
|
|
454
|
+
company: item.company,
|
|
455
|
+
finalCount
|
|
456
|
+
}
|
|
457
|
+
}) || []
|
|
458
|
+
|
|
459
|
+
const totalSKUWithHIT = records.filter(record => record.countStatus === 'HIT').length
|
|
460
|
+
const totalSKUInCycleCount = records.length
|
|
461
|
+
const inventoryAccuracy = (totalSKUWithHIT / totalSKUInCycleCount) * 100
|
|
462
|
+
|
|
463
|
+
this._fillupForm({
|
|
464
|
+
company,
|
|
465
|
+
cycleCountNo: inventoryCheckName,
|
|
466
|
+
executionDate,
|
|
467
|
+
status,
|
|
468
|
+
inventoryAccuracy: inventoryAccuracy.toFixed(2) + '%'
|
|
469
|
+
})
|
|
370
470
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
471
|
+
total = records.length
|
|
472
|
+
|
|
473
|
+
if (this._enableCartonLabel) {
|
|
474
|
+
const groupedRecords = {}
|
|
475
|
+
records.forEach(record => {
|
|
476
|
+
const groupKey = `${record.cartonId || ''}-${record.sku || ''}-${record.originBatchNo || ''}`
|
|
477
|
+
if (!groupedRecords[groupKey]) {
|
|
478
|
+
groupedRecords[groupKey] = { ...record, count: 1, originQty: record.originQty }
|
|
479
|
+
} else {
|
|
480
|
+
groupedRecords[groupKey].originQty += record.originQty
|
|
481
|
+
Object.keys(record).forEach(key => {
|
|
482
|
+
if (key.startsWith('count_') && record[key] !== '-') {
|
|
483
|
+
groupedRecords[groupKey][key] =
|
|
484
|
+
(groupedRecords[groupKey][key] || 0) + (parseInt(record[key], 10) || 0)
|
|
485
|
+
}
|
|
486
|
+
})
|
|
487
|
+
groupedRecords[groupKey].count += 1
|
|
488
|
+
}
|
|
489
|
+
})
|
|
374
490
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
id
|
|
391
|
-
name
|
|
392
|
-
}
|
|
491
|
+
records = Object.values(groupedRecords).map(groupedRecord => {
|
|
492
|
+
const latestCountKey = [...Object.keys(groupedRecord)]
|
|
493
|
+
.filter(key => key.startsWith('count_') && groupedRecord[key] !== '-')
|
|
494
|
+
.pop()
|
|
495
|
+
|
|
496
|
+
const finalCount = latestCountKey ? groupedRecord[latestCountKey] : groupedRecord['originQty']
|
|
497
|
+
const countVariance = finalCount - groupedRecord['originQty']
|
|
498
|
+
|
|
499
|
+
let countStatus
|
|
500
|
+
if (finalCount === groupedRecord.originQty) {
|
|
501
|
+
countStatus = 'HIT'
|
|
502
|
+
} else if (finalCount < groupedRecord.originQty) {
|
|
503
|
+
countStatus = 'SHORT'
|
|
504
|
+
} else if (finalCount < groupedRecord.originQty) {
|
|
505
|
+
countStatus = 'EXCESS'
|
|
393
506
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
id
|
|
401
|
-
originBatchNo
|
|
402
|
-
inspectedBatchNo
|
|
403
|
-
originQty
|
|
404
|
-
inspectedQty
|
|
405
|
-
originUomValue
|
|
406
|
-
inspectedUomValue
|
|
407
|
-
originLocation {
|
|
408
|
-
id
|
|
409
|
-
name
|
|
410
|
-
description
|
|
411
|
-
}
|
|
412
|
-
inspectedLocation {
|
|
413
|
-
id
|
|
414
|
-
name
|
|
415
|
-
description
|
|
416
|
-
}
|
|
417
|
-
inventory {
|
|
418
|
-
palletId
|
|
419
|
-
packingType
|
|
420
|
-
uom
|
|
421
|
-
product {
|
|
422
|
-
name
|
|
423
|
-
brand
|
|
424
|
-
description
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}
|
|
507
|
+
|
|
508
|
+
return {
|
|
509
|
+
...groupedRecord,
|
|
510
|
+
finalCount,
|
|
511
|
+
countVariance,
|
|
512
|
+
countStatus
|
|
428
513
|
}
|
|
429
|
-
|
|
430
|
-
|
|
514
|
+
})
|
|
515
|
+
total = Object.keys(groupedRecords).length
|
|
431
516
|
}
|
|
432
|
-
|
|
433
|
-
|
|
517
|
+
|
|
518
|
+
this._createDynamicColumns(records)
|
|
519
|
+
|
|
520
|
+
this._updateColumnVisibility()
|
|
521
|
+
this.updateContext()
|
|
522
|
+
return { records, total }
|
|
523
|
+
} else {
|
|
524
|
+
console.error(response.errors)
|
|
525
|
+
}
|
|
526
|
+
} catch (error) {
|
|
527
|
+
console.error(error)
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
_createDynamicColumns(records) {
|
|
532
|
+
if (records.length === 0) {
|
|
533
|
+
console.error('No records available')
|
|
534
|
+
return
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
const countColumns = Object.keys(records[0]).filter(key => key.startsWith('count_'))
|
|
538
|
+
if (!countColumns.length) {
|
|
539
|
+
console.error('No count columns found in exampleRecord')
|
|
540
|
+
return
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// Sorting the countColumns
|
|
544
|
+
countColumns.sort((a, b) => {
|
|
545
|
+
const numA = parseInt(a.split('_')[1])
|
|
546
|
+
const numB = parseInt(b.split('_')[1])
|
|
547
|
+
return numA - numB
|
|
434
548
|
})
|
|
435
549
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
550
|
+
const existingColumnNames = this.config.columns.map(column => column.name)
|
|
551
|
+
const dynamicColumns = countColumns
|
|
552
|
+
.filter(column => !existingColumnNames.includes(column))
|
|
553
|
+
.map(column => ({
|
|
554
|
+
type: 'integer',
|
|
555
|
+
name: column,
|
|
556
|
+
header: column,
|
|
557
|
+
width: 100
|
|
558
|
+
}))
|
|
559
|
+
|
|
560
|
+
if (dynamicColumns.length > 0) {
|
|
561
|
+
const originQtyColumnIndex = this.config.columns.findIndex(col => col.name === 'originQty')
|
|
562
|
+
const finalCountColumnIndex = this.config.columns.findIndex(col => col.name === 'finalCount')
|
|
563
|
+
|
|
564
|
+
if (originQtyColumnIndex !== -1 && finalCountColumnIndex !== -1) {
|
|
565
|
+
this.config.columns.splice(originQtyColumnIndex + 1, 0, ...dynamicColumns)
|
|
566
|
+
} else {
|
|
567
|
+
console.warn('originQty or finalCount columns not found. Appending count_ columns at the end.')
|
|
568
|
+
this.config.columns.push(...dynamicColumns)
|
|
569
|
+
}
|
|
441
570
|
|
|
442
|
-
this.
|
|
443
|
-
|
|
571
|
+
this.grist.config = { ...this.config }
|
|
572
|
+
}
|
|
573
|
+
}
|
|
444
574
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
})
|
|
451
|
-
const records = worksheetDetails
|
|
452
|
-
.map(worksheetDetail => {
|
|
453
|
-
return {
|
|
454
|
-
...worksheetDetail.targetInventory.inventory,
|
|
455
|
-
name: worksheetDetail.name,
|
|
456
|
-
brand: worksheetDetail.targetInventory.inventory.product.brand,
|
|
457
|
-
description: worksheetDetail.description,
|
|
458
|
-
productName:
|
|
459
|
-
worksheetDetail.targetInventory.inventory.product.name +
|
|
460
|
-
`(` +
|
|
461
|
-
worksheetDetail.targetInventory.inventory.product.description +
|
|
462
|
-
`)`,
|
|
463
|
-
locationName: worksheetDetail.targetInventory.originLocation?.name,
|
|
464
|
-
status: worksheetDetail.status,
|
|
465
|
-
batchId: worksheetDetail.targetInventory.originBatchNo,
|
|
466
|
-
inspectedBatchNo: worksheetDetail.targetInventory.inspectedBatchNo,
|
|
467
|
-
qty: worksheetDetail.targetInventory.originQty,
|
|
468
|
-
inspectedQty: worksheetDetail.targetInventory.inspectedQty,
|
|
469
|
-
uomValue: worksheetDetail.targetInventory.originUomValue,
|
|
470
|
-
inspectedUomValue: worksheetDetail.targetInventory.inspectedUomValue,
|
|
471
|
-
uom:
|
|
472
|
-
worksheetDetail.targetInventory &&
|
|
473
|
-
worksheetDetail.targetInventory.inventory &&
|
|
474
|
-
worksheetDetail.targetInventory.inventory.uom,
|
|
475
|
-
location: worksheetDetail.targetInventory.originLocation,
|
|
476
|
-
inspectedLocation: worksheetDetail.targetInventory.inspectedLocation?.name,
|
|
477
|
-
packingType: worksheetDetail.targetInventory.inventory?.packingType || '',
|
|
478
|
-
inspectedStatus: worksheetDetail.targetInventory.status,
|
|
479
|
-
orderInventoryId: worksheetDetail.targetInventory.id
|
|
480
|
-
}
|
|
481
|
-
})
|
|
482
|
-
.sort(this._compareValues('status', 'desc'))
|
|
575
|
+
_updateColumnVisibility() {
|
|
576
|
+
if (this.config && this.config.columns) {
|
|
577
|
+
const uomValueVarianceColumn = this.config.columns.find(col => col.name === 'uomValueVariance')
|
|
578
|
+
const cartonIdColumn = this.config.columns.find(col => col.name === 'cartonId')
|
|
579
|
+
const palletIdColumn = this.config.columns.find(col => col.name === 'palletId')
|
|
483
580
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
581
|
+
if (cartonIdColumn) {
|
|
582
|
+
cartonIdColumn.hidden = !this._enableCartonLabel
|
|
583
|
+
}
|
|
584
|
+
if (palletIdColumn && uomValueVarianceColumn) {
|
|
585
|
+
palletIdColumn.hidden = this._enableCartonLabel
|
|
586
|
+
uomValueVarianceColumn.hidden = this._enableCartonLabel
|
|
587
|
+
}
|
|
487
588
|
}
|
|
488
589
|
}
|
|
489
590
|
|
|
@@ -523,55 +624,32 @@ class CycleCountReport extends localize(i18next)(PageView) {
|
|
|
523
624
|
}
|
|
524
625
|
}
|
|
525
626
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
const
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
cycleCountAdjustment(cycleCountNo: $cycleCountNo)
|
|
543
|
-
}
|
|
627
|
+
_showInventoryDetailsPopup(columns, data, column, record, rowIndex) {
|
|
628
|
+
if (record.inventoryId && this._cycleCountNo) {
|
|
629
|
+
const title = record.cartonId ? `[${record.cartonId}] ${record.sku}` : `[${record.palletId}] ${record.sku}`
|
|
630
|
+
|
|
631
|
+
openPopup(
|
|
632
|
+
html`
|
|
633
|
+
<cycle-count-inventory-details-popup
|
|
634
|
+
.inventoryId="${record.inventoryId}"
|
|
635
|
+
.cartonId="${record.cartonId}"
|
|
636
|
+
.pallet="${record.palletId}"
|
|
637
|
+
.cycleCountNo="${this._cycleCountNo}"
|
|
638
|
+
.enableCartonLabel="${this._enableCartonLabel}"
|
|
639
|
+
@saved="${e => {
|
|
640
|
+
this.dataGrist.fetch()
|
|
641
|
+
}}"
|
|
642
|
+
></cycle-count-inventory-details-popup>
|
|
544
643
|
`,
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
navigate(`inventory_check_list`)
|
|
552
|
-
}
|
|
553
|
-
} catch (e) {
|
|
554
|
-
this._showToast(e)
|
|
644
|
+
{
|
|
645
|
+
backdrop: true,
|
|
646
|
+
size: 'large',
|
|
647
|
+
title: title
|
|
648
|
+
}
|
|
649
|
+
)
|
|
555
650
|
}
|
|
556
651
|
}
|
|
557
652
|
|
|
558
|
-
openCycleCountRecheckPopup() {
|
|
559
|
-
openPopup(
|
|
560
|
-
html`
|
|
561
|
-
<cycle-count-recheck-popup
|
|
562
|
-
.cycleCountNo="${this._cycleCountNo}"
|
|
563
|
-
.customerId="${this.customerId}"
|
|
564
|
-
@completed="${() => this.grist.fetch()}"
|
|
565
|
-
></cycle-count-recheck-popup>
|
|
566
|
-
`,
|
|
567
|
-
{
|
|
568
|
-
backdrop: true,
|
|
569
|
-
size: 'large',
|
|
570
|
-
title: i18next.t('title.cycle_count_recheck')
|
|
571
|
-
}
|
|
572
|
-
)
|
|
573
|
-
}
|
|
574
|
-
|
|
575
653
|
async _checkUserBelongsDomain() {
|
|
576
654
|
try {
|
|
577
655
|
const response = await client.query({
|
|
@@ -595,28 +673,42 @@ class CycleCountReport extends localize(i18next)(PageView) {
|
|
|
595
673
|
let data = []
|
|
596
674
|
|
|
597
675
|
var headerSetting = [
|
|
598
|
-
{ header: i18next.t('field.
|
|
599
|
-
{ header: i18next.t('field.inspected_batch_no'), key: 'inspectedBatchNo', width: 25, type: 'string' },
|
|
676
|
+
{ header: i18next.t('field.carton_id'), key: 'cartonId', width: 25, type: 'string' },
|
|
600
677
|
{ header: i18next.t('field.lot_id'), key: 'palletId', width: 25, type: 'string' },
|
|
678
|
+
{ header: i18next.t('field.sku'), key: 'sku', width: 25, type: 'string' },
|
|
601
679
|
{ header: i18next.t('field.product'), key: 'productName', width: 60, type: 'string' },
|
|
680
|
+
{ header: i18next.t('field.brand'), key: 'brand', width: 60, type: 'string' },
|
|
602
681
|
{ header: i18next.t('field.packing_type'), key: 'packingType', width: 20, type: 'string' },
|
|
603
|
-
{ header: i18next.t('field.
|
|
604
|
-
{ header: i18next.t('field.
|
|
605
|
-
{ header: i18next.t('field.
|
|
606
|
-
{ header: i18next.t('field.system_qty'), key: '
|
|
607
|
-
{ header: i18next.t('field.
|
|
608
|
-
{ header: i18next.t('field.
|
|
609
|
-
{
|
|
610
|
-
header: i18next.t('field.inspected_uom_value'),
|
|
611
|
-
key: 'inspectedUomValue',
|
|
612
|
-
width: 20,
|
|
613
|
-
type: 'string'
|
|
614
|
-
},
|
|
615
|
-
{ header: i18next.t('field.uom'), key: 'uom', width: 20, type: 'string' },
|
|
616
|
-
{ header: i18next.t('field.status'), key: 'status', width: 20, type: 'string' }
|
|
682
|
+
{ header: i18next.t('field.batch_no_variance'), key: 'batchNoVariance', width: 25, type: 'boolean' },
|
|
683
|
+
{ header: i18next.t('field.location_variance'), key: 'locationVariance', width: 25, type: 'boolean' },
|
|
684
|
+
{ header: i18next.t('field.uom_value_variance'), key: 'uomValueVariance', width: 25, type: 'boolean' },
|
|
685
|
+
{ header: i18next.t('field.system_qty'), key: 'originQty', width: 20, type: 'string' },
|
|
686
|
+
{ header: i18next.t('field.final_count'), key: 'finalCount', width: 20, type: 'string' },
|
|
687
|
+
{ header: i18next.t('field.count_variance'), key: 'countVariance', width: 20, type: 'string' },
|
|
688
|
+
{ header: i18next.t('field.count_status'), key: 'countStatus', width: 20, type: 'string' }
|
|
617
689
|
]
|
|
618
690
|
|
|
619
|
-
data = (await this.
|
|
691
|
+
data = (await this.fetchCycleCountReport({ page: 1, limit: 999999 })).records
|
|
692
|
+
|
|
693
|
+
const indexToInsert = headerSetting.findIndex(header => header.key === 'originQty')
|
|
694
|
+
if (indexToInsert === -1) {
|
|
695
|
+
console.error('originQty header not found in headerSetting')
|
|
696
|
+
return
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
if (data.length > 0) {
|
|
700
|
+
const dynamicColumns = Object.keys(data[0]).filter(key => key.startsWith('count_'))
|
|
701
|
+
const dynamicHeaders = dynamicColumns.map(column => {
|
|
702
|
+
return {
|
|
703
|
+
header: column,
|
|
704
|
+
key: column,
|
|
705
|
+
width: 20,
|
|
706
|
+
type: 'string'
|
|
707
|
+
}
|
|
708
|
+
})
|
|
709
|
+
|
|
710
|
+
headerSetting.splice(indexToInsert + 1, 0, ...dynamicHeaders)
|
|
711
|
+
}
|
|
620
712
|
|
|
621
713
|
return { header: headerSetting, data }
|
|
622
714
|
} catch (e) {
|
|
@@ -624,6 +716,33 @@ class CycleCountReport extends localize(i18next)(PageView) {
|
|
|
624
716
|
}
|
|
625
717
|
}
|
|
626
718
|
|
|
719
|
+
async _exportInventoryAuditOverview() {
|
|
720
|
+
try {
|
|
721
|
+
let data = []
|
|
722
|
+
|
|
723
|
+
var headerSetting = [
|
|
724
|
+
{ header: i18next.t('field.sku'), key: 'sku', width: 20, type: 'string' },
|
|
725
|
+
{ header: i18next.t('field.system_qty'), key: 'originQty', width: 20, type: 'string' },
|
|
726
|
+
{ header: i18next.t('field.final_count'), key: 'finalCount', width: 20, type: 'string' },
|
|
727
|
+
{ header: i18next.t('field.variance'), key: 'countVariance', width: 20, type: 'string' },
|
|
728
|
+
{ header: i18next.t('field.status'), key: 'countStatus', width: 20, type: 'string' }
|
|
729
|
+
]
|
|
730
|
+
|
|
731
|
+
data = (await this.fetchCycleCountReport({ page: 1, limit: 999999 })).records
|
|
732
|
+
|
|
733
|
+
store.dispatch({
|
|
734
|
+
type: EXPORT,
|
|
735
|
+
exportable: {
|
|
736
|
+
extension: 'xlsx',
|
|
737
|
+
name: this._cycleCountNo,
|
|
738
|
+
data: { header: headerSetting, data }
|
|
739
|
+
}
|
|
740
|
+
})
|
|
741
|
+
} catch (e) {
|
|
742
|
+
this._showToast(e)
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
627
746
|
_showToast({ type, message }) {
|
|
628
747
|
document.dispatchEvent(
|
|
629
748
|
new CustomEvent('notify', {
|