From b6a40a2d8fdcffb3accfc7e424c0726a87a59ddf Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期五, 05 十二月 2025 21:20:59 +0800
Subject: [PATCH] 提交
---
项目代码/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue | 1590 +++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 1,182 insertions(+), 408 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue"
index 243b5dc..48d960a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue"
@@ -4,29 +4,8 @@
<el-page-header @back="goBack">
<template #content>
<span class="title">鍑哄簱鎷i�夌‘璁� - {{ this.$route.query.orderNo }}</span>
- <el-tag v-if="currentBatchNo" type="success" style="margin-left: 10px;">
- 褰撳墠鎵规: {{ currentBatchNo }}
- </el-tag>
</template>
</el-page-header>
- </div>
-
- <!-- 鎵规鎿嶄綔鍖哄煙 -->
- <div class="batch-operations">
- <el-card>
- <div class="batch-actions">
- <el-button type="primary" @click="openBatchAllocateDialog">鍒嗘壒鍒嗛厤</el-button>
- <el-select v-model="selectedBatchNo" placeholder="閫夋嫨鎵规" @change="onBatchChange" style="width: 200px; margin-left: 10px;">
- <el-option
- v-for="batch in batchList"
- :key="batch.batchNo"
- :label="`${batch.batchNo} (${batch.batchStatusText})`"
- :value="batch.batchNo">
- </el-option>
- </el-select>
- <el-button type="info" @click="refreshBatchList">鍒锋柊鎵规</el-button>
- </div>
- </el-card>
</div>
<!-- 鎵爜鍖哄煙 -->
@@ -52,21 +31,6 @@
<el-button type="info" @click="openRevertSplitDialog">鎾ら攢鎷嗗寘</el-button>
<el-button type="info" @click="handleEmptyPallet">鍙栫┖绠�</el-button>
<el-button type="primary" @click="openBatchReturnDialog">鍥炲簱</el-button>
- </div>
- </el-card>
- </div>
-
- <!-- 鎵规姹囨�讳俊鎭� -->
- <div class="batch-summary-area" v-if="currentBatchNo">
- <el-card>
- <div class="batch-summary-info">
- <el-tag type="info">鎵规鍙�: {{ batchSummary.batchNo }}</el-tag>
- <el-tag :type="getBatchStatusType(batchSummary.batchStatus)">
- {{ batchSummary.batchStatusText }}
- </el-tag>
- <el-tag type="warning">鍒嗛厤鏁伴噺: {{ batchSummary.batchQuantity }}</el-tag>
- <el-tag type="success">瀹屾垚鏁伴噺: {{ batchSummary.completedQuantity }}</el-tag>
- <el-tag type="danger">鍓╀綑鏁伴噺: {{ batchSummary.remainingQuantity }}</el-tag>
</div>
</el-card>
</div>
@@ -119,7 +83,7 @@
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="materielCode" label="鐗╂枡缂栫爜" width="120"></el-table-column>
<el-table-column prop="pickedQty" label="宸叉嫞鏁伴噺" width="100"></el-table-column>
- <el-table-column prop="locationCode" label="璐т綅" width="100"></el-table-column>
+ <!-- <el-table-column prop="locationCode" label="璐т綅" width="100"></el-table-column> -->
<el-table-column prop="currentBarcode" label="鏉$爜"></el-table-column>
</el-table>
</el-card>
@@ -127,54 +91,8 @@
</el-row>
</div>
- <!-- 鍒嗘壒鍒嗛厤寮圭獥 -->
- <div v-if="showBatchAllocateDialog" class="custom-dialog-overlay">
- <div class="custom-dialog-wrapper">
- <div class="custom-dialog">
- <div class="custom-dialog-header">
- <h3>鍒嗘壒鍒嗛厤搴撳瓨</h3>
- <el-button type="text" @click="closeBatchAllocateDialog" class="close-button">脳</el-button>
- </div>
- <div class="custom-dialog-body">
- <el-form :model="batchAllocateForm" :rules="batchAllocateFormRules" ref="batchAllocateFormRef" label-width="100px">
- <el-form-item label="璁㈠崟缂栧彿">
- <el-input v-model="batchAllocateForm.orderNo" disabled></el-input>
- </el-form-item>
- <el-form-item label="鐗╂枡鏄庣粏" prop="orderDetailId">
- <el-select v-model="batchAllocateForm.orderDetailId" placeholder="閫夋嫨鐗╂枡鏄庣粏" style="width: 100%">
- <el-option
- v-for="detail in allocatableDetails"
- :key="detail.id"
- :label="`${detail.materielCode} - 闇�姹�:${detail.needOutQuantity} 宸插垎閰�:${detail.allocatedQuantity} 鍙垎閰�:${detail.availableQuantity}`"
- :value="detail.id">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="鍒嗛厤鏁伴噺" prop="batchQuantity">
- <el-input-number
- v-model="batchAllocateForm.batchQuantity"
- :min="0.01"
- :precision="2"
- :step="1"
- style="width: 100%"
- placeholder="杈撳叆鍒嗛厤鏁伴噺">
- </el-input-number>
- </el-form-item>
- <el-form-item label="鍙垎閰嶆暟閲�">
- <el-input :value="getAvailableQuantity()" disabled></el-input>
- </el-form-item>
- </el-form>
- </div>
- <div class="custom-dialog-footer">
- <el-button @click="closeBatchAllocateDialog">鍙栨秷</el-button>
- <el-button type="primary" @click="handleBatchAllocate" :loading="batchAllocateLoading">纭鍒嗛厤</el-button>
- </div>
- </div>
- </div>
- </div>
-
<!-- 鎷嗗寘寮圭獥 -->
- <div v-if="showCustomSplitDialog" class="custom-dialog-overlay">
+ <div v-if="showCustomSplitDialog" class="custom-dialog-overlay" style="z-index: 2000;">
<div class="custom-dialog-wrapper">
<div class="custom-dialog">
<div class="custom-dialog-header">
@@ -186,20 +104,28 @@
<el-form-item label="璁㈠崟缂栧彿">
<el-input v-model="splitForm.orderNo" disabled></el-input>
</el-form-item>
- <el-form-item label="鎵规缂栧彿">
- <el-input v-model="splitForm.batchNo" disabled></el-input>
- </el-form-item>
<el-form-item label="鎵樼洏缂栧彿">
<el-input v-model="splitForm.palletCode" disabled></el-input>
</el-form-item>
<el-form-item label="鍘熸潯鐮�" prop="originalBarcode">
- <el-input
- v-model="splitForm.originalBarcode"
- placeholder="鎵弿鍘熸潯鐮�"
- @keyup.enter.native="onSplitBarcodeScan"
- @change="onSplitBarcodeScan"
- clearable>
- </el-input>
+ <div style="display: flex; align-items: center; gap: 10px;">
+ <el-input
+ v-model="splitForm.originalBarcode"
+ placeholder="鎵弿鍘熸潯鐮�"
+ @keyup.enter.native="onSplitBarcodeScan"
+ @change="onSplitBarcodeScan"
+ clearable
+ style="flex: 1;">
+ </el-input>
+ <!-- 鏂板锛氭煡鐪嬫媶鍖呴摼鎸夐挳 -->
+ <el-button
+ type="primary"
+ @click="viewSplitChainFromSplit(splitForm.originalBarcode)"
+ :disabled="!splitForm.originalBarcode"
+ :loading="splitChainLoading">
+ 鏌ョ湅鎷嗗寘閾�
+</el-button>
+ </div>
</el-form-item>
<el-form-item label="鐗╂枡缂栫爜">
<el-input v-model="splitForm.materielCode" disabled></el-input>
@@ -228,7 +154,7 @@
</div>
<!-- 鎾ら攢鎷嗗寘寮圭獥 -->
- <div v-if="showRevertSplitDialog" class="custom-dialog-overlay">
+ <div v-if="showRevertSplitDialog" class="custom-dialog-overlay" style="z-index: 2001;">
<div class="custom-dialog-wrapper">
<div class="custom-dialog">
<div class="custom-dialog-header">
@@ -238,15 +164,46 @@
<div class="custom-dialog-body">
<el-form :model="revertSplitForm" :rules="revertSplitFormRules" ref="revertSplitFormRef" label-width="100px">
<el-form-item label="鏂版潯鐮�" prop="newBarcode">
- <el-input
- v-model="revertSplitForm.newBarcode"
- placeholder="鎵弿鏂版潯鐮�"
- @keyup.enter.native="onRevertSplitBarcodeScan"
- @change="onRevertSplitBarcodeScan"
- clearable>
- </el-input>
+ <div style="display: flex; align-items: center; gap: 10px;">
+ <el-input
+ v-model="revertSplitForm.newBarcode"
+ placeholder="鎵弿鏂版潯鐮�"
+ @keyup.enter.native="onRevertSplitBarcodeScan"
+ @change="onRevertSplitBarcodeScan"
+ clearable
+ style="flex: 1;">
+ </el-input>
+ <!-- 鏂板锛氭煡鐪嬫媶鍖呴摼鎸夐挳 -->
+ <el-button
+ type="primary"
+ @click="viewSplitChain(revertSplitForm.newBarcode)"
+ :disabled="!revertSplitForm.newBarcode">
+ 鏌ョ湅鎷嗗寘閾�
+ </el-button>
+ </div>
</el-form-item>
</el-form>
+
+ <!-- 鏂板锛氭媶鍖呴摼绠�瑕佷俊鎭樉绀� -->
+ <div v-if="splitChainInfo.splitChain && splitChainInfo.splitChain.length > 0"
+ style="margin-top: 15px; padding: 10px; background: #f0f9ff; border-radius: 4px;">
+ <div style="font-size: 14px; color: #606266;">
+ <div>鎷嗗寘閾句俊鎭�: 鍏� {{ splitChainInfo.totalSplitTimes }} 娆℃媶鍖�</div>
+ <div style="margin-top: 5px;">
+ <el-tag
+ v-for="item in splitChainInfo.splitChain.slice(0, 3)"
+ :key="item.newBarcode"
+ :type="item.isReverted ? 'success' : 'primary'"
+ size="small"
+ style="margin-right: 5px;">
+ {{ item.newBarcode }} ({{ item.splitQuantity }})
+ </el-tag>
+ <span v-if="splitChainInfo.splitChain.length > 3" style="color: #909399;">
+ 绛� {{ splitChainInfo.splitChain.length }} 涓潯鐮�
+ </span>
+ </div>
+ </div>
+ </div>
</div>
<div class="custom-dialog-footer">
<el-button @click="closeRevertSplitDialog">鍙栨秷</el-button>
@@ -256,12 +213,136 @@
</div>
</div>
+ <!-- 鎷嗗寘閾句俊鎭脊绐� -->
+<div v-if="showSplitChainDialog" class="custom-dialog-overlay" style="z-index: 2002;">
+ <div class="custom-dialog-wrapper">
+ <div class="custom-dialog" style="width: 750px;">
+ <div class="custom-dialog-header">
+ <h3>鎷嗗寘閾句俊鎭�</h3>
+ <el-button type="text" @click="closeSplitChainDialog" class="close-button">脳</el-button>
+ </div>
+ <div class="custom-dialog-body">
+ <!-- 鏂板锛氭媶鍖呴摼璇存槑 -->
+ <div style="margin-bottom: 15px; padding: 10px; background: #f0f9ff; border-radius: 4px;">
+ <div style="display: flex; justify-content: space-between; align-items: center;">
+ <div>
+ <div style="font-weight: bold; color: #303133;">鎷嗗寘閾捐鏄�</div>
+ <div style="font-size: 12px; color: #606266; margin-top: 5px;">
+ 褰撳墠鏄剧ず鐨勬槸浠� <el-tag type="primary" size="small">{{ splitChainInfo.originalBarcode }}</el-tag> 寮�濮嬬殑鎷嗗寘閾�
+ <br>鍏� {{ splitChainInfo.totalSplitTimes }} 娆℃媶鍖呮搷浣滐紝娑夊強 {{ splitChainInfo.splitChain.length }} 涓潯鐮�
+ </div>
+ </div>
+ <el-button
+ type="primary"
+ size="small"
+ @click="findRootChain(splitChainInfo.originalBarcode)"
+ v-if="splitChainInfo.chainType !== 'root'">
+ 鏌ユ壘瀹屾暣鎷嗗寘閾�
+ </el-button>
+ </div>
+ </div>
+
+ <div style="margin-bottom: 15px;">
+ <el-tag type="info">鎬绘媶鍖呮鏁�: {{ splitChainInfo.totalSplitTimes }}</el-tag>
+ <el-tag type="warning" style="margin-left: 10px;">
+ 鍘熷鏉$爜: {{ splitChainInfo.originalBarcode }}
+ </el-tag>
+ <el-tag :type="splitChainInfo.chainType === 'root' ? 'success' : 'warning'" style="margin-left: 10px;">
+ {{ splitChainInfo.chainType === 'root' ? '瀹屾暣閾�' : '鍒嗘敮閾�' }}
+ </el-tag>
+ </div>
+
+ <el-table :data="splitChainInfo.splitChain" border height="300">
+ <el-table-column type="index" label="搴忓彿" width="60" align="center"></el-table-column>
+ <el-table-column prop="splitTime" label="鎷嗗寘鏃堕棿" width="160">
+ <template #default="scope">
+ {{ formatDateTime(scope.row.splitTime) }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="originalBarcode" label="鍘熸潯鐮�" width="140">
+ <template #default="scope">
+ <el-tag
+ :type="scope.row.originalBarcode === splitChainInfo.rootBarcode ? 'success' : 'primary'"
+ size="small">
+ {{ scope.row.originalBarcode }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="newBarcode" label="鏂版潯鐮�" width="140">
+ <template #default="scope">
+ <el-tag
+ :type="scope.row.isReverted ? 'info' : 'warning'"
+ size="small">
+ {{ scope.row.newBarcode }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="splitQuantity" label="鎷嗗寘鏁伴噺" width="100" align="right">
+ <template #default="scope">
+ {{ scope.row.splitQuantity.toFixed(2) }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="operator" label="鎿嶄綔鍛�" width="100"></el-table-column>
+ <el-table-column prop="isReverted" label="鐘舵��" width="80" align="center">
+ <template #default="scope">
+ <el-tag
+ :type="scope.row.isReverted ? 'success' : 'danger'"
+ size="small">
+ {{ scope.row.isReverted ? '宸叉挙閿�' : '鏈夋晥' }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔" width="120" align="center">
+ <template #default="scope">
+ <el-button
+ v-if="!scope.row.isReverted"
+ type="danger"
+ size="mini"
+ @click="cancelSingleSplit(scope.row.newBarcode)"
+ :disabled="hasPicked(scope.row.newBarcode)">
+ 鍙栨秷
+ </el-button>
+ <span v-else style="color: #909399;">宸叉挙閿�</span>
+ </template>
+ </el-table-column>
+ </el-table>
+
+ <!-- 鎵归噺鎿嶄綔鍖哄煙 -->
+ <div style="margin-top: 15px; padding: 10px; background: #f5f7fa; border-radius: 4px;">
+ <div style="display: flex; justify-content: space-between; align-items: center;">
+ <div>
+ <span style="font-size: 14px; color: #606266;">
+ 鎵归噺鎿嶄綔: 鍙互鍙栨秷鏁翠釜鎷嗗寘閾炬垨閫夋嫨鍗曚釜鎷嗗寘璁板綍鍙栨秷
+ </span>
+ <div style="font-size: 12px; color: #909399; margin-top: 5px;">
+ 瀹屾暣鎷嗗寘閾惧寘鍚粠鏈�鍘熷鏉$爜寮�濮嬬殑鎵�鏈夋媶鍖呮搷浣�
+ </div>
+ </div>
+ <div>
+ <el-button
+ type="danger"
+ @click="cancelWholeSplitChain"
+ :disabled="!canCancelWholeChain"
+ :loading="revertSplitLoading">
+ 鍙栨秷鏁翠釜鎷嗗寘閾�
+ </el-button>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="custom-dialog-footer">
+ <el-button @click="closeSplitChainDialog">鍏抽棴</el-button>
+ </div>
+ </div>
+ </div>
+</div>
+
<!-- 鎵归噺鍥炲簱寮圭獥 -->
- <div v-if="showBatchReturnDialog" class="custom-dialog-overlay">
+ <div v-if="showBatchReturnDialog" class="custom-dialog-overlay" style="z-index: 2003;">
<div class="custom-dialog-wrapper">
<div class="custom-dialog">
<div class="custom-dialog-header">
- <h3>鎵规鍥炲簱</h3>
+ <h3>鎵樼洏鍥炲簱</h3>
<el-button type="text" @click="closeBatchReturnDialog" class="close-button">脳</el-button>
</div>
<div class="custom-dialog-body">
@@ -269,8 +350,8 @@
<el-form-item label="璁㈠崟缂栧彿">
<el-input v-model="batchReturnForm.orderNo" disabled></el-input>
</el-form-item>
- <el-form-item label="鎵规缂栧彿">
- <el-input v-model="batchReturnForm.batchNo" disabled></el-input>
+ <el-form-item label="鎵樼洏缂栧彿">
+ <el-input v-model="batchReturnForm.palletCode" disabled></el-input>
</el-form-item>
<el-form-item label="鏈嫞閫夋暟閲�">
<el-input v-model="batchReturnForm.unpickedQuantity" disabled></el-input>
@@ -289,7 +370,7 @@
</div>
<!-- 鍙栬蛋绌虹寮圭獥 -->
- <div v-if="showEmptyPalletDialog" class="custom-dialog-overlay">
+ <div v-if="showEmptyPalletDialog" class="custom-dialog-overlay" style="z-index: 2004;">
<div class="custom-dialog-wrapper">
<div class="custom-dialog">
<div class="custom-dialog-header">
@@ -324,47 +405,25 @@
</div>
</template>
+
+
<script>
import http from '@/api/http.js'
-import { ref, defineComponent } from "vue";
+import { defineComponent } from "vue";
import { ElMessage } from 'element-plus'
-import { useRoute } from 'vue-router'
import printView from "@/extension/outbound/extend/printView.vue"
export default defineComponent({
name: 'BatchOutboundPicking',
components: {printView},
data() {
- // 楠岃瘉瑙勫垯瀹氫箟...
- const validateBatchQuantity = (rule, value, callback) => {
- if (value === null || value === undefined || value === '') {
- callback(new Error('璇疯緭鍏ュ垎閰嶆暟閲�'));
- } else if (value <= 0) {
- callback(new Error('鍒嗛厤鏁伴噺蹇呴』澶т簬0'));
- } else {
- callback();
- }
- };
-
- const validateOrderDetailId = (rule, value, callback) => {
- if (!value) {
- callback(new Error('璇烽�夋嫨鐗╂枡鏄庣粏'));
- } else {
- callback();
- }
- };
-
return {
+ // 淇濇寔鎵�鏈夊師濮嬫暟鎹粨鏋勪笉鍙�...
scanData: {
orderNo: '',
palletCode: '',
- barcode: '',
- batchNo: ''
+ barcode: ''
},
- currentBatchNo: '', // 褰撳墠鎵规鍙�
- batchList: [], // 鎵规鍒楄〃
- selectedBatchNo: '', // 閫変腑鐨勬壒娆″彿
- batchSummary: {}, // 鎵规姹囨�讳俊鎭�
unpickedList: [],
pickedList: [],
selectedPickedRows: [],
@@ -375,31 +434,26 @@
},
palletStatus: '鏈煡',
- // 寮圭獥鐘舵��
- showBatchAllocateDialog: false,
+ // 寮圭獥鐘舵�� - 鍏抽敭淇锛氬彧鍏佽涓�涓脊绐楁墦寮�
+ activeDialog: null, // 'split', 'revert', 'batchReturn', 'emptyPallet', 'splitChain'
showCustomSplitDialog: false,
showRevertSplitDialog: false,
showBatchReturnDialog: false,
showEmptyPalletDialog: false,
+ showSplitChainDialog: false,
+ // 娣诲姞闃查噸澶嶇偣鍑绘爣蹇�
+ isOpeningDialog: false,
// 鍔犺浇鐘舵��
- batchAllocateLoading: false,
splitLoading: false,
revertSplitLoading: false,
batchReturnLoading: false,
emptypalletOutLoading: false,
+ splitChainLoading: false,
- // 琛ㄥ崟鏁版嵁
- batchAllocateForm: {
- orderNo: '',
- orderDetailId: '',
- batchQuantity: 0
- },
- allocatableDetails: [], // 鍙垎閰嶇殑璁㈠崟鏄庣粏
-
+ // 琛ㄥ崟鏁版嵁...
splitForm: {
orderNo: '',
- batchNo: '',
palletCode: '',
originalBarcode: '',
materielCode: '',
@@ -413,7 +467,7 @@
batchReturnForm: {
orderNo: '',
- batchNo: '',
+ palletCode: '',
unpickedCount: 0,
unpickedQuantity: 0
},
@@ -423,177 +477,72 @@
palletCode: ''
},
- // 楠岃瘉瑙勫垯
- batchAllocateFormRules: {
- orderDetailId: [
- { required: true, validator: validateOrderDetailId, trigger: 'change' }
+ splitChainInfo: {
+ originalBarcode: '',
+ totalSplitTimes: 0,
+ splitChain: []
+ },
+
+ // 楠岃瘉瑙勫垯...
+ splitFormRules: {
+ originalBarcode: [
+ { required: true, message: '璇疯緭鍏ュ師鏉$爜', trigger: 'blur' }
],
- batchQuantity: [
- { required: true, validator: validateBatchQuantity, trigger: 'blur' }
+ splitQuantity: [
+ { required: true, message: '璇疯緭鍏ユ媶鍖呮暟閲�', trigger: 'blur' },
+ { type: 'number', min: 0.01, message: '鎷嗗寘鏁伴噺蹇呴』澶т簬0', trigger: 'blur' }
]
},
- // 鍏朵粬楠岃瘉瑙勫垯...
+ revertSplitFormRules: {
+ newBarcode: [
+ { required: true, message: '璇疯緭鍏ユ柊鏉$爜', trigger: 'blur' }
+ ]
+ },
+
+ emptypalletOutFormRules: {
+ palletCode: [
+ { required: true, message: '璇疯緭鍏ユ墭鐩樼爜', trigger: 'blur' }
+ ]
+ },
+
isProcessing: false
+ }
+ },
+ watch: {
+ // 鍏抽敭淇锛氱‘淇濆悓涓�鏃堕棿鍙湁涓�涓脊绐楁墦寮�
+ activeDialog(newVal, oldVal) {
+ this.showCustomSplitDialog = newVal === 'split'
+ this.showRevertSplitDialog = newVal === 'revert'
+ this.showBatchReturnDialog = newVal === 'batchReturn'
+ this.showEmptyPalletDialog = newVal === 'emptyPallet'
+ this.showSplitChainDialog = newVal === 'splitChain'
+ }
+ },
+ computed: {
+ canCancelWholeChain() {
+ return this.splitChainInfo.splitChain &&
+ this.splitChainInfo.splitChain.some(item => !item.isReverted);
}
},
mounted() {
if (this.$route.query.orderNo) {
this.scanData.orderNo = this.$route.query.orderNo;
- this.batchAllocateForm.orderNo = this.$route.query.orderNo;
- this.loadBatchList();
+ this.splitForm.orderNo = this.$route.query.orderNo;
+ this.batchReturnForm.orderNo = this.$route.query.orderNo;
+ this.emptypalletOutForm.orderNo = this.$route.query.orderNo;
}
- this.$nextTick(() => {
- this.$refs.palletInput.focus();
+ // 浣跨敤 requestAnimationFrame 纭繚椤甸潰瀹屽叏鍔犺浇
+ requestAnimationFrame(() => {
+ if (this.$refs.palletInput) {
+ this.$refs.palletInput.focus();
+ }
});
+
},
methods: {
goBack(){
this.$router.back()
- },
-
- // 鎵规鐩稿叧鏂规硶
- async loadBatchList() {
- try {
- const res = await http.post('/api/BatchOutbound/order-batch-list', {
- orderNo: this.scanData.orderNo
- });
- if (res.status) {
- this.batchList = res.data || [];
- if (this.batchList.length > 0) {
- this.selectedBatchNo = this.batchList[0].batchNo;
- this.currentBatchNo = this.selectedBatchNo;
- this.scanData.batchNo = this.selectedBatchNo;
- this.loadBatchData();
- }
- }
- } catch (error) {
- this.$message.error('鍔犺浇鎵规鍒楄〃澶辫触');
- }
- },
-
- async refreshBatchList() {
- await this.loadBatchList();
- this.$message.success('鎵规鍒楄〃宸插埛鏂�');
- },
-
- onBatchChange(batchNo) {
- this.currentBatchNo = batchNo;
- this.scanData.batchNo = batchNo;
- this.loadBatchData();
- },
-
- async loadBatchData() {
- if (!this.currentBatchNo) return;
-
- await this.loadBatchSummary();
- await this.loadUnpickedList();
- await this.loadPickedList();
- },
-
- async loadBatchSummary() {
- try {
- const res = await http.post('/api/BatchOutbound/batch-summary', {
- orderNo: this.scanData.orderNo,
- batchNo: this.currentBatchNo
- });
- if (res.status) {
- this.batchSummary = res.data || {};
- }
- } catch (error) {
- this.$message.error('鍔犺浇鎵规姹囨�诲け璐�');
- }
- },
-
- async loadUnpickedList() {
- try {
- const res = await http.post('/api/BatchOutbound/batch-unpicked-list', {
- orderNo: this.scanData.orderNo,
- batchNo: this.currentBatchNo
- });
- this.unpickedList = res.data || [];
- this.summary.unpickedCount = this.unpickedList.length;
- this.summary.unpickedQuantity = this.unpickedList.reduce((sum, item) => sum + (item.remainQuantity || 0), 0);
- } catch (error) {
- this.$message.error('鍔犺浇鏈嫞閫夊垪琛ㄥけ璐�');
- }
- },
-
- async loadPickedList() {
- try {
- const res = await http.post('/api/BatchOutbound/batch-picked-list', {
- orderNo: this.scanData.orderNo,
- batchNo: this.currentBatchNo
- });
- this.pickedList = res.data || [];
- this.summary.pickedCount = this.pickedList.length;
- } catch (error) {
- this.$message.error('鍔犺浇宸叉嫞閫夊垪琛ㄥけ璐�');
- }
- },
-
- getBatchStatusType(status) {
- const statusMap = {
- 0: 'info', // 鍒嗛厤涓�
- 1: 'warning', // 鎵ц涓�
- 2: 'success', // 宸插畬鎴�
- 3: 'danger' // 宸插洖搴�
- };
- return statusMap[status] || 'info';
- },
-
- // 鍒嗘壒鍒嗛厤鐩稿叧鏂规硶
- async openBatchAllocateDialog() {
- this.showBatchAllocateDialog = true;
- await this.loadAllocatableDetails();
- this.batchAllocateForm.orderDetailId = '';
- this.batchAllocateForm.batchQuantity = 0;
- },
-
- async loadAllocatableDetails() {
- try {
- const res = await http.post('/api/BatchOutbound/allocatable-order-details', {
- orderNo: this.scanData.orderNo
- });
- if (res.status) {
- this.allocatableDetails = res.data || [];
- }
- } catch (error) {
- this.$message.error('鍔犺浇鍙垎閰嶆槑缁嗗け璐�');
- }
- },
-
- getAvailableQuantity() {
- const detail = this.allocatableDetails.find(d => d.id === this.batchAllocateForm.orderDetailId);
- return detail ? detail.availableQuantity : 0;
- },
-
- async handleBatchAllocate() {
- if (this.$refs.batchAllocateFormRef) {
- this.$refs.batchAllocateFormRef.validate(async (valid) => {
- if (valid) {
- this.batchAllocateLoading = true;
- try {
- const res = await http.post('/api/BatchOutbound/batch-allocate-stock', this.batchAllocateForm);
- if (res.status) {
- this.$message.success('鍒嗘壒鍒嗛厤鎴愬姛');
- this.showBatchAllocateDialog = false;
- await this.loadBatchList(); // 鍒锋柊鎵规鍒楄〃
- } else {
- this.$message.error(res.message || '鍒嗘壒鍒嗛厤澶辫触');
- }
- } catch (error) {
- this.$message.error('鍒嗘壒鍒嗛厤澶辫触');
- } finally {
- this.batchAllocateLoading = false;
- }
- }
- });
- }
- },
-
- closeBatchAllocateDialog() {
- this.showBatchAllocateDialog = false;
},
// 鍒嗘嫞鐩稿叧鏂规硶
@@ -606,21 +555,20 @@
return;
}
- if (!this.currentBatchNo) {
- this.$message.warning('璇峰厛閫夋嫨鎵规');
- return;
- }
-
this.isProcessing = true;
try {
- const res = await http.post('/api/BatchOutbound/confirm-picking', this.scanData);
+ const res = await http.post('/api/OutboundBatchPicking/confirm-picking', {
+ orderNo: this.scanData.orderNo,
+ palletCode: this.scanData.palletCode,
+ barcode: this.scanData.barcode
+ });
if (res.status) {
this.$message.success('鎷i�夌‘璁ゆ垚鍔�');
this.scanData.barcode = '';
- await this.loadBatchData();
- if(res.data && res.data.splitResults && res.data.splitResults.length>0){
- this.$refs.childs.open(res.data.splitResults);
+ await this.loadPalletData();
+ if(res.data && res.data && res.data.length>0){
+ this.$refs.childs.open(res.data);
}
this.$nextTick(() => {
this.$refs.barcodeInput.focus();
@@ -637,21 +585,445 @@
}
},
- // 鎷嗗寘鐩稿叧鏂规硶
- openSplitDialog() {
+ openSplitDialog() {
+ console.log('绱ф�ヤ慨澶嶇増锛氭墦寮�鎷嗗寘寮圭獥');
+
if (!this.scanData.palletCode) {
this.$message.warning('璇峰厛鎵弿鎵樼洏鐮�');
return;
}
- if (!this.currentBatchNo) {
- this.$message.warning('璇峰厛閫夋嫨鎵规');
+
+ // 1. 鍏抽棴鎵�鏈塚ue寮圭獥
+ this.closeAllDialogs();
+
+ // 2. 寮哄埗浠嶥OM涓Щ闄ゆ墍鏈夊脊绐�
+ setTimeout(() => {
+ const dialogs = document.querySelectorAll('.custom-dialog-overlay');
+ dialogs.forEach(dialog => {
+ if (dialog.parentNode) {
+ dialog.parentNode.removeChild(dialog);
+ }
+ });
+
+ // 濡傛灉宸茬粡瀛樺湪鎵嬪姩寮圭獥锛屽厛绉婚櫎
+ if (this.manualDialog && this.manualDialog.parentNode) {
+ this.manualDialog.parentNode.removeChild(this.manualDialog);
+ }
+
+ // 3. 绛夊緟涓�甯�
+ requestAnimationFrame(() => {
+ // 4. 鐩存帴鍒涘缓鏂板脊绐楋紝涓嶄緷璧朧ue鐨勫搷搴斿紡绯荤粺
+ this.createManualSplitDialog();
+ });
+ }, 10);
+ },
+
+ // 鍒涘缓鎵嬪姩鎷嗗寘寮圭獥
+ createManualSplitDialog() {
+ const newDialog = document.createElement('div');
+ newDialog.className = 'custom-dialog-overlay emergency-fix';
+
+ // 鐢熸垚闅忔満ID鐢ㄤ簬浜嬩欢缁戝畾
+ const dialogId = 'manual-dialog-' + Date.now();
+ newDialog.id = dialogId;
+
+ // 瀛樺偍寮曠敤
+ this.manualDialog = newDialog;
+
+ // 寮圭獥鍐呭
+ newDialog.innerHTML = `
+ <div class="custom-dialog-wrapper">
+ <div class="custom-dialog" style="width: 500px;">
+ <div class="custom-dialog-header">
+ <h3 style="margin: 0; color: #303133;">鎷嗗寘鎿嶄綔</h3>
+ <button class="close-button" onclick="document.getElementById('${dialogId}').remove()" style="
+ font-size: 18px;
+ color: #909399;
+ padding: 0;
+ width: 24px;
+ height: 24px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: none;
+ border: none;
+ cursor: pointer;
+ ">脳</button>
+ </div>
+ <div class="custom-dialog-body" style="padding: 20px;">
+ <div style="margin-bottom: 15px;">
+ <div style="display: flex; align-items: center; margin-bottom: 5px;">
+ <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">璁㈠崟缂栧彿:</span>
+ <input type="text" value="${this.scanData.orderNo}" disabled style="
+ flex: 1;
+ padding: 8px 12px;
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ background-color: #f5f7fa;
+ color: #909399;
+ ">
+ </div>
+ </div>
+
+ <div style="margin-bottom: 15px;">
+ <div style="display: flex; align-items: center; margin-bottom: 5px;">
+ <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">鎵樼洏缂栧彿:</span>
+ <input type="text" value="${this.scanData.palletCode}" disabled style="
+ flex: 1;
+ padding: 8px 12px;
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ background-color: #f5f7fa;
+ color: #909399;
+ ">
+ </div>
+ </div>
+
+ <div style="margin-bottom: 15px;">
+ <div style="display: flex; align-items: center; margin-bottom: 5px;">
+ <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">鍘熸潯鐮�:</span>
+ <div style="flex: 1; display: flex; align-items: center; gap: 10px;">
+ <input type="text" id="${dialogId}-barcode" placeholder="鎵弿鍘熸潯鐮�" style="
+ flex: 1;
+ padding: 8px 12px;
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ ">
+ <button id="${dialogId}-viewChain" style="
+ padding: 8px 16px;
+ background: #409eff;
+ color: white;
+ border: none;
+ border-radius: 4px;
+ cursor: pointer;
+ white-space: nowrap;
+ ">鏌ョ湅鎷嗗寘閾�</button>
+ </div>
+ </div>
+ </div>
+
+ <div style="margin-bottom: 15px;">
+ <div style="display: flex; align-items: center; margin-bottom: 5px;">
+ <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">鐗╂枡缂栫爜:</span>
+ <input type="text" id="${dialogId}-materiel" disabled style="
+ flex: 1;
+ padding: 8px 12px;
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ background-color: #f5f7fa;
+ color: #909399;
+ ">
+ </div>
+ </div>
+
+ <div style="margin-bottom: 15px;">
+ <div style="display: flex; align-items: center; margin-bottom: 5px;">
+ <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">鍓╀綑鏁伴噺:</span>
+ <input type="text" id="${dialogId}-remain" disabled style="
+ flex: 1;
+ padding: 8px 12px;
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ background-color: #f5f7fa;
+ color: #909399;
+ ">
+ </div>
+ </div>
+
+ <div style="margin-bottom: 15px;">
+ <div style="display: flex; align-items: center; margin-bottom: 5px;">
+ <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">鎷嗗寘鏁伴噺:</span>
+ <div style="flex: 1;">
+ <input type="number" id="${dialogId}-splitQty" value="1" min="0.01" step="0.01" style="
+ width: 100%;
+ padding: 8px 12px;
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ ">
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="custom-dialog-footer" style="
+ padding: 10px 20px 20px;
+ text-align: right;
+ border-top: 1px solid #ebeef5;
+ ">
+ <button id="${dialogId}-cancel" style="
+ padding: 9px 15px;
+ background: white;
+ color: #606266;
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ cursor: pointer;
+ margin-right: 10px;
+ ">鍙栨秷</button>
+ <button id="${dialogId}-confirm" style="
+ padding: 9px 15px;
+ background: #409eff;
+ color: white;
+ border: none;
+ border-radius: 4px;
+ cursor: pointer;
+ ">纭鎷嗗寘</button>
+ </div>
+ </div>
+ </div>
+ `;
+
+ // 娣诲姞鏍峰紡
+ newDialog.style.cssText = `
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(0,0,0,0.5);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 999999;
+ `;
+
+ // 寮圭獥瀹瑰櫒鏍峰紡
+ const wrapper = newDialog.querySelector('.custom-dialog-wrapper');
+ if (wrapper) {
+ wrapper.style.position = 'relative';
+ wrapper.style.zIndex = '1000000';
+ }
+
+ // 寮圭獥鍐呭鏍峰紡
+ const dialog = newDialog.querySelector('.custom-dialog');
+ if (dialog) {
+ dialog.style.background = 'white';
+ dialog.style.borderRadius = '4px';
+ dialog.style.maxWidth = '90vw';
+ dialog.style.maxHeight = '90vh';
+ dialog.style.boxShadow = '0 2px 12px 0 rgba(0, 0, 0, 0.1)';
+ dialog.style.overflow = 'auto';
+ }
+
+ // 寮圭獥澶撮儴鏍峰紡
+ const header = newDialog.querySelector('.custom-dialog-header');
+ if (header) {
+ header.style.display = 'flex';
+ header.style.justifyContent = 'space-between';
+ header.style.alignItems = 'center';
+ header.style.padding = '20px 20px 10px';
+ header.style.borderBottom = '1px solid #ebeef5';
+ }
+
+ document.body.appendChild(newDialog);
+ console.log('绱ф�ュ脊绐楀凡鍒涘缓');
+
+ // 缁戝畾浜嬩欢
+ this.bindManualDialogEvents(dialogId);
+
+ // 鑷姩鑱氱劍鍒版潯鐮佽緭鍏ユ
+ setTimeout(() => {
+ const barcodeInput = document.getElementById(`${dialogId}-barcode`);
+ if (barcodeInput) {
+ barcodeInput.focus();
+ // 娣诲姞鍥炶溅閿洃鍚�
+ barcodeInput.addEventListener('keyup', (event) => {
+ if (event.key === 'Enter') {
+ this.onManualSplitBarcodeScan(dialogId);
+ }
+ });
+ }
+ }, 100);
+ },
+
+ // 缁戝畾鎵嬪姩寮圭獥浜嬩欢
+ bindManualDialogEvents(dialogId) {
+ const vm = this; // 淇濆瓨Vue瀹炰緥寮曠敤
+
+ // 鏌ョ湅鎷嗗寘閾炬寜閽�
+ const viewChainBtn = document.getElementById(`${dialogId}-viewChain`);
+ if (viewChainBtn) {
+ viewChainBtn.onclick = () => {
+ const barcodeInput = document.getElementById(`${dialogId}-barcode`);
+ if (barcodeInput && barcodeInput.value.trim()) {
+ vm.viewSplitChainFromManualDialog(barcodeInput.value.trim(), dialogId);
+ } else {
+ ElMessage.warning('璇峰厛杈撳叆鏉$爜');
+ }
+ };
+ }
+
+ // 鍙栨秷鎸夐挳
+ const cancelBtn = document.getElementById(`${dialogId}-cancel`);
+ if (cancelBtn) {
+ cancelBtn.onclick = () => {
+ const dialog = document.getElementById(dialogId);
+ if (dialog && dialog.parentNode) {
+ dialog.parentNode.removeChild(dialog);
+ }
+ };
+ }
+
+ // 纭鎷嗗寘鎸夐挳
+ const confirmBtn = document.getElementById(`${dialogId}-confirm`);
+ if (confirmBtn) {
+ confirmBtn.onclick = () => {
+ vm.handleManualSplitPackage(dialogId);
+ };
+ }
+
+ // 鏉$爜杈撳叆妗嗗彉鍖栦簨浠�
+ const barcodeInput = document.getElementById(`${dialogId}-barcode`);
+ if (barcodeInput) {
+ // 闃叉姈澶勭悊
+ let timeout;
+ barcodeInput.addEventListener('input', () => {
+ clearTimeout(timeout);
+ timeout = setTimeout(() => {
+ if (barcodeInput.value.trim()) {
+ vm.onManualSplitBarcodeScan(dialogId);
+ }
+ }, 500);
+ });
+ }
+ },
+
+ // 鎵嬪姩寮圭獥鐨勬潯鐮佹壂鎻忓鐞�
+ async onManualSplitBarcodeScan(dialogId) {
+ const barcodeInput = document.getElementById(`${dialogId}-barcode`);
+ if (!barcodeInput || !barcodeInput.value.trim()) return;
+
+ const barcode = barcodeInput.value.trim();
+
+ try {
+ const res = await http.post('/api/OutboundBatchPicking/split-package-info', {
+ orderNo: this.scanData.orderNo,
+ palletCode: this.scanData.palletCode,
+ barcode: barcode
+ });
+
+ if (res.status) {
+ // 鏇存柊鐗╂枡缂栫爜
+ const materielInput = document.getElementById(`${dialogId}-materiel`);
+ if (materielInput) {
+ materielInput.value = res.data.materielCode || '';
+ }
+
+ // 鏇存柊鍓╀綑鏁伴噺
+ const remainInput = document.getElementById(`${dialogId}-remain`);
+ if (remainInput) {
+ remainInput.value = res.data.remainQuantity || 0;
+ }
+
+ // 鏇存柊鎷嗗寘鏁伴噺锛堥粯璁や负1锛屼笉瓒呰繃鍓╀綑鏁伴噺锛�
+ const splitQtyInput = document.getElementById(`${dialogId}-splitQty`);
+ if (splitQtyInput) {
+ const maxQty = res.data.remainQuantity || 0;
+ splitQtyInput.max = maxQty;
+ const currentVal = parseFloat(splitQtyInput.value) || 1;
+ if (currentVal > maxQty) {
+ splitQtyInput.value = Math.min(1, maxQty);
+ }
+ }
+ } else {
+ ElMessage.error(res.message || '鑾峰彇鎷嗗寘淇℃伅澶辫触');
+ }
+ } catch (error) {
+ console.error('鑾峰彇鎷嗗寘淇℃伅澶辫触:', error);
+ ElMessage.error('鑾峰彇鎷嗗寘淇℃伅澶辫触');
+ }
+ },
+
+ // 浠庢墜鍔ㄥ脊绐楁煡鐪嬫媶鍖呴摼
+ viewSplitChainFromManualDialog(barcode, dialogId) {
+ // 鍏堝叧闂墜鍔ㄥ脊绐�
+ const dialog = document.getElementById(dialogId);
+ if (dialog && dialog.parentNode) {
+ dialog.parentNode.removeChild(dialog);
+ }
+
+ // 寤惰繜涓�涓嬶紝鐒跺悗鎵撳紑Vue鐨勬媶鍖呴摼寮圭獥
+ setTimeout(() => {
+ this.viewSplitChain(barcode);
+ }, 50);
+ },
+
+ // 澶勭悊鎵嬪姩寮圭獥鐨勬媶鍖呮搷浣�
+ async handleManualSplitPackage(dialogId) {
+ const barcodeInput = document.getElementById(`${dialogId}-barcode`);
+ const splitQtyInput = document.getElementById(`${dialogId}-splitQty`);
+
+ if (!barcodeInput || !barcodeInput.value.trim()) {
+ ElMessage.warning('璇疯緭鍏ュ師鏉$爜');
return;
}
- this.showCustomSplitDialog = true;
- this.resetSplitForm();
- this.splitForm.orderNo = this.scanData.orderNo;
- this.splitForm.batchNo = this.currentBatchNo;
- this.splitForm.palletCode = this.scanData.palletCode;
+
+ if (!splitQtyInput || !splitQtyInput.value || parseFloat(splitQtyInput.value) <= 0) {
+ ElMessage.warning('璇疯緭鍏ユ湁鏁堢殑鎷嗗寘鏁伴噺');
+ return;
+ }
+
+ const originalBarcode = barcodeInput.value.trim();
+ const splitQuantity = parseFloat(splitQtyInput.value);
+
+ try {
+ // 鏄剧ず鍔犺浇鐘舵��
+ const confirmBtn = document.getElementById(`${dialogId}-confirm`);
+ if (confirmBtn) {
+ confirmBtn.disabled = true;
+ confirmBtn.textContent = '澶勭悊涓�...';
+ }
+
+ const res = await http.post('/api/OutboundBatchPicking/split-package', {
+ orderNo: this.scanData.orderNo,
+ palletCode: this.scanData.palletCode,
+ originalBarcode: originalBarcode,
+ splitQuantity: splitQuantity
+ });
+
+ if (res.status) {
+ ElMessage.success('鎷嗗寘鎴愬姛');
+
+ // 鍏抽棴鎵嬪姩寮圭獥
+ const dialog = document.getElementById(dialogId);
+ if (dialog && dialog.parentNode) {
+ dialog.parentNode.removeChild(dialog);
+ }
+
+ // 閲嶆柊鍔犺浇鏁版嵁
+ await this.loadPalletData();
+ } else {
+ ElMessage.error(res.message || '鎷嗗寘澶辫触');
+
+ // 鎭㈠鎸夐挳鐘舵��
+ if (confirmBtn) {
+ confirmBtn.disabled = false;
+ confirmBtn.textContent = '纭鎷嗗寘';
+ }
+ }
+ } catch (error) {
+ console.error('鎷嗗寘澶辫触:', error);
+ ElMessage.error('鎷嗗寘澶辫触');
+
+ // 鎭㈠鎸夐挳鐘舵��
+ const confirmBtn = document.getElementById(`${dialogId}-confirm`);
+ if (confirmBtn) {
+ confirmBtn.disabled = false;
+ confirmBtn.textContent = '纭鎷嗗寘';
+ }
+ }
+ },
+ closeAllDialogsImmediately() {
+ console.log('绔嬪嵆鍏抽棴鎵�鏈夊脊绐�');
+
+ // 鐩存帴璁剧疆涓� false锛屼笉绛夊緟浠讳綍寮傛鎿嶄綔
+ this.showCustomSplitDialog = false;
+ this.showRevertSplitDialog = false;
+ this.showBatchReturnDialog = false;
+ this.showEmptyPalletDialog = false;
+ this.showSplitChainDialog = false;
+
+ // 寮哄埗DOM鏇存柊
+ this.$forceUpdate();
},
async onSplitBarcodeScan() {
@@ -659,13 +1031,16 @@
this.splitForm.originalBarcode = this.splitForm.originalBarcode.replace(/\n/g, '').trim();
try {
- const res = await http.post('/api/BatchOutbound/split-package-info', {
+ const res = await http.post('/api/OutboundBatchPicking/split-package-info', {
orderNo: this.splitForm.orderNo,
- batchNo: this.splitForm.batchNo,
+ palletCode: this.splitForm.palletCode,
barcode: this.splitForm.originalBarcode
});
if (res.status) {
+ if(res.data && res.data.length>0){
+ this.$refs.childs.open(res.data);
+ }
this.splitForm.materielCode = res.data.materielCode;
this.splitForm.maxQuantity = res.data.remainQuantity;
this.splitForm.splitQuantity = Math.min(1, this.splitForm.maxQuantity);
@@ -683,11 +1058,16 @@
if (valid) {
this.splitLoading = true;
try {
- const res = await http.post('/api/BatchOutbound/manual-split-package', this.splitForm);
+ const res = await http.post('/api/OutboundBatchPicking/split-package', {
+ orderNo: this.splitForm.orderNo,
+ palletCode: this.splitForm.palletCode,
+ originalBarcode: this.splitForm.originalBarcode,
+ splitQuantity: this.splitForm.splitQuantity
+ });
if (res.status) {
this.$message.success('鎷嗗寘鎴愬姛');
- this.showCustomSplitDialog = false;
- await this.loadBatchData();
+ this.closeAllDialogs();
+ await this.loadPalletData();
} else {
this.$message.error(res.message || '鎷嗗寘澶辫触');
}
@@ -699,6 +1079,19 @@
}
});
}
+ },
+
+ async viewSplitChainFromSplit(barcode) {
+ if (!barcode) {
+ this.$message.warning('璇峰厛杈撳叆鏉$爜');
+ return;
+ }
+
+ this.closeAllDialogs();
+
+ setTimeout(() => {
+ this.viewSplitChain(barcode);
+ }, 50);
},
// 鎾ら攢鎷嗗寘
@@ -713,15 +1106,15 @@
if (valid) {
this.revertSplitLoading = true;
try {
- const res = await http.post('/api/BatchOutbound/cancel-split-package', {
+ const res = await http.post('/api/OutboundBatchPicking/cancel-split', {
orderNo: this.scanData.orderNo,
- batchNo: this.currentBatchNo,
+ palletCode: this.scanData.palletCode,
newBarcode: this.revertSplitForm.newBarcode
});
if (res.status) {
this.$message.success('鎾ら攢鎷嗗寘鎴愬姛');
- this.showRevertSplitDialog = false;
- await this.loadBatchData();
+ this.closeAllDialogs();
+ await this.loadPalletData();
} else {
this.$message.error(res.message || '鎾ら攢鎷嗗寘澶辫触');
}
@@ -735,49 +1128,259 @@
}
},
- // 鍥炲簱鐩稿叧鏂规硶
- openBatchReturnDialog() {
- if (!this.currentBatchNo) {
- this.$message.warning('璇峰厛閫夋嫨鎵规');
+ async findRootChain(currentBarcode) {
+ this.splitChainLoading = true;
+ try {
+ const res = await http.post('/api/OutboundBatchPicking/find-root-split-chain', {
+ orderNo: this.scanData.orderNo,
+ barcode: currentBarcode
+ });
+
+ if (res.status) {
+ this.splitChainInfo = res.data;
+ this.$message.success('宸插姞杞藉畬鏁存媶鍖呴摼');
+ } else {
+ this.$message.error(res.message || '鏌ユ壘瀹屾暣鎷嗗寘閾惧け璐�');
+ }
+ } catch (error) {
+ this.$message.error('鏌ユ壘瀹屾暣鎷嗗寘閾惧け璐�');
+ } finally {
+ this.splitChainLoading = false;
+ }
+ },
+
+ // 鏌ョ湅鎷嗗寘閾句俊鎭�
+ async viewSplitChain(barcode) {
+ if (!barcode) {
+ this.$message.warning('璇峰厛杈撳叆鏉$爜');
return;
}
- this.showBatchReturnDialog = true;
- this.batchReturnForm.orderNo = this.scanData.orderNo;
- this.batchReturnForm.batchNo = this.currentBatchNo;
- this.batchReturnForm.unpickedCount = this.summary.unpickedCount;
- this.batchReturnForm.unpickedQuantity = this.summary.unpickedQuantity;
+
+ this.splitChainLoading = true;
+ try {
+ const res = await http.post('/api/OutboundBatchPicking/split-package-chain-info', {
+ orderNo: this.scanData.orderNo,
+ barcode: barcode
+ });
+
+ if (res.status) {
+ this.splitChainInfo = res.data;
+ this.activeDialog = 'splitChain';
+ } else {
+ this.$message.error(res.message || '鑾峰彇鎷嗗寘閾句俊鎭け璐�');
+ }
+ } catch (error) {
+ this.$message.error('鑾峰彇鎷嗗寘閾句俊鎭け璐�');
+ } finally {
+ this.splitChainLoading = false;
+ }
+ },
+
+ // 鍏抽棴鎷嗗寘閾句俊鎭脊绐�
+ closeSplitChainDialog() {
+ this.showSplitChainDialog = false;
+ },
+
+ // 鍙栨秷鍗曚釜鎷嗗寘璁板綍
+ async cancelSingleSplit(newBarcode) {
+ const originalBarcode = this.splitChainInfo.originalBarcode;
+
+ try {
+ await this.$confirm(
+ `纭畾瑕佸彇娑堟潯鐮� ${newBarcode} 鐨勬媶鍖呮搷浣滃悧锛焋,
+ '鍙栨秷鍗曚釜鎷嗗寘',
+ {
+ confirmButtonText: '纭畾鍙栨秷',
+ cancelButtonText: '鍐嶆兂鎯�',
+ type: 'warning'
+ }
+ );
+
+ this.revertSplitLoading = true;
+
+ const res = await http.post('/api/OutboundBatchPicking/cancel-split', {
+ orderNo: this.scanData.orderNo,
+ palletCode: this.scanData.palletCode,
+ newBarcode: newBarcode
+ });
+
+ if (res.status) {
+ this.$message.success('鍙栨秷鎷嗗寘鎴愬姛');
+ await this.loadPalletData();
+ this.closeAllDialogs();
+ setTimeout(() => {
+ this.viewSplitChain(originalBarcode);
+ }, 50);
+ } else {
+ this.$message.error(res.message || '鍙栨秷鎷嗗寘澶辫触');
+ }
+ } catch (error) {
+ if (error !== 'cancel') {
+ this.$message.error('鍙栨秷鎷嗗寘澶辫触');
+ }
+ } finally {
+ this.revertSplitLoading = false;
+ }
+ },
+
+ // 鍙栨秷鏁翠釜鎷嗗寘閾�
+ async cancelWholeSplitChain() {
+ try {
+ await this.$confirm(
+ `纭畾瑕佸彇娑堟暣涓媶鍖呴摼鍚楋紵\n杩欏皢鍙栨秷浠庢潯鐮� ${this.splitChainInfo.originalBarcode} 寮�濮嬬殑鎵�鏈夋媶鍖呮搷浣溿�俙,
+ '鍙栨秷鎷嗗寘閾剧‘璁�',
+ {
+ confirmButtonText: '纭畾鍙栨秷',
+ cancelButtonText: '鍐嶆兂鎯�',
+ type: 'warning',
+ center: true,
+ closeOnClickModal: false
+ }
+ );
+
+ this.revertSplitLoading = true;
+
+ const res = await http.post('/api/OutboundBatchPicking/cancel-split-chain', {
+ orderNo: this.scanData.orderNo,
+ palletCode: this.scanData.palletCode,
+ startBarcode: this.splitChainInfo.originalBarcode
+ });
+
+ if (res.status) {
+ this.$message.success('鍙栨秷鎷嗗寘閾炬垚鍔�');
+ this.closeAllDialogs();
+ await this.loadPalletData();
+ } else {
+ this.$message.error(res.message || '鍙栨秷鎷嗗寘閾惧け璐�');
+ }
+ } catch (error) {
+ if (error !== 'cancel') {
+ this.$message.error('鍙栨秷鎷嗗寘閾惧け璐�: ' + error.message);
+ }
+ } finally {
+ this.revertSplitLoading = false;
+ }
+ },
+
+ // 妫�鏌ユ潯鐮佹槸鍚﹀凡琚垎鎷�
+ hasPicked(barcode) {
+ return this.pickedList.some(item => item.currentBarcode === barcode);
+ },
+
+ // 鏍煎紡鍖栨棩鏈熸椂闂�
+ formatDateTime(dateTime) {
+ if (!dateTime) return '';
+ const date = new Date(dateTime);
+ return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')} ${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}:${date.getSeconds().toString().padStart(2, '0')}`;
+ },
+
+ // 鍏抽敭淇锛氭柊澧炲叧闂墍鏈夊脊绐楃殑鏂规硶
+ closeAllDialogs() {
+ this.activeDialog = null;
+ // 纭繚鎵�鏈夊脊绐楃姸鎬侀兘琚噸缃�
+// 鍏抽棴Vue寮圭獥
+ this.showCustomSplitDialog = false;
+ this.showRevertSplitDialog = false;
+ this.showBatchReturnDialog = false;
+ this.showEmptyPalletDialog = false;
+ this.showSplitChainDialog = false;
+
+ // 鍏抽棴鎵嬪姩寮圭獥
+ if (this.manualDialog && this.manualDialog.parentNode) {
+ this.manualDialog.parentNode.removeChild(this.manualDialog);
+ this.manualDialog = null;
+ }
+
+ // 绉婚櫎鎵�鏈夌揣鎬ュ脊绐�
+ const emergencyDialogs = document.querySelectorAll('.emergency-fix');
+ emergencyDialogs.forEach(dialog => {
+ if (dialog.parentNode) {
+ dialog.parentNode.removeChild(dialog);
+ }
+ });
+ },
+
+ // 鍥炲簱鐩稿叧鏂规硶
+ openBatchReturnDialog() {
+ if (!this.scanData.palletCode) {
+ this.$message.warning('璇峰厛鎵弿鎵樼洏鐮�');
+ return;
+ }
+
+ if (this.isOpeningDialog) return;
+
+ this.isOpeningDialog = true;
+
+ setTimeout(() => {
+ this.closeAllDialogsImmediately();
+
+ requestAnimationFrame(() => {
+ this.showBatchReturnDialog = true;
+ this.batchReturnForm.orderNo = this.scanData.orderNo;
+ this.batchReturnForm.palletCode = this.scanData.palletCode;
+ this.batchReturnForm.unpickedCount = this.summary.unpickedCount;
+ this.batchReturnForm.unpickedQuantity = this.summary.unpickedQuantity;
+
+ this.$nextTick(() => {
+ this.isOpeningDialog = false;
+ });
+ });
+ }, 0);
},
async handleBatchReturnConfirm() {
this.batchReturnLoading = true;
try {
- const res = await http.post('/api/BatchOutbound/batch-return-stock', {
+ const res = await http.post('/api/OutboundBatchPicking/return-stock', {
orderNo: this.scanData.orderNo,
- batchNo: this.currentBatchNo
+ palletCode: this.scanData.palletCode
});
if (res.status) {
- this.$message.success('鎵规鍥炲簱鎴愬姛');
- this.showBatchReturnDialog = false;
- await this.loadBatchData();
+ this.$message.success('鍥炲簱鎴愬姛');
+ this.closeAllDialogs();
+ await this.loadPalletData();
} else {
- this.$message.error(res.message || '鎵规鍥炲簱澶辫触');
+ this.$message.error(res.message || '鍥炲簱澶辫触');
}
} catch (error) {
- this.$message.error('鎵规鍥炲簱澶辫触');
+ this.$message.error('鍥炲簱澶辫触');
} finally {
this.batchReturnLoading = false;
}
},
// 鍙栫┖绠辨柟娉�
+handleEmptyPallet() {
+ if (this.isOpeningDialog) return;
+
+ this.isOpeningDialog = true;
+
+ setTimeout(() => {
+ this.closeAllDialogsImmediately();
+
+ requestAnimationFrame(() => {
+ this.showEmptyPalletDialog = true;
+ this.emptypalletOutForm.orderNo = this.scanData.orderNo;
+ this.emptypalletOutForm.palletCode = '';
+
+ this.$nextTick(() => {
+ this.isOpeningDialog = false;
+ });
+ });
+ }, 0);
+ },
+
async handleEmptyPalletConfirm() {
this.emptypalletOutLoading = true;
try {
- const res = await http.post('/api/BatchOutbound/remove-empty-pallet', this.emptypalletOutForm);
+ const res = await http.post('/api/OutboundBatchPicking/remove-empty-pallet', {
+ orderNo: this.emptypalletOutForm.orderNo,
+ palletCode: this.emptypalletOutForm.palletCode
+ });
if (res.status) {
this.$message.success('鍙栬蛋绌虹鎴愬姛');
- this.showEmptyPalletDialog = false;
- await this.loadBatchData();
+ this.closeAllDialogs();
+ await this.loadPalletData();
} else {
this.$message.error(res.message || '鍙栬蛋绌虹澶辫触');
}
@@ -788,32 +1391,76 @@
}
},
- // 鍏朵粬鍘熸湁鏂规硶...
+ // 鏁版嵁鍔犺浇鏂规硶
+ async loadPalletData() {
+ if (!this.scanData.orderNo || !this.scanData.palletCode) return;
+
+ try {
+ await this.loadUnpickedList();
+ await this.loadPickedList();
+ await this.loadPalletStatus();
+ } catch (error) {
+ console.error('鍔犺浇鎵樼洏鏁版嵁澶辫触:', error);
+ }
+ },
+
+ async loadUnpickedList() {
+ try {
+ const res = await http.post('/api/OutboundBatchPicking/pallet-locks', {
+ orderNo: this.scanData.orderNo,
+ palletCode: this.scanData.palletCode
+ });
+ if (res.status) {
+ this.unpickedList = (res.data || []).filter(item => item.canPick === true);
+ this.summary.unpickedCount = this.unpickedList.length;
+ this.summary.unpickedQuantity = this.unpickedList.reduce((sum, item) => sum + (item.remainQuantity || 0), 0);
+ }
+ } catch (error) {
+ this.$message.error('鍔犺浇鏈嫞閫夊垪琛ㄥけ璐�');
+ }
+ },
+
+ async loadPickedList() {
+ try {
+ const res = await http.post('/api/OutboundBatchPicking/pallet-picked-list', {
+ orderNo: this.scanData.orderNo,
+ palletCode: this.scanData.palletCode
+ });
+ if (res.status) {
+ this.pickedList = res.data.map(item => ({
+ ...item,
+ currentBarcode: item.barcode
+ }));
+ this.summary.pickedCount = this.pickedList.length;
+ }
+ } catch (error) {
+ this.$message.error('鍔犺浇宸叉嫞閫夊垪琛ㄥけ璐�');
+ }
+ },
+
+ async loadPalletStatus() {
+ try {
+ const res = await http.post('/api/OutboundBatchPicking/pallet-status', {
+ orderNo: this.scanData.orderNo,
+ palletCode: this.scanData.palletCode
+ });
+ if (res.status) {
+ this.palletStatus = res.data.statusText || '鏈煡';
+ }
+ } catch (error) {
+ this.palletStatus = '鏈煡';
+ }
+ },
+
+ // 鎵爜鐩稿叧鏂规硶
onPalletScan() {
this.scanData.palletCode = this.scanData.palletCode.replace(/\n/g, '').trim();
if (!this.scanData.palletCode) return;
- this.loadActiveBatch();
+ this.loadPalletData();
this.$nextTick(() => {
this.$refs.barcodeInput.focus();
});
- },
-
- async loadActiveBatch() {
- try {
- const res = await http.post('/api/BatchOutbound/active-batch', {
- orderNo: this.scanData.orderNo,
- palletCode: this.scanData.palletCode
- });
- if (res.status && res.data) {
- this.currentBatchNo = res.data.batchNo;
- this.scanData.batchNo = res.data.batchNo;
- this.selectedBatchNo = res.data.batchNo;
- await this.loadBatchData();
- }
- } catch (error) {
- console.log('鑾峰彇娲昏穬鎵规澶辫触锛屽彲鑳芥墭鐩樻病鏈夊叧鑱旀壒娆�');
- }
},
onBarcodeScan() {
@@ -853,9 +1500,8 @@
try {
for (const row of this.selectedPickedRows) {
try {
- const res = await http.post('/api/BatchOutbound/cancel-picking', {
+ const res = await http.post('/api/OutboundBatchPicking/cancel-picking', {
orderNo: this.scanData.orderNo,
- batchNo: this.currentBatchNo,
palletCode: this.scanData.palletCode,
barcode: row.currentBarcode
});
@@ -867,7 +1513,7 @@
}
}
this.$message.success('鎵归噺鍙栨秷瀹屾垚');
- await this.loadBatchData();
+ await this.loadPalletData();
this.selectedPickedRows = [];
} catch (error) {
this.$message.error('鎵归噺鍙栨秷鎿嶄綔澶辫触');
@@ -888,34 +1534,46 @@
this.resetSplitForm();
},
- openRevertSplitDialog() {
- this.showRevertSplitDialog = true;
- this.revertSplitForm.newBarcode = '';
+openRevertSplitDialog() {
+ if (this.isOpeningDialog) return;
+
+ this.isOpeningDialog = true;
+
+ setTimeout(() => {
+ this.closeAllDialogsImmediately();
+
+ requestAnimationFrame(() => {
+ this.showRevertSplitDialog = true;
+ this.revertSplitForm.newBarcode = '';
+
+ this.$nextTick(() => {
+ this.isOpeningDialog = false;
+ });
+ });
+ }, 0);
},
- closeRevertSplitDialog() {
+ closeRevertSplitDialog() {
this.showRevertSplitDialog = false;
this.revertSplitForm.newBarcode = '';
},
- closeBatchReturnDialog() {
+ closeBatchReturnDialog() {
this.showBatchReturnDialog = false;
- },
-
- openEmptyPalletDialog() {
- this.showEmptyPalletDialog = true;
- this.emptypalletOutForm.orderNo = this.scanData.orderNo;
- this.emptypalletOutForm.palletCode = '';
- },
-
- closeEmptyPalletDialog() {
- this.showEmptyPalletDialog = false;
- this.emptypalletOutForm.palletCode = '';
},
onEmptyPalletScan() {
if (!this.emptypalletOutForm.palletCode) return;
this.emptypalletOutForm.palletCode = this.emptypalletOutForm.palletCode.replace(/\n/g, '').trim();
+ },
+
+ closeEmptyPalletDialog() {
+ this.showEmptyPalletDialog = false;
+ this.emptypalletOutForm.palletCode = '';
+ },
+
+ parentcall() {
+ // 鎵撳嵃鍥炶皟
}
}
})
@@ -924,26 +1582,6 @@
<style scoped>
.OutboundPicking-container {
padding: 20px;
-}
-
-.batch-operations {
- margin-bottom: 15px;
-}
-
-.batch-actions {
- display: flex;
- align-items: center;
- gap: 10px;
-}
-
-.batch-summary-area {
- margin-bottom: 15px;
-}
-
-.batch-summary-info {
- display: flex;
- gap: 15px;
- flex-wrap: wrap;
}
.scanner-form {
@@ -976,7 +1614,7 @@
color: #909399;
}
-/* 鑷畾涔夊脊绐楁牱寮� */
+/* 鑷畾涔夊脊绐楁牱寮� - 鍏抽敭淇 */
.custom-dialog-overlay {
position: fixed;
top: 0;
@@ -987,7 +1625,7 @@
display: flex;
align-items: center;
justify-content: center;
- z-index: 9999;
+ z-index: 9999; /* 鎻愰珮z-index纭繚鍦ㄦ渶涓婂眰 */
}
.custom-dialog-wrapper {
@@ -1063,4 +1701,140 @@
width: 100%;
}
}
+
+/* 鍘熸湁鐨勬牱寮忎繚鎸佷笉鍙� */
+.OutboundPicking-container {
+ padding: 20px;
+}
+
+.scanner-form {
+ display: flex;
+ gap: 10px;
+ align-items: center;
+ flex-wrap: wrap;
+}
+
+.scanner-form .el-input {
+ width: 200px;
+}
+
+.summary-info {
+ display: flex;
+ gap: 20px;
+ flex-wrap: wrap;
+}
+
+.table-actions {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 10px;
+ padding: 0 10px;
+}
+
+.selection-count {
+ font-size: 12px;
+ color: #909399;
+}
+
+/* 鍘熸湁鐨勮嚜瀹氫箟寮圭獥鏍峰紡 */
+.custom-dialog-overlay {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background-color: rgba(0, 0, 0, 0.5);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 2000;
+}
+
+.custom-dialog-wrapper {
+ position: relative;
+ z-index: 2001;
+}
+
+.custom-dialog {
+ background: white;
+ border-radius: 4px;
+ width: 500px;
+ max-width: 90vw;
+ max-height: 90vh;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+ overflow: auto;
+}
+
+.custom-dialog-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 20px 20px 10px;
+ border-bottom: 1px solid #ebeef5;
+}
+
+.custom-dialog-header h3 {
+ margin: 0;
+ color: #303133;
+}
+
+.close-button {
+ font-size: 18px;
+ color: #909399;
+ padding: 0;
+ width: 24px;
+ height: 24px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.close-button:hover {
+ color: #409EFF;
+ background-color: transparent;
+}
+
+.custom-dialog-body {
+ padding: 20px;
+}
+
+.custom-dialog-footer {
+ padding: 10px 20px 20px;
+ text-align: right;
+ border-top: 1px solid #ebeef5;
+}
+
+.custom-dialog-footer .el-button {
+ margin-left: 10px;
+}
+
+@media (max-width: 768px) {
+ .custom-dialog {
+ width: 95vw;
+ margin: 10px;
+ }
+
+ .scanner-form {
+ flex-direction: column;
+ align-items: stretch;
+ }
+
+ .scanner-form .el-input {
+ width: 100%;
+ }
+}
+
+/* 鏂板锛氭墜鍔ㄥ脊绐楃殑鎸夐挳鎮仠鏁堟灉 */
+:deep(button) {
+ transition: all 0.3s;
+}
+
+:deep(button:hover) {
+ opacity: 0.8;
+}
+
+:deep(button:active) {
+ opacity: 0.6;
+}
</style>
\ No newline at end of file
--
Gitblit v1.9.3