修复:完善装填状态与确认权限
This commit is contained in:
@@ -98,7 +98,7 @@
|
||||
filterable
|
||||
style="width: 100%"
|
||||
:loading="optionLoading"
|
||||
:disabled="operationPending || optionLoading"
|
||||
:disabled="operationPending || scanLoading || optionLoading"
|
||||
>
|
||||
<el-option
|
||||
v-for="option in strainOptions"
|
||||
@@ -115,7 +115,7 @@
|
||||
maxlength="64"
|
||||
show-word-limit
|
||||
placeholder="请输入生产批次"
|
||||
:disabled="operationPending"
|
||||
:disabled="operationPending || scanLoading"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="包装规格" prop="packageSpec">
|
||||
@@ -125,7 +125,7 @@
|
||||
maxlength="64"
|
||||
show-word-limit
|
||||
placeholder="请输入包装规格"
|
||||
:disabled="operationPending"
|
||||
:disabled="operationPending || scanLoading"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="初始包数" prop="initialPackages">
|
||||
@@ -136,7 +136,7 @@
|
||||
:precision="0"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
:disabled="operationPending"
|
||||
:disabled="operationPending || scanLoading"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -285,6 +285,19 @@ function clearFillingIdempotencyKey() {
|
||||
fillingIdempotencyKey.value = ''
|
||||
}
|
||||
|
||||
function clearFillingPayload() {
|
||||
clearFillingIdempotencyKey()
|
||||
scannedPallet.value = null
|
||||
form.value = {
|
||||
qrToken: '',
|
||||
warehouseId: undefined,
|
||||
strainId: undefined,
|
||||
batchNo: '',
|
||||
packageSpec: '',
|
||||
initialPackages: undefined
|
||||
}
|
||||
}
|
||||
|
||||
function ensureFillingIdempotencyKey() {
|
||||
if (!fillingIdempotencyKey.value) {
|
||||
fillingIdempotencyKey.value = createIdempotencyKey()
|
||||
@@ -296,9 +309,7 @@ function resetFillingOperation() {
|
||||
dialogSession += 1
|
||||
invalidateOptionRequest()
|
||||
invalidateScanRequest()
|
||||
clearFillingIdempotencyKey()
|
||||
scannedPallet.value = null
|
||||
form.value = { qrToken: '', warehouseId: undefined, strainId: undefined, batchNo: '', packageSpec: '', initialPackages: undefined }
|
||||
clearFillingPayload()
|
||||
optionError.value = ''
|
||||
scanError.value = ''
|
||||
formError.value = ''
|
||||
@@ -337,9 +348,7 @@ function resetQuery() {
|
||||
|
||||
function handleFillingScan(qrToken) {
|
||||
if (operationPending.value || scanLoading.value) return
|
||||
clearFillingIdempotencyKey()
|
||||
scannedPallet.value = null
|
||||
form.value = { qrToken: '', warehouseId: undefined, strainId: undefined, batchNo: '', packageSpec: '', initialPackages: undefined }
|
||||
clearFillingPayload()
|
||||
const scanContext = { generation: ++scanGeneration, dialogSession, qrToken }
|
||||
scanLoading.value = true
|
||||
scanError.value = ''
|
||||
@@ -347,6 +356,7 @@ function handleFillingScan(qrToken) {
|
||||
if (!isCurrentScanRequest(scanContext)) return
|
||||
const pallet = response.data
|
||||
if (pallet.flowState !== 'EMPTY_IN_WAREHOUSE') {
|
||||
clearFillingPayload()
|
||||
scanError.value = '该托盘当前不可装填'
|
||||
return
|
||||
}
|
||||
@@ -361,6 +371,7 @@ function handleFillingScan(qrToken) {
|
||||
form.value.warehouseId = pallet.warehouseId
|
||||
}).catch(() => {
|
||||
if (!isCurrentScanRequest(scanContext)) return
|
||||
clearFillingPayload()
|
||||
scanError.value = '托盘扫码校验失败,请检查后重试'
|
||||
}).finally(() => {
|
||||
if (!isCurrentScanRequest(scanContext)) return
|
||||
@@ -369,9 +380,7 @@ function handleFillingScan(qrToken) {
|
||||
}
|
||||
|
||||
function handleScanInvalid(message) {
|
||||
clearFillingIdempotencyKey()
|
||||
scannedPallet.value = null
|
||||
form.value = { qrToken: '', warehouseId: undefined, strainId: undefined, batchNo: '', packageSpec: '', initialPackages: undefined }
|
||||
clearFillingPayload()
|
||||
scanError.value = message
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user