From d88884b7072dff4269626c600ef11f9bb42dd9e3 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期六, 15 十一月 2025 17:04:28 +0800
Subject: [PATCH] 1
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/Basic/WarehouseDTO.cs | 14 ++
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs | 29 +++
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/WarehouseController.cs | 7
项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue | 189 +++++++++++++++++++++++---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/MaterielGroupDTO.cs | 4
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IBasicService/IWarehouseService.cs | 2
项目代码/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js | 153 ++++++++++++++++-----
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/WarehouseService.cs | 9 +
8 files changed, 338 insertions(+), 69 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 2fbaa74..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>
@@ -151,12 +180,14 @@
<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>
@@ -217,7 +248,7 @@
loading: false,
error: '',
debugMode: false,
- currentFocus: 'tray',
+ currentFocus: 'warehouse',
// 鎵爜鏋浉鍏冲彉閲�
scanCode: '',
@@ -234,11 +265,14 @@
uniqueUnit: '',
sumLoading: false,
sumError: '',
-
+ // 浠撳簱鐩稿叧鍙橀噺
+ warehouseTypes: [],
+ warehouseLoading: false,
// 浠撳簱鍖哄煙鐩稿叧鍙橀噺
locationTypes: [],
locationLoading: false,
form: {
+ warehouseType: null,
locationType: null
},
rules: {
@@ -247,8 +281,14 @@
validator: this.validateLocationType,
trigger: 'change'
}
- ]
- }
+ ],
+ warehouseType: [
+ {
+ massage:'璇烽�夋嫨浠撳簱',
+ trigger: 'change'
+ }
+ ]
+ }
}
},
computed: {
@@ -257,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)
@@ -274,7 +319,8 @@
this.$nextTick(() => {
setTimeout(() => {
// this.focusTrayInput();
- this.initLocationTypes(); // 鍒濆鍖栦粨搴撳尯鍩�
+ this.initwarehouseTypes(); // 鍒濆鍖栦粨搴�
+ this.initLocationTypes(); // 鍒濆鍖栦粨搴撳尯鍩�
this.fetchStockStatistics(); // 鍔犺浇缁熻鏁版嵁
}, 300);
});
@@ -298,6 +344,13 @@
}
}
},
+ 'form.warehouseType'(newVal) {
+ if (newVal) {
+ this.form.locationType = null;
+ } else {
+ this.locationTypes = [];
+ }
+ },
mounted() {
@@ -322,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();
}
},
@@ -358,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;
+ }
+ },
+
+
/**
* 浠撳簱鍖哄煙鍙樻洿澶勭悊
*/
@@ -379,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) {
@@ -435,7 +547,10 @@
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('璇峰厛閫夋嫨浠撳簱鍖哄煙');
} else {
@@ -447,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';
@@ -492,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) {
@@ -527,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);
@@ -567,6 +697,8 @@
}
const result = {
+ warehouseType:this.form.warehouseType,
+ warehouseName:this.currentWarehouseName,
locationType: this.form.locationType,
locationDesc: this.currentLocationDesc,
trayBarcode: this.trayBarcode,
@@ -615,6 +747,10 @@
// 澶勭悊鎵樼洏鏉$爜鎻愪氦
async handleTraySubmit() {
// 鍏堢洿鎺ユ鏌ocationType锛岄伩鍏嶈〃鍗曢獙璇佺殑寮傛闂
+ if (!this.form.warehouseType) {
+ this.error = '璇峰厛閫夋嫨浠撳簱';
+ return;
+ }
if (!this.form.locationType) {
this.error = '璇峰厛閫夋嫨浠撳簱鍖哄煙';
//this.$message.warning('璇峰厛閫夋嫨浠撳簱鍖哄煙');
@@ -755,7 +891,8 @@
orderNo: this.docNo,
barcodes: barcode,
locationTypeDesc: this.currentLocationDesc,
- locationType: this.form.locationType // 娣诲姞浠撳簱鍖哄煙淇℃伅
+ locationType: this.form.locationType, // 娣诲姞浠撳簱鍖哄煙淇℃伅
+ warehouseType:this.form.warehouseType
}
);
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js"
index e6758f8..51aa666 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js"
@@ -1,8 +1,8 @@
//姝s鏂囦欢鏄敤鏉ヨ嚜瀹氫箟鎵╁睍涓氬姟浠g爜锛屽彲浠ユ墿灞曚竴浜涜嚜瀹氫箟椤甸潰鎴栬�呴噸鏂伴厤缃敓鎴愮殑浠g爜
import http from '@/api/http.js'
-import { h,createVNode, render,reactive } from 'vue';
-import { ElDialog , ElForm, ElFormItem, ElInput, ElButton, ElMessage } from 'element-plus'; // 寮曞叆ElMessage锛岃В鍐虫彁绀烘棤鍙嶅簲
+import { h,createVNode, render,reactive,ref } from 'vue';
+import { ElDialog , ElForm, ElFormItem, ElInput, ElButton, ElMessage ,ElSelect ,ElOption } from 'element-plus'; // 寮曞叆ElMessage锛岃В鍐虫彁绀烘棤鍙嶅簲
let extension = {
components: {
@@ -101,16 +101,93 @@
const mountNode = document.createElement('div');
document.body.appendChild(mountNode);
- // 鍝嶅簲寮忚〃鍗曟暟鎹細鏂欑鐮佹敼涓哄彲閫夊~锛堝垵濮嬬┖瀛楃涓诧級
+ // 鍝嶅簲寮忚〃鍗曟暟鎹細鏂欑鐮侊紙蹇呭~锛屾壂鐮佹灙/鎵嬪姩杈撳叆锛�
const formData = reactive({
- boxCode: '' // 鏂欑鐮侊紙string绫诲瀷锛屽彲绌猴級
+ boxCode: '',
+ warehouseCode:''
});
+ const warehouses = ref([]);
+ const isLoadingWarehouses = ref(false);
+
+ const getWarehouseList = async () => {
+ isLoadingWarehouses.value = true;
+ try {
+ const { data, status } = await http.post('/api/Warehouse/GetWarehouseTypes');
+ if (status && Array.isArray(data)) {
+ // 鏍煎紡鍖栦粨搴撻�夐」锛氶�傞厤ElSelect鐨刲abel-value鏍煎紡
+ warehouses.value = data.map(item => ({
+ label: item.warehouseTypeDesc,
+ value: item.warehouseType
+ }));
+ } else {
+ ElMessage.error('鑾峰彇浠撳簱鍒楄〃澶辫触');
+ warehouses.value = [];
+ }
+ } catch (err) {
+ ElMessage.error('浠撳簱鏁版嵁璇锋眰寮傚父锛岃绋嶅悗閲嶈瘯');
+ warehouses.value = [];
+ } finally {
+ isLoadingWarehouses.value = false;
+ }
+ };
+
+ // 鎻愪氦琛ㄥ崟鐨勭粺涓�閫昏緫锛堜緵鍥炶溅瑙﹀彂鍜屾寜閽偣鍑诲叡鐢級
+ const submitForm = async () => {
+ const formRef = vnode.component.refs.batchInForm;
+ try {
+ // 鎵ц琛ㄥ崟鏍¢獙锛堟枡绠辩爜蹇呭~锛�
+ await formRef.validate();
+ } catch (err) {
+ ElMessage.warning('璇疯緭鍏ユ湁鏁堢殑鏂欑鐮�');
+ return;
+ }
+
+
+ http.post('/api/InboundOrder/EmptyMaterielGroup', {
+ palletCode: formData.boxCode.trim(),
+ warehouseCode:formData.warehouseCode
+ }).then(({ data, status, message }) => {
+ if (status) {
+ ElMessage.success(`鍏ュ簱鎴愬姛锛屾枡绠辩爜锛�${formData.boxCode.trim()}`);
+ this.refresh();
+ formData.boxCode = '';
+
+ setTimeout(() => {
+ const inputRef = vnode.component.refs.boxCodeInput;
+ inputRef?.focus();
+ }, 100);
+ } else {
+ ElMessage.error(message || data?.message || '鍏ュ簱澶辫触');
+ selectBoxCodeInput();
+ }
+ }).catch(() => {
+ ElMessage.error('璇锋眰澶辫触锛岃绋嶅悗閲嶈瘯');
+ selectBoxCodeInput();
+ });
+ };
+
+ const selectBoxCodeInput = () => {
+ setTimeout(() => {
+ const inputRef = vnode.component.refs.boxCodeInput;
+ if (inputRef) {
+ const targetInput = inputRef.$el?.querySelector('input') || inputRef;
+ targetInput?.focus();
+ targetInput?.select();
+ }
+ }, 100);
+}
const vnode = createVNode(ElDialog, {
title: '绌烘墭鐩樺叆搴�',
width: '400px',
modelValue: true,
appendToBody: true,
+
+ onOpened: async () => {
+ await getWarehouseList();
+ const inputRef = vnode.component.refs.boxCodeInput;
+ inputRef?.focus();
+ },
'onUpdate:modelValue': (isVisible) => {
if (!isVisible) {
render(null, mountNode);
@@ -121,25 +198,54 @@
default: () => h(ElForm, {
model: formData,
rules: {
- // 鏂欑鐮佹牎楠岋細浠呬繚鐣欏瓧绗︿覆绫诲瀷锛岀Щ闄ゅ繀濉姹傦紙绌哄�煎彲閫氳繃锛�
boxCode: [
- { required: true, message: '璇疯緭鍏ユ枡绠辩爜', trigger: 'blur' },
- { type: 'string', message: '鏂欑鐮佸繀椤讳负瀛楃涓�', trigger: 'blur' }
+ { required: true, message: '璇疯緭鍏ユ枡绠辩爜', trigger: ['blur', 'enter'] }
+ ],
+ warehouseCode:[
+ { required: true, message: '璇烽�夋嫨浠撳簱', trigger: ['change', 'blur'] }
]
},
ref: 'batchInForm'
}, [
- // 鏂欑鐮佽緭鍏ラ」锛堝彲閫夊~锛�
- h(ElFormItem, { label: '鏂欑鐮�', prop: 'boxCode',required:true }, [
+ //浠撳簱鏁版嵁
+ h(ElFormItem, { label: '浠撳簱', prop: 'warehouseCode', required: true }, [
+ h(ElSelect, {
+ modelValue: formData.warehouseCode,
+ 'onUpdate:modelValue': (val) => {
+ formData.warehouseCode = val;
+ },
+ placeholder: '璇烽�夋嫨鍏ュ簱浠撳簱',
+ filterable: true, // 鏀寔鎼滅储浠撳簱
+ loading: isLoadingWarehouses.value, // 鍔犺浇鐘舵��
+ style: { width: '100%' }
+ }, [
+ // 娓叉煋浠撳簱涓嬫媺閫夐」
+ warehouses.value.map(item => h(ElOption, {
+ label: item.label,
+ value: item.value
+ }))
+ ])
+ ]),
+ // 鏂欑鐮佽緭鍏ラ」锛堟敮鎸佽仛鐒︺�佸洖杞︽彁浜わ級
+ h(ElFormItem, { label: '鏂欑鐮�', prop: 'boxCode', required: true }, [
h(ElInput, {
type: 'text',
modelValue: formData.boxCode,
'onUpdate:modelValue': (val) => {
formData.boxCode = val;
+ },
+ ref: 'boxCodeInput',
+ placeholder: '鎵爜杈撳叆鎴栨墜鍔ㄨ緭鍏ユ枡绠辩爜',
+ // 鐩戝惉鍥炶溅浜嬩欢锛堟壂鐮佹灙榛樿浼氬彂閫佸洖杞︼級
+ onKeydown: (e) => {
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ submitForm();
+ }
}
})
]),
- // 搴曢儴鎸夐挳鍖猴紙淇濇寔涓嶅彉锛�
+ // 搴曢儴鎸夐挳鍖�
h('div', { style: { textAlign: 'right', marginTop: '16px' } }, [
h(ElButton, {
type: 'text',
@@ -151,30 +257,7 @@
}, '鍙栨秷'),
h(ElButton, {
type: 'primary',
- onClick: async () => {
- const formRef = vnode.component.refs.batchInForm;
- try {
- await formRef.validate(); // 绌哄�煎彲閫氳繃鏍¢獙
- } catch (err) {
- return;
- }
-
- // 鍏ュ簱鎺ュ彛鎻愪氦锛氭枡绠辩爜涓虹┖鏃朵紶閫掔┖瀛楃涓诧紝鍚庣闇�鏀寔璇ュ瓧娈靛彲閫�
- http.post('/api/InboundOrder/EmptyMaterielGroup', {
- palletCode: formData.boxCode // 鍙┖锛氱敤鎴疯緭鍏ユ垨绌哄瓧绗︿覆
- }).then(({ data, status, message }) => {
- if (status) {
- ElMessage.success(`鍏ュ簱鎴愬姛${formData.boxCode ? '锛屾枡绠辩爜锛�' + formData.boxCode : ''}`);
- this.refresh();
- render(null, mountNode);
- document.body.removeChild(mountNode);
- } else {
- ElMessage.error(message || data?.message || '鍏ュ簱澶辫触');
- }
- }).catch(() => {
- ElMessage.error('璇锋眰澶辫触锛岃绋嶅悗閲嶈瘯');
- });
- }
+ onClick: submitForm
}, '纭畾')
])
])
@@ -184,7 +267,7 @@
render(vnode, mountNode);
}
}
- ], box: [], detail: [] }, //鎵╁睍鐨勬寜閽�
+ ], box: [], detail: [] },
methods: {
//涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄�
onInit() {
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/WarehouseService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/WarehouseService.cs"
index 82c58f0..1fd25c4 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/WarehouseService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/WarehouseService.cs"
@@ -116,6 +116,15 @@
return WebResponseContent.Instance.OK();
}
+
+ public List<WarehouseDTO> GetWarehouseTypes()
+ {
+ return _warehouseArearepository.Db.Queryable<Dt_WarehouseArea>().Select(x => new WarehouseDTO
+ {
+ WarehouseType = x.Code,
+ WarehouseTypeDesc = $"{x.Code}-{x.Name}"
+ }).ToList();
+ }
}
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_DTO/Basic/WarehouseDTO.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_DTO/Basic/WarehouseDTO.cs"
new file mode 100644
index 0000000..a312386
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_DTO/Basic/WarehouseDTO.cs"
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_DTO.Basic
+{
+ public class WarehouseDTO
+ {
+ public string WarehouseType { get; set; }
+ public string WarehouseTypeDesc { get; set; }
+ }
+}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/MaterielGroupDTO.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/MaterielGroupDTO.cs"
index 721535d..a00add4 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/MaterielGroupDTO.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/MaterielGroupDTO.cs"
@@ -35,6 +35,8 @@
public string locationType { get; set; }
+ public string WarehouseType { get; set; }
+
public string locationTypeDesc { get; set; }
}
@@ -44,6 +46,6 @@
[PropertyValidate("鎵樼洏缂栧彿", NotNullAndEmpty = true)]
public string PalletCode { get; set; }
-
+ public string WarehouseCode { get; set; }
}
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IBasicService/IWarehouseService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IBasicService/IWarehouseService.cs"
index 35695e4..f9e9e6a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IBasicService/IWarehouseService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IBasicService/IWarehouseService.cs"
@@ -16,5 +16,7 @@
IRepository<Dt_Warehouse> Repository { get; }
Task<WebResponseContent> ReceiveWarehouseArea(List<WarehouseAreaDto> models);
+
+ List<WarehouseDTO> GetWarehouseTypes();
}
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
index 5c44e9c..b3faa42 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
@@ -37,9 +37,10 @@
private readonly IRepository<Dt_StockInfoDetail> _stockDetailRepository;
private readonly IRepository<Dt_InboundOrder> _inboundOrderRepository;
private readonly IRepository<Dt_WarehouseArea> _warehouseAreaRepository;
+ private readonly IRepository<Dt_StockInfo> _stockRepository;
public IRepository<Dt_InboundOrder> Repository => BaseDal;
- public InboundOrderService(IRepository<Dt_InboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_Task> taskRepository, IStockService stockService, IInboundOrderDetailService inboundOrderDetailService, IMaterialUnitService materialUnitService, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository) : base(BaseDal)
+ public InboundOrderService(IRepository<Dt_InboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_Task> taskRepository, IStockService stockService, IInboundOrderDetailService inboundOrderDetailService, IMaterialUnitService materialUnitService, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository,IRepository<Dt_StockInfo> stockRepository) : base(BaseDal)
{
_mapper = mapper;
_unitOfWorkManage = unitOfWorkManage;
@@ -51,6 +52,7 @@
_stockDetailRepository = stockDetailRepository;
_inboundOrderRepository = inboundOrderRepository;
_warehouseAreaRepository = warehouseAreaRepository;
+ _stockRepository = stockRepository;
}
public async Task<WebResponseContent> ReceiveInboundOrder(List<Dt_InboundOrder> models, int operateType)
@@ -320,6 +322,14 @@
(bool, string, object?) result2 = ModelValidate.ValidateModelData(materielGroupDTO);
if (!result2.Item1) return content = WebResponseContent.Instance.Error(result2.Item2);
+ // materielGroupDTO.WarehouseCode
+ var code = _warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>().Where(x => x.Code == materielGroupDTO.WarehouseType).Select(x=>x.Code).First();
+ if(string.IsNullOrEmpty(code))
+ {
+ return content = WebResponseContent.Instance.Error($"浠撳簱涓病鏈夎{materielGroupDTO.WarehouseType}缂栧彿銆�");
+ }
+
+
Dt_InboundOrder inboundOrder = GetInboundOrder(materielGroupDTO.OrderNo);
var dbinboundOrderDetails = _inboundOrderDetailService.GetByBarcode(materielGroupDTO.Barcodes);
@@ -343,9 +353,7 @@
stockInfo = new Dt_StockInfo() { PalletType = (int)PalletTypeEnum.None,LocationType=materielGroupDTO.locationType.ObjToInt() };
stockInfo.Details = new List<Dt_StockInfoDetail>();
}
- var warehouseareas = _warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>().ToList();
- var warehousearea = warehouseareas.FirstOrDefault(x => x.Name == materielGroupDTO.locationTypeDesc && x.FactoryArea == inboundOrder.FactoryArea);
-
+
foreach (var item in dbinboundOrderDetails)
{
stockInfo.Details.Add(new Dt_StockInfoDetail
@@ -357,7 +365,7 @@
Unit = item.Unit,
InboundOrderRowNo = item.lineNo,
SupplyCode = item.SupplyCode,
- WarehouseCode = warehousearea!=null? warehousearea.Code: item.WarehouseCode,
+ WarehouseCode = materielGroupDTO.WarehouseType,
StockQuantity = item.OrderQuantity,
Status = 0,
OrderNo = inboundOrder.InboundOrderNo,
@@ -367,7 +375,7 @@
item.ReceiptQuantity = item.BarcodeQty;
item.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
- item.WarehouseCode = warehousearea != null ? warehousearea.Code : "";
+ item.WarehouseCode = materielGroupDTO.WarehouseType;
}
if (stockInfo.Id == 0)
@@ -415,6 +423,15 @@
(bool, string, object?) result2 = ModelValidate.ValidateModelData(materielGroupDTO);
if (!result2.Item1) return content = WebResponseContent.Instance.Error(result2.Item2);
+ var code = _warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>().Where(x => x.Code == materielGroupDTO.WarehouseCode).Select(x => x.Code).First();
+ if (string.IsNullOrEmpty(code))
+ {
+ return content = WebResponseContent.Instance.Error($"浠撳簱涓病鏈夎{materielGroupDTO.WarehouseCode}缂栧彿銆�");
+ }
+
+ if(_stockRepository.QueryFirst(x=>x.PalletCode == materielGroupDTO.PalletCode)!=null){
+ return WebResponseContent.Instance.Error("璇ユ墭鐩樺凡缁忕粍杩囩洏");
+ }
Dt_StockInfo? stockInfo = _stockService.StockInfoService.GetStockByPalletCode(materielGroupDTO.PalletCode);
if (stockInfo != null && !string.IsNullOrEmpty(stockInfo.LocationCode) && stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt())
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/WarehouseController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/WarehouseController.cs"
index d604ca4..1de9102 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/WarehouseController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/WarehouseController.cs"
@@ -48,6 +48,11 @@
else return WebResponseContent.Instance.Error(content.Message);
}
-
+ [HttpPost, Route("GetWarehouseTypes"), AllowAnonymous, MethodParamsValidate]
+ public WebResponseContent GetWarehouseTypes()
+ {
+ var lists = Service.GetWarehouseTypes();
+ return WebResponseContent.Instance.OK("", lists);
+ }
}
}
--
Gitblit v1.9.3