From 8639f19c82f6e263654db44286256bb8d028d2c2 Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期日, 30 十一月 2025 10:10:40 +0800
Subject: [PATCH] 1
---
项目代码/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue | 1743 +++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 1,417 insertions(+), 326 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue"
index 899297b..2fc26e1 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue"
@@ -1,354 +1,1445 @@
<template>
- <div class="picking-confirm">
+ <div class="OutboundPicking-container">
<div class="page-header">
<el-page-header @back="goBack">
<template #content>
- <span class="title">鍑哄簱鎷i�夌‘璁� - {{ orderInfo.orderNo }}</span>
+ <span class="title">鍑哄簱鎷i�夌‘璁� - {{ this.$route.query.orderNo }}</span>
</template>
</el-page-header>
</div>
+ <!-- 鎵爜鍖哄煙 -->
+ <div class="scanner-area">
+ <el-card>
+ <div class="scanner-form">
+ <el-input
+ ref="palletInput"
+ v-model="scanData.palletCode"
+ placeholder="鎵弿鎵樼洏鐮�"
+ @change="onPalletScan"
+ @keyup.enter.native="onPalletScan">
+ </el-input>
+ <el-input
+ ref="barcodeInput"
+ v-model="scanData.barcode"
+ placeholder="鎵弿鐗╂枡鏉$爜"
+ @change="onBarcodeScan"
+ @keyup.enter.native="onBarcodeScan">
+ </el-input>
+ <el-button type="success" @click="confirmPicking">纭鎷i��</el-button>
+ <!-- <el-button type="warning" @click="openSplitDialog">鎷嗗寘</el-button>
+ <el-button type="info" @click="openRevertSplitDialog">鎾ら攢鎷嗗寘</el-button> -->
+ <el-button type="info" @click="handleEmptyPallet">鍙栫┖绠�</el-button>
+ <el-button type="primary" @click="openBatchReturnDialog">鍥炲簱</el-button>
+ <!-- <el-button type="danger" @click="handleDirectOutbound">鐩存帴鍑哄簱</el-button> -->
- <el-row :gutter="20" class="main-content">
- <el-col :span="8">
- <div class="scan-section">
- <el-card header="鎵爜鍖哄煙">
- <el-form label-width="100px" size="small">
- <el-form-item label="鎵樼洏鏉$爜">
- <el-input
- v-model="scanForm.palletCode"
- placeholder="鎵弿鎴栬緭鍏ユ墭鐩樻潯鐮�"
- @keyup.enter="handlePalletScan"
- clearable
- >
- <template #append>
- <el-button @click="handlePalletScan">纭</el-button>
- </template>
- </el-input>
- </el-form-item>
-
- <el-form-item label="鐗╂枡鏉$爜">
- <el-input
- v-model="scanForm.barcode"
- placeholder="鎵弿鎴栬緭鍏ョ墿鏂欐潯鐮�"
- @keyup.enter="handleBarcodeScan"
- :disabled="!currentPallet"
- clearable
- >
- <template #append>
- <el-button @click="handleBarcodeScan" :disabled="!currentPallet">纭</el-button>
- </template>
- </el-input>
- </el-form-item>
-
- <el-form-item label="鎷i�夋暟閲�">
- <el-input-number
- v-model="scanForm.quantity"
- :min="1"
- :max="maxPickQuantity"
- :disabled="!currentLockInfo"
- />
- </el-form-item>
- </el-form>
-
- <div class="current-info" v-if="currentPallet">
- <p>褰撳墠鎵樼洏: {{ currentPallet.palletCode }}</p>
- <p>璐т綅: {{ currentPallet.locationCode }}</p>
- <p>鐘舵��: {{ currentPallet.statusText }}</p>
- </div>
- </el-card>
-
- <div class="action-buttons">
- <el-button
- type="warning"
- @click="handleBackToStock"
- :disabled="!currentPallet"
- style="margin-bottom: 10px;"
- >
- 鍥炲簱
- </el-button>
- <el-button
- type="success"
- @click="handleDirectOutbound"
- :disabled="!currentPallet"
- style="margin-bottom: 10px;"
- >
- 鐩存帴鍑哄簱
- </el-button>
- <el-button
- type="primary"
- @click="handleOpenSplit"
- :disabled="!currentLockInfo"
- >
- 鎷嗗寘
- </el-button>
- </div>
</div>
- </el-col>
+ </el-card>
+ </div>
- <el-col :span="16">
- <el-card header="鎷i�夌粨鏋�">
- <div class="summary-info">
- <el-alert
- :title="`鏈嫞璐�: ${unpickedCount} 鏉�, ${unpickedQuantity} 涓猔"
- type="warning"
- :closable="false"
- />
- </div>
+ <!-- 姹囨�讳俊鎭� -->
+ <div class="summary-area">
+ <el-card>
+ <div class="summary-info">
+ <el-tag type="warning">鏈嫞閫夋潯鏁�: {{summary.unpickedCount}}</el-tag>
+ <el-tag type="danger">鏈嫞閫夋暟閲�: {{summary.unpickedQuantity}}</el-tag>
+ <!-- <el-tag type="success">宸叉嫞閫夋潯鏁�: {{summary.pickedCount}}</el-tag> -->
+ <el-tag type="info">鎵樼洏鐘舵��: {{palletStatus}}</el-tag>
+ </div>
+ </el-card>
+ </div>
- <vol-table
- :data="pickedList"
- :columns="pickedColumns"
- :pagination="false"
- :height="400"
- >
- <template #action="{ row }">
- <el-button type="text" @click="handleCancelPick(row)">鎾ら攢</el-button>
- </template>
- </vol-table>
- </el-card>
- </el-col>
- </el-row>
+ <!-- 鏁版嵁鍒楄〃 -->
+ <div class="content-area">
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-card header="鏈嫞閫夊垪琛�">
+ <el-table :data="unpickedList" border height="440">
+ <el-table-column prop="materielCode" label="鐗╂枡缂栫爜" width="120"></el-table-column>
+
+ <el-table-column prop="assignQuantity" label="鍒嗛厤鏁伴噺" width="100"></el-table-column>
+ <el-table-column prop="remainQuantity" 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-column label="鎿嶄綔" width="100">
+ <template slot-scope="scope">
+ <el-button
+ size="mini"
+ type="primary"
+ @click="handleSingleReturn(scope.row)">
+ 鍥炲簱
+ </el-button>
+ </template>
+ </el-table-column> -->
+ </el-table>
+ </el-card>
+ </el-col>
+
+ <el-col :span="12">
+ <el-card header="宸叉嫞閫夊垪琛�">
+ <div class="table-actions">
+ <el-button
+ size="mini"
+ type="danger"
+ :disabled="selectedPickedRows.length === 0"
+ @click="batchCancelSelected">
+ 鍙栨秷鎷i��
+ </el-button>
+ <span class="selection-count">宸查�夋嫨 {{selectedPickedRows.length}} 椤�</span>
+ </div>
+ <el-table :data="pickedList" border height="400" style="width: 100%" @selection-change="handlePickedSelectionChange">
+ <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="currentBarcode" label="鏉$爜"></el-table-column>
+
+
+ </el-table>
+ </el-card>
+ </el-col>
+ </el-row>
+ </div>
<!-- 鎷嗗寘寮圭獥 -->
- <vol-box
- v-model="splitVisible"
- title="鎷嗗寘鎿嶄綔"
- :width="600"
- :height="500"
- >
- <SplitPackageModal
- v-if="splitVisible"
- :lockInfo="currentLockInfo"
- @success="handleSplitSuccess"
- @close="splitVisible = false"
- />
- </vol-box>
+<!-- 鎷嗗寘寮圭獥 -->
+ <div v-if="showCustomSplitDialog" class="custom-dialog-overlay">
+ <div class="custom-dialog-wrapper">
+ <div class="custom-dialog">
+ <div class="custom-dialog-header">
+ <h3>鎷嗗寘鎿嶄綔</h3>
+ <!-- <el-button
+ type="text"
+ icon="el-icon-close"
+ @click="closeCustomSplitDialog"
+ class="close-button">
+ </el-button> -->
+ <el-button
+ type="text"
+ @click="closeCustomSplitDialog"
+ class="close-button">
+ X
+ </el-button>
+
+ </div>
+ <div class="custom-dialog-body">
+ <el-form :model="splitForm" :rules="splitFormRules" ref="splitFormRef" label-width="100px">
+ <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.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>
+ </el-form-item>
+ <el-form-item label="鐗╂枡缂栫爜">
+ <el-input v-model="splitForm.materielCode" disabled></el-input>
+ </el-form-item>
+ <el-form-item label="鍓╀綑鏁伴噺">
+ <el-input v-model="splitForm.maxQuantity" disabled></el-input>
+ </el-form-item>
+ <el-form-item label="鎷嗗寘鏁伴噺" prop="splitQuantity">
+ <el-input-number
+ v-model="splitForm.splitQuantity"
+ :min="1"
+ :max="splitForm.maxQuantity"
+ :precision="2"
+ :step="1"
+ style="width: 100%">
+ </el-input-number>
+ </el-form-item>
+ </el-form>
+ </div>
+ <div class="custom-dialog-footer">
+ <el-button @click="closeCustomSplitDialog">鍙栨秷</el-button>
+ <el-button type="primary" @click="handleSplitPackage" :loading="splitLoading">纭鎷嗗寘</el-button>
+ </div>
+ </div>
+ </div>
+ </div>
+
+
+ <!-- 鎾ら攢鎷嗗寘寮圭獥 -->
+ <div v-if="showRevertSplitDialog" 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="closeRevertSplitDialog"
+ class="close-button">
+ 脳
+ </el-button>
+ </div>
+ <div class="custom-dialog-body">
+ <el-form
+ :model="revertSplitForm"
+ :rules="revertSplitFormRules"
+ ref="revertSplitFormRef"
+ label-width="100px">
+ <el-form-item label="鍘熸潯鐮�" prop="originalBarcode">
+ <el-input
+ v-model="revertSplitForm.originalBarcode"
+ placeholder="鎵弿鍘熸潯鐮�"
+ @keyup.enter.native="onRevertSplitBarcodeScan"
+ @change="onRevertSplitBarcodeScan"
+ clearable>
+ </el-input>
+ </el-form-item>
+ </el-form>
+ </div>
+ <div class="custom-dialog-footer">
+ <el-button @click="closeRevertSplitDialog">鍙栨秷</el-button>
+ <el-button type="primary" @click="handleRevertSplit" :loading="revertSplitLoading">纭鎾ら攢</el-button>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <!-- 鎵归噺鍥炲簱寮圭獥 -->
+ <div v-if="showBatchReturnDialog" 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="closeBatchReturnDialog"
+ class="close-button">
+ 脳
+ </el-button>
+ </div>
+ <div class="custom-dialog-body">
+ <el-form
+ :model="batchReturnForm"
+ :rules="batchReturnFormRules"
+ ref="batchReturnFormRef"
+ label-width="100px">
+ <el-form-item label="璁㈠崟缂栧彿">
+ <el-input v-model="batchReturnForm.orderNo" disabled></el-input>
+ </el-form-item>
+ <el-form-item label="鎵樼洏缂栧彿" prop="palletCode">
+ <el-input
+ v-model="batchReturnForm.palletCode"
+ placeholder="鎵弿鎵樼洏鐮�"
+ @keyup.enter.native="onBatchReturnPalletScan"
+ @change="onBatchReturnPalletScan"
+ clearable>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="鏈嫞閫夋暟閲�">
+ <el-input v-model="batchReturnForm.unpickedCount" disabled></el-input>
+ </el-form-item>
+ <el-form-item label="鏈嫞閫夋潯鏁�">
+ <el-input v-model="batchReturnForm.unpickedQuantity" disabled></el-input>
+ </el-form-item>
+ </el-form>
+ </div>
+ <div class="custom-dialog-footer">
+ <el-button @click="closeBatchReturnDialog">鍙栨秷</el-button>
+ <el-button type="primary" @click="handleBatchReturnConfirm" :loading="batchReturnLoading">纭鍥炲簱</el-button>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <!-- 鍙栬蛋绌虹-->
+ <div v-if="showEmptyPalletDialog" 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="closeEmptyPalletDialog"
+ class="close-button">
+ 脳
+ </el-button>
+ </div>
+ <div class="custom-dialog-body">
+ <el-form
+ :model="emptypalletOutForm"
+ :rules="emptypalletOutFormRules"
+ ref="emptypalletOutFormRef"
+ label-width="100px">
+ <el-form-item label="璁㈠崟缂栧彿">
+ <el-input v-model="emptypalletOutForm.orderNo" disabled></el-input>
+ </el-form-item>
+ <el-form-item label="鎵樼洏缂栧彿" prop="palletCode">
+ <el-input
+ v-model="emptypalletOutForm.palletCode"
+ placeholder="鎵弿鎵樼洏鐮�"
+ @keyup.enter.native="onEmptyPalletScan"
+ @change="onEmptyPalletScan"
+ clearable>
+ </el-input>
+ </el-form-item>
+ </el-form>
+ </div>
+ <div class="custom-dialog-footer">
+ <el-button @click="closeEmptyPalletDialog">鍙栨秷</el-button>
+ <el-button type="primary" @click="handleEmptyPalletConfirm" :loading="emptypalletOutLoading">纭鍙栬蛋绌虹</el-button>
+ </div>
+ </div>
+ </div>
+ </div>
</div>
+
+ <!-- 鐩存帴鍑哄簱寮圭獥 -->
+ <div v-if="showDirectOutDialog" 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="closeDirectOutDialog"
+ class="close-button">
+ 脳
+ </el-button>
+ </div>
+ <div class="custom-dialog-body">
+ <el-form
+ :model="directOutForm"
+ :rules="directOutFormRules"
+ ref="directOutFormRef"
+ label-width="100px">
+ <el-form-item label="璁㈠崟缂栧彿">
+ <el-input v-model="directOutForm.orderNo" disabled></el-input>
+ </el-form-item>
+ <el-form-item label="鎵樼洏缂栧彿" prop="palletCode">
+ <el-input
+ v-model="directOutForm.palletCode"
+ placeholder="鎵弿鎵樼洏鐮�"
+ @keyup.enter.native="onDirectOutPalletScan"
+ @change="onDirectOutPalletScan"
+ clearable>
+ </el-input>
+ </el-form-item>
+ </el-form>
+ </div>
+ <div class="custom-dialog-footer">
+ <el-button @click="closeDirectOutDialog">鍙栨秷</el-button>
+ <el-button type="primary" @click="handleDirectOutConfirm" :loading="directOutLoading">纭鍑哄簱</el-button>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <print-view ref="childs" @parentcall="parentcall"></print-view>
</template>
<script>
-import SplitPackageModal from './SplitPackageModal.vue'
+import http from '@/api/http.js'
+import { ref, defineComponent } from "vue";
+import { ElMessage } from 'element-plus'
+import { useRoute } from 'vue-router'
+import printView from "@/extension/outbound/extend/printView.vue"
-export default {
- components: { SplitPackageModal },
+export default defineComponent({
+ name: 'PickingConfirm',
+ components: {printView},
+ props: {
+ orderNo: {
+ type: String,
+ required: true
+ }
+ },
+ emits: ['confirm', 'close'],
data() {
+ // 瀹氫箟鎷嗗寘琛ㄥ崟楠岃瘉瑙勫垯
+ const validateOriginalBarcode = (rule, value, callback) => {
+ if (!value || value.trim() === '') {
+ callback(new Error('璇疯緭鍏ュ師鏉$爜'));
+ } else {
+ callback();
+ }
+ };
+
+ const validateSplitQuantity = (rule, value, callback) => {
+ if (value === null || value === undefined || value === '') {
+ callback(new Error('璇疯緭鍏ユ媶鍖呮暟閲�'));
+ } else if (value <= 0) {
+ callback(new Error('鎷嗗寘鏁伴噺蹇呴』澶т簬0'));
+ } else if (this.splitForm.maxQuantity && value > this.splitForm.maxQuantity) {
+ callback(new Error('鎷嗗寘鏁伴噺涓嶈兘澶т簬鍓╀綑鏁伴噺'));
+ } else {
+ callback();
+ }
+ };
+
+ // 瀹氫箟鎾ら攢鎷嗗寘琛ㄥ崟楠岃瘉瑙勫垯
+ const validateRevertOriginalBarcode = (rule, value, callback) => {
+ if (!value || value.trim() === '') {
+ callback(new Error('璇疯緭鍏ュ師鏉$爜'));
+ } else {
+ callback();
+ }
+ };
+ // 瀹氫箟鎵归噺鍥炲簱琛ㄥ崟楠岃瘉瑙勫垯
+ const validateBatchReturnPalletCode = (rule, value, callback) => {
+ if (!value || value.trim() === '') {
+ callback(new Error('璇疯緭鍏ユ墭鐩樼爜'));
+ } else {
+ callback();
+ }
+ };
+ // 瀹氫箟鐩存帴鍑哄簱琛ㄥ崟楠岃瘉瑙勫垯
+ const validateDirectOutPalletCode = (rule, value, callback) => {
+ if (!value || value.trim() === '') {
+ callback(new Error('璇疯緭鍏ユ墭鐩樼爜'));
+ } else {
+ callback();
+ }
+ };
return {
- orderInfo: {},
- scanForm: {
+ scanData: {
+ orderNo: '',
+ palletCode: '',
+ barcode: ''
+ },
+ unpickedList: [],
+ pickedList: [],
+ selectedUnpickedRows: [], // 鏈嫞閫夊垪琛ㄩ�変腑鐨勮
+ selectedPickedRows: [], // 宸叉嫞閫夊垪琛ㄩ�変腑鐨勮
+ summary: {
+ unpickedCount: 0,
+ unpickedQuantity: 0,
+ pickedCount: 0
+ },
+ palletStatus: '鏈煡',
+ showSplitDialog: false,
+ showRevertSplitDialog: false,
+ showCustomSplitDialog: false, // 鑷畾涔夋媶鍖呭脊绐楁樉绀虹姸鎬�
+ showBatchReturnDialog: false, // 鎵归噺鍥炲簱寮圭獥鏄剧ず鐘舵��
+ showReturnDialog: false,
+ splitLoading: false,
+ revertSplitLoading: false,
+ batchReturnLoading: false, // 鎵归噺鍥炲簱鍔犺浇鐘舵��
+ splitForm: {
+ orderNo: '',
+ palletCode: '',
+ originalBarcode: '',
+ materielCode: '',
+ splitQuantity: 0,
+ maxQuantity: 0
+ },
+ // 鎷嗗寘琛ㄥ崟楠岃瘉瑙勫垯
+ splitFormRules: {
+ originalBarcode: [
+ { required: true, validator: validateOriginalBarcode, trigger: 'blur' }
+ ],
+ splitQuantity: [
+ { required: true, validator: validateSplitQuantity, trigger: 'blur' }
+ ]
+ },
+ revertSplitForm: {
+ originalBarcode: ''
+ },
+ // 鎾ら攢鎷嗗寘琛ㄥ崟楠岃瘉瑙勫垯
+ revertSplitFormRules: {
+ originalBarcode: [
+ { required: true, validator: validateRevertOriginalBarcode, trigger: 'blur' }
+ ]
+ },
+ // 鎵归噺鍥炲簱琛ㄥ崟
+ batchReturnForm: {
+ orderNo: '',
+ palletCode: '',
+ unpickedCount: 0,
+ unpickedQuantity: 0
+ },
+ // 鎵归噺鍥炲簱琛ㄥ崟楠岃瘉瑙勫垯
+ batchReturnFormRules: {
+ palletCode: [
+ { required: true, validator: validateBatchReturnPalletCode, trigger: 'blur' }
+ ]
+ },
+ showDirectOutDialog: false, // 鐩存帴鍑哄簱寮圭獥鏄剧ず鐘舵��
+ directOutLoading: false, // 鐩存帴鍑哄簱鍔犺浇鐘舵��
+ directOutForm: {
+ orderNo: '',
+ palletCode: ''
+ },
+ directOutFormRules: {
+ palletCode: [
+ { required: true, validator: validateDirectOutPalletCode, trigger: 'blur' }
+ ]
+ },
+
+ showEmptyPalletDialog: false, // 鍙栬蛋绌虹寮圭獥鏄剧ず鐘舵��
+ emptypalletOutLoading: false, // 鍙栬蛋绌虹鍔犺浇鐘舵��
+ emptypalletOutForm: {
+ orderNo: '',
+ palletCode: ''
+ },
+ emptypalletOutFormRules: {
+ palletCode: [
+ { required: true, validator: validateDirectOutPalletCode, trigger: 'blur' }
+ ]
+ },
+
+
+ returnForm: {
+ orderNo: '',
palletCode: '',
barcode: '',
- quantity: 1
+ materielCode: '',
+ returnQuantity: 0
},
- currentPallet: null,
- currentLockInfo: null,
- pickedList: [],
- pickedColumns: [
- { field: 'barcode', title: '鐗╂枡鏉$爜', width: 150 },
- { field: 'materielCode', title: '鐗╂枡缂栫爜', width: 120 },
- { field: 'materielName', title: '鐗╂枡鍚嶇О', width: 150 },
- { field: 'pickQuantity', title: '鎷i�夋暟閲�', width: 100 },
- { field: 'palletCode', title: '鎵樼洏缂栧彿', width: 120 },
- { field: 'pickTime', title: '鎷i�夋椂闂�', width: 160 },
- { field: 'operator', title: '鎿嶄綔浜�', width: 100 },
- { field: 'action', title: '鎿嶄綔', width: 80, slot: true }
- ],
- splitVisible: false,
- maxPickQuantity: 0
- }
- },
- computed: {
- unpickedCount() {
- return this.orderInfo.unpickedCount || 0
- },
- unpickedQuantity() {
- return this.orderInfo.unpickedQuantity || 0
- }
- },
- methods: {
- goBack() {
- this.$router.back()
- },
-
- async loadOrderInfo() {
- const orderId = this.$route.query.orderId
- if (!orderId) return
-
- try {
- const result = await this.http.post(`api/OutboundOrder/GetById?id=${orderId}`)
- if (result.status) {
- this.orderInfo = result.data
- }
- } catch (error) {
- this.$message.error('鍔犺浇鍑哄簱鍗曚俊鎭け璐�')
- }
- },
-
- async handlePalletScan() {
- if (!this.scanForm.palletCode) {
- this.$message.warning('璇疯緭鍏ユ墭鐩樻潯鐮�')
- return
- }
-
- try {
- const result = await this.http.get(
- `api/OutboundPicking/GetPalletOutboundStatus?palletCode=${this.scanForm.palletCode}`
- )
- if (result.status) {
- this.currentPallet = result.data
- this.loadPalletLockInfo()
- this.$message.success(`鎵樼洏 ${this.scanForm.palletCode} 璇嗗埆鎴愬姛`)
- } else {
- this.$message.error(result.message)
- }
- } catch (error) {
- this.$message.error('鎵樼洏璇嗗埆澶辫触')
- }
- },
-
- async loadPalletLockInfo() {
- if (!this.currentPallet) return
-
- try {
- const result = await this.http.get(
- `api/OutboundPicking/GetPalletLockInfos?palletCode=${this.currentPallet.palletCode}`
- )
- if (result.status && result.data.length > 0) {
- this.currentLockInfo = result.data[0]
- this.maxPickQuantity = this.currentLockInfo.assignQuantity - this.currentLockInfo.pickedQty
- }
- } catch (error) {
- console.error('鍔犺浇閿佸畾淇℃伅澶辫触:', error)
- }
- },
-
- async handleBarcodeScan() {
- // 瀹炵幇鎵爜纭閫昏緫
- if (!this.scanForm.barcode) {
- this.$message.warning('璇疯緭鍏ョ墿鏂欐潯鐮�')
- return
- }
-
- try {
- const request = {
- barcode: this.scanForm.barcode,
- quantity: this.scanForm.quantity,
- palletCode: this.currentPallet.palletCode,
- orderId: this.orderInfo.id
- }
-
- const result = await this.http.post('api/OutboundPicking/ConfirmPicking', request)
- if (result.status) {
- this.$message.success('鎷i�夌‘璁ゆ垚鍔�')
- this.scanForm.barcode = ''
- this.scanForm.quantity = 1
- this.loadPickedHistory()
- this.loadOrderInfo()
- } else {
- this.$message.error(result.message)
- }
- } catch (error) {
- this.$message.error('鎷i�夌‘璁ゅけ璐�')
- }
- },
-
- async handleBackToStock() {
- if (!this.currentPallet) return
-
- try {
- await this.$confirm(`纭畾灏嗘墭鐩� ${this.currentPallet.palletCode} 鍥炲簱鍚楋紵`, '鎻愮ず', {
- type: 'warning'
- })
-
- const result = await this.http.post('api/BackToStock/GenerateBackToStockTask', {
- palletCode: this.currentPallet.palletCode,
- currentLocation: '鎷i�変綅'
- })
-
- if (result.status) {
- this.$message.success('鍥炲簱浠诲姟宸茬敓鎴�')
- this.resetCurrentPallet()
- }
- } catch (error) {
- // 鐢ㄦ埛鍙栨秷
- }
- },
-
- async handleDirectOutbound() {
- if (!this.currentPallet) return
-
- try {
- await this.$confirm(`纭畾灏嗘墭鐩� ${this.currentPallet.palletCode} 鐩存帴鍑哄簱鍚楋紵`, '鎻愮ず', {
- type: 'warning'
- })
-
- const result = await this.http.post('api/OutboundPicking/DirectOutbound', {
- palletCode: this.currentPallet.palletCode
- })
-
- if (result.status) {
- this.$message.success('鐩存帴鍑哄簱鎴愬姛')
- this.resetCurrentPallet()
- this.loadOrderInfo()
- }
- } catch (error) {
- // 鐢ㄦ埛鍙栨秷
- }
- },
-
- handleOpenSplit() {
- if (!this.currentLockInfo) {
- this.$message.warning('璇峰厛閫夋嫨閿佸畾淇℃伅')
- return
- }
- this.splitVisible = true
- },
-
- handleSplitSuccess() {
- this.$message.success('鎷嗗寘鎴愬姛')
- this.loadPalletLockInfo()
- },
-
- resetCurrentPallet() {
- this.currentPallet = null
- this.currentLockInfo = null
- this.scanForm.palletCode = ''
- },
-
- async loadPickedHistory() {
- const orderId = this.$route.query.orderId
- if (!orderId) return
-
- try {
- const result = await this.http.get(`api/OutboundPicking/GetPickingHistory?orderId=${orderId}`)
- if (result.status) {
- this.pickedList = result.data
- }
- } catch (error) {
- console.error('鍔犺浇鎷i�夊巻鍙插け璐�:', error)
- }
- },
-
- async handleCancelPick(row) {
- try {
- await this.$confirm('纭畾鎾ら攢杩欐潯鎷i�夎褰曞悧锛�', '鎻愮ず', { type: 'warning' })
-
- const result = await this.http.post('api/OutboundPicking/CancelPicking', {
- pickingHistoryId: row.id
- })
-
- if (result.status) {
- this.$message.success('鎾ら攢鎴愬姛')
- this.loadPickedHistory()
- this.loadOrderInfo()
- }
- } catch (error) {
- // 鐢ㄦ埛鍙栨秷
- }
+ isProcessing: false // 闃叉閲嶅鎻愪氦
}
},
mounted() {
- this.loadOrderInfo()
- this.loadPickedHistory()
+ // 浠庤矾鐢卞弬鏁拌幏鍙栬鍗曠紪鍙�
+ if (this.$route.query.orderNo) {
+ this.scanData.orderNo = this.$route.query.orderNo;
+ this.splitForm.orderNo = this.$route.query.orderNo;
+ this.returnForm.orderNo = this.$route.query.orderNo;
+ }
+ // 椤甸潰鍔犺浇鍚庤嚜鍔ㄨ仛鐒﹀埌鎵樼洏鐮佽緭鍏ユ
+ this.$nextTick(() => {
+ this.$refs.palletInput.focus();
+ });
+
+ },
+ methods: {
+ goBack(){
+ this.$router.back()
+ },
+
+ openSplitDialog() {
+ console.log('鎵撳紑鑷畾涔夋媶鍖呭脊绐�');
+ if (!this.scanData.palletCode) {
+ this.$message.warning('璇峰厛鎵弿鎵樼洏鐮�');
+ return;
+ }
+ this.showCustomSplitDialog = true;
+
+ // 閲嶇疆琛ㄥ崟
+ this.resetSplitForm();
+
+ // 璁剧疆璁㈠崟鍜屾墭鐩樹俊鎭�
+ this.splitForm.orderNo = this.scanData.orderNo;
+ this.splitForm.palletCode = this.scanData.palletCode;
+
+ // 娓呴櫎琛ㄥ崟楠岃瘉
+ this.$nextTick(() => {
+ if (this.$refs.splitFormRef) {
+ this.$refs.splitFormRef.clearValidate();
+ }
+ });
+ },
+
+ // 鍏抽棴鑷畾涔夋媶鍖呭脊绐�
+ closeCustomSplitDialog() {
+ this.showCustomSplitDialog = false;
+ this.resetSplitForm();
+ // 娓呴櫎琛ㄥ崟楠岃瘉
+ if (this.$refs.splitFormRef) {
+ this.$refs.splitFormRef.clearValidate();
+ }
+ },
+
+ // 鎵撳紑鎾ら攢鎷嗗寘寮圭獥
+ openRevertSplitDialog() {
+ console.log('鎵撳紑鎾ら攢鎷嗗寘寮圭獥');
+ this.showRevertSplitDialog = true;
+
+ // 閲嶇疆琛ㄥ崟
+ this.resetRevertSplitForm();
+
+ // 娓呴櫎琛ㄥ崟楠岃瘉
+ this.$nextTick(() => {
+ if (this.$refs.revertSplitFormRef) {
+ this.$refs.revertSplitFormRef.clearValidate();
+ }
+ });
+ },
+
+ // 鍏抽棴鎾ら攢鎷嗗寘寮圭獥
+ closeRevertSplitDialog() {
+ this.showRevertSplitDialog = false;
+ this.resetRevertSplitForm();
+
+ // 娓呴櫎琛ㄥ崟楠岃瘉
+ if (this.$refs.revertSplitFormRef) {
+ this.$refs.revertSplitFormRef.clearValidate();
+ }
+ },
+ // 鎵撳紑鎵归噺鍥炲簱寮圭獥
+ openBatchReturnDialog() {
+ console.log('鎵撳紑鎵归噺鍥炲簱寮圭獥');
+ this.showBatchReturnDialog = true;
+
+ // 閲嶇疆琛ㄥ崟
+ this.resetBatchReturnForm();
+
+ // 璁剧疆璁㈠崟淇℃伅
+ this.batchReturnForm.orderNo = this.scanData.orderNo;
+
+ // 鏇存柊鏈嫞閫変俊鎭�
+ this.batchReturnForm.unpickedCount = this.summary.unpickedCount || 0;
+ this.batchReturnForm.unpickedQuantity = this.summary.unpickedQuantity || 0;
+
+ // 娓呴櫎琛ㄥ崟楠岃瘉
+ this.$nextTick(() => {
+ if (this.$refs.batchReturnFormRef) {
+ this.$refs.batchReturnFormRef.clearValidate();
+ }
+ });
+ },
+
+ // 鍏抽棴鎵归噺鍥炲簱寮圭獥
+ closeBatchReturnDialog() {
+ this.showBatchReturnDialog = false;
+ this.resetBatchReturnForm();
+
+ // 娓呴櫎琛ㄥ崟楠岃瘉
+ if (this.$refs.batchReturnFormRef) {
+ this.$refs.batchReturnFormRef.clearValidate();
+ }
+ },
+
+ // 鍥炲簱鎵樼洏鐮佹壂鐮�
+ onBatchReturnPalletScan() {
+ if (!this.batchReturnForm.palletCode) return;
+
+ this.batchReturnForm.palletCode = this.batchReturnForm.palletCode.replace(/\n/g, '').trim();
+
+ // 娓呴櫎楠岃瘉鐘舵��
+ if (this.$refs.batchReturnFormRef) {
+ this.$refs.batchReturnFormRef.clearValidate(['palletCode']);
+ }
+ },
+
+ // 鍥炲簱纭
+ async handleBatchReturnConfirm() {
+ // 琛ㄥ崟楠岃瘉
+ if (this.$refs.batchReturnFormRef) {
+ this.$refs.batchReturnFormRef.validate((valid) => {
+ if (valid) {
+ this.submitBatchReturn();
+ } else {
+ this.$message.warning('璇锋壂鎻忔墭鐩樼爜');
+ return false;
+ }
+ });
+ } else {
+ // 濡傛灉娌℃湁琛ㄥ崟寮曠敤锛屼娇鐢ㄥ師鏈夌殑楠岃瘉
+ if (!this.batchReturnForm.palletCode) {
+ this.$message.warning('璇锋壂鎻忔墭鐩樼爜');
+ return;
+ }
+
+ this.submitBatchReturn();
+ }
+ },
+
+ // 鎻愪氦鍥炲簱璇锋眰
+ async submitBatchReturn() {
+ this.batchReturnLoading = true;
+
+ try {
+ const res = await this.http.post('/api/OutboundPicking/return-to-stock', {
+ orderNo: this.batchReturnForm.orderNo,
+ palletCode: this.batchReturnForm.palletCode
+ });
+
+ if (res.status) {
+ this.$message.success(res.message);
+ this.showBatchReturnDialog = false;
+ this.loadData();
+ } else {
+ this.$message.error(res.message || '鍥炲簱澶辫触');
+ }
+ } catch (error) {
+ this.$message.error('鍥炲簱澶辫触');
+ } finally {
+ this.batchReturnLoading = false;
+ }
+ },
+ // 鎵撳紑鐩存帴鍑哄簱寮圭獥
+ openDirectOutDialog() {
+ console.log('鎵撳紑鐩存帴鍑哄簱寮圭獥');
+ this.showDirectOutDialog = true;
+
+ // 閲嶇疆琛ㄥ崟
+ this.resetDirectOutForm();
+
+ // 璁剧疆璁㈠崟淇℃伅
+ this.directOutForm.orderNo = this.scanData.orderNo;
+
+ // 娓呴櫎琛ㄥ崟楠岃瘉
+ this.$nextTick(() => {
+ if (this.$refs.directOutFormRef) {
+ this.$refs.directOutFormRef.clearValidate();
+ }
+ });
+ },
+
+ // 鍏抽棴鐩存帴鍑哄簱寮圭獥
+ closeDirectOutDialog() {
+ this.showDirectOutDialog = false;
+ this.resetDirectOutForm();
+
+ // 娓呴櫎琛ㄥ崟楠岃瘉
+ if (this.$refs.directOutFormRef) {
+ this.$refs.directOutFormRef.clearValidate();
+ }
+ },
+
+ // 鐩存帴鍑哄簱鎵樼洏鐮佹壂鐮�
+ onDirectOutPalletScan() {
+ if (!this.directOutForm.palletCode) return;
+
+ this.directOutForm.palletCode = this.directOutForm.palletCode.replace(/\n/g, '').trim();
+
+ // 娓呴櫎楠岃瘉鐘舵��
+ if (this.$refs.directOutFormRef) {
+ this.$refs.directOutFormRef.clearValidate(['palletCode']);
+ }
+ },
+
+ // 鐩存帴鍑哄簱纭
+ async handleDirectOutConfirm() {
+ // 琛ㄥ崟楠岃瘉
+ if (this.$refs.directOutFormRef) {
+ this.$refs.directOutFormRef.validate((valid) => {
+ if (valid) {
+ this.submitDirectOut();
+ } else {
+ this.$message.warning('璇锋壂鎻忔墭鐩樼爜');
+ return false;
+ }
+ });
+ } else {
+ // 濡傛灉娌℃湁琛ㄥ崟寮曠敤锛屼娇鐢ㄥ師鏈夌殑楠岃瘉
+ if (!this.directOutForm.palletCode) {
+ this.$message.warning('璇锋壂鎻忔墭鐩樼爜');
+ return;
+ }
+
+ this.submitDirectOut();
+ }
+ },
+
+ // 鎻愪氦鐩存帴鍑哄簱璇锋眰
+ async submitDirectOut() {
+ this.directOutLoading = true;
+
+ try {
+ const res = await this.http.post('/api/OutboundPicking/direct-outbound', {
+ orderNo: this.directOutForm.orderNo,
+ palletCode: this.directOutForm.palletCode
+ });
+ debugger;
+ if (res.status) {
+ this.$message.success('鐩存帴鍑哄簱鎴愬姛');
+ this.showDirectOutDialog = false;
+ this.loadData();
+ } else {
+ this.$message.error(res.message || '鐩存帴鍑哄簱澶辫触');
+ }
+ } catch (error) {
+ this.$message.error('鐩存帴鍑哄簱澶辫触');
+ } finally {
+ this.directOutLoading = false;
+ }
+ },
+
+ // 閲嶇疆鐩存帴鍑哄簱琛ㄥ崟
+ resetDirectOutForm() {
+ this.directOutForm.palletCode = '';
+ },
+
+ // 淇敼鍘熸湁鐨勭洿鎺ュ嚭搴撴寜閽偣鍑讳簨浠�
+ handleDirectOutbound() {
+ this.openDirectOutDialog();
+ },
+
+ // 鎵撳紑鍙栬蛋绌虹寮圭獥
+ openEmptyPalletDialog() {
+ console.log('鎵撳紑鍙栬蛋绌虹寮圭獥');
+ this.showEmptyPalletDialog = true;
+
+ // 閲嶇疆琛ㄥ崟
+ this.resetEmptyPalletForm();
+
+ // 璁剧疆璁㈠崟淇℃伅
+ this.emptypalletOutForm.orderNo = this.scanData.orderNo;
+
+ // 娓呴櫎琛ㄥ崟楠岃瘉
+ this.$nextTick(() => {
+ if (this.$refs.emptyPalletFormRef) {
+ this.$refs.emptyPalletFormRef.clearValidate();
+ }
+ });
+ },
+
+ // 鍏抽棴鍙栬蛋绌虹寮圭獥
+ closeEmptyPalletDialog() {
+ this.showEmptyPalletDialog = false;
+ this.resetEmptyPalletForm();
+
+ // 娓呴櫎琛ㄥ崟楠岃瘉
+ if (this.$refs.emptyPalletFormRef) {
+ this.$refs.emptyPalletFormRef.clearValidate();
+ }
+ },
+
+ // 鍙栬蛋绌虹鎵樼洏鐮佹壂鐮�
+ onEmptyPalletScan() {
+ if (!this.emptypalletOutForm.palletCode) return;
+
+ this.emptypalletOutForm.palletCode = this.emptypalletOutForm.palletCode.replace(/\n/g, '').trim();
+
+ // 娓呴櫎楠岃瘉鐘舵��
+ if (this.$refs.emptyPalletFormRef) {
+ this.$refs.emptyPalletFormRef.clearValidate(['palletCode']);
+ }
+ },
+
+ // 鍙栬蛋绌虹纭
+ async handleEmptyPalletConfirm() {
+ // 琛ㄥ崟楠岃瘉
+ if (this.$refs.emptyPalletFormRef) {
+ this.$refs.emptyPalletFormRef.validate((valid) => {
+ if (valid) {
+ this.submitEmptyPallet();
+ } else {
+ this.$message.warning('璇锋壂鎻忔墭鐩樼爜');
+ return false;
+ }
+ });
+ } else {
+ // 濡傛灉娌℃湁琛ㄥ崟寮曠敤锛屼娇鐢ㄥ師鏈夌殑楠岃瘉
+ if (!this.emptypalletOutForm.palletCode) {
+ this.$message.warning('璇锋壂鎻忔墭鐩樼爜');
+ return;
+ }
+
+ this.submitEmptyPallet();
+ }
+ },
+
+ // 鎻愪氦鍙栬蛋绌虹璇锋眰
+ async submitEmptyPallet() {
+ this.emptypalletOutLoading = true;
+
+ try {
+ const res = await this.http.post('/api/OutboundPicking/remove-empty-pallet', {
+ orderNo: this.emptypalletOutForm.orderNo,
+ palletCode: this.emptypalletOutForm.palletCode
+ });
+ debugger;
+ if (res.status) {
+ this.$message.success('鍙栬蛋绌虹鎴愬姛');
+ this.showEmptyPalletDialog = false;
+ this.loadData();
+ } else {
+ this.$message.error(res.message || '鍙栬蛋绌虹澶辫触');
+ }
+ } catch (error) {
+ this.$message.error('鍙栬蛋绌虹澶辫触');
+ } finally {
+ this.emptypalletOutLoading = false;
+ }
+ },
+
+ // 閲嶇疆鍙栬蛋绌虹琛ㄥ崟
+ resetEmptyPalletForm() {
+ this.emptypalletOutForm.palletCode = '';
+ },
+
+ // 淇敼鍘熸湁鐨勫彇璧扮┖绠辨寜閽偣鍑讳簨浠�
+ handleEmptyPallet() {
+ this.openEmptyPalletDialog();
+ },
+
+
+
+
+ async loadData() {
+ if (!this.scanData.orderNo || !this.scanData.palletCode) {
+ return;
+ }
+
+ try {
+ // 鍔犺浇鏈嫞閫夊垪琛�
+ const unpickedRes = await this.http.post('/api/OutboundPicking/unpicked-list', this.scanData);
+ this.unpickedList = unpickedRes.data || [];
+
+ // 鍔犺浇宸叉嫞閫夊垪琛�
+ const pickedRes = await this.http.post('/api/OutboundPicking/picked-list', this.scanData);
+ this.pickedList = pickedRes.data || [];
+
+ // 鍔犺浇姹囨�讳俊鎭�
+ const summaryRes = await this.http.post('/api/OutboundPicking/picking-summary',this.scanData);
+ this.summary = summaryRes.data || {};
+
+ // 鏇存柊鎵樼洏鐘舵��
+ this.updatePalletStatus();
+
+ } catch (error) {
+ this.$message.error('鍔犺浇鏁版嵁澶辫触');
+ }
+ },
+
+ updatePalletStatus() {
+ if (this.unpickedList.length === 0 && this.pickedList.length > 0) {
+ this.palletStatus = '宸插叏閮ㄦ嫞閫�';
+ } else if (this.unpickedList.length > 0 && this.pickedList.length === 0) {
+ this.palletStatus = '寰呮嫞閫�';
+ } else if (this.unpickedList.length > 0 && this.pickedList.length > 0) {
+ this.palletStatus = '閮ㄥ垎鎷i��';
+ } else {
+ this.palletStatus = '鏃犳暟鎹�';
+ }
+ },
+ // 宸叉嫞閫夊垪琛ㄩ�夋嫨鍙樺寲
+ handlePickedSelectionChange(selection) {
+ this.selectedPickedRows = selection;
+ },
+ // 鎵归噺鍙栨秷閫変腑鐨勫凡鎷i�夐」
+ async batchCancelSelected() {
+ if (this.selectedPickedRows.length === 0) {
+ this.$message.warning('璇峰厛閫夋嫨瑕佸彇娑堢殑椤�');
+ return;
+ }
+
+ this.$confirm(`纭畾瑕佸彇娑堥�変腑鐨� ${this.selectedPickedRows.length} 椤瑰悧锛焋, '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(async () => {
+ try {
+ let successCount = 0;
+ let errorCount = 0;
+
+ for (const row of this.selectedPickedRows) {
+ try {
+ const res = await this.http.post('/api/OutboundPicking/CancelPicking', {
+ orderNo: this.scanData.orderNo,
+ palletCode: this.scanData.palletCode,
+ barcode: row.currentBarcode
+ });
+
+ if (res.status) {
+ successCount++;
+ this.$message.success(`鎴愬姛鍙栨秷`);
+ } else {
+ errorCount++;
+ this.$message.warning(`鍙栨秷鎷i�夊け璐�: ${row.currentBarcode} - ${res.message}`);
+ }
+ } catch (error) {
+ errorCount++;
+ this.$message.warning(`鍙栨秷鎷i�夊け璐�: ${row.currentBarcode} - ${error.message}` );
+ }
+ }
+
+ this.loadData();
+ this.selectedPickedRows = [];
+ } catch (error) {
+ this.$message.error('鎵归噺鍙栨秷鎿嶄綔澶辫触');
+ }
+ }).catch(() => {
+ this.$message.info('宸插彇娑堟壒閲忔搷浣�');
+ });
+ },
+ // 鎵樼洏鐮佹壂鐮�
+ onPalletScan() {
+ // 鍘婚櫎鍥炶溅绗﹀拰鍓嶅悗绌烘牸
+ this.scanData.palletCode = this.scanData.palletCode.replace(/\n/g, '').trim();
+ if (!this.scanData.palletCode) return;
+
+ this.splitForm.palletCode = this.scanData.palletCode;
+ this.returnForm.palletCode = this.scanData.palletCode;
+
+ // 鍔犺浇鏁版嵁
+ this.loadData();
+
+ // 鑷姩璺宠浆鍒扮墿鏂欐潯鐮佽緭鍏ユ
+ this.$nextTick(() => {
+ this.$refs.barcodeInput.focus();
+ });
+ },
+
+ onBarcodeScan() {
+ // 鍘婚櫎鍥炶溅绗﹀拰鍓嶅悗绌烘牸
+ this.scanData.barcode = this.scanData.barcode.replace(/\n/g, '').trim();
+ if (!this.scanData.barcode) return;
+
+ // 鑷姩纭鎷i��
+ this.confirmPicking();
+ },
+
+ async confirmPicking() {
+ if (this.isProcessing) return;
+
+ if (!this.scanData.orderNo || !this.scanData.palletCode || !this.scanData.barcode) {
+ this.$message.warning('璇峰厛鎵弿鎵樼洏鐮佸拰鐗╂枡鏉$爜');
+ this.focusBarcodeInput();
+ return;
+ }
+
+ this.isProcessing = true;
+
+ try {
+ const res = await this.http.post('/api/OutboundPicking/confirm-picking', this.scanData);
+ if (res.status) {
+ this.$message.success('鎷i�夌‘璁ゆ垚鍔�');
+ this.scanData.barcode = ''; // 娓呯┖鐗╂枡鏉$爜
+ this.loadData();
+ console.log(res.data.splitResults)
+ if(res.data && res.data.splitResults.length>0){
+ // 璋冪敤瀛愮粍浠舵墦鍗版柟娉�
+ this.$refs.childs.open(res.data.splitResults);
+ //this.$refs.childs.printSplitLabel(res.data.splitResults);
+ }
+ // 鎴愬姛鍚庣户缁仛鐒﹀埌鐗╂枡鏉$爜杈撳叆妗嗭紝鍑嗗涓嬩竴涓壂鐮�
+ this.$nextTick(() => {
+ this.$refs.barcodeInput.focus();
+ });
+ } else {
+ // 鏄剧ず鍚庣杩斿洖鐨勯敊璇俊鎭�
+ this.$message.error(res.message || '鎷i�夌‘璁ゅけ璐�');
+ // 澶辫触鏃惰仛鐒﹀苟閫変腑鐗╂枡鏉$爜杈撳叆妗嗗唴瀹�
+ this.focusBarcodeInput(true);
+ }
+ } catch (error) {
+ this.$message.error('鎷i�夌‘璁ゅけ璐�: ' + (error.message || '缃戠粶閿欒'));
+ // 澶辫触鏃惰仛鐒﹀苟閫変腑鐗╂枡鏉$爜杈撳叆妗嗗唴瀹�
+ this.focusBarcodeInput(true);
+ } finally {
+ this.isProcessing = false;
+ }
+ },
+
+ // 鑱氱劍鍒扮墿鏂欐潯鐮佽緭鍏ユ
+ focusBarcodeInput(selectText = false) {
+ this.$nextTick(() => {
+ const input = this.$refs.barcodeInput;
+ if (input && input.$el && input.$el.querySelector('input')) {
+ const inputEl = input.$el.querySelector('input');
+ inputEl.focus();
+ if (selectText) {
+ inputEl.select();
+ }
+ }
+ });
+ },
+
+ async cancelPicking(row) {
+ try {
+ const res = await this.http.post('/api/OutboundPicking/CancelPicking', {
+ orderNo: this.scanData.orderNo,
+ palletCode: this.scanData.palletCode,
+ barcode: row.Barcode
+ });
+
+ if (res.status) {
+ this.$message.success('鍙栨秷鎷i�夋垚鍔�');
+ this.loadData();
+ } else {
+ this.$message.error(res.message || '鍙栨秷鎷i�夊け璐�');
+ }
+ } catch (error) {
+ this.$message.error('鍙栨秷鎷i�夊け璐�');
+ }
+ },
+
+ /* // 鍥炲簱鎿嶄綔 - 鍥炲簱鏁翠釜鎵樼洏鏈嫞閫夌殑璐х墿
+ async handleBatchReturn() {
+ if (!this.scanData.orderNo || !this.scanData.palletCode) {
+ this.$message.warning('璇峰厛鎵弿鎵樼洏鐮�');
+ return;
+ }
+
+ if (this.unpickedList.length === 0) {
+ this.$message.warning('璇ユ墭鐩樻病鏈夊彲鍥炲簱鐨勮揣鐗�');
+ return;
+ }
+
+ this.$confirm(`纭畾瑕佸洖搴撴暣涓墭鐩樼殑鏈嫞閫夎揣鐗╁悧锛熷叡 ${this.unpickedList.length} 鏉¤褰昤, '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(async () => {
+ try {
+ const res = await this.http.post('/api/OutboundPicking/batch-return-to-stock', {
+ orderNo: this.scanData.orderNo,
+ palletCode: this.scanData.palletCode
+ });
+
+ if (res.success) {
+ this.$message.success('鎵归噺鍥炲簱鎴愬姛');
+ this.loadData();
+ } else {
+ this.$message.error(res.message || '鎵归噺鍥炲簱澶辫触');
+ }
+ } catch (error) {
+ this.$message.error('鎵归噺鍥炲簱澶辫触');
+ }
+ }).catch(() => {
+ this.$message.info('宸插彇娑堟壒閲忓洖搴�');
+ });
+ }, */
+
+ /* // 鐩存帴鍑哄簱鎿嶄綔
+ async handleDirectOutbound() {
+ if (!this.scanData.orderNo || !this.scanData.palletCode) {
+ this.$message.warning('璇峰厛鎵弿鎵樼洏鐮�');
+ return;
+ }
+
+ this.$confirm('纭畾瑕佺洿鎺ュ嚭搴撴暣涓墭鐩樺悧锛�', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(async () => {
+ try {
+ const res = await this.http.post('/api/OutboundPicking/direct-outbound', {
+ orderNo: this.scanData.orderNo,
+ palletCode: this.scanData.palletCode
+ });
+
+ if (res.success) {
+ this.$message.success('鐩存帴鍑哄簱鎴愬姛');
+ this.loadData();
+ } else {
+ this.$message.error(res.message || '鐩存帴鍑哄簱澶辫触');
+ }
+ } catch (error) {
+ this.$message.error('鐩存帴鍑哄簱澶辫触');
+ }
+ }).catch(() => {
+ this.$message.info('宸插彇娑堢洿鎺ュ嚭搴�');
+ });
+ }, */
+ // 纭鍥炲簱锛堥�氳繃寮圭獥锛�
+ async handleReturnConfirm() {
+ if (!this.returnForm.barcode) {
+ this.$message.warning('璇锋壂鎻忓洖搴撴潯鐮�');
+ return;
+ }
+
+ try {
+ const res = await this.http.post('/api/OutboundPicking/return-to-stock', {
+ orderNo: this.returnForm.orderNo,
+ palletCode: this.returnForm.palletCode,
+ barcode: this.returnForm.barcode
+ });
+
+ if (res.status) {
+ this.$message.success('鍥炲簱鎴愬姛');
+ this.showReturnDialog = false;
+ this.resetReturnForm();
+ this.loadData();
+ } else {
+ this.$message.error(res.message || '鍥炲簱澶辫触');
+ }
+ } catch (error) {
+ this.$message.error('鍥炲簱澶辫触');
+ }
+ },
+
+ // 鎷嗗寘鎵爜
+ async onSplitBarcodeScan() {
+ if (!this.splitForm.originalBarcode) return;
+
+ // 鍘婚櫎鍥炶溅绗﹀拰鍓嶅悗绌烘牸
+ this.splitForm.originalBarcode = this.splitForm.originalBarcode.replace(/\n/g, '').trim();
+
+ try {
+ const res = await this.http.post('/api/OutboundPicking/split-package-info', {
+
+ orderNo: this.splitForm.orderNo,
+ palletCode: this.splitForm.palletCode,
+ barcode: this.splitForm.originalBarcode
+
+ });
+
+ if (res.status) {
+ this.splitForm.materielCode = res.data.materielCode;
+ this.splitForm.maxQuantity = res.data.remainQuantity;
+ this.splitForm.splitQuantity = Math.min(1, this.splitForm.maxQuantity);
+ // 娓呴櫎楠岃瘉鐘舵��
+ if (this.$refs.splitFormRef) {
+ this.$refs.splitFormRef.clearValidate(['originalBarcode']);
+ }
+ } else {
+ this.$message.error(res.message || '鑾峰彇鎷嗗寘淇℃伅澶辫触');
+ // 楠岃瘉澶辫触锛岃缃敊璇姸鎬�
+ if (this.$refs.splitFormRef) {
+ this.$refs.splitFormRef.validateField('originalBarcode');
+ }
+ }
+ } catch (error) {
+ this.$message.error('鑾峰彇鎷嗗寘淇℃伅澶辫触');
+ // 楠岃瘉澶辫触锛岃缃敊璇姸鎬�
+ if (this.$refs.splitFormRef) {
+ this.$refs.splitFormRef.validateField('originalBarcode');
+ }
+ }
+ },
+
+ async handleSplitPackage() {
+ // 琛ㄥ崟楠岃瘉
+ if (this.$refs.splitFormRef) {
+ this.$refs.splitFormRef.validate((valid) => {
+ if (valid) {
+ this.submitSplitPackage();
+ } else {
+ this.$message.warning('璇峰~鍐欏畬鏁寸殑鎷嗗寘淇℃伅');
+ return false;
+ }
+ });
+ } else {
+ // 濡傛灉娌℃湁琛ㄥ崟寮曠敤锛屼娇鐢ㄥ師鏈夌殑楠岃瘉
+ if (!this.splitForm.originalBarcode || this.splitForm.splitQuantity <= 0) {
+ this.$message.warning('璇峰~鍐欏畬鏁寸殑鎷嗗寘淇℃伅');
+ return;
+ }
+
+ if (this.splitForm.splitQuantity > this.splitForm.maxQuantity) {
+ this.$message.warning('鎷嗗寘鏁伴噺涓嶈兘澶т簬鍓╀綑鏁伴噺');
+ return;
+ }
+
+ this.submitSplitPackage();
+ }
+
+
+ },
+ // 鎻愪氦鎷嗗寘璇锋眰
+ async submitSplitPackage() {
+ this.splitLoading = true;
+ try {
+ const res = await this.http.post('/api/OutboundPicking/split-package', this.splitForm);
+ if (res.status) {
+ this.$message.success('鎷嗗寘鎴愬姛');
+ this.showSplitDialog = false;
+ this.splitLoading = false;
+ this.resetSplitForm();
+ this.loadData();
+ } else {
+ this.splitLoading = false;
+ this.$message.error(res.message || '鎷嗗寘澶辫触');
+ }
+ } catch (error) {
+ this.splitLoading = false;
+ this.$message.error('鎷嗗寘澶辫触');
+ }
+ },
+ // 鎾ら攢鎷嗗寘鎵爜
+ onRevertSplitBarcodeScan() {
+ if (!this.revertSplitForm.originalBarcode) return;
+
+ this.revertSplitForm.originalBarcode = this.revertSplitForm.originalBarcode.replace(/\n/g, '').trim();
+
+ // 娓呴櫎楠岃瘉鐘舵��
+ if (this.$refs.revertSplitFormRef) {
+ this.$refs.revertSplitFormRef.clearValidate(['originalBarcode']);
+ }
+ },
+ async handleRevertSplit() {
+ // 琛ㄥ崟楠岃瘉
+ if (this.$refs.revertSplitFormRef) {
+ this.$refs.revertSplitFormRef.validate((valid) => {
+ if (valid) {
+ this.submitRevertSplit();
+ } else {
+ this.$message.warning('璇疯緭鍏ュ師鏉$爜');
+ return false;
+ }
+ });
+ } else {
+ // 濡傛灉娌℃湁琛ㄥ崟寮曠敤锛屼娇鐢ㄥ師鏈夌殑楠岃瘉
+ if (!this.revertSplitForm.originalBarcode) {
+ this.$message.warning('璇疯緭鍏ュ師鏉$爜');
+ return;
+ }
+
+ this.submitRevertSplit();
+ }
+ },
+ // 鎻愪氦鎾ら攢鎷嗗寘璇锋眰
+ async submitRevertSplit() {
+ this.revertSplitLoading = true;
+
+ try {
+ const res = await this.http.post('/api/OutboundPicking/revert-split-package', {
+ originalBarcode: this.revertSplitForm.originalBarcode
+ });
+
+ if (res.status) {
+ this.$message.success('鎾ら攢鎷嗗寘鎴愬姛');
+ this.showRevertSplitDialog = false;
+ this.revertSplitLoading = false;
+ this.revertSplitForm.originalBarcode = '';
+ this.loadData();
+ } else {
+ this.revertSplitLoading = false;
+ this.$message.error(res.message || '鎾ら攢鎷嗗寘澶辫触');
+ }
+ } catch (error) {
+ this.revertSplitLoading = false;
+ this.$message.error('鎾ら攢鎷嗗寘澶辫触');
+ }
+ },
+ resetSplitForm() {
+ this.splitForm.originalBarcode = '';
+ this.splitForm.materielCode = '';
+ this.splitForm.splitQuantity = 0;
+ this.splitForm.maxQuantity = 0;
+ },
+ // 閲嶇疆鎵归噺鍥炲簱琛ㄥ崟
+ resetBatchReturnForm() {
+ this.batchReturnForm.palletCode = '';
+ this.batchReturnForm.unpickedCount = 0;
+ this.batchReturnForm.unpickedQuantity = 0;
+ },
+ resetReturnForm() {
+ this.returnForm.barcode = '';
+ this.returnForm.materielCode = '';
+ this.returnForm.returnQuantity = 0;
+ }
+ }
+})
+</script>
+
+<style scoped>
+.picking-container {
+ padding: 20px;
+ position: relative; /* 涓哄脊绐楀畾浣嶆彁渚涗笂涓嬫枃 */
+}
+.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;
+}
+
+/* 琛ㄦ牸鏍峰紡璋冩暣 */
+.content-area .el-table {
+ margin-top: 0;
+}
+
+/* 纭繚琛ㄦ牸楂樺害閫傚簲 */
+.content-area .el-card__body {
+ padding: 15px;
+}
+
+
+/* 鑷畾涔夊脊绐楁牱寮� */
+.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: 9999;
+}
+
+.custom-dialog-wrapper {
+ position: relative;
+ z-index: 10000;
+}
+
+.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;
+}
+
+/* 纭繚寮圭獥鍦ㄧЩ鍔ㄨ澶囦笂涔熻兘姝e父鏄剧ず */
+@media (max-width: 768px) {
+ .custom-dialog {
+ width: 95vw;
+ margin: 10px;
}
}
-</script>
\ No newline at end of file
+</style>
\ No newline at end of file
--
Gitblit v1.9.3