From 68e75f8e483accd14d34ea64e228678c58b498bc Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期四, 22 一月 2026 21:46:38 +0800
Subject: [PATCH] 虚拟出入库合单优化
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/MESOperation/FeedbackMesService.cs | 5
项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue | 534 ++++++++--------
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs | 552 ++++++++++------
项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/AllcatedPallet.vue | 576 ++++++++++-------
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs | 8
项目代码/WIDESEA_WMSClient/src/views/outbound/outPicking.vue | 112 ++-
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs | 28
项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/NoStockOut.vue | 99 ++
8 files changed, 1,131 insertions(+), 783 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/AllcatedPallet.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/AllcatedPallet.vue"
index 7706fbe..0fc42d7 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/AllcatedPallet.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/AllcatedPallet.vue"
@@ -70,11 +70,11 @@
<div class="input-label">鐗╂枡鏉$爜</div>
<el-input ref="barcodeInput" v-model="barcode" placeholder="璇锋壂鎻忔垨杈撳叆鐗╂枡鏉$爜鍚庢寜鍥炶溅閿�" clearable
:disabled="!form.locationType || !trayBarcode || !form.warehouseType"
- @keyup.enter.native="handleBarcodeSubmit" @clear="handleClear" @input="handleBarcodeInput"
+ @keyup.enter.native="debounceHandleBarcodeSubmit" @clear="handleClear" @input="handleBarcodeInput"
class="custom-input" size="medium">
<template slot="append">
- <el-button :loading="loading" @click="handleBarcodeSubmit" type="primary" icon="el-icon-search"
- :disabled="!form.locationType || !trayBarcode || !barcode || !from.warehouseType" size="medium">
+ <el-button :loading="loading" @click="debounceHandleBarcodeSubmit" type="primary" icon="el-icon-search"
+ :disabled="!form.locationType || !trayBarcode || !barcode || !form.warehouseType" size="medium">
{{ loading ? '鏌ヨ涓�...' : '鏌ヨ' }}
</el-button>
</template>
@@ -84,7 +84,7 @@
<div class="input-tips compact-tips">
<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" class="warning-text">鈿狅笍 璇峰厛閫夋嫨浠撳簱鍖哄煙</p>
<p v-if="form.warehouseType && form.locationType && !trayBarcode" class="warning-text">鈿狅笍 璇峰厛杈撳叆鏂欑鐮�</p>
</div>
@@ -111,7 +111,6 @@
<el-tag type="primary" size="small">鏈粍鐩� {{ totalStockCount }}</el-tag>
</span>
</div>
-
<div class="table-container">
<el-table :data="unpalletMaterials" stripe style="width: 100%" height="100%" size="small"
@@ -146,7 +145,7 @@
<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-if="form.warehouseType && !form.locationType">璇峰厛閫夋嫨浠撳簱鍖哄煙</p>
<p v-else-if="!trayBarcode">璇峰厛杈撳叆鏂欑鏉$爜</p>
<p v-else>鏆傛棤鐗╂枡鏁版嵁锛岃鎵弿鎴栬緭鍏ョ墿鏂欐潯鐮�</p>
</div>
@@ -171,9 +170,23 @@
</template>
</vol-box>
</template>
+
<script>
import http from '@/api/http.js';
import VolBox from '@/components/basic/VolBox.vue';
+
+// 闃叉姈鍑芥暟淇濇寔涓嶅彉
+function debounce(func, wait) {
+ let timeout;
+ return function () {
+ const context = this;
+ const args = arguments;
+ clearTimeout(timeout);
+ timeout = setTimeout(() => {
+ func.apply(context, args);
+ }, wait);
+ };
+}
export default {
components: { VolBox },
@@ -193,27 +206,25 @@
unpalletBarcodes: [],
unpalletBarcodesLoading: false,
- unpalletMaterials: [], // 鏈粍鐩樿缁嗘暟鎹垪琛�
+ unpalletMaterials: [],
- // 鎵爜鏋浉鍏冲彉閲�
scanCode: '',
lastKeyTime: null,
isManualInput: false,
isScanning: false,
scanTimer: null,
manualInputTimer: null,
- scanTarget: 'tray', // 褰撳墠鎵爜鐩爣: tray 鎴� material
+ scanTarget: 'tray',
+ isSubmitting: false,
+ palletGroupedBarcodes: {},
- // 搴撳瓨缁熻鐩稿叧鍙橀噺
totalStockSum: 0,
totalStockCount: 0,
uniqueUnit: '',
sumLoading: false,
sumError: '',
- // 浠撳簱鐩稿叧鍙橀噺
warehouseTypes: [],
warehouseLoading: false,
- // 浠撳簱鍖哄煙鐩稿叧鍙橀噺
locationTypes: [],
locationLoading: false,
form: {
@@ -245,22 +256,25 @@
},
computed: {
- // 褰撳墠閫夋嫨鐨勪粨搴撳悕绉�
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)
return location ? location.locationTypeDesc : ''
+ },
+
+ debounceHandleBarcodeSubmit() {
+ return debounce(this.handleBarcodeSubmit, 500);
}
},
+
watch: {
visible(newVal, oldVal) {
this.palletVisible = newVal;
- // 褰撲粠 false 鍙樹负 true 鏃讹紝琛ㄧず寮规鎵撳紑
if (newVal === true && oldVal === false) {
console.log('寮规鎵撳紑锛岄噸缃暟鎹�');
this.resetData();
@@ -271,15 +285,16 @@
});
}
- // 褰撲粠 true 鍙樹负 false 鏃讹紝琛ㄧず寮规鍏抽棴
if (newVal === false && oldVal === true) {
console.log('寮规鍏抽棴锛岄噸缃暟鎹�');
this.resetData();
}
},
+
palletVisible(newVal) {
this.$emit('update:visible', newVal);
},
+
docNo(newVal) {
if (newVal) {
this.palletForm = { palletCode: '', barcode: '' };
@@ -289,13 +304,16 @@
}
}
},
+
mounted() {
document.addEventListener('keypress', this.handleKeyPress);
},
+
beforeDestroy() {
document.removeEventListener('keypress', this.handleKeyPress);
this.clearAllTimers();
},
+
methods: {
open() {
this.show = true;
@@ -305,6 +323,7 @@
this.initwarehouseTypes();
this.fetchUnpalletMaterialDetails();
},
+
validateLocationType(rule, value, callback) {
if (!this.form.warehouseType) {
callback(new Error('璇峰厛閫夋嫨浠撳簱'));
@@ -315,72 +334,104 @@
}
},
- // 鏍规嵁鏉$爜鍒楄〃鑾峰彇璇︾粏鏁版嵁
- async fetchUnpalletMaterialDetails() {
- try {
- const response = await http.post('/api/InboundOrder/UnPalletGroupBarcode?orderNo=' + this.orderNo, {});
- if (response.status && Array.isArray(response.data)) {
- this.unpalletMaterials = response.data;
- this.unpalletBarcodes = response.data.map(item => item.barcode || '');
- this.totalStockCount = response.data.length;
- } else {
- this.unpalletMaterials = [];
- }
- } catch (err) {
- this.unpalletMaterials = this.unpalletBarcodes.map(barcode => ({
- barcode: barcode,
- materielCode: '-',
- batchNo: '-',
- stockQuantity: '-',
- unit: '-',
- supplyCode: '-',
- warehouseType: '-'
- }));
- }
+ // 鑾峰彇鏈粍鐩樼墿鏂欒鎯�
+ fetchUnpalletMaterialDetails() {
+ this.unpalletBarcodesLoading = true;
+
+ http.post('/api/InboundOrder/UnPalletGroupBarcode?orderNo=' + this.orderNo, {})
+ .then(response => {
+ if (response.status && Array.isArray(response.data)) {
+ this.unpalletMaterials = response.data;
+ this.unpalletBarcodes = response.data.map(item => item.barcode || '');
+ this.totalStockCount = response.data.length;
+ } else {
+ this.unpalletMaterials = [];
+ }
+ })
+ .catch(err => {
+ console.error('鑾峰彇鏈粍鐩樼墿鏂欏け璐�:', err);
+ this.unpalletMaterials = this.unpalletBarcodes.map(barcode => ({
+ barcode: barcode,
+ materielCode: '-',
+ batchNo: '-',
+ stockQuantity: '-',
+ unit: '-',
+ supplyCode: '-',
+ warehouseType: '-'
+ }));
+ })
+ .finally(() => {
+ this.unpalletBarcodesLoading = false;
+ });
},
- async initLocationTypes() {
- try {
- const { data } = await this.http.post("api/LocationInfo/GetLocationTypes")
- this.locationTypes = data
- } catch (e) {
- this.$message.error('鑾峰彇鍖哄煙绫诲瀷澶辫触')
- }
+
+ // 鍒濆鍖栦粨搴撳尯鍩熺被鍨�
+ initLocationTypes() {
+ this.locationLoading = true;
+
+ this.http.post("api/LocationInfo/GetLocationTypes")
+ .then(({ data }) => {
+ this.locationTypes = data;
+ })
+ .catch(e => {
+ console.error('鑾峰彇鍖哄煙绫诲瀷澶辫触:', e);
+ this.$message.error('鑾峰彇鍖哄煙绫诲瀷澶辫触');
+ })
+ .finally(() => {
+ this.locationLoading = false;
+ });
},
- async initwarehouseTypes() {
- try {
- const { data } = await this.http.post("api/Warehouse/GetwarehouseTypes")
- this.warehouseTypes = data
- } catch (e) {
- this.$message.error('鑾峰彇鍖哄煙绫诲瀷澶辫触')
- }
+
+ // 鍒濆鍖栦粨搴撶被鍨�
+ initwarehouseTypes() {
+ this.warehouseLoading = true;
+
+ this.http.post("api/Warehouse/GetwarehouseTypes")
+ .then(({ data }) => {
+ this.warehouseTypes = data;
+ })
+ .catch(e => {
+ console.error('鑾峰彇浠撳簱绫诲瀷澶辫触:', e);
+ this.$message.error('鑾峰彇浠撳簱绫诲瀷澶辫触');
+ })
+ .finally(() => {
+ this.warehouseLoading = false;
+ });
},
- async fetchStockStatistics(orderNo) {
- // 鍗曟嵁鍙蜂负绌烘椂涓嶆煡璇�
+ // 鑾峰彇搴撳瓨缁熻
+ fetchStockStatistics(orderNo) {
if (!orderNo) {
this.sumError = '鍗曟嵁鍙蜂负绌猴紝鏃犳硶缁熻';
- return;
+ return Promise.resolve(null);
}
this.sumLoading = true;
this.sumError = '';
- try {
- const response = await http.post('/api/InboundOrder/UnPalletQuantity?orderNo=' + orderNo, {});
- if (response.data) {
- this.totalStockSum = response.data.stockSumQuantity || 0;
- this.totalStockCount = response.data.stockCount || 0;
- this.uniqueUnit = response.data.uniqueUnit || '';
- }
- } catch (err) {
- this.sumError = '缁熻鍔犺浇澶辫触';
- this.totalStockSum = 0;
- this.totalStockCount = 0;
- } finally {
- this.sumLoading = false;
- }
+
+ return http.post('/api/InboundOrder/UnPalletQuantity?orderNo=' + orderNo, {})
+ .then(response => {
+ if (response.data) {
+ this.totalStockSum = response.data.stockSumQuantity || 0;
+ this.totalStockCount = response.data.stockCount || 0;
+ this.uniqueUnit = response.data.uniqueUnit || '';
+ }
+ return response.data;
+ })
+ .catch(err => {
+ console.error('缁熻鍔犺浇澶辫触:', err);
+ this.sumError = '缁熻鍔犺浇澶辫触';
+ this.totalStockSum = 0;
+ this.totalStockCount = 0;
+ throw err;
+ })
+ .finally(() => {
+ this.sumLoading = false;
+ });
},
- async validateForm() {
+ // 琛ㄥ崟楠岃瘉
+ validateForm() {
return new Promise((resolve) => {
if (!this.$refs.locationForm) {
this.error = '琛ㄥ崟鏈垵濮嬪寲';
@@ -394,10 +445,9 @@
this.error = '';
resolve(true);
} else {
- if (!this.from.warehouseType) {
+ if (!this.form.warehouseType) {
this.error = '璇峰厛閫夋嫨浠撳簱';
- }
- else if (this.form.locationType === null || this.form.locationType === undefined || this.form.locationType === '') {
+ } else if (!this.form.locationType) {
this.error = '璇峰厛閫夋嫨浠撳簱鍖哄煙';
} else {
this.error = '璇锋鏌ヨ〃鍗曞~鍐欐槸鍚︽纭�';
@@ -407,7 +457,7 @@
});
});
},
- // 鑱氱劍鍒版墭鐩樿緭鍏ユ
+
focusTrayInput() {
if (this.$refs.trayInput && this.$refs.trayInput.$el) {
const inputEl = this.$refs.trayInput.$el.querySelector('input');
@@ -420,7 +470,6 @@
}
},
- // 鑱氱劍鍒扮墿鏂欒緭鍏ユ
focusBarcodeInput() {
if (this.$refs.barcodeInput && this.$refs.barcodeInput.$el) {
const inputEl = this.$refs.barcodeInput.$el.querySelector('input');
@@ -432,8 +481,10 @@
}
}
},
- // 閲嶇疆鎵�鏈夋暟鎹�
+
resetData() {
+ this.palletGroupedBarcodes = {};
+ this.isSubmitting = false;
this.trayBarcode = '';
this.barcode = '';
this.materials = [];
@@ -455,10 +506,10 @@
this.form = {
warehouseType: null,
locationType: null
- }
+ };
this.warehouseTypes = [];
this.locationTypes = [];
- // 娓呴櫎琛ㄥ崟楠岃瘉鐘舵��
+
this.$nextTick(() => {
if (this.$refs.locationForm) {
this.$refs.locationForm.clearValidate();
@@ -466,7 +517,6 @@
});
},
- // 娓呴櫎鎵�鏈夎鏃跺櫒
clearAllTimers() {
if (this.manualInputTimer) {
clearTimeout(this.manualInputTimer);
@@ -477,121 +527,108 @@
this.scanTimer = null;
}
},
+
handleDialogClose() {
this.show = false;
this.resetData();
},
// 纭鎸夐挳
- async handleConfirm() {
- if (!await this.validateForm()) return;
+ handleConfirm() {
+ this.validateForm()
+ .then(valid => {
+ if (!valid) return;
+
+ if (this.materials.length === 0) {
+ this.$message.warning('璇疯嚦灏戞坊鍔犱竴涓墿鏂�');
+ return;
+ }
- if (this.materials.length === 0) {
- this.$message.warning('璇疯嚦灏戞坊鍔犱竴涓墿鏂�');
- return;
- }
+ if (!this.trayBarcode) {
+ this.$message.warning('璇疯緭鍏ユ墭鐩樻潯鐮�');
+ return;
+ }
- if (!this.trayBarcode) {
- this.$message.warning('璇疯緭鍏ユ墭鐩樻潯鐮�');
- return;
- }
+ const result = {
+ warehouseType: this.form.warehouseType,
+ warehouseName: this.currentWarehouseName,
+ locationType: this.form.locationType,
+ locationDesc: this.currentLocationDesc,
+ trayBarcode: this.trayBarcode,
+ materials: this.materials,
+ docNo: this.docNo
+ };
- const result = {
- warehouseType: this.form.warehouseType,
- warehouseName: this.currentWarehouseName,
- locationType: this.form.locationType,
- locationDesc: this.currentLocationDesc,
- trayBarcode: this.trayBarcode,
- materials: this.materials,
- docNo: this.docNo
- };
-
- // 瑙﹀彂鐖剁粍浠剁殑 back-success 浜嬩欢
- this.$emit('back-success', result);
- this.palletVisible = false;
+ this.$emit('back-success', result);
+ this.palletVisible = false;
+ });
},
- // 澶勭悊鎵樼洏杈撳叆
+
handleTrayInput() {
- // 鏍囪涓烘墜鍔ㄨ緭鍏ユā寮�
this.isManualInput = true;
this.isScanning = false;
- // 娓呴櫎涔嬪墠鐨勮鏃跺櫒
if (this.manualInputTimer) {
clearTimeout(this.manualInputTimer);
}
- // 璁剧疆璁℃椂鍣紝濡傛灉涓�娈垫椂闂村唴娌℃湁杈撳叆锛屽垯閲嶇疆涓烘壂鐮佹ā寮�
this.manualInputTimer = setTimeout(() => {
this.isManualInput = false;
}, 1000);
},
- // 澶勭悊鐗╂枡杈撳叆
handleBarcodeInput() {
- // 鏍囪涓烘墜鍔ㄨ緭鍏ユā寮�
this.isManualInput = true;
this.isScanning = false;
- // 娓呴櫎涔嬪墠鐨勮鏃跺櫒
if (this.manualInputTimer) {
clearTimeout(this.manualInputTimer);
}
- // 璁剧疆璁℃椂鍣紝濡傛灉涓�娈垫椂闂村唴娌℃湁杈撳叆锛屽垯閲嶇疆涓烘壂鐮佹ā寮�
this.manualInputTimer = setTimeout(() => {
this.isManualInput = false;
}, 1000);
},
// 澶勭悊鎵樼洏鏉$爜鎻愪氦
- async handleTraySubmit() {
- // 鍏堢洿鎺ユ鏌ocationType锛岄伩鍏嶈〃鍗曢獙璇佺殑寮傛闂
+ handleTraySubmit() {
+ this.barcode = '';
+ this.materials = [];
+ this.error = '';
+
if (!this.form.warehouseType) {
this.error = '璇峰厛閫夋嫨浠撳簱';
return;
}
if (!this.form.locationType) {
this.error = '璇峰厛閫夋嫨浠撳簱鍖哄煙';
- //this.$message.warning('璇峰厛閫夋嫨浠撳簱鍖哄煙');
return;
}
- // 鐒跺悗鍐嶈繘琛屽畬鏁寸殑琛ㄥ崟楠岃瘉
- if (!await this.validateForm()) return;
+ this.validateForm()
+ .then(valid => {
+ if (!valid) return;
+
+ const currentTrayBarcode = this.trayBarcode.trim();
- const currentTrayBarcode = this.trayBarcode.trim();
+ if (!currentTrayBarcode) {
+ this.error = '璇疯緭鍏ユ垨鎵弿鎵樼洏鏉$爜';
+ return;
+ }
- if (!currentTrayBarcode) {
- this.error = '璇疯緭鍏ユ垨鎵弿鎵樼洏鏉$爜';
- return;
- }
+ this.error = '';
- this.error = '';
+ if (!this.trayBarcodeReg.test(currentTrayBarcode)) {
+ this.$message("鎵樼洏鍙锋牸寮忛敊璇�");
+ this.focusTrayInput();
+ return;
+ }
- if (!this.trayBarcodeReg.test(currentTrayBarcode)) {
- // ElMessage.warning({
- // message: '鎵樼洏鍙锋牸寮忛敊璇�',
- // type: 'warning',
- // duration: 3000
- // })
- this.$message("鎵樼洏鍙锋牸寮忛敊璇�");
- this.focusTrayInput();
- return;
- }
-
- // 璁剧疆鎵樼洏鏉$爜鍚庯紝鑷姩鑱氱劍鍒扮墿鏂欒緭鍏ユ
- this.focusBarcodeInput();
-
- // this.$message({
- // message: `鎵樼洏鏉$爜宸茶缃�: ${currentTrayBarcode}`,
- // type: 'success',
- // duration: 2000
- // });
- this.$message.success(`鎵樼洏鏉$爜宸茶缃�: ${currentTrayBarcode}`);
+ this.focusBarcodeInput();
+ this.$message.success(`鎵樼洏鏉$爜宸茶缃�: ${currentTrayBarcode}`);
+ });
},
- // 娓呴櫎鎵樼洏
clearTray() {
this.trayBarcode = '';
this.materials = [];
@@ -603,12 +640,10 @@
});
},
- // 娓呯┖鎵樼洏杈撳叆
handleTrayClear() {
this.error = '';
},
- // 娓呯┖杈撳叆
handleClear() {
this.error = '';
this.scanCode = '';
@@ -616,123 +651,171 @@
this.isScanning = false;
},
-
// 澶勭悊鐗╂枡鏉$爜鎻愪氦
- async handleBarcodeSubmit() {
- if (!await this.validateForm()) return;
+ handleBarcodeSubmit() {
+ if (this.isSubmitting) {
+ this.$message.warning('姝e湪澶勭悊涓紝璇风◢鍊�');
+ return;
+ }
+
const currentBarcode = this.barcode.trim();
-
- if (!this.trayBarcode) {
- this.error = '璇峰厛杈撳叆鎵樼洏鏉$爜';
- this.focusTrayInput();
- return;
- }
-
- if (!currentBarcode) {
- this.error = '璇疯緭鍏ユ垨鎵弿鐗╂枡鏉$爜';
- return;
- }
-
- this.focusBarcodeInput();
- this.error = '';
- this.loading = true;
-
- try {
- // 璋冪敤API鏌ヨ鐗╂枡淇℃伅
- const materialData = await this.fetchMaterialData(currentBarcode);
- if (!materialData || materialData.length === 0) {
- return;
- }
-
- this.materials = [];
- materialData.forEach(item => {
- this.materials.push({
- ...item,
- trayCode: this.trayBarcode,
- locationType: this.form.locationType,
- locationDesc: this.currentLocationDesc,
- scanTime: this.formatTime(new Date())
- });
- });
- this.orderNo = materialData[0].orderNo;
- await this.fetchStockStatistics(materialData[0].orderNo);
- await this.fetchUnpalletMaterialDetails();
- // 娓呯┖鐗╂枡杈撳叆妗嗗苟淇濇寔鑱氱劍
+ const currentTrayGrouped = this.palletGroupedBarcodes[this.trayBarcode] || [];
+
+ if (currentTrayGrouped.includes(currentBarcode)) {
+ this.error = `鏉$爜 ${currentBarcode} 宸茶褰撳墠鎵樼洏缁勭洏锛岃鍕块噸澶嶆搷浣渀;
this.barcode = '';
- this.scanCode = ''; // 娓呯┖鎵爜缂撳瓨
- this.isScanning = false;
-
- setTimeout(() => {
- this.focusBarcodeInput();
- }, 100);
- } catch (err) {
- this.error = err.message || '鏌ヨ鏉$爜淇℃伅澶辫触锛岃閲嶈瘯';
this.focusBarcodeInput();
- setTimeout(() => {
- // 閫変腑杈撳叆妗嗗唴鐨勯敊璇唴瀹癸紙纭繚focus瀹屾垚鍚庢墽琛岋級
- const inputEl = this.$refs.barcodeInput?.$el?.querySelector('input');
- if (inputEl) inputEl.select();
- }, 100);
- } finally {
- this.loading = false;
+ return;
}
+
+ this.isSubmitting = true;
+
+ this.validateForm()
+ .then(valid => {
+ if (!valid) {
+ this.isSubmitting = false;
+ return;
+ }
+
+ if (!this.trayBarcode) {
+ this.error = '璇峰厛杈撳叆鎵樼洏鏉$爜';
+ this.focusTrayInput();
+ this.isSubmitting = false;
+ return;
+ }
+
+ if (!currentBarcode) {
+ this.error = '璇疯緭鍏ユ垨鎵弿鐗╂枡鏉$爜';
+ this.isSubmitting = false;
+ return;
+ }
+
+ this.focusBarcodeInput();
+ this.error = '';
+ this.loading = true;
+
+ console.log('缁勭洏璇锋眰鍙傛暟:', {
+ palletCode: this.trayBarcode,
+ barcode: currentBarcode,
+ locationTypeDesc: this.currentLocationDesc,
+ locationType: this.form.locationType,
+ warehouseType: this.form.warehouseType
+ });
+
+ return this.fetchMaterialData(currentBarcode);
+ })
+ .then(materialData => {
+ if (!materialData || materialData.length === 0) {
+ return;
+ }
+
+ this.materials = [];
+ const newBarcodes = [];
+
+ materialData.forEach(item => {
+ this.materials.push({
+ ...item,
+ trayCode: this.trayBarcode,
+ locationType: this.form.locationType,
+ locationDesc: this.currentLocationDesc,
+ scanTime: this.formatTime(new Date())
+ });
+ newBarcodes.push(item.barcode);
+ });
+
+ if (!this.palletGroupedBarcodes[this.trayBarcode]) {
+ this.palletGroupedBarcodes[this.trayBarcode] = [];
+ }
+ this.palletGroupedBarcodes[this.trayBarcode] = [...new Set([...this.palletGroupedBarcodes[this.trayBarcode], ...newBarcodes])];
+
+ this.orderNo = materialData[0].orderNo;
+
+ return Promise.all([
+ this.fetchStockStatistics(materialData[0].orderNo),
+ this.fetchUnpalletMaterialDetails()
+ ]);
+ })
+ .then(() => {
+ this.barcode = '';
+ this.scanCode = '';
+ this.isScanning = false;
+
+ setTimeout(() => {
+ this.focusBarcodeInput();
+ }, 100);
+ })
+ .catch(err => {
+ console.error('澶勭悊鐗╂枡鏉$爜澶辫触:', err);
+ this.error = err.message || '鏌ヨ鏉$爜淇℃伅澶辫触锛岃閲嶈瘯';
+ this.focusBarcodeInput();
+ setTimeout(() => {
+ const inputEl = this.$refs.barcodeInput?.$el?.querySelector('input');
+ if (inputEl) inputEl.select();
+ }, 100);
+ })
+ .finally(() => {
+ this.loading = false;
+ this.isSubmitting = false;
+ });
},
- // API璇锋眰 - 鏇挎崲涓哄疄闄呯殑API璋冪敤
- async fetchMaterialData(barcode) {
- try {
- const response = await http.post('/api/Inbound/AllGroupPallet',
- {
- palletCode: this.trayBarcode,
- barcode: barcode,
- locationTypeDesc: this.currentLocationDesc,
- locationType: this.form.locationType, // 娣诲姞浠撳簱鍖哄煙淇℃伅
- warehouseType: this.form.warehouseType
+ // API璇锋眰
+ fetchMaterialData(barcode) {
+ return http.post('/api/Inbound/AllGroupPallet', {
+ palletCode: this.trayBarcode,
+ barcode: barcode,
+ locationTypeDesc: this.currentLocationDesc,
+ locationType: this.form.locationType,
+ warehouseType: this.form.warehouseType
+ })
+ .then(response => {
+ let materialData;
+
+ if (typeof response.data === 'string') {
+ try {
+ materialData = JSON.parse(response.data);
+ } catch (e) {
+ console.error('瑙f瀽鍝嶅簲鏁版嵁澶辫触:', e);
+ }
+ } else {
+ materialData = response.data;
}
- );
- let materialData;
-
- if (typeof response.data === 'string') {
-
- try {
- materialData = JSON.parse(response.data);
- } catch (e) {
-
+
+ if (!response.status) {
+ this.error = response.message || '鏌ヨ鏉$爜淇℃伅澶辫触锛岃閲嶈瘯';
+ return [];
}
- } else {
- materialData = response.data;
- }
- if (!response.status) {
- this.error = response.message || '鏌ヨ鏉$爜淇℃伅澶辫触锛岃閲嶈瘯';
- }
-
- return materialData;
-
- } catch (error) {
- console.error('API璋冪敤澶辫触:', error);
- }
+
+ return materialData || [];
+ })
+ .catch(error => {
+ console.error('API璋冪敤澶辫触:', error);
+ this.$message.error('鎺ュ彛璇锋眰澶辫触锛岃鑱旂郴绠$悊鍛�');
+ throw error;
+ });
},
// 澶勭悊鎵爜鏋緭鍏�
handleKeyPress(event) {
- // 濡傛灉鏄墜鍔ㄨ緭鍏ユā寮忥紝涓嶅鐞嗘壂鐮佹灙閫昏緫
- if (this.isManualInput) {
+ if (this.isManualInput || this.isSubmitting) {
return;
}
const key = event.key;
const currentTime = new Date().getTime();
- // 蹇界暐鐩存帴鎸変笅鐨勫洖杞﹂敭锛堢敱handleBarcodeSubmit澶勭悊锛�
if (key === 'Enter') {
+ event.preventDefault();
if (this.scanCode.length > 0) {
- // 闃绘榛樿鍥炶溅琛屼负锛岄伩鍏嶈〃鍗曟彁浜�
- event.preventDefault();
+ if (this.scanTarget === 'material' && !this.trayBarcode) {
+ this.$message.warning('璇峰厛璁剧疆鎵樼洏鏉$爜');
+ this.scanCode = '';
+ this.lastKeyTime = null;
+ return;
+ }
- // 鎵爜瀹屾垚锛岃嚜鍔ㄨЕ鍙戞煡璇�
this.isScanning = false;
- // 鏍规嵁褰撳墠鎵爜鐩爣璁剧疆鐩稿簲鐨勮緭鍏ユ鍊�
if (this.scanTarget === 'tray') {
this.trayBarcode = this.scanCode;
this.handleTraySubmit();
@@ -746,7 +829,6 @@
return;
}
- // 鏋勫缓鎵爜鍐呭锛堝揩閫熻繛缁緭鍏ヨ涓烘壂鐮侊級
if (this.lastKeyTime && currentTime - this.lastKeyTime < 50) {
this.scanCode += key;
this.isScanning = true;
@@ -755,7 +837,6 @@
this.isScanning = true;
}
- // 璁剧疆璁℃椂鍣紝濡傛灉涓�娈垫椂闂村唴娌℃湁杈撳叆锛屽垯閲嶇疆鎵弿鐘舵��
if (this.scanTimer) {
clearTimeout(this.scanTimer);
}
@@ -776,6 +857,23 @@
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+ },
+
+ // 浠撳簱鍒囨崲浜嬩欢
+ handleWarehouseChange() {
+ this.form.locationType = null;
+ this.trayBarcode = '';
+ this.barcode = '';
+ this.materials = [];
+ this.error = '';
+ },
+
+ // 鍖哄煙鍒囨崲浜嬩欢
+ handleLocationChange() {
+ this.trayBarcode = '';
+ this.barcode = '';
+ this.materials = [];
+ this.error = '';
}
}
}
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 c7201a6..85cfe01 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"
@@ -175,7 +175,7 @@
import http from '@/api/http.js';
import VolBox from '@/components/basic/VolBox.vue';
-// 鏂板锛氶槻鎶栧嚱鏁�
+// 闃叉姈鍑芥暟淇濇寔涓嶅彉
function debounce(func, wait) {
let timeout;
return function () {
@@ -206,30 +206,25 @@
unpalletBarcodes: [],
unpalletBarcodesLoading: false,
- unpalletMaterials: [], // 鏈粍鐩樿缁嗘暟鎹垪琛�
+ unpalletMaterials: [],
- // 鎵爜鏋浉鍏冲彉閲�
scanCode: '',
lastKeyTime: null,
isManualInput: false,
isScanning: false,
scanTimer: null,
manualInputTimer: null,
- scanTarget: 'tray', // 褰撳墠鎵爜鐩爣: tray 鎴� material
- isSubmitting: false, // 鏂板锛氭彁浜ら攣瀹氾紝闃叉閲嶅璇锋眰
- // 淇锛氭敼涓烘寜鎵樼洏瀛樺偍宸茬粍鐩樻潯鐮侊紝閬垮厤鐘舵�佹贩娣�
- palletGroupedBarcodes: {}, // 鏍煎紡锛歿 [trayBarcode]: [barcode1, barcode2, ...] }
+ scanTarget: 'tray',
+ isSubmitting: false,
+ palletGroupedBarcodes: {},
- // 搴撳瓨缁熻鐩稿叧鍙橀噺
totalStockSum: 0,
totalStockCount: 0,
uniqueUnit: '',
sumLoading: false,
sumError: '',
- // 浠撳簱鐩稿叧鍙橀噺
warehouseTypes: [],
warehouseLoading: false,
- // 浠撳簱鍖哄煙鐩稿叧鍙橀噺
locationTypes: [],
locationLoading: false,
form: {
@@ -261,26 +256,25 @@
},
computed: {
- // 褰撳墠閫夋嫨鐨勪粨搴撳悕绉�
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)
return location ? location.locationTypeDesc : ''
},
- // 鏂板锛氶槻鎶栧悗鐨勭墿鏂欐彁浜ゆ柟娉�
+
debounceHandleBarcodeSubmit() {
return debounce(this.handleBarcodeSubmit, 500);
}
},
+
watch: {
visible(newVal, oldVal) {
this.palletVisible = newVal;
- // 褰撲粠 false 鍙樹负 true 鏃讹紝琛ㄧず寮规鎵撳紑
if (newVal === true && oldVal === false) {
console.log('寮规鎵撳紑锛岄噸缃暟鎹�');
this.resetData();
@@ -291,15 +285,16 @@
});
}
- // 褰撲粠 true 鍙樹负 false 鏃讹紝琛ㄧず寮规鍏抽棴
if (newVal === false && oldVal === true) {
console.log('寮规鍏抽棴锛岄噸缃暟鎹�');
this.resetData();
}
},
+
palletVisible(newVal) {
this.$emit('update:visible', newVal);
},
+
docNo(newVal) {
if (newVal) {
this.palletForm = { palletCode: '', barcode: '' };
@@ -309,13 +304,16 @@
}
}
},
+
mounted() {
document.addEventListener('keypress', this.handleKeyPress);
},
+
beforeDestroy() {
document.removeEventListener('keypress', this.handleKeyPress);
this.clearAllTimers();
},
+
methods: {
open() {
this.show = true;
@@ -325,6 +323,7 @@
this.initwarehouseTypes();
this.fetchUnpalletMaterialDetails();
},
+
validateLocationType(rule, value, callback) {
if (!this.form.warehouseType) {
callback(new Error('璇峰厛閫夋嫨浠撳簱'));
@@ -335,74 +334,104 @@
}
},
- // 鏍规嵁鏉$爜鍒楄〃鑾峰彇璇︾粏鏁版嵁
- async fetchUnpalletMaterialDetails() {
- try {
- const response = await http.post('/api/InboundOrder/UnPalletGroupBarcode?orderNo=' + this.orderNo, {});
- if (response.status && Array.isArray(response.data)) {
- this.unpalletMaterials = response.data;
- this.unpalletBarcodes = response.data.map(item => item.barcode || '');
- this.totalStockCount = response.data.length;
- } else {
- this.unpalletMaterials = [];
- }
- } catch (err) {
- this.unpalletMaterials = this.unpalletBarcodes.map(barcode => ({
- barcode: barcode,
- materielCode: '-',
- batchNo: '-',
- stockQuantity: '-',
- unit: '-',
- supplyCode: '-',
- warehouseType: '-'
- }));
- }
+ // 鑾峰彇鏈粍鐩樼墿鏂欒鎯�
+ fetchUnpalletMaterialDetails() {
+ this.unpalletBarcodesLoading = true;
+
+ http.post('/api/InboundOrder/UnPalletGroupBarcode?orderNo=' + this.orderNo, {})
+ .then(response => {
+ if (response.status && Array.isArray(response.data)) {
+ this.unpalletMaterials = response.data;
+ this.unpalletBarcodes = response.data.map(item => item.barcode || '');
+ this.totalStockCount = response.data.length;
+ } else {
+ this.unpalletMaterials = [];
+ }
+ })
+ .catch(err => {
+ console.error('鑾峰彇鏈粍鐩樼墿鏂欏け璐�:', err);
+ this.unpalletMaterials = this.unpalletBarcodes.map(barcode => ({
+ barcode: barcode,
+ materielCode: '-',
+ batchNo: '-',
+ stockQuantity: '-',
+ unit: '-',
+ supplyCode: '-',
+ warehouseType: '-'
+ }));
+ })
+ .finally(() => {
+ this.unpalletBarcodesLoading = false;
+ });
},
- async initLocationTypes() {
- try {
- // 淇锛歨ttp 鏀逛负 this.$http锛堝師浠g爜閿欒锛�
- const { data } = await this.http.post("api/LocationInfo/GetLocationTypes")
- this.locationTypes = data
- } catch (e) {
- this.$message.error('鑾峰彇鍖哄煙绫诲瀷澶辫触')
- }
+
+ // 鍒濆鍖栦粨搴撳尯鍩熺被鍨�
+ initLocationTypes() {
+ this.locationLoading = true;
+
+ this.http.post("api/LocationInfo/GetLocationTypes")
+ .then(({ data }) => {
+ this.locationTypes = data;
+ })
+ .catch(e => {
+ console.error('鑾峰彇鍖哄煙绫诲瀷澶辫触:', e);
+ this.$message.error('鑾峰彇鍖哄煙绫诲瀷澶辫触');
+ })
+ .finally(() => {
+ this.locationLoading = false;
+ });
},
- async initwarehouseTypes() {
- try {
- // 淇锛歨ttp 鏀逛负 this.$http锛堝師浠g爜閿欒锛�
- const { data } = await this.http.post("api/Warehouse/GetwarehouseTypes")
- this.warehouseTypes = data
- } catch (e) {
- this.$message.error('鑾峰彇鍖哄煙绫诲瀷澶辫触')
- }
+
+ // 鍒濆鍖栦粨搴撶被鍨�
+ initwarehouseTypes() {
+ this.warehouseLoading = true;
+
+ this.http.post("api/Warehouse/GetwarehouseTypes")
+ .then(({ data }) => {
+ this.warehouseTypes = data;
+ })
+ .catch(e => {
+ console.error('鑾峰彇浠撳簱绫诲瀷澶辫触:', e);
+ this.$message.error('鑾峰彇浠撳簱绫诲瀷澶辫触');
+ })
+ .finally(() => {
+ this.warehouseLoading = false;
+ });
},
- async fetchStockStatistics(orderNo) {
- // 鍗曟嵁鍙蜂负绌烘椂涓嶆煡璇�
+ // 鑾峰彇搴撳瓨缁熻
+ fetchStockStatistics(orderNo) {
if (!orderNo) {
this.sumError = '鍗曟嵁鍙蜂负绌猴紝鏃犳硶缁熻';
- return;
+ return Promise.resolve(null);
}
this.sumLoading = true;
this.sumError = '';
- try {
- const response = await http.post('/api/InboundOrder/UnPalletQuantity?orderNo=' + orderNo, {});
- if (response.data) {
- this.totalStockSum = response.data.stockSumQuantity || 0;
- this.totalStockCount = response.data.stockCount || 0;
- this.uniqueUnit = response.data.uniqueUnit || '';
- }
- } catch (err) {
- this.sumError = '缁熻鍔犺浇澶辫触';
- this.totalStockSum = 0;
- this.totalStockCount = 0;
- } finally {
- this.sumLoading = false;
- }
+
+ return http.post('/api/InboundOrder/UnPalletQuantity?orderNo=' + orderNo, {})
+ .then(response => {
+ if (response.data) {
+ this.totalStockSum = response.data.stockSumQuantity || 0;
+ this.totalStockCount = response.data.stockCount || 0;
+ this.uniqueUnit = response.data.uniqueUnit || '';
+ }
+ return response.data;
+ })
+ .catch(err => {
+ console.error('缁熻鍔犺浇澶辫触:', err);
+ this.sumError = '缁熻鍔犺浇澶辫触';
+ this.totalStockSum = 0;
+ this.totalStockCount = 0;
+ throw err;
+ })
+ .finally(() => {
+ this.sumLoading = false;
+ });
},
- async validateForm() {
+ // 琛ㄥ崟楠岃瘉
+ validateForm() {
return new Promise((resolve) => {
if (!this.$refs.locationForm) {
this.error = '琛ㄥ崟鏈垵濮嬪寲';
@@ -416,10 +445,9 @@
this.error = '';
resolve(true);
} else {
- // 淇锛歠rom 鏀逛负 form锛堝師浠g爜鎷煎啓閿欒锛�
if (!this.form.warehouseType) {
this.error = '璇峰厛閫夋嫨浠撳簱';
- } else if (this.form.locationType === null || this.form.locationType === undefined || this.form.locationType === '') {
+ } else if (!this.form.locationType) {
this.error = '璇峰厛閫夋嫨浠撳簱鍖哄煙';
} else {
this.error = '璇锋鏌ヨ〃鍗曞~鍐欐槸鍚︽纭�';
@@ -429,7 +457,7 @@
});
});
},
- // 鑱氱劍鍒版墭鐩樿緭鍏ユ
+
focusTrayInput() {
if (this.$refs.trayInput && this.$refs.trayInput.$el) {
const inputEl = this.$refs.trayInput.$el.querySelector('input');
@@ -442,7 +470,6 @@
}
},
- // 鑱氱劍鍒扮墿鏂欒緭鍏ユ
focusBarcodeInput() {
if (this.$refs.barcodeInput && this.$refs.barcodeInput.$el) {
const inputEl = this.$refs.barcodeInput.$el.querySelector('input');
@@ -454,11 +481,10 @@
}
}
},
- // 閲嶇疆鎵�鏈夋暟鎹�
+
resetData() {
- // 淇锛氭竻绌烘寜鎵樼洏瀛樺偍鐨勫凡缁勭洏鏉$爜
this.palletGroupedBarcodes = {};
- this.isSubmitting = false; // 閲嶇疆鎻愪氦閿�
+ this.isSubmitting = false;
this.trayBarcode = '';
this.barcode = '';
this.materials = [];
@@ -466,12 +492,12 @@
this.unpalletMaterials = [];
this.loading = false;
this.error = '';
- this.scanCode = ''; // 娓呯┖鎵爜缂撳瓨
+ this.scanCode = '';
this.lastKeyTime = null;
this.isManualInput = false;
this.isScanning = false;
this.currentFocus = 'warehouse';
- this.scanTarget = 'tray'; // 閲嶇疆鎵爜鐩爣
+ this.scanTarget = 'tray';
this.clearAllTimers();
this.totalStockSum = 0;
this.totalStockCount = 0;
@@ -480,10 +506,10 @@
this.form = {
warehouseType: null,
locationType: null
- }
+ };
this.warehouseTypes = [];
this.locationTypes = [];
- // 娓呴櫎琛ㄥ崟楠岃瘉鐘舵��
+
this.$nextTick(() => {
if (this.$refs.locationForm) {
this.$refs.locationForm.clearValidate();
@@ -491,7 +517,6 @@
});
},
- // 娓呴櫎鎵�鏈夎鏃跺櫒
clearAllTimers() {
if (this.manualInputTimer) {
clearTimeout(this.manualInputTimer);
@@ -502,81 +527,75 @@
this.scanTimer = null;
}
},
+
handleDialogClose() {
this.show = false;
this.resetData();
},
// 纭鎸夐挳
- async handleConfirm() {
- if (!await this.validateForm()) return;
+ handleConfirm() {
+ this.validateForm()
+ .then(valid => {
+ if (!valid) return;
+
+ if (this.materials.length === 0) {
+ this.$message.warning('璇疯嚦灏戞坊鍔犱竴涓墿鏂�');
+ return;
+ }
- if (this.materials.length === 0) {
- this.$message.warning('璇疯嚦灏戞坊鍔犱竴涓墿鏂�');
- return;
- }
+ if (!this.trayBarcode) {
+ this.$message.warning('璇疯緭鍏ユ墭鐩樻潯鐮�');
+ return;
+ }
- if (!this.trayBarcode) {
- this.$message.warning('璇疯緭鍏ユ墭鐩樻潯鐮�');
- return;
- }
+ const result = {
+ warehouseType: this.form.warehouseType,
+ warehouseName: this.currentWarehouseName,
+ locationType: this.form.locationType,
+ locationDesc: this.currentLocationDesc,
+ trayBarcode: this.trayBarcode,
+ materials: this.materials,
+ docNo: this.docNo
+ };
- const result = {
- warehouseType: this.form.warehouseType,
- warehouseName: this.currentWarehouseName,
- locationType: this.form.locationType,
- locationDesc: this.currentLocationDesc,
- trayBarcode: this.trayBarcode,
- materials: this.materials,
- docNo: this.docNo
- };
-
- // 瑙﹀彂鐖剁粍浠剁殑 back-success 浜嬩欢
- this.$emit('back-success', result);
- this.palletVisible = false;
+ this.$emit('back-success', result);
+ this.palletVisible = false;
+ });
},
- // 澶勭悊鎵樼洏杈撳叆
+
handleTrayInput() {
- // 鏍囪涓烘墜鍔ㄨ緭鍏ユā寮�
this.isManualInput = true;
this.isScanning = false;
- // 娓呴櫎涔嬪墠鐨勮鏃跺櫒
if (this.manualInputTimer) {
clearTimeout(this.manualInputTimer);
}
- // 璁剧疆璁℃椂鍣紝濡傛灉涓�娈垫椂闂村唴娌℃湁杈撳叆锛屽垯閲嶇疆涓烘壂鐮佹ā寮�
this.manualInputTimer = setTimeout(() => {
this.isManualInput = false;
}, 1000);
},
- // 澶勭悊鐗╂枡杈撳叆
handleBarcodeInput() {
- // 鏍囪涓烘墜鍔ㄨ緭鍏ユā寮�
this.isManualInput = true;
this.isScanning = false;
- // 娓呴櫎涔嬪墠鐨勮鏃跺櫒
if (this.manualInputTimer) {
clearTimeout(this.manualInputTimer);
}
- // 璁剧疆璁℃椂鍣紝濡傛灉涓�娈垫椂闂村唴娌℃湁杈撳叆锛屽垯閲嶇疆涓烘壂鐮佹ā寮�
this.manualInputTimer = setTimeout(() => {
this.isManualInput = false;
}, 1000);
},
// 澶勭悊鎵樼洏鏉$爜鎻愪氦
- async handleTraySubmit() {
- // 淇锛氬垏鎹㈡墭鐩樻椂娓呯┖鐗╂枡鐩稿叧鐘舵�侊紝閬垮厤鏃ф暟鎹畫鐣�
+ handleTraySubmit() {
this.barcode = '';
this.materials = [];
this.error = '';
- // 鍏堢洿鎺ユ鏌ocationType锛岄伩鍏嶈〃鍗曢獙璇佺殑寮傛闂
if (!this.form.warehouseType) {
this.error = '璇峰厛閫夋嫨浠撳簱';
return;
@@ -586,31 +605,30 @@
return;
}
- // 鐒跺悗鍐嶈繘琛屽畬鏁寸殑琛ㄥ崟楠岃瘉
- if (!await this.validateForm()) return;
+ this.validateForm()
+ .then(valid => {
+ if (!valid) return;
+
+ const currentTrayBarcode = this.trayBarcode.trim();
- const currentTrayBarcode = this.trayBarcode.trim();
+ if (!currentTrayBarcode) {
+ this.error = '璇疯緭鍏ユ垨鎵弿鎵樼洏鏉$爜';
+ return;
+ }
- if (!currentTrayBarcode) {
- this.error = '璇疯緭鍏ユ垨鎵弿鎵樼洏鏉$爜';
- return;
- }
+ this.error = '';
- this.error = '';
+ if (!this.trayBarcodeReg.test(currentTrayBarcode)) {
+ this.$message("鎵樼洏鍙锋牸寮忛敊璇�");
+ this.focusTrayInput();
+ return;
+ }
- if (!this.trayBarcodeReg.test(currentTrayBarcode)) {
- this.$message("鎵樼洏鍙锋牸寮忛敊璇�");
- this.focusTrayInput();
- return;
- }
-
- // 璁剧疆鎵樼洏鏉$爜鍚庯紝鑷姩鑱氱劍鍒扮墿鏂欒緭鍏ユ
- this.focusBarcodeInput();
-
- this.$message.success(`鎵樼洏鏉$爜宸茶缃�: ${currentTrayBarcode}`);
+ this.focusBarcodeInput();
+ this.$message.success(`鎵樼洏鏉$爜宸茶缃�: ${currentTrayBarcode}`);
+ });
},
- // 娓呴櫎鎵樼洏
clearTray() {
this.trayBarcode = '';
this.materials = [];
@@ -622,12 +640,10 @@
});
},
- // 娓呯┖鎵樼洏杈撳叆
handleTrayClear() {
this.error = '';
},
- // 娓呯┖杈撳叆
handleClear() {
this.error = '';
this.scanCode = '';
@@ -636,15 +652,15 @@
},
// 澶勭悊鐗╂枡鏉$爜鎻愪氦
- async handleBarcodeSubmit() {
+ handleBarcodeSubmit() {
if (this.isSubmitting) {
this.$message.warning('姝e湪澶勭悊涓紝璇风◢鍊�');
return;
}
- // 鏂板锛氭牎楠屽綋鍓嶆潯鐮佹槸鍚﹀凡琚綋鍓嶆墭鐩樼粍鐩�
const currentBarcode = this.barcode.trim();
const currentTrayGrouped = this.palletGroupedBarcodes[this.trayBarcode] || [];
+
if (currentTrayGrouped.includes(currentBarcode)) {
this.error = `鏉$爜 ${currentBarcode} 宸茶褰撳墠鎵樼洏缁勭洏锛岃鍕块噸澶嶆搷浣渀;
this.barcode = '';
@@ -652,121 +668,135 @@
return;
}
- if (!await this.validateForm()) return;
+ this.isSubmitting = true;
+
+ this.validateForm()
+ .then(valid => {
+ if (!valid) {
+ this.isSubmitting = false;
+ return;
+ }
+
+ if (!this.trayBarcode) {
+ this.error = '璇峰厛杈撳叆鎵樼洏鏉$爜';
+ this.focusTrayInput();
+ this.isSubmitting = false;
+ return;
+ }
- if (!this.trayBarcode) {
- this.error = '璇峰厛杈撳叆鎵樼洏鏉$爜';
- this.focusTrayInput();
- return;
- }
+ if (!currentBarcode) {
+ this.error = '璇疯緭鍏ユ垨鎵弿鐗╂枡鏉$爜';
+ this.isSubmitting = false;
+ return;
+ }
- if (!currentBarcode) {
- this.error = '璇疯緭鍏ユ垨鎵弿鐗╂枡鏉$爜';
- return;
- }
-
- this.focusBarcodeInput();
- this.error = '';
- this.loading = true;
- this.isSubmitting = true; // 寮�鍚彁浜ら攣
-
- try {
- // 鏂板锛氳皟璇曟棩蹇楋紝鎵撳嵃璇锋眰鍙傛暟
- console.log('缁勭洏璇锋眰鍙傛暟:', {
- palletCode: this.trayBarcode,
- barcode: currentBarcode,
- locationTypeDesc: this.currentLocationDesc,
- locationType: this.form.locationType,
- warehouseType: this.form.warehouseType
- });
-
- // 璋冪敤API鏌ヨ鐗╂枡淇℃伅
- const materialData = await this.fetchMaterialData(currentBarcode);
- if (!materialData || materialData.length === 0) {
- return;
- }
-
- this.materials = [];
- const newBarcodes = []; // 涓存椂瀛樺偍鏈鏂板鐨勬潯鐮�
- materialData.forEach(item => {
- this.materials.push({
- ...item,
- trayCode: this.trayBarcode,
- locationType: this.form.locationType,
- locationDesc: this.currentLocationDesc,
- scanTime: this.formatTime(new Date())
- });
- newBarcodes.push(item.barcode); // 鏀堕泦鏈缁勭洏鐨勬潯鐮�
- });
-
- // 淇锛氭寜鎵樼洏瀛樺偍宸茬粍鐩樻潯鐮�
- if (!this.palletGroupedBarcodes[this.trayBarcode]) {
- this.palletGroupedBarcodes[this.trayBarcode] = [];
- }
- this.palletGroupedBarcodes[this.trayBarcode] = [...new Set([...this.palletGroupedBarcodes[this.trayBarcode], ...newBarcodes])];
-
- this.orderNo = materialData[0].orderNo;
- await this.fetchStockStatistics(materialData[0].orderNo);
- await this.fetchUnpalletMaterialDetails();
- // 娓呯┖鐗╂枡杈撳叆妗嗗苟淇濇寔鑱氱劍
- this.barcode = '';
- this.scanCode = ''; // 娓呯┖鎵爜缂撳瓨
- this.isScanning = false;
-
- setTimeout(() => {
this.focusBarcodeInput();
- }, 100);
- } catch (err) {
- this.error = err.message || '鏌ヨ鏉$爜淇℃伅澶辫触锛岃閲嶈瘯';
- this.focusBarcodeInput();
- setTimeout(() => {
- // 閫変腑杈撳叆妗嗗唴鐨勯敊璇唴瀹癸紙纭繚focus瀹屾垚鍚庢墽琛岋級
- const inputEl = this.$refs.barcodeInput?.$el?.querySelector('input');
- if (inputEl) inputEl.select();
- }, 100);
- } finally {
- this.loading = false;
- this.isSubmitting = false; // 鍏抽棴鎻愪氦閿�
- }
+ this.error = '';
+ this.loading = true;
+
+ console.log('缁勭洏璇锋眰鍙傛暟:', {
+ palletCode: this.trayBarcode,
+ barcode: currentBarcode,
+ locationTypeDesc: this.currentLocationDesc,
+ locationType: this.form.locationType,
+ warehouseType: this.form.warehouseType
+ });
+
+ return this.fetchMaterialData(currentBarcode);
+ })
+ .then(materialData => {
+ if (!materialData || materialData.length === 0) {
+ return;
+ }
+
+ this.materials = [];
+ const newBarcodes = [];
+
+ materialData.forEach(item => {
+ this.materials.push({
+ ...item,
+ trayCode: this.trayBarcode,
+ locationType: this.form.locationType,
+ locationDesc: this.currentLocationDesc,
+ scanTime: this.formatTime(new Date())
+ });
+ newBarcodes.push(item.barcode);
+ });
+
+ if (!this.palletGroupedBarcodes[this.trayBarcode]) {
+ this.palletGroupedBarcodes[this.trayBarcode] = [];
+ }
+ this.palletGroupedBarcodes[this.trayBarcode] = [...new Set([...this.palletGroupedBarcodes[this.trayBarcode], ...newBarcodes])];
+
+ this.orderNo = materialData[0].orderNo;
+
+ return Promise.all([
+ this.fetchStockStatistics(materialData[0].orderNo),
+ this.fetchUnpalletMaterialDetails()
+ ]);
+ })
+ .then(() => {
+ this.barcode = '';
+ this.scanCode = '';
+ this.isScanning = false;
+
+ setTimeout(() => {
+ this.focusBarcodeInput();
+ }, 100);
+ })
+ .catch(err => {
+ console.error('澶勭悊鐗╂枡鏉$爜澶辫触:', err);
+ this.error = err.message || '鏌ヨ鏉$爜淇℃伅澶辫触锛岃閲嶈瘯';
+ this.focusBarcodeInput();
+ setTimeout(() => {
+ const inputEl = this.$refs.barcodeInput?.$el?.querySelector('input');
+ if (inputEl) inputEl.select();
+ }, 100);
+ })
+ .finally(() => {
+ this.loading = false;
+ this.isSubmitting = false;
+ });
},
- // API璇锋眰 - 鏇挎崲涓哄疄闄呯殑API璋冪敤
- async fetchMaterialData(barcode) {
- try {
- const response = await http.post('/api/Inbound/GroupPallet',
- {
- palletCode: this.trayBarcode,
- barcode: barcode,
- locationTypeDesc: this.currentLocationDesc,
- locationType: this.form.locationType, // 娣诲姞浠撳簱鍖哄煙淇℃伅
- warehouseType: this.form.warehouseType
+ // API璇锋眰
+ fetchMaterialData(barcode) {
+ return http.post('/api/Inbound/GroupPallet', {
+ palletCode: this.trayBarcode,
+ barcode: barcode,
+ locationTypeDesc: this.currentLocationDesc,
+ locationType: this.form.locationType,
+ warehouseType: this.form.warehouseType
+ })
+ .then(response => {
+ let materialData;
+
+ if (typeof response.data === 'string') {
+ try {
+ materialData = JSON.parse(response.data);
+ } catch (e) {
+ console.error('瑙f瀽鍝嶅簲鏁版嵁澶辫触:', e);
+ }
+ } else {
+ materialData = response.data;
}
- );
- let materialData;
-
- if (typeof response.data === 'string') {
- try {
- materialData = JSON.parse(response.data);
- } catch (e) { }
- } else {
- materialData = response.data;
- }
- if (!response.status) {
- this.error = response.message || '鏌ヨ鏉$爜淇℃伅澶辫触锛岃閲嶈瘯';
- }
-
- return materialData;
-
- } catch (error) {
- console.error('API璋冪敤澶辫触:', error);
- this.$message.error('鎺ュ彛璇锋眰澶辫触锛岃鑱旂郴绠$悊鍛�');
- return [];
- }
+
+ if (!response.status) {
+ this.error = response.message || '鏌ヨ鏉$爜淇℃伅澶辫触锛岃閲嶈瘯';
+ return [];
+ }
+
+ return materialData || [];
+ })
+ .catch(error => {
+ console.error('API璋冪敤澶辫触:', error);
+ this.$message.error('鎺ュ彛璇锋眰澶辫触锛岃鑱旂郴绠$悊鍛�');
+ throw error;
+ });
},
// 澶勭悊鎵爜鏋緭鍏�
handleKeyPress(event) {
- // 濡傛灉鏄墜鍔ㄨ緭鍏ユā寮忔垨姝e湪鎻愪氦锛屼笉澶勭悊鎵爜鏋�昏緫
if (this.isManualInput || this.isSubmitting) {
return;
}
@@ -774,11 +804,9 @@
const key = event.key;
const currentTime = new Date().getTime();
- // 蹇界暐鐩存帴鎸変笅鐨勫洖杞﹂敭锛堢敱handleBarcodeSubmit澶勭悊锛�
if (key === 'Enter') {
- event.preventDefault(); // 寮哄埗闃绘榛樿琛屼负锛岄伩鍏嶉噸澶嶈Е鍙�
+ event.preventDefault();
if (this.scanCode.length > 0) {
- // 鏂板锛氭壂鐮佺洰鏍囦负鐗╂枡鏃讹紝鏍¢獙褰撳墠鎵樼洏鏄惁瀛樺湪
if (this.scanTarget === 'material' && !this.trayBarcode) {
this.$message.warning('璇峰厛璁剧疆鎵樼洏鏉$爜');
this.scanCode = '';
@@ -786,10 +814,8 @@
return;
}
- // 鎵爜瀹屾垚锛岃嚜鍔ㄨЕ鍙戞煡璇�
this.isScanning = false;
- // 鏍规嵁褰撳墠鎵爜鐩爣璁剧疆鐩稿簲鐨勮緭鍏ユ鍊�
if (this.scanTarget === 'tray') {
this.trayBarcode = this.scanCode;
this.handleTraySubmit();
@@ -803,7 +829,6 @@
return;
}
- // 鏋勫缓鎵爜鍐呭锛堝揩閫熻繛缁緭鍏ヨ涓烘壂鐮侊級
if (this.lastKeyTime && currentTime - this.lastKeyTime < 50) {
this.scanCode += key;
this.isScanning = true;
@@ -812,7 +837,6 @@
this.isScanning = true;
}
- // 璁剧疆璁℃椂鍣紝濡傛灉涓�娈垫椂闂村唴娌℃湁杈撳叆锛屽垯閲嶇疆鎵弿鐘舵��
if (this.scanTimer) {
clearTimeout(this.scanTimer);
}
@@ -835,9 +859,8 @@
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
- // 浠撳簱鍒囨崲浜嬩欢锛堣ˉ鍏呭疄鐜帮紝鍘熶唬鐮佺己澶憋級
+ // 浠撳簱鍒囨崲浜嬩欢
handleWarehouseChange() {
- // 鍒囨崲浠撳簱鏃舵竻绌哄尯鍩熷拰鎵樼洏鐩稿叧鐘舵��
this.form.locationType = null;
this.trayBarcode = '';
this.barcode = '';
@@ -845,9 +868,8 @@
this.error = '';
},
- // 鍖哄煙鍒囨崲浜嬩欢锛堣ˉ鍏呭疄鐜帮紝鍘熶唬鐮佺己澶憋級
+ // 鍖哄煙鍒囨崲浜嬩欢
handleLocationChange() {
- // 鍒囨崲鍖哄煙鏃舵竻绌烘墭鐩樼浉鍏崇姸鎬�
this.trayBarcode = '';
this.barcode = '';
this.materials = [];
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/NoStockOut.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/NoStockOut.vue"
index 157c95f..bb63598 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/NoStockOut.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/NoStockOut.vue"
@@ -33,8 +33,11 @@
@input="handleOutboundInput"
@keyup.enter="validateOutboundOrder"
ref="outboundInputRef"
- :disabled="loading || submitLoading"
+ :disabled="loading || submitLoading || isOutboundVerified"
></el-input>
+ <!-- 鏂板锛氶獙璇佺姸鎬佹彁绀� -->
+ <span v-if="isOutboundVerified" class="verified-tag">鉁� 宸查獙璇�</span>
+ <span v-else-if="loading" class="loading-tag">鉁� 楠岃瘉涓�...</span>
</el-form-item>
<el-form-item label="閲囪喘鍗曟嵁:" name="purchaseOrderNo">
<el-input
@@ -62,7 +65,6 @@
label="鎵弿鏉$爜:"
style="width: 80%"
name="barcode"
- :rules="[{ required: true, message: '璇锋壂鎻忔垨杈撳叆鏉$爜', trigger: 'blur' }]"
>
<el-input
ref="barcodeInputRef"
@@ -71,7 +73,7 @@
@keydown.enter="debouncedHandleScan"
autofocus
class="custom-input"
- :disabled="!orderForm.outboundOrderNo || loading || submitLoading"
+ :disabled="!isOutboundVerified || loading || submitLoading"
></el-input>
</el-form-item>
<el-form-item>
@@ -80,7 +82,7 @@
size="small"
@click="handleScan"
class="custom-button"
- :disabled="!orderForm.outboundOrderNo || loading || submitLoading"
+ :disabled="!isOutboundVerified || loading || submitLoading"
>
<Search /> 纭鎵弿
</el-button>
@@ -137,7 +139,8 @@
</div>
</transition-group>
<div class="empty-tip" v-if="scannedBarcodes.length === 0">
- <span>鏆傛棤鎵弿璁板綍锛岃鍏堣緭鍏ュ嚭搴撳崟鎹悗鎵弿鏉$爜</span>
+ <span v-if="isOutboundVerified">鏆傛棤鎵弿璁板綍锛岃鎵弿鏉$爜</span>
+ <span v-else>璇峰厛杈撳叆骞堕獙璇佹湁鏁堢殑鍑哄簱鍗曟嵁鍙�</span>
</div>
</el-scrollbar>
</div>
@@ -151,7 +154,7 @@
type="primary"
size="small"
@click="submit"
- :disabled="scannedBarcodes.length === 0 || !orderForm.outboundOrderNo || loading || submitLoading"
+ :disabled="scannedBarcodes.length === 0 || !isOutboundVerified || loading || submitLoading"
class="submit-btn"
>
<Check /> 鎻愪氦鍑哄簱
@@ -196,6 +199,8 @@
const loading = ref(false);
// 鏂板锛氭彁浜や笓灞瀕oading鐘舵�侊紝鎺у埗閬僵灞傛樉绀�
const submitLoading = ref(false);
+// 鏍稿績鏂板锛氬嚭搴撳崟楠岃瘉鐘舵�佹爣璇�
+const isOutboundVerified = ref(false);
// 妯℃澘寮曠敤
const formRef = ref(null);
@@ -229,6 +234,7 @@
orderForm.outboundOrderNo = "";
orderForm.purchaseOrderNo = "";
submitLoading.value = false; // 鎵撳紑寮圭獥鏃堕噸缃彁浜oading
+ isOutboundVerified.value = false; // 鎵撳紑寮圭獥鏃堕噸缃嚭搴撳崟楠岃瘉鐘舵��
nextTick(() => {
outboundInputRef.value?.focus(); // 鎵撳紑寮圭獥浠嶈仛鐒﹀嚭搴撳崟杈撳叆妗�
});
@@ -236,11 +242,12 @@
/**
* 楠岃瘉鍑哄簱鍗曟嵁鍙风殑鏈夋晥鎬�
- * 鏍稿績淇敼锛氶獙璇佹垚鍔熷悗鐩存帴鑱氱劍鏉$爜鎵弿妗嗭紝澶辫触鍒欒仛鐒﹀洖鍑哄簱鍗曡緭鍏ユ
+ * 鏍稿績淇敼锛氶獙璇佹垚鍔熷悗鏍囪isOutboundVerified涓簍rue锛屽け璐ュ垯閲嶇疆涓篺alse
*/
const validateOutboundOrder = async () => {
const outboundOrderNo = orderForm.outboundOrderNo.trim();
if (!outboundOrderNo) {
+ ElMessage.warning("璇疯緭鍏ュ嚭搴撳崟鎹彿");
return;
}
@@ -252,8 +259,9 @@
);
if (res.status !== true) {
- // 楠岃瘉澶辫触锛氭竻绌鸿緭鍏ユ锛屾彁绀洪敊璇紝鑱氱劍鍥炲嚭搴撳崟杈撳叆妗�
+ // 楠岃瘉澶辫触锛氭竻绌鸿緭鍏ユ锛屾彁绀洪敊璇紝閲嶇疆楠岃瘉鐘舵�侊紝鑱氱劍鍥炲嚭搴撳崟杈撳叆妗�
orderForm.outboundOrderNo = "";
+ isOutboundVerified.value = false;
ElMessage.error(res.message || "鍑哄簱鍗曟嵁鍙烽獙璇佸け璐ワ紝璇锋鏌ュ崟鎹彿鏄惁姝g‘");
nextTick(() => {
outboundInputRef.value?.focus(); // 澶辫触鑱氱劍鍑哄簱鍗曡緭鍏ユ
@@ -261,14 +269,16 @@
return;
}
- // 楠岃瘉鎴愬姛锛氭彁绀虹敤鎴凤紝鐩存帴鑱氱劍鏉$爜鎵弿妗嗭紙鏍稿績淇敼锛�
+ // 楠岃瘉鎴愬姛锛氭爣璁伴獙璇佺姸鎬佷负true锛屾彁绀虹敤鎴凤紝鑱氱劍鏉$爜鎵弿妗�
+ isOutboundVerified.value = true;
ElMessage.success("鍑哄簱鍗曟嵁鍙烽獙璇侀�氳繃");
nextTick(() => {
barcodeInputRef.value?.focus(); // 鎴愬姛鐩存帴璺宠浆鍒版潯鐮佹壂鎻忔
});
} catch (error) {
- // 鎺ュ彛寮傚父锛氭竻绌鸿緭鍏ユ锛屾彁绀洪敊璇紝鑱氱劍鍥炲嚭搴撳崟杈撳叆妗�
+ // 鎺ュ彛寮傚父锛氭竻绌鸿緭鍏ユ锛屾彁绀洪敊璇紝閲嶇疆楠岃瘉鐘舵�侊紝鑱氱劍鍥炲嚭搴撳崟杈撳叆妗�
orderForm.outboundOrderNo = "";
+ isOutboundVerified.value = false;
ElMessage.error(`鍑哄簱鍗曟嵁鍙烽獙璇佸紓甯革細${error.message || "缃戠粶閿欒锛岃閲嶈瘯"}`);
nextTick(() => {
outboundInputRef.value?.focus(); // 寮傚父鑱氱劍鍑哄簱鍗曡緭鍏ユ
@@ -280,8 +290,9 @@
// 鍑哄簱鍗曡緭鍏ュ鐞�
const handleOutboundInput = (value) => {
+ // 鏍稿績淇敼锛氳緭鍏ユ椂鑷姩閲嶇疆楠岃瘉鐘舵�侊紙闃叉鎵嬪姩淇敼宸查獙璇佺殑鍑哄簱鍗曞彿锛�
if (value && value.trim()) {
- // 鍙繚鐣欏嚭搴撳崟鍙锋牸寮忛獙璇侀�昏緫
+ isOutboundVerified.value = false;
}
};
@@ -294,10 +305,13 @@
// 鑱氱劍鏉$爜杈撳叆妗嗭紙澶嶇敤鍑芥暟锛�
const focusBarcodeInputDirectly = () => {
- if (orderForm.outboundOrderNo.trim()) {
+ if (isOutboundVerified.value) {
barcodeInputRef.value?.focus();
} else {
- ElMessage.warning("璇峰厛杈撳叆鏈夋晥鐨勫嚭搴撳崟鎹彿");
+ ElMessage.warning("璇峰厛杈撳叆骞堕獙璇佹湁鏁堢殑鍑哄簱鍗曟嵁鍙�");
+ nextTick(() => {
+ outboundInputRef.value?.focus();
+ });
}
};
@@ -323,6 +337,15 @@
// 鎵弿鏉$爜鏍稿績閫昏緫
const handleScan = async () => {
+ // 鏍稿績鏂板锛氬墠缃牎楠岋紝纭繚鍑哄簱鍗曞凡楠岃瘉
+ if (!isOutboundVerified.value) {
+ ElMessage.warning("璇峰厛楠岃瘉鏈夋晥鐨勫嚭搴撳崟鎹彿鍚庡啀鎵弿鏉$爜");
+ nextTick(() => {
+ outboundInputRef.value?.focus();
+ });
+ return;
+ }
+
if (!formRef.value) return;
await formRef.value.validateField('barcode');
@@ -347,8 +370,8 @@
orderForm.purchaseOrderNo = purchaseOrderNo;
} else {
ElMessage.info("鏈煡璇㈠埌璇ユ潯鐮佸搴旂殑閲囪喘鍗曞彿锛岀户缁獙璇佹潯鐮佹湁鏁堟��");
- formData.barcode = ""; // 鏂板锛氶獙璇佸け璐ユ椂娓呯┖杈撳叆妗�
- nextTick(() => barcodeInputRef.value?.focus()); // 鏂板锛氳仛鐒︽潯鐮佽緭鍏ユ
+ formData.barcode = "";
+ nextTick(() => barcodeInputRef.value?.focus());
}
// 姝ラ2锛氶獙璇佹潯鐮佸苟鑾峰彇鐗╂枡淇℃伅
@@ -361,8 +384,8 @@
if (validateRes.status === true) {
if (!Array.isArray(validateRes.data) || validateRes.data.length === 0) {
ElMessage.warning("璇ユ潯鐮侀獙璇佹垚鍔燂紝浣嗘湭杩斿洖鐗╂枡淇℃伅");
- formData.barcode = ""; // 鏂板锛氭棤鐗╂枡淇℃伅鏃朵篃娓呯┖杈撳叆妗�
- nextTick(() => barcodeInputRef.value?.focus()); // 鏂板锛氳仛鐒︽潯鐮佹
+ formData.barcode = "";
+ nextTick(() => barcodeInputRef.value?.focus());
} else {
const newItems = validateRes.data.map(item => ({
barcode: item.barcode || '',
@@ -379,13 +402,12 @@
}
} else {
ElMessage.error("鎵弿澶辫触锛�" + (validateRes.message || '鏉$爜楠岃瘉澶辫触'));
- formData.barcode = ""; // 鏂板锛氶獙璇佸け璐ユ椂娓呯┖杈撳叆妗�
- nextTick(() => barcodeInputRef.value?.focus()); // 鏂板锛氳仛鐒︽潯鐮佽緭鍏ユ
+ formData.barcode = "";
+ nextTick(() => barcodeInputRef.value?.focus());
}
} catch (error) {
ElMessage.error(error.message);
- formData.barcode = ""; // 淇濈暀锛氭帴鍙e紓甯告椂娓呯┖
- // 鏂板锛氬紓甯告椂涔熷己鍒惰仛鐒︽潯鐮佹
+ formData.barcode = "";
nextTick(() => barcodeInputRef.value?.focus());
} finally {
loading.value = false;
@@ -437,9 +459,18 @@
// 鎻愪氦鍑哄簱
const submit = async () => {
+ // 鏍稿績鏂板锛氬墠缃牎楠屽嚭搴撳崟楠岃瘉鐘舵��
+ if (!isOutboundVerified.value) {
+ ElMessage.warning("鍑哄簱鍗曟嵁鍙锋湭楠岃瘉锛屾棤娉曟彁浜�");
+ nextTick(() => {
+ outboundInputRef.value?.focus();
+ });
+ return;
+ }
+
if (scannedBarcodes.value.length === 0) {
ElMessage.warning("璇峰厛鎵弿鑷冲皯涓�鏉℃潯鐮�");
- nextTick(() => barcodeInputRef.value?.focus()); // 鎻愪氦澶辫触鑱氱劍鏉$爜妗�
+ nextTick(() => barcodeInputRef.value?.focus());
return;
}
@@ -460,13 +491,14 @@
showDetailBox.value = false;
scannedBarcodes.value = [];
orderForm.purchaseOrderNo = "";
+ isOutboundVerified.value = false; // 鎻愪氦鎴愬姛鍚庨噸缃獙璇佺姸鎬�
} else {
ElMessage.error("鍑哄簱鎻愪氦澶辫触锛�" + (res.message || '鎻愪氦澶辫触'));
- nextTick(() => barcodeInputRef.value?.focus()); // 鎻愪氦澶辫触鑱氱劍鏉$爜妗�
+ nextTick(() => barcodeInputRef.value?.focus());
}
} catch (error) {
ElMessage.error("鍑哄簱鎻愪氦寮傚父锛�" + error.message);
- nextTick(() => barcodeInputRef.value?.focus()); // 寮傚父鑱氱劍鏉$爜妗�
+ nextTick(() => barcodeInputRef.value?.focus());
} finally {
// 鍏抽棴鎻愪氦loading锛岄殣钘忛伄缃╁眰
submitLoading.value = false;
@@ -525,6 +557,25 @@
animation: el-loading-circle 1.5s linear infinite;
}
+/* 鏂板锛氶獙璇佺姸鎬佹爣绛炬牱寮� */
+.verified-tag {
+ color: #67c23a;
+ font-size: 12px;
+ margin-left: 8px;
+ font-weight: 500;
+}
+.loading-tag {
+ color: #409eff;
+ font-size: 12px;
+ margin-left: 8px;
+ font-weight: 500;
+ animation: spin 1s linear infinite;
+}
+@keyframes spin {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+}
+
.scan-list {
width: 100%;
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/outPicking.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/outPicking.vue"
index f5a29ec..578021c 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/outPicking.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/outPicking.vue"
@@ -499,43 +499,81 @@
}
},
loadUnpickedData() {
- return new Promise((resolve, reject) => {
- this.http.post(`/api/Outbound/QueryPickingTasks?orderNo=${this.orderNo}&palletCode=${this.scanForm.palletCode}`, {}).then(response => {
- if (response.status) {
- if (response.data.outStockLockInfos.length > 0) {
- this.unpickedData = response.data.outStockLockInfos;
- this.matMixed = response.data.isMatMixed;
- this.orderOver = response.data.orderOver;
- this.calculateUnpickedStats()
- // 妫�鏌ユ槸鍚﹂渶瑕佹暣鍑虹‘璁�
- this.$nextTick(() => {
- if (this.hasWholeOut()) {
- this.showWholeOutConfirm()
- }
- })
- // 鑷姩鑱氱劍鍒扮墿鏂欐潯鐮佽緭鍏ユ
- this.$nextTick(() => {
- if (this.$refs.materialInput) {
- this.$refs.materialInput.focus()
- }
- })
- } else {
- if (flag) {
- this.$message.warning('璇ユ墭鐩樻棤鏈嫞閫変换鍔�')
- }
- this.unpickedData = []
+ return new Promise((resolve, reject) => {
+ // 鍏堟竻绌轰箣鍓嶇殑鎻愮ず锛岄伩鍏嶉噸澶嶆彁绀�
+ this.$message.closeAll();
+
+ this.http.post(`/api/Outbound/QueryPickingTasks?orderNo=${this.orderNo}&palletCode=${this.scanForm.palletCode}`, {}).then(response => {
+ if (response.status) {
+ // 鎯呭喌1锛氭湁鏈嫞閫夋暟鎹�
+ if (response.data.outStockLockInfos && response.data.outStockLockInfos.length > 0) {
+ this.unpickedData = response.data.outStockLockInfos;
+ this.matMixed = response.data.isMatMixed;
+ this.orderOver = response.data.orderOver;
+ this.calculateUnpickedStats()
+
+ // 妫�鏌ユ暣鍑虹‘璁�
+ this.$nextTick(() => {
+ if (this.hasWholeOut()) {
+ this.showWholeOutConfirm()
}
- resolve()
- } else {
- this.$message.error(response.message || '鑾峰彇鎵樼洏鏁版嵁澶辫触')
- this.unpickedData = []
- reject(response.message || '鑾峰彇鎵樼洏鏁版嵁澶辫触')
- }
- }).catch(error => {
- reject(error)
- })
- })
- },
+ })
+
+ // 鑱氱劍鐗╂枡鏉$爜杈撳叆妗�
+ this.$nextTick(() => {
+ if (this.$refs.materialInput) {
+ this.$refs.materialInput.focus()
+ }
+ })
+ }
+ // 鎯呭喌2锛氭棤鏈嫞閫夋暟鎹�
+ else {
+ this.unpickedData = [];
+ this.calculateUnpickedStats(); // 閲嶇疆缁熻鏁版嵁
+
+ // 鍙嬪ソ鎻愮ず + 浜や簰浼樺寲
+ this.$message.warning({
+ message: `鎵樼洏銆�${this.scanForm.palletCode}銆戞殏鏃犳嫞閫夎褰昤,
+ duration: 3000, // 鎻愮ず鏄剧ず3绉�
+ showClose: true // 鍏佽鎵嬪姩鍏抽棴
+ });
+
+ // 娓呯┖鐗╂枡鏉$爜骞惰仛鐒﹀洖鎵樼洏鐮佽緭鍏ユ
+ this.scanForm.materialBarcode = '';
+ this.$nextTick(() => {
+ if (this.$refs.palletInput) {
+ this.$refs.palletInput.focus();
+ }
+ });
+ }
+ resolve();
+ }
+ // 鎯呭喌3锛氭帴鍙h繑鍥炲け璐�
+ else {
+ this.unpickedData = [];
+ this.calculateUnpickedStats();
+
+ this.$message.error({
+ message: response.message || `鑾峰彇鎵樼洏銆�${this.scanForm.palletCode}銆戞嫞閫夋暟鎹け璐,
+ duration: 5000,
+ showClose: true
+ });
+ reject(response.message || '鑾峰彇鎵樼洏鏁版嵁澶辫触');
+ }
+ }).catch(error => {
+ // 鎯呭喌4锛氱綉缁�/璇锋眰寮傚父
+ this.unpickedData = [];
+ this.calculateUnpickedStats();
+
+ this.$message.error({
+ message: `鑾峰彇鎵樼洏銆�${this.scanForm.palletCode}銆戞嫞閫夋暟鎹紓甯革細${error.message || '缃戠粶閿欒锛岃閲嶈瘯'}`,
+ duration: 5000,
+ showClose: true
+ });
+ reject(error);
+ })
+ })
+},
loadPickedData() {
return new Promise((resolve, reject) => {
@@ -546,8 +584,10 @@
this.calculatePickedStats()
} else {
this.pickedData = []
+
}
resolve()
+
} else {
this.$message.error(response.message || '鑾峰彇鎵樼洏鏁版嵁澶辫触')
this.pickedData = []
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/MESOperation/FeedbackMesService.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/MESOperation/FeedbackMesService.cs"
index 2e733c2..00e76f5 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/MESOperation/FeedbackMesService.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/MESOperation/FeedbackMesService.cs"
@@ -56,6 +56,11 @@
{
return webResponse = WebResponseContent.Instance.OK($"璇ュ崟鎹棤闇�鍥炰紶MES");
}
+
+ if (outboundOrder.IsBatch == 0 && outboundOrder.OrderStatus != OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt())
+ {
+ return webResponse = WebResponseContent.Instance.OK($"璇ュ崟鎹睘浜庝笉鍒嗘壒鑷姩鍥炰紶锛屼笉鍙墜鍔ㄥ垎鎵瑰洖浼�");
+ }
List<Dt_MesReturnRecord> returnRecords = BaseDal.QueryData(x => x.OrderNo == orderNo && x.OrderId == outboundOrder.Id && x.ReturnStatus == 2);
foreach (var item in returnRecords)
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/TakeStockOrderService.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/TakeStockOrderService.cs"
index 227800f..ded4b28 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/TakeStockOrderService.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/TakeStockOrderService.cs"
@@ -30,6 +30,7 @@
using WIDESEA_DTO.CalcOut;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json;
+using WIDESEA_DTO.Basic;
namespace WIDESEA_InboundService
{
@@ -50,7 +51,8 @@
private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository;
private readonly IOutboundService _outboundService;
private readonly IFeedbackMesService _feedbackMesService;
- public TakeStockOrderService(IRepository<Dt_TakeStockOrder> BaseDal, IUnitOfWorkManage unitOfWorkManage,IRepository<Dt_TakeStockOrder> takeStockOrder,IRepository<Dt_StockInfo> stockInfoRepository,IRepository<Dt_TakeStockOrderDetail> takeStockOrderDetail,IRepository<Dt_Task> taskRepository,ILocationInfoService locationInfoService, IRepository<Dt_InboundOrder> inboundOrderRepository,IRepository<Dt_OutboundOrder> outboundOrderRepository,IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_OutboundOrderDetail> outboundOrderDetailRepository, IOutboundPickingService outboundPickingService, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IOutboundService outboundService,IFeedbackMesService feedbackMesService) : base(BaseDal)
+ private readonly IESSApiService _eSSApiService;
+ public TakeStockOrderService(IRepository<Dt_TakeStockOrder> BaseDal, IUnitOfWorkManage unitOfWorkManage,IRepository<Dt_TakeStockOrder> takeStockOrder,IRepository<Dt_StockInfo> stockInfoRepository,IRepository<Dt_TakeStockOrderDetail> takeStockOrderDetail,IRepository<Dt_Task> taskRepository,ILocationInfoService locationInfoService, IRepository<Dt_InboundOrder> inboundOrderRepository,IRepository<Dt_OutboundOrder> outboundOrderRepository,IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_OutboundOrderDetail> outboundOrderDetailRepository, IOutboundPickingService outboundPickingService, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IOutboundService outboundService,IFeedbackMesService feedbackMesService,IESSApiService eSSApiService) : base(BaseDal)
{
_unitOfWorkManage = unitOfWorkManage;
_takeStockOrder = takeStockOrder;
@@ -66,8 +68,20 @@
_stockInfoDetailRepository = stockInfoDetailRepository;
_outboundService = outboundService;
_feedbackMesService = feedbackMesService;
+ _eSSApiService = eSSApiService;
}
+ private Dictionary<string, string> stations = new Dictionary<string, string>
+ {
+ {"2-1","2-9" },
+ {"3-1","3-9" },
+ };
+
+ private Dictionary<string, string> movestations = new Dictionary<string, string>
+ {
+ {"2-1","2-5" },
+ {"3-1","3-5" },
+ };
public WebResponseContent ValidateBoxNo(string orderNo, string boxNo)
{
try
@@ -253,7 +267,7 @@
NextAddress = "",
OrderNo = takeStockOrder.OrderNo,
Roadway = newLocation.RoadwayNo,
- SourceAddress = sourceAddress,
+ SourceAddress = stations.GetValueOrDefault(sourceAddress)??"",
TargetAddress = newLocation.LocationCode,
TaskStatus = (int)TaskStatusEnum.New,
TaskType = TaskTypeEnum.InInventory.ObjToInt(),
@@ -271,11 +285,11 @@
_taskRepository.AddData(newTask);
_unitOfWorkManage.CommitTran();
- //var moveResult = await _eSSApiService.MoveContainerAsync(new MoveContainerRequest
- //{
- // slotCode = movestations[station],
- // containerCode = palletCode
- //});
+ var moveResult = _eSSApiService.MoveContainerAsync(new MoveContainerRequest
+ {
+ slotCode = movestations[sourceAddress],
+ containerCode = boxNo
+ });
return content.OK();
}
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_OutboundService/OutboundPickingService.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_OutboundService/OutboundPickingService.cs"
index ce1dd2c..6d656bb 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_OutboundService/OutboundPickingService.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_OutboundService/OutboundPickingService.cs"
@@ -2336,258 +2336,370 @@
return WebResponseContent.Instance.OK("鎴愬姛");
}
- public WebResponseContent BarcodeValidate(NoStockOutModel noStockOut)
+
+ public WebResponseContent BarcodeValidate(NoStockOutModel noStockOut)
+ {
+ try
{
- try
+ Dt_InboundOrder inboundOrder = Db.Queryable<Dt_InboundOrder>()
+ .Where(x => x.UpperOrderNo == noStockOut.inOder && x.OrderStatus != InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt())
+ .Includes(x => x.Details)
+ .First();
+ if (inboundOrder == null)
{
- Dt_InboundOrder inboundOrder = Db.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == noStockOut.inOder && x.OrderStatus != InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt()).Includes(x => x.Details).First();
- if (inboundOrder == null)
- {
- return WebResponseContent.Instance.Error($"鏈壘鍒伴噰璐崟锛歿noStockOut.inOder}");
- }
- Dt_OutboundOrder outboundOrder = Db.Queryable<Dt_OutboundOrder>().Where(x => x.UpperOrderNo == noStockOut.outOder && x.OrderStatus != OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt()).Includes(x => x.Details).First();
- if (outboundOrder == null)
- {
- return WebResponseContent.Instance.Error($"鏈壘鍒板嚭搴撳崟锛歿noStockOut.inOder}");
- }
+ return WebResponseContent.Instance.Error($"鏈壘鍒伴噰璐崟锛歿noStockOut.inOder}");
+ }
- //瀛樺偍鍏ュ簱鍗曟嵁鏄庣粏淇℃伅
- var detailLists = new List<Dt_InboundOrderDetail>();
+ Dt_OutboundOrder outboundOrder = Db.Queryable<Dt_OutboundOrder>()
+ .Where(x => x.UpperOrderNo == noStockOut.outOder && x.OrderStatus != OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt())
+ .Includes(x => x.Details)
+ .First();
+ if (outboundOrder == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒板嚭搴撳崟锛歿noStockOut.outOder}");
+ }
- var matchedDetail = inboundOrder.Details.FirstOrDefault(detail =>
- detail.Barcode == noStockOut.barCode &&
+ var detailLists = new List<Dt_InboundOrderDetail>();
+ var matchedDetail = inboundOrder.Details.FirstOrDefault(detail =>
+ detail.Barcode == noStockOut.barCode &&
+ detail.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt());
+
+ if (matchedDetail == null)
+ {
+ matchedDetail = inboundOrder.Details.FirstOrDefault(detail =>
+ detail.OutBoxbarcodes == noStockOut.barCode &&
detail.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt());
-
- if (matchedDetail == null)
- {
- matchedDetail = inboundOrder.Details.FirstOrDefault(detail =>
- detail.OutBoxbarcodes == noStockOut.barCode &&
- detail.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt());
-
- if (matchedDetail == null)
- {
- return WebResponseContent.Instance.Error($"鍦ㄩ噰璐崟 {noStockOut.inOder} 涓湭鎵惧埌鏉$爜涓� {noStockOut.barCode} 鐨勬槑缁嗐��");
- }
- else
- {
-
- // 娣诲姞鎵�鏈夐潪瀹屾垚鐘舵�佺殑鏄庣粏鏉$爜
- foreach (var detail in inboundOrder.Details)
- {
- if (detail.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt() &&
- !string.IsNullOrEmpty(detail.Barcode)&& detail.OutBoxbarcodes == noStockOut.barCode)
- {
- detailLists.Add(detail);
- }
- }
- }
- }
- else
- {
- if (!string.IsNullOrEmpty(noStockOut.barCode))
- {
- detailLists.Add(matchedDetail);
- }
- }
-
- var outDetails = new List<Dt_OutboundOrderDetail>();
-
- foreach (var item in detailLists)
- {
- item.NoStockOutQty = 0;
-
- var matchedCode = outboundOrder.Details.FirstOrDefault(detail => detail.MaterielCode == item.MaterielCode && detail.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt()&& detail.OrderQuantity - detail.LockQuantity - detail.MoveQty - detail.NoStockOutQty > 0);
-
- if (matchedCode != null)
- {
- if(matchedCode.OrderQuantity - matchedCode.LockQuantity - matchedCode.MoveQty - matchedCode.NoStockOutQty < 0)
- {
- return WebResponseContent.Instance.Error($"鐗╂枡{item.MaterielCode}鍙嚭鏁伴噺婧㈠嚭{(matchedCode.LockQuantity + matchedCode.MoveQty + matchedCode.NoStockOutQty) - matchedCode.OrderQuantity}");
- }
- }
- else
- {
- return WebResponseContent.Instance.Error($"鍦ㄥ嚭搴撳崟鐨勭墿鏂欑紪鐮佷腑鏈壘鍒颁笌閲囪喘鍗曚腑鐨剓item.MaterielCode} 瀵瑰簲鐨勭墿鏂�");
- }
- if (!matchedCode.BatchNo.IsNullOrEmpty() && matchedCode.BatchNo != "")
- {
- var matcheBatch = outboundOrder.Details.FirstOrDefault(detail => detail.BatchNo == item.BatchNo);
- if (matcheBatch == null)
- {
- return WebResponseContent.Instance.Error($"鍦ㄥ嚭搴撳崟鐨勭墿鏂欑紪鐮佷腑鏈壘鍒颁笌閲囪喘鍗曟壒娆′腑鐨剓item.BatchNo} 瀵瑰簲鐨勭墿鏂欍��");
- }
- }
- if (!matchedCode.SupplyCode.IsNullOrEmpty() && matchedCode.SupplyCode != "")
- {
- var matcheBatch = outboundOrder.Details.FirstOrDefault(detail => detail.SupplyCode == item.SupplyCode);
- if (matcheBatch == null)
- {
- return WebResponseContent.Instance.Error($"鍦ㄥ嚭搴撳崟鐨勭墿鏂欑紪鐮佷腑鏈壘鍒颁笌閲囪喘鍗曚緵搴斿晢涓殑{item.SupplyCode} 瀵瑰簲鐨勭墿鏂欍��");
- }
- }
- if (!outboundOrder.FactoryArea.IsNullOrEmpty() && outboundOrder.FactoryArea != "" && !inboundOrder.FactoryArea.IsNullOrEmpty() && inboundOrder.FactoryArea != "")
- {
- if (inboundOrder.FactoryArea != outboundOrder.FactoryArea)
- {
- return WebResponseContent.Instance.Error($"璇ユ潯鐮亄item.Barcode}瀵瑰簲鐨勫崟鎹巶鍖轰笌鍑哄簱鍗曟嵁涓嶄竴鑷达紒涓嶅厑璁稿嚭搴撱��");
- }
- }
- if(inboundOrder.BusinessType != "11")
- {
- if (!matchedCode.WarehouseCode.IsNullOrEmpty() && matchedCode.WarehouseCode != "")
- {
- var matcheBatch = outboundOrder.Details.FirstOrDefault(detail => detail.WarehouseCode == item.WarehouseCode);
- if (matcheBatch == null)
- {
- return WebResponseContent.Instance.Error($"浠撳簱涓嶄竴鑷达紒鍦ㄥ嚭搴撳崟鐨勭墿鏂欑紪鐮佷腑鏈壘鍒颁笌閲囪喘鍗曚粨搴撲腑鐨剓item.WarehouseCode} 瀵瑰簲鐨勭墿鏂欍��");
- }
- }
- }
- else
- {
- item.WarehouseCode = matchedCode.WarehouseCode;
- }
-
- //鍓╀綑鍏ュ簱鏁伴噺鍗宠櫄鎷熷嚭鍏ュ簱鍓╀綑鍙嚭鏁伴噺
- decimal outQuantity = item.OrderQuantity - item.ReceiptQuantity;
- if (outQuantity == 0)
- {
- return WebResponseContent.Instance.Error($"璇ラ噰璐崟涓殑鏉$爜瀵瑰簲鐨勫彲鍑烘暟閲忎负0");
- }
- if (matchedCode.OrderQuantity - matchedCode.LockQuantity - matchedCode.MoveQty - matchedCode.NoStockOutQty < outQuantity)
- {
- return WebResponseContent.Instance.Error($"璇ラ噰璐崟涓殑鏉$爜瀵瑰簲鐨勫彲鍑烘暟閲忚秴鍑哄嚭搴撳崟鍑哄簱鏁伴噺{item.OrderQuantity - (matchedCode.OrderQuantity - matchedCode.LockQuantity - matchedCode.MoveQty)},涓嶆弧瓒虫暣鍖呭嚭搴�");
- }
- //鍗曟嵁鍑哄簱閿佸畾鏁伴噺
- item.NoStockOutQty += outQuantity;
- matchedCode.NoStockOutQty += outQuantity;
-
- //鍥炰紶MES鍙傛暟
- List<Barcodes> barcodesList = new List<Barcodes>();
- Barcodes barcodes = new Barcodes
- {
- Barcode = item.Barcode,
- Qty = item.OrderQuantity,
- SupplyCode = item?.SupplyCode ?? "",
- BatchNo = item?.BatchNo ?? "",
- Unit = item?.Unit ?? ""
- };
- if (!string.IsNullOrEmpty(matchedCode.documentsNO))
- {
- barcodesList = JsonConvert.DeserializeObject<List<Barcodes>>(matchedCode.documentsNO) ?? new List<Barcodes>();
- }
- barcodesList.Add(barcodes);
- JsonSerializerSettings settings = new JsonSerializerSettings
- {
- ContractResolver = new CamelCasePropertyNamesContractResolver()
- };
- matchedCode.documentsNO = JsonConvert.SerializeObject(barcodesList, settings);
-
-
- if ((matchedCode.LockQuantity + matchedCode.NoStockOutQty+matchedCode.MoveQty) > matchedCode.OrderQuantity)
- {
- return WebResponseContent.Instance.Error($"鍑哄簱鍗曟槑缁嗘暟閲忔孩鍑簕matchedCode.OrderQuantity - matchedCode.LockQuantity-matchedCode.NoStockOutQty-matchedCode.MoveQty}");
- }
-
- outDetails.Add(matchedCode);
- }
-
- _unitOfWorkManage.BeginTran();
- _inboundOrderDetailService.UpdateData(detailLists);
- _outboundOrderDetailService.UpdateData(outDetails);
- _unitOfWorkManage.CommitTran();
- return WebResponseContent.Instance.OK("鎴愬姛",data:detailLists);
- }
- catch (Exception ex)
- {
- _unitOfWorkManage.RollbackTran();
- return WebResponseContent.Instance.Error(ex.Message);
- }
- }
-
-
- public WebResponseContent DeleteBarcode(NoStockOutModel noStockOut)
- {
- try
- {
- Dt_InboundOrder inboundOrder = Db.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == noStockOut.inOder && x.OrderStatus != InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt()).Includes(x => x.Details).First();
- if (inboundOrder == null)
- {
- return WebResponseContent.Instance.Error($"鏈壘鍒伴噰璐崟锛歿noStockOut.inOder}");
- }
- var matchedDetail = inboundOrder.Details.FirstOrDefault(detail => detail.Barcode == noStockOut.barCode && detail.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt());
if (matchedDetail == null)
{
return WebResponseContent.Instance.Error($"鍦ㄩ噰璐崟 {noStockOut.inOder} 涓湭鎵惧埌鏉$爜涓� {noStockOut.barCode} 鐨勬槑缁嗐��");
}
- matchedDetail.NoStockOutQty = 0;
-
- if (matchedDetail.ReceiptQuantity == 0 && matchedDetail.OverInQuantity == 0)
+ else
{
- matchedDetail.OrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt();
+ // 娣诲姞鎵�鏈夊尮閰嶅绠辩爜涓旈潪瀹屾垚鐘舵�佺殑鏄庣粏
+ foreach (var detail in inboundOrder.Details)
+ {
+ if (detail.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt() &&
+ !string.IsNullOrEmpty(detail.Barcode) &&
+ detail.OutBoxbarcodes == noStockOut.barCode)
+ {
+ detailLists.Add(detail);
+ }
+ }
+ }
+ }
+ else
+ {
+ if (!string.IsNullOrEmpty(noStockOut.barCode))
+ {
+ detailLists.Add(matchedDetail);
+ }
+ }
+ var outDetails = new List<Dt_OutboundOrderDetail>();
+ // 閬嶅巻姣忎釜鍏ュ簱鏄庣粏
+ foreach (var item in detailLists)
+ {
+ // 閲嶇疆褰撳墠鍏ュ簱鏄庣粏鐨勬棤搴撳瓨鍑哄簱鏁伴噺
+ item.NoStockOutQty = 0;
+
+ // 褰撳墠鏉$爜闇�瑕佸嚭搴撶殑鎬绘暟閲忥紙鍏ュ簱鍗曞墿浣欏彲鍑烘暟閲忥級
+ decimal remainingBarcodeQty = item.OrderQuantity - item.ReceiptQuantity;
+ if (remainingBarcodeQty <= 0)
+ {
+ return WebResponseContent.Instance.Error($"璇ラ噰璐崟涓殑鏉$爜{item.Barcode}瀵瑰簲鐨勫彲鍑烘暟閲忎负0");
+ }
+
+ // 绛涢�夊嚭搴撳崟涓鍚堟潯浠剁殑鏄庣粏锛堝悓鐗╂枡銆侀潪瀹屾垚銆佹湁鍓╀綑鍙嚭鏁伴噺锛�
+ var eligibleOutDetails = outboundOrder.Details.Where(detail =>
+ detail.MaterielCode == item.MaterielCode &&
+ detail.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt() &&
+ (detail.OrderQuantity - detail.LockQuantity - detail.MoveQty - detail.NoStockOutQty) > 0).ToList();
+
+ if (!eligibleOutDetails.Any())
+ {
+ return WebResponseContent.Instance.Error($"鍦ㄥ嚭搴撳崟涓湭鎵惧埌鐗╂枡{item.MaterielCode}鐨勫彲鍑哄簱鏄庣粏");
+ }
+
+ // 閬嶅巻绗﹀悎鏉′欢鐨勫嚭搴撴槑缁嗭紝閫愯鍒嗛厤鏁伴噺
+ foreach (var outDetail in eligibleOutDetails)
+ {
+ // 璁$畻褰撳墠鍑哄簱琛岀殑鍓╀綑鍙嚭鏁伴噺
+ decimal rowRemainingQty = outDetail.OrderQuantity - outDetail.LockQuantity - outDetail.MoveQty - outDetail.NoStockOutQty;
+ if (rowRemainingQty <= 0) continue;
+
+ if (!outDetail.BatchNo.IsNullOrEmpty())
+ {
+ if (outDetail.BatchNo != item.BatchNo)
+ {
+ return WebResponseContent.Instance.Error($"鍑哄簱鍗曡鎵规{outDetail.BatchNo}涓庨噰璐崟鎵规{item.BatchNo}涓嶅尮閰�");
+ }
+ }
+ if (!outDetail.SupplyCode.IsNullOrEmpty())
+ {
+ if (outDetail.SupplyCode != item.SupplyCode)
+ {
+ return WebResponseContent.Instance.Error($"鍑哄簱鍗曡渚涘簲鍟唟outDetail.SupplyCode}涓庨噰璐崟渚涘簲鍟唟item.SupplyCode}涓嶅尮閰�");
+ }
+ }
+ if (!string.IsNullOrEmpty(outboundOrder.FactoryArea) && !string.IsNullOrEmpty(inboundOrder.FactoryArea))
+ {
+ if (inboundOrder.FactoryArea != outboundOrder.FactoryArea)
+ {
+ return WebResponseContent.Instance.Error($"璇ユ潯鐮亄item.Barcode}瀵瑰簲鐨勫崟鎹巶鍖轰笌鍑哄簱鍗曟嵁涓嶄竴鑷达紒涓嶅厑璁稿嚭搴撱��");
+ }
+ }
+ if (inboundOrder.BusinessType != "11" && !outDetail.WarehouseCode.IsNullOrEmpty())
+ {
+ if (outDetail.WarehouseCode != item.WarehouseCode)
+ {
+ return WebResponseContent.Instance.Error($"浠撳簱涓嶄竴鑷达紒鍑哄簱鍗曡浠撳簱{outDetail.WarehouseCode}涓庨噰璐崟浠撳簱{item.WarehouseCode}涓嶅尮閰�");
+ }
+ }
+ else
+ {
+ item.WarehouseCode = outDetail.WarehouseCode;
+ }
+
+ // 璁$畻鏈鍒嗛厤鐨勬暟閲忥紙鍙栧墿浣欐潯鐮佹暟閲忓拰褰撳墠琛屽墿浣欐暟閲忕殑杈冨皬鍊硷級
+ decimal assignQty = Math.Min(remainingBarcodeQty, rowRemainingQty);
+
+ // 鏇存柊鍏ュ簱鏄庣粏鍜屽嚭搴撴槑缁嗙殑鏃犲簱瀛樺嚭搴撴暟閲�
+ item.NoStockOutQty += assignQty;
+ outDetail.NoStockOutQty += assignQty;
+
+ // 鏇存柊鍓╀綑闇�瑕佸垎閰嶇殑鏉$爜鏁伴噺
+ remainingBarcodeQty -= assignQty;
+
+ // 璁板綍宸叉洿鏂扮殑鍑哄簱鏄庣粏锛堝幓閲嶏級
+ if (!outDetails.Contains(outDetail))
+ {
+ outDetails.Add(outDetail);
+ }
+
+ // 楠岃瘉褰撳墠琛屾槸鍚︽孩鍑�
+ if ((outDetail.LockQuantity + outDetail.NoStockOutQty + outDetail.MoveQty) > outDetail.OrderQuantity)
+ {
+ return WebResponseContent.Instance.Error($"鍑哄簱鍗曟槑缁唟outDetail.Id}鏁伴噺婧㈠嚭锛岃秴鍑烘暟閲忥細{(outDetail.LockQuantity + outDetail.NoStockOutQty + outDetail.MoveQty) - outDetail.OrderQuantity}");
+ }
+
+ // 澶勭悊MES鍙傛暟鍥炰紶锛氳褰曞綋鍓嶆潯鐮佸垎閰嶅埌璇ヨ鐨勫疄闄呮暟閲�
+ List<Barcodes> barcodesList = new List<Barcodes>();
+ Barcodes barcodes = new Barcodes
+ {
+ Barcode = item.Barcode,
+ Qty = assignQty,
+ SupplyCode = item?.SupplyCode ?? "",
+ BatchNo = item?.BatchNo ?? "",
+ Unit = item?.Unit ?? ""
+ };
+ // 鍙嶅簭鍒楀寲璇ヨ宸叉湁鐨勬潯鐮佽褰�
+ if (!string.IsNullOrEmpty(outDetail.documentsNO))
+ {
+ try
+ {
+ barcodesList = JsonConvert.DeserializeObject<List<Barcodes>>(outDetail.documentsNO) ?? new List<Barcodes>();
+ }
+ catch (JsonException ex)
+ {
+ return WebResponseContent.Instance.Error($"鍑哄簱鍗曟槑缁唟outDetail.Id}鐨刣ocumentsNO瀛楁鏍煎紡閿欒锛歿ex.Message}");
+ }
+ }
+ // 娣诲姞鏈鍒嗛厤鐨勮褰�
+ barcodesList.Add(barcodes);
+ // 搴忓垪鍖栧洖瀛�
+ JsonSerializerSettings settings = new JsonSerializerSettings
+ {
+ ContractResolver = new CamelCasePropertyNamesContractResolver()
+ };
+ outDetail.documentsNO = JsonConvert.SerializeObject(barcodesList, settings);
+
+ // 鏉$爜鏁伴噺鍒嗛厤瀹屾瘯锛岄��鍑哄綋鍓嶈寰幆
+ if (remainingBarcodeQty <= 0)
+ {
+ break;
+ }
+ }
+
+ // 鎵�鏈夌鍚堟潯浠剁殑鍑哄簱琛岄亶鍘嗗畬鍚庯紝鏉$爜鏁伴噺浠嶆湁鍓╀綑
+ if (remainingBarcodeQty > 0)
+ {
+ return WebResponseContent.Instance.Error($"鏉$爜{item.Barcode}闇�鍑哄簱鏁伴噺{item.OrderQuantity - item.ReceiptQuantity}锛屼絾鍑哄簱鍗曚腑鐗╂枡{item.MaterielCode}鍓╀綑鍙嚭鎬婚噺涓嶈冻锛屼粛鍓╀綑{remainingBarcodeQty}鏁伴噺鏈垎閰�");
+ }
}
- Dt_OutboundOrder outboundOrder = Db.Queryable<Dt_OutboundOrder>().Where(x => x.UpperOrderNo == noStockOut.outOder && x.OrderStatus != OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt()).Includes(x => x.Details).First();
- if (outboundOrder == null)
- {
- return WebResponseContent.Instance.Error($"鏈壘鍒板嚭搴撳崟锛歿noStockOut.inOder}");
- }
+ _unitOfWorkManage.BeginTran();
+ _inboundOrderDetailService.UpdateData(detailLists);
+ _outboundOrderDetailService.UpdateData(outDetails);
+ _unitOfWorkManage.CommitTran();
- // 鎾ら攢鍥炰紶MES鍙傛暟
+ return WebResponseContent.Instance.OK("鎴愬姛", data: detailLists);
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return WebResponseContent.Instance.Error(ex.Message);
+ }
+ }
+
+
+ public WebResponseContent DeleteBarcode(NoStockOutModel noStockOut)
+ {
+ try
+ {
+ Dt_InboundOrder inboundOrder = Db.Queryable<Dt_InboundOrder>()
+ .Where(x => x.UpperOrderNo == noStockOut.inOder && x.OrderStatus != InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt())
+ .Includes(x => x.Details)
+ .First();
+ if (inboundOrder == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒伴噰璐崟锛歿noStockOut.inOder}");
+ }
+
+ var matchedDetail = inboundOrder.Details.FirstOrDefault(detail =>
+ detail.Barcode == noStockOut.barCode &&
+ detail.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt());
+
+ if (matchedDetail == null)
+ {
+ return WebResponseContent.Instance.Error($"鍦ㄩ噰璐崟 {noStockOut.inOder} 涓湭鎵惧埌鏉$爜涓� {noStockOut.barCode} 鐨勬槑缁嗐��");
+ }
+
+ // 閲嶇疆鍏ュ簱鏄庣粏鐨勬棤搴撳瓨鍑哄簱鏁伴噺
+ decimal revokedTotalQty = matchedDetail.NoStockOutQty; // 璁板綍闇�瑕佹挙閿�鐨勬�绘暟閲忥紙鍏ュ簱鍗曚腑宸插垎閰嶇殑鏁伴噺锛�
+ matchedDetail.NoStockOutQty = 0;
+ if(inboundOrder.BusinessType == "11")
+ {
+ matchedDetail.WarehouseCode ="";
+ }
+
+ // 閲嶇疆鍏ュ簱鏄庣粏鐘舵��
+ if (matchedDetail.ReceiptQuantity == 0 && matchedDetail.OverInQuantity == 0)
+ {
+ matchedDetail.OrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt();
+ }
+
+ Dt_OutboundOrder outboundOrder = Db.Queryable<Dt_OutboundOrder>()
+ .Where(x => x.UpperOrderNo == noStockOut.outOder && x.OrderStatus != OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt())
+ .Includes(x => x.Details)
+ .First();
+ if (outboundOrder == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒板嚭搴撳崟锛歿noStockOut.outOder}");
+ }
+
+ // 鎵惧埌鎵�鏈夊叧鑱旇鏉$爜鐨勫嚭搴撴槑缁嗚
+ // 鍚岀墿鏂欍�侀潪瀹屾垚鐘舵�併�乨ocumentsNO鍖呭惈璇ユ潯鐮�
+ var matchedCodeList = outboundOrder.Details.Where(detail =>
+ detail.MaterielCode == matchedDetail.MaterielCode && // 纭繚鐗╂枡鍖归厤
+ detail.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt() &&
+ !string.IsNullOrEmpty(detail.documentsNO) &&
+ detail.documentsNO.Contains(noStockOut.barCode) // 鍖呭惈褰撳墠鏉$爜
+ ).ToList();
+
+ if (!matchedCodeList.Any())
+ {
+ return WebResponseContent.Instance.Error($"鍦ㄥ嚭搴撳崟涓湭鎵惧埌鍏宠仈鏉$爜{noStockOut.barCode}鐨勭墿鏂檣matchedDetail.MaterielCode}鏄庣粏銆�");
+ }
+
+ //閫愯澶勭悊鍑哄簱鏄庣粏鐨勬挙閿�閫昏緫
+ decimal remainingRevokeQty = revokedTotalQty; // 鍓╀綑闇�瑕佹挙閿�鐨勬暟閲�
+ foreach (var matchedCode in matchedCodeList)
+ {
+ if (remainingRevokeQty <= 0) break; // 鎵�鏈夋暟閲忓凡鎾ら攢锛岄��鍑哄惊鐜�
+
+ // 澶勭悊MES鍙傛暟鎾ら攢
List<Barcodes> barcodesList = new List<Barcodes>();
- Barcodes barcodes = new Barcodes
- {
- Barcode = matchedDetail.Barcode,
- Qty = matchedDetail.OrderQuantity,
- SupplyCode = matchedDetail?.SupplyCode ?? "",
- BatchNo = matchedDetail?.BatchNo ?? "",
- Unit = matchedDetail?.Unit ?? ""
- };
- var matchedCode = outboundOrder.Details.FirstOrDefault(detail =>
- detail.documentsNO.Contains(barcodes.Barcode) &&
- detail.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt()
- );
-
- if (matchedCode == null)
- {
- return WebResponseContent.Instance.Error($"鍦ㄥ嚭搴撳崟鐨勭墿鏂欑紪鐮佷腑鏈壘鍒颁笌閲囪喘鍗曚腑鐨剓matchedDetail.MaterielCode} 瀵瑰簲鐨勭墿鏂欍��");
- }
-
if (!string.IsNullOrEmpty(matchedCode.documentsNO))
{
- barcodesList = JsonConvert.DeserializeObject<List<Barcodes>>(matchedCode.documentsNO) ?? new List<Barcodes>();
+ try
+ {
+ barcodesList = JsonConvert.DeserializeObject<List<Barcodes>>(matchedCode.documentsNO) ?? new List<Barcodes>();
+ }
+ catch (JsonException ex)
+ {
+ return WebResponseContent.Instance.Error($"鍑哄簱鍗曟槑缁唟matchedCode.Id}鐨刣ocumentsNO瀛楁鏍煎紡閿欒锛歿ex.Message}");
+ }
}
- barcodesList.RemoveAll(b =>
- string.Equals(b.Barcode, barcodes.Barcode, StringComparison.OrdinalIgnoreCase)
- );
+ // 绛涢�夊嚭褰撳墠鏉$爜鐨勬墍鏈夎褰�
+ var barcodeRecords = barcodesList.Where(b =>
+ string.Equals(b.Barcode, noStockOut.barCode, StringComparison.OrdinalIgnoreCase)).ToList();
+ if (!barcodeRecords.Any()) continue;
+
+ // 璁$畻璇ヨ闇�瑕佹挙閿�鐨勬暟閲忥紙绱姞璇ユ潯鐮佸湪璇ヨ鐨勬墍鏈夊垎閰嶆暟閲忥級
+ decimal rowRevokeQty = barcodeRecords.Sum(b => b.Qty);
+ // 瀹為檯鎾ら攢鏁伴噺锛氬彇璇ヨ鍙挙閿�鏁伴噺鍜屽墿浣欓渶瑕佹挙閿�鏁伴噺鐨勮緝灏忓��
+ decimal actualRevokeQty = Math.Min(rowRevokeQty, remainingRevokeQty);
+
+ // 绉婚櫎璇ヨ涓鏉$爜鐨勮褰曪紙鎴栭儴鍒嗚褰曪紝鑻ュ墿浣欐挙閿�鏁伴噺涓嶈冻锛�
+ if (actualRevokeQty < rowRevokeQty)
+ {
+ // 鍓╀綑鎾ら攢鏁伴噺涓嶈冻锛屽彧绉婚櫎閮ㄥ垎璁板綍锛堟寜鏁伴噺鎵e噺锛�
+ decimal tempQty = actualRevokeQty;
+ var removeList = new List<Barcodes>();
+ foreach (var record in barcodeRecords)
+ {
+ if (tempQty <= 0) break;
+ if (record.Qty <= tempQty)
+ {
+ removeList.Add(record);
+ tempQty -= record.Qty;
+ }
+ else
+ {
+ // 璁板綍鏁伴噺鎷嗗垎锛屾墸鍑忛儴鍒嗘暟閲�
+ record.Qty -= tempQty;
+ tempQty = 0;
+ }
+ }
+ barcodesList.RemoveAll(b => removeList.Contains(b));
+ }
+ else
+ {
+ // 绉婚櫎璇ヨ涓鏉$爜鐨勬墍鏈夎褰�
+ barcodesList.RemoveAll(b =>
+ string.Equals(b.Barcode, noStockOut.barCode, StringComparison.OrdinalIgnoreCase));
+ }
+
+ //閲嶆柊搴忓垪鍖朚ES鍙傛暟
JsonSerializerSettings settings = new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
matchedCode.documentsNO = JsonConvert.SerializeObject(barcodesList, settings);
- matchedCode.NoStockOutQty -= matchedDetail.OrderQuantity;
+ //鎵e噺鍑哄簱鏄庣粏鐨勬棤搴撳瓨鍑哄簱鏁伴噺
+ matchedCode.NoStockOutQty = Math.Max(0, matchedCode.NoStockOutQty - actualRevokeQty);
+ remainingRevokeQty -= actualRevokeQty;
+
+ //閲嶇疆鍑哄簱鏄庣粏鐘舵��
if (matchedCode.LockQuantity == 0 && matchedCode.OverOutQuantity == 0)
{
matchedCode.OrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt();
}
- _unitOfWorkManage.BeginTran();
- _inboundOrderDetailService.UpdateData(matchedDetail);
- _outboundOrderDetailService.UpdateData(matchedCode);
- _unitOfWorkManage.CommitTran();
- return WebResponseContent.Instance.OK();
-
}
- catch (Exception ex)
+
+ //鑻ヤ粛鏈夋湭鎾ら攢鐨勬暟閲忥紝璇存槑鏁版嵁涓嶄竴鑷�
+ if (remainingRevokeQty > 0)
{
- _unitOfWorkManage.RollbackTran();
- return WebResponseContent.Instance.Error(ex.Message);
+ return WebResponseContent.Instance.Error($"鎾ら攢鏉$爜{noStockOut.barCode}鏃讹紝鍑哄簱鍗曚腑鍙挙閿�鏁伴噺涓嶈冻锛屼粛鏈墈remainingRevokeQty}鏁伴噺鏈挙閿�");
}
- }
- public async Task<WebResponseContent> NoStockOutSubmit(NoStockOutSubmit noStockOutSubmit)
+ _unitOfWorkManage.BeginTran();
+ _inboundOrderDetailService.UpdateData(matchedDetail);
+ _outboundOrderDetailService.UpdateData(matchedCodeList);
+ _unitOfWorkManage.CommitTran();
+
+ return WebResponseContent.Instance.OK("鏉$爜鎾ら攢鎴愬姛", data: new { RevokedQty = revokedTotalQty });
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return WebResponseContent.Instance.Error(ex.Message);
+ }
+ }
+
+ public async Task<WebResponseContent> NoStockOutSubmit(NoStockOutSubmit noStockOutSubmit)
{
try
{
@@ -2715,7 +2827,7 @@
{
item.LockQuantity += item.NoStockOutQty;
item.OverOutQuantity += item.NoStockOutQty;
- item.CurrentDeliveryQty = item.NoStockOutQty;
+ item.CurrentDeliveryQty += item.NoStockOutQty;
//娣诲姞鍥炰紶MES鍙傛暟
List<Barcodes> barcodesList = new List<Barcodes>();
List<Barcodes> documentsNOList = new List<Barcodes>();
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_OutboundService/OutboundService.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_OutboundService/OutboundService.cs"
index cc36450..be18841 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_OutboundService/OutboundService.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_OutboundService/OutboundService.cs"
@@ -1113,8 +1113,8 @@
{
barcodeQuantity = item.LockQuantity - item.OverOutQuantity;
allocatedQuantity -= (item.LockQuantity - item.OverOutQuantity);
+ item.CurrentDeliveryQty = item.LockQuantity - item.OverOutQuantity;
item.OverOutQuantity = item.LockQuantity;
- item.CurrentDeliveryQty = item.LockQuantity;
}
updateDetails.Add(item);
@@ -1930,6 +1930,12 @@
{
var stock = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletCode).FirstAsync();
+ Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == palletCode);
+ if (task != null)
+ {
+ return WebResponseContent.Instance.Error("浠诲姟淇℃伅鍒楄〃瀛樺湪璇ユ墭鐩樼殑浠诲姟淇℃伅锛屼笉鍙彇璧扮┖绠憋紝璇锋鏌ヤ换鍔℃槸鍚﹀畬鎴�");
+ }
+
if (stock == null)
{
return content.Error($"鏈壘鍒版墭鐩榹palletCode}搴撳瓨淇℃伅");
--
Gitblit v1.9.3