From 03d2286afe8347ec7649250f5ba1d18387b6a5b9 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期一, 24 十一月 2025 20:43:36 +0800
Subject: [PATCH] 提交
---
项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue | 204 +++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 172 insertions(+), 32 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
index bad04be..b976153 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
@@ -12,13 +12,38 @@
>
<div class="barcode-scanner-container">
+ <!-- 浠撳簱閫夋嫨 - 绱у噾甯冨眬 -->
+ <div class="location-section compact">
+ <el-form :model="form" :rules="rules" ref="locationForm" class="compact-form">
+ <el-form-item label="浠撳簱" prop="warehouseType" class="location-select compact-item">
+ <el-select
+ v-model="form.warehouseType"
+ placeholder="璇烽�夋嫨浠撳簱"
+ clearable
+ filterable
+ @change="handleWarehouseChange"
+ style="width: 100%"
+ :loading="warehouseLoading"
+ size="medium"
+ >
+ <el-option
+ v-for="item in warehouseTypes"
+ :key="item.warehouseType"
+ :label="item.warehouseTypeDesc"
+ :value="item.warehouseType"
+ />
+ </el-select>
+ </el-form-item>
+ </el-form>
+ </div>
+
<!-- 浠撳簱鍖哄煙閫夋嫨 - 绱у噾甯冨眬 -->
<div class="location-section compact">
<el-form :model="form" :rules="rules" ref="locationForm" class="compact-form">
<el-form-item label="浠撳簱鍖哄煙" prop="locationType" class="location-select compact-item">
<el-select
v-model="form.locationType"
- placeholder="璇烽�夋嫨浠撳簱鍖哄煙"
+ placeholder="璇峰厛閫夋嫨浠撳簱"
clearable
filterable
@change="handleLocationChange"
@@ -40,6 +65,9 @@
<!-- 鎵樼洏淇℃伅鏄剧ず - 绱у噾甯冨眬 -->
<div class="tray-info compact" v-if="trayBarcode">
<i class="el-icon-s-management"></i> 褰撳墠鏂欑: {{ trayBarcode }}
+ <span class="location-info" v-if="form.warehouseType">
+ | 浠撳簱: {{ currentWarehouseName }}
+ </span>
<span class="location-info" v-if="form.locationType">
| 浠撳簱鍖哄煙: {{ currentLocationDesc }}
</span>
@@ -52,7 +80,7 @@
<span><i class="el-icon-scanner"></i> 鎵爜鍖哄煙</span>
<span class="scan-status">
<span class="scan-indicator"></span>
- {{ form.locationType ? '鎵爜灏辩华' : '璇峰厛閫夋嫨浠撳簱鍖哄煙' }}
+ {{ form.locationType && form.warehouseType ? '鎵爜灏辩华' : '璇峰厛閫夋嫨浠撳簱鍜屼粨搴撳尯鍩�' }}
</span>
</div>
@@ -64,7 +92,7 @@
v-model="trayBarcode"
placeholder="璇锋壂鎻忔垨杈撳叆鏂欑鐮佸悗鎸夊洖杞﹂敭"
clearable
- :disabled="!form.locationType"
+ :disabled="!form.locationType || !form.warehouseType"
@keyup.enter.native="handleTraySubmit"
@clear="handleTrayClear"
@input="handleTrayInput"
@@ -76,7 +104,7 @@
@click="handleTraySubmit"
type="primary"
icon="el-icon-position"
- :disabled="!form.locationType || !trayBarcode"
+ :disabled="!form.locationType || !trayBarcode || !form.warehouseType"
size="medium"
>
纭
@@ -93,7 +121,7 @@
v-model="barcode"
placeholder="璇锋壂鎻忔垨杈撳叆鐗╂枡鏉$爜鍚庢寜鍥炶溅閿�"
clearable
- :disabled="!form.locationType || !trayBarcode"
+ :disabled="!form.locationType || !trayBarcode || !form.warehouseType"
@keyup.enter.native="handleBarcodeSubmit"
@clear="handleClear"
@input="handleBarcodeInput"
@@ -106,7 +134,7 @@
@click="handleBarcodeSubmit"
type="primary"
icon="el-icon-search"
- :disabled="!form.locationType || !trayBarcode || !barcode"
+ :disabled="!form.locationType || !trayBarcode || !barcode || !from.warehouseType"
size="medium"
>
{{ loading ? '鏌ヨ涓�...' : '鏌ヨ' }}
@@ -116,9 +144,10 @@
</div>
<div class="input-tips compact-tips">
- <p>鎻愮ず锛氳鍏堥�夋嫨浠撳簱鍖哄煙锛岀劧鍚庤緭鍏ユ枡绠辩爜锛屾渶鍚庤緭鍏ョ墿鏂欐潯鐮�</p>
- <p v-if="!form.locationType" class="warning-text">鈿狅笍 璇峰厛閫夋嫨浠撳簱鍖哄煙</p>
- <p v-if="form.locationType && !trayBarcode" class="warning-text">鈿狅笍 璇峰厛杈撳叆鏂欑鐮�</p>
+ <p>鎻愮ず锛氳鍏堥�夋嫨浠撳簱 鈫� 閫夋嫨浠撳簱鍖哄煙 鈫� 杈撳叆鏂欑鐮� 鈫� 杈撳叆鐗╂枡鏉$爜</p>
+ <p v-if="!form.warehouseType" class="warning-text">鈿狅笍 璇峰厛閫夋嫨浠撳簱</p>
+ <p v-if="!form.locationType && !form.warehouseType" class="warning-text">鈿狅笍 璇峰厛閫夋嫨浠撳簱鍖哄煙</p>
+ <p v-if="form.warehouseType && form.locationType && !trayBarcode" class="warning-text">鈿狅笍 璇峰厛杈撳叆鏂欑鐮�</p>
</div>
</el-card>
@@ -148,15 +177,17 @@
<span><i class="el-icon-tickets"></i> 缁勭洏鏁版嵁</span>
<span class="list-actions">
<el-tag type="primary" size="small">鍏� {{ materials.length }} 鏉�</el-tag>
- <el-tag type="primary" size="small">宸茬粍鐩� {{ totalStockCount }}</el-tag>
- <el-tag type="primary" size="small">搴撳瓨 {{ totalStockSum }}{{ uniqueUnit }}</el-tag>
+ <el-tag type="primary" size="small">鏈粍鐩� {{ totalStockCount }}</el-tag>
+ <el-tag type="primary" size="small">鏈叆搴撴暟閲� {{ totalStockSum }}{{ uniqueUnit }}</el-tag>
<el-tag v-if="trayBarcode" type="success" size="small">鎵樼洏: {{ trayBarcode }}</el-tag>
+ <el-tag v-if="form.warehouseType" type="info" size="small">浠撳簱: {{ currentWarehouseName }}</el-tag>
<el-tag v-if="form.locationType" type="info" size="small">鍖哄煙: {{ currentLocationDesc }}</el-tag>
</span>
</div>
<div v-if="materials.length === 0" class="empty-state compact">
<i class="el-icon-document"></i>
+ <p v-if="!form.warehouseType">璇峰厛閫夋嫨浠撳簱</p>
<p v-if="!form.locationType">璇峰厛閫夋嫨浠撳簱鍖哄煙</p>
<p v-else-if="!trayBarcode">璇峰厛杈撳叆鏂欑鏉$爜</p>
<p v-else>鏆傛棤鐗╂枡鏁版嵁锛岃鎵弿鎴栬緭鍏ョ墿鏂欐潯鐮�</p>
@@ -177,7 +208,7 @@
<el-table-column prop="stockQuantity" label="鏁伴噺" min-width="130" align="right"></el-table-column>
<el-table-column prop="unit" label="鍗曚綅" width="80" align="center"></el-table-column>
<el-table-column prop="supplyCode" label="渚涘簲鍟�" min-width="130" show-overflow-tooltip></el-table-column>
- <el-table-column prop="warehouseCode" label="浠撳簱" min-width="120" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="warehouseType" label="浠撳簱" min-width="120" show-overflow-tooltip></el-table-column>
</el-table>
</div>
</el-card>
@@ -198,6 +229,7 @@
import { ElLoading, ElMessage,ElMessageBox } from 'element-plus';
import { ref, onMounted, onUnmounted } from 'vue'
import InboundOrder from '../../../views/inbound/inboundOrder.vue';
+import { th } from 'element-plus/es/locales.mjs';
export default {
name: 'BarcodeScanner',
@@ -216,7 +248,7 @@
loading: false,
error: '',
debugMode: false,
- currentFocus: 'tray',
+ currentFocus: 'warehouse',
// 鎵爜鏋浉鍏冲彉閲�
scanCode: '',
@@ -233,11 +265,14 @@
uniqueUnit: '',
sumLoading: false,
sumError: '',
-
+ // 浠撳簱鐩稿叧鍙橀噺
+ warehouseTypes: [],
+ warehouseLoading: false,
// 浠撳簱鍖哄煙鐩稿叧鍙橀噺
locationTypes: [],
locationLoading: false,
form: {
+ warehouseType: null,
locationType: null
},
rules: {
@@ -246,8 +281,14 @@
validator: this.validateLocationType,
trigger: 'change'
}
- ]
- }
+ ],
+ warehouseType: [
+ {
+ massage:'璇烽�夋嫨浠撳簱',
+ trigger: 'change'
+ }
+ ]
+ }
}
},
computed: {
@@ -256,6 +297,11 @@
set(newVal) { this.$emit('update:visible', newVal); }
},
currentDocNo() { return this.docNo; },
+ // 褰撳墠閫夋嫨鐨勪粨搴撳悕绉�
+ currentWarehouseName() {
+ const warehouse = this.warehouseTypes.find(item => item.warehouseType === this.form.warehouseType);
+ return warehouse ? warehouse.warehouseTypeDesc : '';
+ },
// 褰撳墠閫夋嫨鐨勪粨搴撳尯鍩熸弿杩�
currentLocationDesc() {
const location = this.locationTypes.find(item => item.locationType === this.form.locationType)
@@ -273,7 +319,8 @@
this.$nextTick(() => {
setTimeout(() => {
// this.focusTrayInput();
- this.initLocationTypes(); // 鍒濆鍖栦粨搴撳尯鍩�
+ this.initwarehouseTypes(); // 鍒濆鍖栦粨搴�
+ this.initLocationTypes(); // 鍒濆鍖栦粨搴撳尯鍩�
this.fetchStockStatistics(); // 鍔犺浇缁熻鏁版嵁
}, 300);
});
@@ -297,6 +344,13 @@
}
}
},
+ 'form.warehouseType'(newVal) {
+ if (newVal) {
+ this.form.locationType = null;
+ } else {
+ this.locationTypes = [];
+ }
+ },
mounted() {
@@ -321,10 +375,11 @@
*/
validateLocationType(rule, value, callback) {
// 妫�鏌ュ�兼槸鍚︿负null銆乽ndefined鎴栫┖瀛楃涓诧紝浣嗗厑璁告暟瀛�0
- if (value === null || value === undefined || value === '') {
+ if (!this.form.warehouseType) {
+ callback(new Error('璇峰厛閫夋嫨浠撳簱'));
+ } else if (value === null || value === undefined || value === '') {
callback(new Error('璇烽�夋嫨浠撳簱鍖哄煙'));
} else {
- // 鍊间负0鎴栧叾浠栨湁鏁堝�奸兘閫氳繃楠岃瘉
callback();
}
},
@@ -357,6 +412,36 @@
}
},
+ /**
+ * 鍒濆鍖栦粨搴撴暟鎹�
+ */
+ async initwarehouseTypes() {
+ this.warehouseLoading = true;
+ this.error = '';
+
+ try {
+ const response = await http.post('/api/Warehouse/GetwarehouseTypes');
+
+ if (response.status && Array.isArray(response.data)) {
+ this.warehouseTypes = response.data;
+ if (this.warehouseTypes.length === 0) {
+ this.error = '鏈幏鍙栧埌浠撳簱鏁版嵁';
+ } else {
+ // 濡傛灉鏈夐粯璁ゅ尯鍩燂紝鍙互鍦ㄨ繖閲岃缃�
+ // this.form.locationType = this.locationTypes[0].locationType;
+ }
+ } else {
+ this.error = '鑾峰彇浠撳簱鏁版嵁澶辫触';
+ }
+ } catch (error) {
+ console.error('鑾峰彇浠撳簱澶辫触:', error);
+ this.error = `鑾峰彇浠撳簱澶辫触: ${error.message || '缃戠粶閿欒'}`;
+ } finally {
+ this.warehouseLoading = false;
+ }
+ },
+
+
/**
* 浠撳簱鍖哄煙鍙樻洿澶勭悊
*/
@@ -378,14 +463,42 @@
if (!errorMsg && (value === 0 || value)) {
console.log('浠撳簱鍖哄煙楠岃瘉閫氳繃:', value);
// 鍖哄煙閫夋嫨鍚庯紝鑷姩鑱氱劍鍒版墭鐩樿緭鍏ユ
- this.focusTrayInput();
+ this.focusLocationSelect();
}
});
}, 100);
}
});
},
- // 鏂板锛氭煡璇㈠悗绔簱瀛樼粺璁℃暟鎹紙璋冪敤涔嬪墠鐨� SumQuantity 鎺ュ彛锛�
+
+/**
+ * 浠撳簱鍙樻洿澶勭悊
+ */
+handleWarehouseChange(value) {
+ console.log('閫夋嫨浠撳簱:', value, '绫诲瀷:', typeof value, this.currentWarehouseName);
+
+ // 绔嬪嵆娓呴櫎閿欒淇℃伅
+ this.error = '';
+
+ // 鎵嬪姩瑙﹀彂琛ㄥ崟楠岃瘉鏇存柊
+ this.$nextTick(() => {
+ if (this.$refs.locationForm) {
+ // 娓呴櫎璇ュ瓧娈电殑楠岃瘉鐘舵�侊紝鐒跺悗閲嶆柊楠岃瘉
+ this.$refs.locationForm.clearValidate('warehouseType');
+
+ // 鐭殏寤惰繜鍚庨噸鏂伴獙璇侊紝纭繚DOM宸叉洿鏂�
+ setTimeout(() => {
+ this.$refs.locationForm.validateField('warehouseType', (errorMsg) => {
+ if (!errorMsg && (value === 0 || value)) {
+ console.log('浠撳簱楠岃瘉閫氳繃:', value);
+ this.focusLocationSelect();
+ }
+ });
+ }, 100);
+ }
+ });
+},
+
async fetchStockStatistics() {
// 鍗曟嵁鍙蜂负绌烘椂涓嶆煡璇�
if (!this.docNo) {
@@ -434,9 +547,12 @@
resolve(true);
} else {
// 鎵嬪姩妫�鏌ocationType锛屾纭鐞嗗�间负0鐨勬儏鍐�
- if (this.form.locationType === null || this.form.locationType === undefined || this.form.locationType === '') {
+ if(!this.from.warehouseType){
+ this.error='璇峰厛閫夋嫨浠撳簱';
+ }
+ else if(this.form.locationType === null || this.form.locationType === undefined || this.form.locationType === '') {
this.error = '璇峰厛閫夋嫨浠撳簱鍖哄煙';
- this.$message.warning('璇峰厛閫夋嫨浠撳簱鍖哄煙');
+ //this.$message.warning('璇峰厛閫夋嫨浠撳簱鍖哄煙');
} else {
// 濡傛灉鍊煎瓨鍦紙鍖呮嫭0锛夛紝浣嗛獙璇佷笉閫氳繃锛屽彲鑳芥槸鍏朵粬楠岃瘉閿欒
this.error = '璇锋鏌ヨ〃鍗曞~鍐欐槸鍚︽纭�';
@@ -446,10 +562,19 @@
});
});
},
+ focusWarehouseSelect() {
+ if (this.$refs.locationForm) {
+ const selectEl = this.$el.querySelector('.location-select:first-child .el-input__inner');
+ if (selectEl) {
+ selectEl.focus();
+ this.currentFocus = 'warehouse';
+ }
+ }
+ },
// 鑱氱劍鍒颁粨搴撳尯鍩熼�夋嫨
focusLocationSelect() {
if (this.$refs.locationForm) {
- const selectEl = this.$el.querySelector('.el-select .el-input__inner');
+ const selectEl = this.$el.querySelector('.location-select:nth-child(2) .el-input__inner');
if (selectEl) {
selectEl.focus();
this.currentFocus = 'location';
@@ -491,14 +616,19 @@
this.lastKeyTime = null;
this.isManualInput = false;
this.isScanning = false;
- this.currentFocus = 'location';
+ this.currentFocus = 'warehouse';
this.scanTarget = 'tray';
this.clearAllTimers();
this.totalStockSum = 0;
this.totalStockCount = 0;
this.sumLoading = false;
this.sumError = '';
- this.form.locationType = null;
+ this.form={
+ warehouseType:null,
+ locationType:null
+ }
+ this.warehouseTypes=[];
+ this.locationTypes=[];
// 娓呴櫎琛ㄥ崟楠岃瘉鐘舵��
this.$nextTick(() => {
if (this.$refs.locationForm) {
@@ -526,14 +656,15 @@
// 浣跨敤setTimeout纭繚DOM瀹屽叏娓叉煋鍚庡啀鑱氱劍
this.$nextTick(() => {
setTimeout(() => {
+ this.initwarehouseTypes();
this.initLocationTypes(); // 鍒濆鍖栦粨搴撳尯鍩�
// 纭繚琛ㄥ崟寮曠敤瀛樺湪鍚庡啀鑱氱劍
if (this.$refs.locationForm) {
- this.focusLocationSelect();
+ this.focusWarehouseSelect();
} else {
// 濡傛灉琛ㄥ崟寮曠敤杩樹笉瀛樺湪锛岀◢鍚庨噸璇�
setTimeout(() => {
- this.focusLocationSelect();
+ this.focusWarehouseSelect();
}, 500);
}
}, 300);
@@ -566,6 +697,8 @@
}
const result = {
+ warehouseType:this.form.warehouseType,
+ warehouseName:this.currentWarehouseName,
locationType: this.form.locationType,
locationDesc: this.currentLocationDesc,
trayBarcode: this.trayBarcode,
@@ -614,9 +747,13 @@
// 澶勭悊鎵樼洏鏉$爜鎻愪氦
async handleTraySubmit() {
// 鍏堢洿鎺ユ鏌ocationType锛岄伩鍏嶈〃鍗曢獙璇佺殑寮傛闂
+ if (!this.form.warehouseType) {
+ this.error = '璇峰厛閫夋嫨浠撳簱';
+ return;
+ }
if (!this.form.locationType) {
this.error = '璇峰厛閫夋嫨浠撳簱鍖哄煙';
- this.$message.warning('璇峰厛閫夋嫨浠撳簱鍖哄煙');
+ //this.$message.warning('璇峰厛閫夋嫨浠撳簱鍖哄煙');
return;
}
@@ -728,7 +865,7 @@
duration: 2000
});
-
+ this.fetchStockStatistics();
// 娓呯┖鐗╂枡杈撳叆妗嗗苟淇濇寔鑱氱劍
this.barcode = '';
this.scanCode = ''; // 娓呯┖鎵爜缂撳瓨
@@ -754,7 +891,8 @@
orderNo: this.docNo,
barcodes: barcode,
locationTypeDesc: this.currentLocationDesc,
- locationType: this.form.locationType // 娣诲姞浠撳簱鍖哄煙淇℃伅
+ locationType: this.form.locationType, // 娣诲姞浠撳簱鍖哄煙淇℃伅
+ warehouseType:this.form.warehouseType
}
);
@@ -775,7 +913,7 @@
if(!response.status){
this.error = response.message || '鏌ヨ鏉$爜淇℃伅澶辫触锛岃閲嶈瘯';
}
- // 纭繚杩斿洖鐨勬暟鎹寘鍚墍鏈夊繀闇�鐨勫瓧娈�
+
return materialData;
} catch (error) {
@@ -850,6 +988,8 @@
type: 'success',
message: '鍒犻櫎鎴愬姛!'
});
+ this.fetchStockStatistics();
+
}).catch(() => {
// 鍙栨秷鍒犻櫎
});
--
Gitblit v1.9.3