From 557f7f6079c30cd6fe8d6005cea3d89468bbcd31 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期一, 09 三月 2026 09:23:13 +0800
Subject: [PATCH] 代码优化
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/MESOperation/FeedbackMesService.cs | 4
项目代码/WIDESEA_WMSClient/src/extension/inbound/Dt_AllocateOrder.js | 4
项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/DirectOutbound.vue | 71 ++++
项目代码/WIDESEA_WMSClient/src/views/Login.vue | 12
项目代码/WIDESEA_WMSClient/src/extension/outbound/outboundOrder.js | 2
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs | 42 ++
项目代码/WIDESEA_WMSClient/src/router/viewGird.js | 6
项目代码/WIDESEA_WMSClient/src/views/outbound/outPicking.vue | 21 +
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs | 44 ++
/dev/null | 78 -----
项目代码/WIDESEA_WMSClient/src/extension/outbound/allocateoutboundOrder.js | 4
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs | 10
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs | 179 ++++++++++++
项目代码/WIDESEA_WMSClient/src/views/Index.vue | 2
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 296 +++++++++++++++++++++
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockDetailByMaterielService.cs | 6
项目代码/WIDESEA_WMSClient/src/views/outbound/outboundOrder.vue | 9
项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/NoStockOut.vue | 42 ++
18 files changed, 695 insertions(+), 137 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/Dt_AllocateOrder.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/Dt_AllocateOrder.js"
index 4143ebe..b607654 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/Dt_AllocateOrder.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/Dt_AllocateOrder.js"
@@ -67,10 +67,10 @@
.post(`api/MesFeedback/OutboundFeedback?orderNo=${selectedRows[0].orderNo}`, {}, "鏁版嵁澶勭悊涓�...")
.then((x) => {
if (x.status) {
- _this.$Message.success('鍒嗘壒鍑哄簱鍥炶皟瀹屾垚');
+ _this.$Message.success(x.message);
_this.refresh();
} else {
- return _this.$Message.error('鍒嗘壒鍑哄簱鍥炶皟澶辫触');
+ return _this.$Message.error(x.message);
}
})
.catch((error) => {
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/allocateoutboundOrder.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/allocateoutboundOrder.js"
index 8bdfe1b..db82eb1 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/allocateoutboundOrder.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/allocateoutboundOrder.js"
@@ -59,10 +59,10 @@
.post(`api/MesFeedback/OutboundFeedback?orderNo=${selectedRows[0].orderNo}`, {}, "鏁版嵁澶勭悊涓�...")
.then((x) => {
if (x.status) {
- _this.$Message.success('鍒嗘壒鍑哄簱鍥炶皟瀹屾垚');
+ _this.$Message.success(x.message);
_this.refresh();
} else {
- return _this.$Message.error('鍒嗘壒鍑哄簱鍥炶皟澶辫触');
+ return _this.$Message.error(x.message);
}
})
.catch((error) => {
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/DirectOutbound.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/DirectOutbound.vue"
index d19763c..07127fa 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/DirectOutbound.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/DirectOutbound.vue"
@@ -1,4 +1,7 @@
<template>
+ <!-- 鍏ㄥ眬閬僵灞傦細鍦ㄨ姹傚鐞嗘椂鏄剧ず -->
+ <div class="mask-layer" v-if="loading"></div>
+
<vol-box v-model="show" title="鐩存帴鍑哄簱" :width="800" :height="1200">
<template #content>
<el-form ref="form" :model="form" label-width="90px">
@@ -18,7 +21,7 @@
</template>
<template #footer>
<div>
- <el-button type="danger" size="small" plain @click="submit">
+ <el-button type="danger" size="small" plain @click="submit" :loading="loading">
<i class="el-icon-check">纭</i>
</el-button>
<el-button size="small" type="primary" plain @click="() => { this.show = false }">
@@ -48,6 +51,8 @@
orderNo: "",
keys: [],
isBatch: "",
+ loading: false, // 鎺у埗閬僵鍜屾寜閽姞杞界姸鎬�
+ form: {} // 琛ュ厖鍘熶唬鐮佷腑鏈畾涔夌殑form
}
},
methods: {
@@ -59,9 +64,19 @@
if (params.isBatch == 1) {
this.outboundQuantity = params.outboundQuantity
}
-
},
submit() {
+ // 楠岃瘉蹇呭~椤�
+ if (!this.station) {
+ this.$message.warning("璇烽�夋嫨鍑哄簱鍖哄煙");
+ return;
+ }
+ if (this.isBatch === 1 && !this.outboundQuantity) {
+ this.$message.warning("璇峰~鍐欏嚭搴撴暟閲�");
+ return;
+ }
+
+ this.loading = true; // 鎵撳紑閬僵鍜屽姞杞界姸鎬�
this.$emit('parentCall', ($vue) => {
const requestParams = {
detailIds: this.keys,
@@ -74,17 +89,63 @@
console.log(requestParams);
this.http.post("api/Outbound/ProcessPickingOutbound", requestParams, '鏁版嵁澶勭悊涓�...')
.then((x) => {
+ this.loading = false; // 鍏抽棴閬僵鍜屽姞杞界姸鎬�
if (!x.status) {
this.$message.error(x.message)
} else {
this.show = false
- this.$Message.success(x.message)
- $vue.refresh();
+ this.$message.success(x.message) // 淇$Message涓�$message
+
+ // 淇鏍稿績锛氬畨鍏ㄨ皟鐢╮efresh鏂规硶
+ if ($vue && typeof $vue.refresh === 'function') {
+ $vue.refresh();
+ } else {
+ // 澶囬�夋柟妗堬細濡傛灉鐖剁粍浠舵病鏈塺efresh鏂规硶锛岃Е鍙戣嚜瀹氫箟浜嬩欢閫氱煡鍒锋柊
+ this.$emit('needRefresh');
+ console.warn('鐖剁粍浠舵湭瀹氫箟refresh鏂规硶锛屽凡瑙﹀彂needRefresh浜嬩欢');
+ }
}
+ })
+ .catch((error) => {
+ this.loading = false; // 寮傚父鏃朵篃瑕佸叧闂伄缃�
+ this.$message.error("璇锋眰澶辫触锛�" + (error.message || "鏈煡閿欒"));
+ console.error("璇锋眰寮傚父锛�", error);
})
})
},
}
}
</script>
-
\ No newline at end of file
+
+<style scoped>
+/* 閬僵灞傛牱寮� */
+.mask-layer {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100vw;
+ height: 100vh;
+ background-color: rgba(0, 0, 0, 0.5); /* 鍗婇�忔槑榛戣壊閬僵 */
+ z-index: 9999; /* 纭繚閬僵鍦ㄦ渶涓婂眰锛堥珮浜庡脊绐楋級 */
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ pointer-events: auto; /* 闃绘鐐瑰嚮閬僵涓嬫柟鐨勫唴瀹� */
+}
+
+/* 鍔犺浇鍔ㄧ敾 */
+.mask-layer::after {
+ content: "";
+ width: 40px;
+ height: 40px;
+ border: 4px solid #ffffff;
+ border-top: 4px solid #409eff;
+ border-radius: 50%;
+ animation: spin 1s linear infinite;
+}
+
+@keyframes spin {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+}
+</style>
\ No newline at end of file
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 bb63598..9d2333c 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"
@@ -208,6 +208,21 @@
const outboundInputRef = ref(null);
const purchaseInputRef = ref(null);
+const successAudioSrc = require('@/assets/audio/success.mp3');
+const errorAudioSrc = require('@/assets/audio/error.mp3');
+
+// ========== 浠呮柊澧烇細闊抽鎾斁鍑芥暟锛堟棤鍏朵粬浠g爜鏀瑰姩锛� ==========
+const playAudio = (audioSrc, volume = 0.8) => {
+ try {
+ const audio = new Audio(audioSrc);
+ audio.volume = volume;
+ audio.play().catch(() => {});
+ } catch (e) {}
+};
+const playSuccess = () => playAudio(successAudioSrc);
+const playError = () => playAudio(errorAudioSrc);
+// ========== 闊抽鍑芥暟缁撴潫 ==========
+
// 缁勪欢鎸傝浇鏃惰仛鐒﹀埌鍑哄簱鍗曡緭鍏ユ
onMounted(() => {
nextTick(() => {
@@ -340,6 +355,7 @@
// 鏍稿績鏂板锛氬墠缃牎楠岋紝纭繚鍑哄簱鍗曞凡楠岃瘉
if (!isOutboundVerified.value) {
ElMessage.warning("璇峰厛楠岃瘉鏈夋晥鐨勫嚭搴撳崟鎹彿鍚庡啀鎵弿鏉$爜");
+ playError(); // ========== 浠呮柊澧炶繖涓�琛� ==========
nextTick(() => {
outboundInputRef.value?.focus();
});
@@ -356,6 +372,7 @@
const isDuplicate = scannedBarcodes.value.some(item => item.barcode === barcode);
if (isDuplicate) {
ElMessage.warning(`鏉$爜銆�${barcode}銆戝凡瀛樺湪锛屾棤闇�閲嶅鎵弿`);
+ playError(); // ========== 浠呮柊澧炶繖涓�琛� ==========
formData.barcode = "";
nextTick(() => barcodeInputRef.value?.focus()); // 鍘婚噸鍚庝粛鑱氱劍鏉$爜妗�
return;
@@ -365,13 +382,18 @@
loading.value = true;
// 姝ラ1锛氭煡璇㈤噰璐崟鍙�
- const purchaseOrderNo = await getPurchaseOrderByBarcode(barcode);
- if (purchaseOrderNo) {
- orderForm.purchaseOrderNo = purchaseOrderNo;
- } else {
- ElMessage.info("鏈煡璇㈠埌璇ユ潯鐮佸搴旂殑閲囪喘鍗曞彿锛岀户缁獙璇佹潯鐮佹湁鏁堟��");
- formData.barcode = "";
- nextTick(() => barcodeInputRef.value?.focus());
+ let purchaseOrderNo = '';
+ try {
+ purchaseOrderNo = await getPurchaseOrderByBarcode(barcode);
+ if (purchaseOrderNo) {
+ orderForm.purchaseOrderNo = purchaseOrderNo;
+ } else {
+ ElMessage.info("鏈煡璇㈠埌璇ユ潯鐮佸搴旂殑閲囪喘鍗曞彿锛岀户缁獙璇佹潯鐮佹湁鏁堟��");
+ playError(); // ========== 浠呮柊澧炶繖涓�琛� ==========
+ }
+ } catch (error) {
+ ElMessage.info("鏈煡璇㈠埌璇ユ潯鐮佸搴旂殑閲囪喘鍗曞彿锛岀户缁獙璇佹潯鐮佹湁鏁堟�э細" + error.message);
+ playError(); // ========== 浠呮柊澧炶繖涓�琛� ==========
}
// 姝ラ2锛氶獙璇佹潯鐮佸苟鑾峰彇鐗╂枡淇℃伅
@@ -384,6 +406,7 @@
if (validateRes.status === true) {
if (!Array.isArray(validateRes.data) || validateRes.data.length === 0) {
ElMessage.warning("璇ユ潯鐮侀獙璇佹垚鍔燂紝浣嗘湭杩斿洖鐗╂枡淇℃伅");
+ playError(); // ========== 浠呮柊澧炶繖涓�琛� ==========
formData.barcode = "";
nextTick(() => barcodeInputRef.value?.focus());
} else {
@@ -398,15 +421,18 @@
}));
scannedBarcodes.value.push(...newItems);
ElMessage.success(`鎵弿鎴愬姛锛屾柊澧� ${newItems.length} 鏉$墿鏂欎俊鎭紝绱 ${scannedBarcodes.value.length} 鏉);
+ playSuccess(); // ========== 浠呮柊澧炶繖涓�琛� ==========
formData.barcode = "";
}
} else {
- ElMessage.error("鎵弿澶辫触锛�" + (validateRes.message || '鏉$爜楠岃瘉澶辫触'));
+
+ playError(); // ========== 浠呮柊澧炶繖涓�琛� ==========
formData.barcode = "";
nextTick(() => barcodeInputRef.value?.focus());
}
} catch (error) {
ElMessage.error(error.message);
+ playError(); // ========== 浠呮柊澧炶繖涓�琛� ==========
formData.barcode = "";
nextTick(() => barcodeInputRef.value?.focus());
} finally {
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/outboundOrder.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/outboundOrder.js"
index 1ff6c97..ade07b8 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/outboundOrder.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/outboundOrder.js"
@@ -521,7 +521,7 @@
return;
}
- ElMessage.success("鎿嶄綔鎴愬姛");
+ ElMessage.success(x.message);
this.showDetialBox = false;
this.$emit("parentCall", ($vue) => {
$vue.getData();
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/router/viewGird.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/router/viewGird.js"
index 947b8f7..e7a5f1d 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/router/viewGird.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/router/viewGird.js"
@@ -190,11 +190,7 @@
name: 'customerInfo',
component: () => import('@/views/basic/customerInfo.vue')
}
- , {
- path: '/userInfo',
- name: 'userInfo',
- component: () => import('@/views/basic/userInfo.vue')
- }
+
, {
path: '/mesOutboundOrder',
name: 'mesOutboundOrder',
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/Index.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/Index.vue"
index 66a38ce..c8f3a16 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/Index.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/Index.vue"
@@ -270,7 +270,7 @@
{ name: "white", color: "#fff" },
]);
const links = ref([
- // { text: "涓汉涓績", path: "/UserInfo", id: -1, icon: "el-icon-s-custom" },
+ { text: "涓汉涓績", path: "/UserInfo", id: -1, icon: "el-icon-s-custom" },
{
text: "瀹夊叏閫�鍑�",
path: "/login",
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/Login.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/Login.vue"
index 91b5e8d..c342358 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/Login.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/Login.vue"
@@ -28,13 +28,7 @@
</div>
- <div class="item">
- <div class="input-icon el-icon-mobile"></div>
- <input v-focus type="text" v-model="userInfo.verificationCode" placeholder="杈撳叆楠岃瘉鐮�" />
- <div class="code" @click="getVierificationCode">
- <img v-show="codeImgSrc != ''" :src="codeImgSrc" />
- </div>
- </div>
+
</div>
<div class="loging-btn">
<el-button size="large" :loading="loading" color="#3a6cd1" :dark="true" @click="login" long>
@@ -113,9 +107,7 @@
const login = () => {
if (!userInfo.userName) return $message.error("璇疯緭鍏ョ敤鎴峰悕");
if (!userInfo.password) return $message.error("璇疯緭鍏ュ瘑鐮�");
- if (!userInfo.verificationCode) {
- return $message.error("璇疯緭鍏ラ獙璇佺爜");
- }
+
// 纭繚绔欏彴鍊煎凡淇濆瓨
if (stationValue.value) {
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/basic/userInfo.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/basic/userInfo.vue"
deleted file mode 100644
index 5aa50c2..0000000
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/basic/userInfo.vue"
+++ /dev/null
@@ -1,78 +0,0 @@
-<!--
-*Author锛歫xx
- *Contact锛�283591387@qq.com
- *浠g爜鐢辨鏋剁敓鎴�,浠讳綍鏇存敼閮藉彲鑳藉鑷磋浠g爜鐢熸垚鍣ㄨ鐩�
- *涓氬姟璇峰湪@/extension/widesea_wcs/order/Dt_UserInfo.js姝ゅ缂栧啓
- -->
-<template>
- <view-grid ref="grid"
- :columns="columns"
- :detail="detail"
- :editFormFields="editFormFields"
- :editFormOptions="editFormOptions"
- :searchFormFields="searchFormFields"
- :searchFormOptions="searchFormOptions"
- :table="table"
- :extend="extend">
- </view-grid>
-</template>
-<script>
- import extend from "@/extension/basic/userInfo.js";
- import { ref, defineComponent } from "vue";
- export default defineComponent({
- setup() {
- const table = ref({
- key: 'id',
- footer: "Foots",
- cnName: '鍛樺伐淇℃伅',
- name: 'userInfo',
- url: "/UserInfo/",
- sortName: "id"
- });
- const editFormFields = ref({});
- const editFormOptions = ref([]);
- const searchFormFields = ref({});
- const searchFormOptions = ref([
- [
- {title:"鍛樺伐鍙�", field:"code", type:"like"},
- {title:"閮ㄩ棬缂栫爜", field:"deptNo", type:"like"},
- {title:"閮ㄩ棬鍚嶇О", field : "name", type:"like"}
- ],
- [
- {title:"鐘舵��", field:"state",type:"select",dataKey:"",data:[]},
- {title:"搴撳瓨缁勭粐", field:"invOrgId", type:"like"},
- {title:"绫诲瀷", field:"type", type:"select", dataKey:"", data:[]},
- ]
- ]);
- const columns = ref([{field:'id',title:'涓婚敭',type:'int',width:110,hidden:true,readonly:true,require:true,align:'left'},
- {field:'code',title:'鍛樺伐鍙�',type:'string',width:110,align:'left',sort:true},
- {field:'deptNo',title:'閮ㄩ棬缂栫爜',type:'string',width:110,align:'left'},
- {field:'deptName',title:'閮ㄩ棬鍚嶇О',type:'string',width:110,align:'left'},
- {field:'name',title:'鍛樺伐鍚嶇О',type:'string',width:110,align:'left'},
- {field:'state',title:'鐘舵��',type:'int',width:110,require:true,align:'left',bind: { key: "status", data: [] }},
- {field:'invOrgId',title:'搴撳瓨缁勭粐',type:'string',width:110,align:'left'},
- {field:'type',title:'绫诲瀷',type:'int',width:110,require:true,align:'left',hidden:true},
- {field:'creater',title:'鍒涘缓鑰�',type:'string',width:110,require:true,align:'left'},
- {field:'createDate',title:'鍒涘缓鏃堕棿',type:'datetime',width:150,require:true,align:'left',sort:true},
- {field:'modifier',title:'淇敼浜�',type:'string',width:100,align:'left'},
- {field:'modifyDate',title:'淇敼鏃ユ湡',type:'datetime',width:150,align:'left',sort:true}]);
- const detail = ref({
- cnName: "#detailCnName",
- table: "#detailTable",
- columns: [],
- sortName: "",
- key: ""
- });
- return {
- table,
- extend,
- editFormFields,
- editFormOptions,
- searchFormFields,
- searchFormOptions,
- columns,
- detail,
- };
- },
- });
-</script>
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 5a5d03a..49b205f 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"
@@ -433,6 +433,12 @@
this.playErrorAudio();
const errorMsg = response.message || '璇ユ墭鐩樺彿鏈叧鑱斾换浣曡鍗�';
this.$message.error(errorMsg);
+ this.$nextTick(() => {
+ if (this.$refs.palletInput) {
+ this.$refs.palletInput.focus();
+ this.$refs.palletInput.select(); // 閫変腑鍏ㄩ儴鍐呭
+ }
+ });
return null;
}
} catch (error) {
@@ -440,6 +446,12 @@
const errorMsg = `鑾峰彇璁㈠崟鍙峰紓甯革細${error.message || '缃戠粶閿欒'}`;
this.$message.error(errorMsg);
console.error("銆愭墭鐩樺彿鏌ヨ鍗曞彿鎺ュ彛寮傚父銆�", error);
+ this.$nextTick(() => {
+ if (this.$refs.palletInput) {
+ this.$refs.palletInput.focus();
+ this.$refs.palletInput.select(); // 閫変腑鍏ㄩ儴鍐呭
+ }
+ });
return null;
} finally {
this.hideFullScreenLoading();
@@ -663,6 +675,13 @@
if (!palletCode) {
return;
}
+
+ this.$nextTick(() => {
+ if (this.$refs.palletInput) {
+ this.$refs.palletInput.focus();
+ this.$refs.palletInput.select(); // 閫変腑鍏ㄩ儴鍐呭
+ }
+ });
// 鍏堟牴鎹墭鐩樺彿鑾峰彇璁㈠崟鍙�
this.getOrderNoByPallet(palletCode).then((orderNo) => {
if (orderNo) {
@@ -718,10 +737,12 @@
await this.loadPalletData(false)
} else {
this.$message.error(response.message || '鎷i�夌‘璁ゅけ璐�')
+ this.scanForm.materialBarcode = '';
this.playErrorAudio()
}
} catch (error) {
this.$message.error('鎷i�夌‘璁ゅけ璐�')
+ this.scanForm.materialBarcode = '';
this.playErrorAudio()
} finally {
this.confirmLoading = false
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/outboundOrder.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/outboundOrder.vue"
index 97f5a24..f082b8a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/outboundOrder.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/outboundOrder.vue"
@@ -341,6 +341,15 @@
required: true,
},
{
+ field: "warehouseCode",
+ title: "浠撳簱缂栧彿",
+ type: "string",
+ width: 90,
+ align: "left",
+ edit: { type: "string" },
+ required: true,
+ },
+ {
field: "lineNo",
title: "琛屽彿",
type: "string",
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 9d0a70d..0983b44 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"
@@ -139,7 +139,7 @@
_outboundOrderRepository.UpdateData(outboundOrder);
- return webResponse = WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝澶辫触鏁版嵁鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x=>x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
+ return webResponse = WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x=>x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
}
@@ -197,7 +197,7 @@
_outboundOrderRepository.UpdateData(outboundOrder);
- return webResponse = WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝澶辫触鏁版嵁鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
+ return webResponse = WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
}
string apiUrl = AppSettings.GetValue("AllocationFeedbackUrl");
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/InboundService.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/InboundService.cs"
index eec793d..e34d7b7 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/InboundService.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/InboundService.cs"
@@ -58,7 +58,8 @@
private readonly ILocationInfoService _locationInfoService;
private readonly IRepository<Dt_TakeStockOrder> _takeStockOrder;
private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository;
- public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper, IRepository<Dt_MesReturnRecord> mesReturnRecord,ILocationInfoService locationInfoService,IRepository<Dt_TakeStockOrder> takeStockOrder,IRepository<Dt_StockInfoDetail> stockInfoDetailRepository)
+ private readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository;
+ public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper, IRepository<Dt_MesReturnRecord> mesReturnRecord,ILocationInfoService locationInfoService,IRepository<Dt_TakeStockOrder> takeStockOrder,IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository)
{
_unitOfWorkManage = unitOfWorkManage;
InboundOrderDetailService = inboundOrderDetailService;
@@ -76,6 +77,7 @@
_locationInfoService = locationInfoService;
_takeStockOrder = takeStockOrder;
_stockInfoDetailRepository = stockInfoDetailRepository;
+ _allocateOrderRepository = allocateOrderRepository;
}
public async Task<WebResponseContent> GroupPallet(GroupPalletDto palletDto)
@@ -148,10 +150,22 @@
return content.Error($"褰撳墠鍘傚尯涓嶄竴鑷�");
}
- if(inboundOrder.BusinessType != "11"&& inboundOrder.Details.FirstOrDefault().WarehouseCode != palletDto.WarehouseType)
+ if(inboundOrder.BusinessType != "11")
{
- return content.Error($"璇ユ潯鐮佹墍灞炰粨搴撲负{inboundOrder.Details.FirstOrDefault().WarehouseCode}涓庡綋鍓嶄粨搴搟palletDto.WarehouseType}涓嶄竴鑷达紝涓嶅厑璁哥粍鐩�");
+ var warehouseType = _inboundOrderDetailRepository.Db.Queryable<Dt_InboundOrderDetail>().Where(x => x.Barcode == palletDto.Barcode || x.OutBoxbarcodes == palletDto.Barcode).Select(x => x.WarehouseCode).First();
+
+ if (string.IsNullOrEmpty(warehouseType))
+ {
+ return content.Error($"鏈煡璇㈠埌鏉$爜[{palletDto.Barcode}]瀵瑰簲鐨勪粨搴撲俊鎭紝涓嶅厑璁哥粍鐩�");
+ }
+
+ if (!warehouseType.Equals(palletDto.WarehouseType))
+ {
+ return content.Error($"璇ユ潯鐮佹墍灞炰粨搴撲负{warehouseType}涓庡綋鍓嶄粨搴搟palletDto.WarehouseType}涓嶄竴鑷达紝涓嶅厑璁哥粍鐩�");
+ }
}
+
+
Dt_StockInfo? stockInfo = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletDto.PalletCode).FirstAsync();
@@ -443,9 +457,27 @@
WebResponseContent content = new WebResponseContent();
try
{
- var inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>()
+ Dt_InboundOrder inboundOrder = null;
+ var allocateOrder = _allocateOrderRepository.Db.Queryable<Dt_AllocateOrder>().Where(x => x.Id == id).First();
+ if (allocateOrder != null)
+ {
+ inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == allocateOrder.OrderNo).First();
+ if (inboundOrder.IsBatch == 0 && inboundOrder.OrderStatus == InOrderStatusEnum.鍏ュ簱涓�.ObjToInt())
+ {
+ return content = WebResponseContent.Instance.OK($"璇ュ崟鎹睘浜庝笉鍒嗘壒鑷姩鍥炰紶锛屼笉鍙墜鍔ㄥ垎鎵瑰洖浼�");
+ }
+ }else
+ {
+ inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>()
.Where(x => x.Id == id)
.First();
+ if (inboundOrder.IsBatch == 0 && inboundOrder.OrderStatus == InOrderStatusEnum.鍏ュ簱涓�.ObjToInt())
+ {
+ return content = WebResponseContent.Instance.OK($"璇ュ崟鎹睘浜庝笉鍒嗘壒鑷姩鍥炰紶锛屼笉鍙墜鍔ㄥ垎鎵瑰洖浼�");
+ }
+ }
+
+
List<Dt_MesReturnRecord> returnRecords = _mesReturnRecord.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo && x.OrderId == inboundOrder.Id && x.ReturnStatus == 2);
foreach (var item in returnRecords)
@@ -558,7 +590,7 @@
inboundOrder.ReturnToMESStatus = 2;
}
_inboundOrderRepository.UpdateData(inboundOrder);
- return WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝澶辫触鏁版嵁鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
+ return WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
}
var response = responseModel(inboundOrder, 3, null, allocatefeedmodel);
@@ -653,7 +685,7 @@
inboundOrder.ReturnToMESStatus = 2;
}
_inboundOrderRepository.UpdateData(inboundOrder);
- return WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝澶辫触鏁版嵁鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
+ return WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
}
var response = responseModel(inboundOrder, 3, feedmodel);
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/OutboundOrderService.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/OutboundOrderService.cs"
index e7cfc2d..128d1e9 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/OutboundOrderService.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/OutboundOrderService.cs"
@@ -166,12 +166,20 @@
|| !string.Equals(outboundOrderDetail.Unit, item.Unit)
|| !string.Equals(outboundOrderDetail.WarehouseCode, item.WarehouseCode)
|| !string.Equals(outboundOrderDetail.lineNo, item.lineNo)
- || outboundOrderDetail.MoveQty != item.MoveQty;
+ ;
if (isFieldChanged)
{
return WebResponseContent.Instance.Error($"琛屽彿{item.lineNo}宸查攣瀹氬嚭搴擄紙閿佸畾鏁伴噺锛歿outboundOrderDetail.LockQuantity}锛夛紝浠呭厑璁镐慨鏀硅鍗曟暟閲忥紝绂佹淇敼鐗╂枡/鎵规/浠撳簱绛夊叾浠栦俊鎭�");
}
+ else
+ {
+ if(item.MoveQty > (outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity))
+ {
+ return WebResponseContent.Instance.Error($"琛屽彿{item.lineNo}鎸枡鏁伴噺涓嶈兘瓒呰繃鍓╀笅鐨勮鍗曟暟閲弡outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity}");
+ }
+ outboundOrderDetail.MoveQty = item.MoveQty;
+ }
}
#endregion
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 af8d795..96577c1 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"
@@ -1,14 +1,16 @@
-锘縰sing System.Reflection.Emit;
-using AutoMapper;
+锘縰sing AutoMapper;
using Dm.filter;
using MailKit.Search;
using Mapster;
using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using Org.BouncyCastle.Asn1.Ocsp;
using Org.BouncyCastle.Crypto;
using SqlSugar;
+using System;
+using System.Reflection.Emit;
using WIDESEA_BasicService;
using WIDESEA_Common.CommonEnum;
using WIDESEA_Common.LocationEnum;
@@ -29,6 +31,7 @@
using WIDESEA_IRecordService;
using WIDESEA_IStockService;
using WIDESEA_Model.Models;
+using WIDESEA_Model.Models.Basic;
using WIDESEA_Model.Models.Check;
using static HslCommunication.Profinet.Knx.KnxCode;
@@ -65,6 +68,8 @@
private readonly IRepository<Dt_AllocateMaterialInfo> _allocateMaterialInfoRepository;
public readonly IRepository<Dt_InboundOrderDetail> _inboundOrderDetailRepository;
public readonly IRepository<Dt_InboundOrder> _inboundOrderRepository;
+ public readonly IRepository<Dt_WarehouseArea> _warehouseAreaRepository;
+ public readonly IRepository<Dt_LocationType> _locationTypeRepository;
private Dictionary<string, string> stations = new Dictionary<string, string>
{
@@ -78,7 +83,7 @@
{"3-1","3-5" },
};
- public OutboundService(IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> detailRepository, IRepository<Dt_OutboundOrder> outboundRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_StockQuantityChangeRecord> stockChangeRepository, IRepository<Dt_StockInfoDetail_Hty> stockDetailHistoryRepository, IBasicService basicService, IOutboundOrderDetailService outboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutStockLockInfoService outboundStockLockInfoService, IFeedbackMesService feedbackMesService, IRepository<Dt_Task> taskRepository, ILocationInfoService locationInfoService, IESSApiService eSSApiService, IRepository<Dt_AllocateOrder> allocateOrderRepository, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository)
+ public OutboundService(IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> detailRepository, IRepository<Dt_OutboundOrder> outboundRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_StockQuantityChangeRecord> stockChangeRepository, IRepository<Dt_StockInfoDetail_Hty> stockDetailHistoryRepository, IBasicService basicService, IOutboundOrderDetailService outboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutStockLockInfoService outboundStockLockInfoService, IFeedbackMesService feedbackMesService, IRepository<Dt_Task> taskRepository, ILocationInfoService locationInfoService, IESSApiService eSSApiService, IRepository<Dt_AllocateOrder> allocateOrderRepository, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository)
{
_mapper = mapper;
_unitOfWorkManage = unitOfWorkManage;
@@ -103,6 +108,8 @@
_allocateMaterialInfoRepository = allocateMaterialInfoRepository;
_inboundOrderDetailRepository = inboundOrderDetailRepository;
_inboundOrderRepository = inboundOrderRepository;
+ _locationTypeRepository = locationTypeRepository;
+ _warehouseAreaRepository = warehouseAreaRepository;
}
public WebResponseContent PrintFromData (string barcode)
@@ -144,6 +151,14 @@
PickingOutboundResponseDTO response = new PickingOutboundResponseDTO();
decimal totalNeedAllocate = 0; // 鎬婚渶姹傚垎閰嶉噺
decimal totalActualAllocate = 0; // 瀹為檯鎬诲垎閰嶉噺
+ string targetWarehouse = string.Empty;// 鐩爣浠撳簱
+ string targetLocationCode = string.Empty; // 鐩爣璐т綅
+ bool isWholeCaseOutbound = false; // 鏄惁鏁寸鍑哄簱
+ List<string> wholeCasePallets = new List<string>();
+ Dictionary<string, string> palletLocationMap = new Dictionary<string, string>();
+ Dictionary<string, bool> palletIsWholeCaseMap = new Dictionary<string, bool>();
+ int? targetLocationType = null;
+
try
{
@@ -159,6 +174,7 @@
// 璁板綍鎬婚渶姹傛暟閲�
totalNeedAllocate = calculationResult.MaterielCalculations.Sum(x => x.UnallocatedQuantity);
+
// 2. 澶勭悊鐗╂枡鍒嗛厤
List<PickedStockDetailDTO> pickedDetails = new List<PickedStockDetailDTO>();
Dt_OutboundOrder outboundOrder = calculationResult.OutboundOrder;
@@ -192,11 +208,116 @@
materielCalc.OutStockLockInfos.Add(item);
}
outStockLockInfos.Add(item);
- }
+
+ if (outboundOrder.OrderType == 117)
+ {
+ // 鍖归厤褰撳墠鍗曟嵁鐨勯攣瀹氳褰�
+ if (outboundOrder.OrderNo == item.OrderNo)
+ {
+ // 鏌ヨ搴撳瓨淇℃伅
+ var stockInfo = _stockInfoRepository.QueryFirst(x => x.PalletCode == item.PalletCode);
+ if (stockInfo == null)
+ {
+ content = WebResponseContent.Instance.Error($"鎵樼洏{item.PalletCode}鏈煡璇㈠埌搴撳瓨淇℃伅锛屾棤娉曞鐞嗘暣绠卞嚭搴�");
+ _unitOfWorkManage.RollbackTran();
+ return content;
+ }
+
+ // 璁$畻搴撳瓨鎬婚噺锛屽垽鏂槸鍚︽暣绠憋紙澧炲姞0鍊间繚鎶わ級
+ decimal stockQuantity = _stockDetailRepository.QueryData(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity);
+ if (stockQuantity > 0 && stockQuantity == item.AssignQuantity)
+ {
+ // 鏍囪褰撳墠鎵樼洏涓烘暣绠憋紙鏍稿績淇锛氭寜鎵樼洏缁村害璁板綍鐘舵�侊級
+ if (!palletIsWholeCaseMap.ContainsKey(item.PalletCode))
+ {
+ palletIsWholeCaseMap.Add(item.PalletCode, true);
+ }
+ else
+ {
+ palletIsWholeCaseMap[item.PalletCode] = true;
+ }
+
+ // 鐩爣浠撳簱/璐т綅绫诲瀷鍙煡璇竴娆★紙鎬ц兘浼樺寲+绌哄�间繚鎶わ級
+ if (string.IsNullOrEmpty(targetWarehouse))
+ {
+ targetWarehouse = GetToWarehouseByOrderNo(request.OrderNo);
+ if (string.IsNullOrEmpty(targetWarehouse))
+ {
+ content = WebResponseContent.Instance.Error("鏅轰粨璋冩櫤浠撴暣绠卞嚭搴撳崟鎹湭閰嶇疆鐩爣浠撳簱");
+ _unitOfWorkManage.RollbackTran();
+ return content;
+ }
+
+ // 鏇挎崲First()涓篎irstOrDefault()锛岄伩鍏嶇┖鍊煎紓甯�
+ string warehouseAreaName = _warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>()
+ .Where(x => x.Code == targetWarehouse)
+ .Select(x => x.Name)
+ .First();
+ if (string.IsNullOrEmpty(warehouseAreaName))
+ {
+ content = WebResponseContent.Instance.Error($"鐩爣浠撳簱{targetWarehouse}鏈煡璇㈠埌瀵瑰簲鐨勫簱鍖哄悕绉�");
+ _unitOfWorkManage.RollbackTran();
+ return content;
+ }
+
+ int? locationType = _locationTypeRepository.Db.Queryable<Dt_LocationType>()
+ .Where(x => string.Equals(x.LocationTypeDesc, warehouseAreaName, StringComparison.OrdinalIgnoreCase))
+ .Select(x => x.LocationType)
+ .First();
+ if (!locationType.HasValue)
+ {
+ content = WebResponseContent.Instance.Error($"搴撳尯{warehouseAreaName}鏈尮閰嶅埌瀵瑰簲鐨勮揣浣嶇被鍨�");
+ _unitOfWorkManage.RollbackTran();
+ return content;
+ }
+ targetLocationType = locationType.Value;
+ }
+
+ // 鍒嗛厤鐩爣璐т綅锛堟瘡涓墭鐩樼嫭绔嬭揣浣嶏級
+ if (!palletLocationMap.ContainsKey(item.PalletCode) && targetLocationType.HasValue)
+ {
+ Dt_LocationInfo locationInfo = _locationInfoService.AssignLocation(targetLocationType.Value);
+ if (locationInfo == null || string.IsNullOrEmpty(locationInfo.LocationCode))
+ {
+ content = WebResponseContent.Instance.Error($"璐т綅绫诲瀷{targetLocationType.Value}鏈垎閰嶅埌鍙敤璐т綅锛堟墭鐩橈細{item.PalletCode}锛�");
+ _unitOfWorkManage.RollbackTran();
+ return content;
+ }
+ palletLocationMap.Add(item.PalletCode, locationInfo.LocationCode);
+ }
+
+ // 鍔犲叆鏁寸鎵樼洏鍒楄〃
+ if (!wholeCasePallets.Contains(item.PalletCode))
+ {
+ wholeCasePallets.Add(item.PalletCode);
+ }
+ }
+ else
+ {
+ if (!palletIsWholeCaseMap.ContainsKey(item.PalletCode))
+ {
+ palletIsWholeCaseMap.Add(item.PalletCode, false);
+ }
+ else
+ {
+ palletIsWholeCaseMap[item.PalletCode] = false;
+ }
+ }
+ }
+ }
+ }
// 澶勭悊浠诲姟
foreach (var item in materielPickedDetails.Tasks)
{
+ if (outboundOrder.OrderType == 117
+ && palletIsWholeCaseMap.ContainsKey(item.PalletCode)
+ && palletIsWholeCaseMap[item.PalletCode]
+ && palletLocationMap.ContainsKey(item.PalletCode))
+ {
+ item.TaskType = (int)TaskTypeEnum.Relocation;
+ item.TargetAddress = palletLocationMap[item.PalletCode];
+ }
if (tasks.FirstOrDefault(x => x.PalletCode == item.PalletCode) == null)
tasks.Add(item);
}
@@ -234,8 +355,26 @@
if (tasks.Any()) _taskRepository.AddData(tasks);
-
- _unitOfWorkManage.CommitTran();
+ if (outboundOrder.OrderType == 117 && wholeCasePallets.Any())
+ {
+ foreach (var palletCode in wholeCasePallets)
+ {
+ var completeReq = new OutboundCompletePalletRequestDTO
+ {
+ OrderNo = request.OrderNo,
+ PalletCode = palletCode
+ };
+
+ var res = CompleteOutboundWithPallet(completeReq);
+ if (!res.Status)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return res;
+ }
+ }
+ }
+
+ _unitOfWorkManage.CommitTran();
// 4. 鏋勯�犲搷搴旓細鍖哄垎銆屽叏閮ㄥ垎閰嶃�嶅拰銆岄儴鍒嗗垎閰嶃��
string responseMsg = totalActualAllocate == totalNeedAllocate
@@ -259,6 +398,18 @@
content = WebResponseContent.Instance.Error("澶勭悊鎷h揣鍑哄簱澶辫触锛�" + ex.Message);
}
return content;
+ }
+
+
+ /// <summary>
+ /// 鏍规嵁鍗曟嵁鍙疯幏鍙栫洰鏍囦粨搴�
+ /// </summary>
+ /// <param name="orderNo"></param>
+ /// <returns></returns>
+ public String GetToWarehouseByOrderNo(string orderNo)
+ {
+ var order =_allocateOrderRepository.QueryFirst(x => x.OrderNo == orderNo);
+ return order.ToWarehouse;
}
/// <summary>
@@ -1327,9 +1478,15 @@
_stockDetailHistoryRepository.AddData(historyRecords);
// 鍒犻櫎搴撳瓨鏄庣粏璁板綍
- _stockDetailRepository.DeleteData(stockInfo.Details);
+ var orderNo =_outboundRepository.QueryFirst(x => x.OrderNo == request.OrderNo);
+ if(orderNo.OrderType != 117)
+ {
+ _stockDetailRepository.DeleteData(stockInfo.Details);
+ }
_stockChangeRepository.AddData(changeRecords);
}
+
+
#endregion
#region 鎷i��
@@ -1549,6 +1706,10 @@
item.OverOutQuantity = item.LockQuantity;
}
+ if (item.OverOutQuantity == item.OrderQuantity)
+ {
+ item.OrderDetailStatus = (int)OrderDetailStatusEnum.Over;
+ }
updateDetails.Add(item);
List<Barcodes> barcodesList = new List<Barcodes>();
@@ -1643,7 +1804,7 @@
{
UpdateOutboundOrderStatus(request.OrderNo, OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt());
- if (outboundOrder.OrderType != OutOrderTypeEnum.InternalAllocat.ObjToInt() && outboundOrder.CreateType!=OrderCreateTypeEnum.CreateInSystem.ObjToInt())
+ if (outboundOrder.CreateType!=OrderCreateTypeEnum.CreateInSystem.ObjToInt())
{
_feedbackMesService.OutboundFeedback(outboundOrder.OrderNo);
}
@@ -2191,5 +2352,7 @@
}
#endregion
+
+
}
}
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_StockService/StockDetailByMaterielService.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_StockService/StockDetailByMaterielService.cs"
index 385eed4..626c036 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_StockService/StockDetailByMaterielService.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_StockService/StockDetailByMaterielService.cs"
@@ -167,10 +167,8 @@
}
int count = groupedData.Count;
- return new PageGridData<StockDetailByMateriel>(count, materielnfoStatistics)
- {
- TotalStockQuantity = totalStockQuantity
- };
+ return new PageGridData<StockDetailByMateriel>(count, materielnfoStatistics);
+
}
catch (Exception ex)
{
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_TaskInfoService/TaskService.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_TaskInfoService/TaskService.cs"
index 99cb413..9a74826 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_TaskInfoService/TaskService.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_TaskInfoService/TaskService.cs"
@@ -58,6 +58,7 @@
using WIDESEA_IStockService;
using WIDESEA_ITaskInfoService;
using WIDESEA_Model.Models;
+using WIDESEA_Model.Models.Basic;
using WIDESEA_Model.Models.Check;
using WIDESEA_Model.Models.Outbound;
using static HslCommunication.Profinet.Knx.KnxCode;
@@ -95,6 +96,8 @@
private readonly HttpClientHelper _httpClientHelper;
private readonly IBasicService _basicService;
private readonly IRepository<Dt_TakeStockOrder> _takeStockOrder;
+ public readonly IRepository<Dt_LocationType> _locationTypeRepository;
+ public readonly IRepository<Dt_WarehouseArea> _warehouseAreaRepository;
public IRepository<Dt_Task> Repository => BaseDal;
private Dictionary<string, SqlSugar.OrderByType> _taskOrderBy = new()
@@ -114,7 +117,7 @@
public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList();
- public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper, IBasicService basicService,IRepository<Dt_TakeStockOrder> takeStockOrder) : base(BaseDal)
+ public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper, IBasicService basicService,IRepository<Dt_TakeStockOrder> takeStockOrder, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository) : base(BaseDal)
{
_mapper = mapper;
_unitOfWorkManage = unitOfWorkManage;
@@ -143,6 +146,8 @@
_httpClientHelper = httpClientHelper;
_basicService = basicService;
_takeStockOrder = takeStockOrder;
+ _locationTypeRepository = locationTypeRepository;
+ _warehouseAreaRepository = warehouseAreaRepository;
}
public async Task TaskStatusChange(string taskNum, TaskStatusEnum taskStatusEnum)
@@ -482,6 +487,293 @@
return WebResponseContent.Instance.OK();
}
+ public async Task<WebResponseContent> RelocationTaskCompleted(Dt_Task task)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ if (task == null || string.IsNullOrEmpty(task.PalletCode) || string.IsNullOrEmpty(task.TargetAddress))
+ {
+ return WebResponseContent.Instance.Error("绉诲簱浠诲姟淇℃伅涓嶅畬鏁达紙鎵樼洏鍙�/鐩爣璐т綅涓虹┖锛�");
+ }
+
+ // 2. 鏌ヨ鎵樼洏搴撳瓨淇℃伅
+ Dt_StockInfo stockInfo = await _stockRepository.Db.Queryable<Dt_StockInfo>()
+ .Includes(x => x.Details)
+ .Where(x => x.PalletCode == task.PalletCode)
+ .FirstAsync();
+
+ if (stockInfo == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒版墭鐩榌{task.PalletCode}]瀵瑰簲鐨勭粍鐩樹俊鎭�");
+ }
+
+ // 闈炵┖鎵樼洏蹇呴』鏈夋槑缁�
+ if (stockInfo.Details.Count == 0 && stockInfo.PalletType != PalletTypeEnum.Empty.ObjToInt())
+ {
+ _logger.LogInformation($"TaskService RelocationTaskCompleted: 鏈壘鍒拌鎵樼洏搴撳瓨鏄庣粏淇℃伅.{task.TaskNum}");
+ return WebResponseContent.Instance.Error($"鏈壘鍒拌鎵樼洏[{task.PalletCode}]搴撳瓨鏄庣粏淇℃伅");
+ }
+
+ // 3. 鏌ヨ鐩爣璐т綅+鍘熻揣浣嶄俊鎭�
+ Dt_LocationInfo targetLocationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
+ if (targetLocationInfo == null)
+ {
+ return content.Error($"鏈壘鍒板搴旂殑缁堢偣璐т綅[{task.TargetAddress}]淇℃伅");
+ }
+
+ // 鍘熻揣浣嶄俊鎭�
+ Dt_LocationInfo oldLocationInfo = null;
+ if (!string.IsNullOrEmpty(stockInfo.LocationCode))
+ {
+ oldLocationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode);
+ if (oldLocationInfo == null)
+ {
+ return content.Error($"鏈壘鍒板師璐т綅[{stockInfo.LocationCode}]淇℃伅");
+ }
+ }
+
+ // 4. 璐т綅鐘舵�佹牎楠�
+ if (targetLocationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt())
+ {
+ return WebResponseContent.Instance.Error($"鐩爣璐т綅[{task.TargetAddress}]鐘舵�佷笉姝g‘锛堝綋鍓嶄负宸插崰鐢級");
+ }
+
+ // 5. 寮�鍚簨鍔″鐞嗘牳蹇冮�昏緫
+ _unitOfWorkManage.BeginTran();
+
+ // 5.1 璁板綍鐩爣璐т綅鍘熺姸鎬侊紝鏇存柊涓哄崰鐢�
+ var beforeTargetLocationStatus = targetLocationInfo.LocationStatus;
+ targetLocationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
+ _locationInfoService.Repository.UpdateData(targetLocationInfo);
+
+ // 5.2 閲婃斁鍘熻揣浣�
+ int beforeOldLocationStatus = 0;
+ if (oldLocationInfo != null)
+ {
+ beforeOldLocationStatus = oldLocationInfo.LocationStatus;
+ // 鍘熻揣浣嶆仮澶嶄负绌洪棽
+ oldLocationInfo.LocationStatus = stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt()
+ ? LocationStatusEnum.Pallet.ObjToInt()
+ : LocationStatusEnum.Free.ObjToInt();
+ _locationInfoService.Repository.UpdateData(oldLocationInfo);
+ }
+ var stockLockInfo = _outStockLockInfoService.Db.Queryable<Dt_OutboundLockInfo_Hty>().Where(x => x.PalletCode == stockInfo.PalletCode && x.TaskNum == task.TaskNum).First();
+ var allocateOrderToWarehouse = _allocateOrderRepository.Db.Queryable<Dt_AllocateOrder>().Where(x => x.OrderNo == stockLockInfo.OrderNo).First();
+ // 5.3 鏇存柊搴撳瓨鏄庣粏鐘舵�侊紙绉诲簱瀹屾垚锛�
+ stockInfo.Details.ForEach(x =>
+ {
+ x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+ x.WarehouseCode = allocateOrderToWarehouse.ToWarehouse;
+ });
+ _stockService.StockInfoDetailService.Repository.UpdateData(stockInfo.Details);
+
+ // 5.4 鏇存柊搴撳瓨涓讳俊鎭紙缁戝畾鏂拌揣浣嶏級
+ string oldLocationCode = stockInfo.LocationCode; // 璁板綍鍘熻揣浣�
+ stockInfo.LocationCode = targetLocationInfo.LocationCode; // 缁戝畾鐩爣璐т綅
+ stockInfo.PalletCode = task.PalletCode;
+ stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+
+ var name =_warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>().Where(x => x.Code == allocateOrderToWarehouse.ToWarehouse).First();
+ var locationType =_locationTypeRepository.QueryFirst(x => x.LocationTypeDesc.Equals(name.Name));
+ if(locationType != null)
+ {
+ stockInfo.LocationType = locationType.LocationType;
+ }
+ _stockRepository.UpdateData(stockInfo);
+
+ // 5.5 鏇存柊浠诲姟鐘舵�佷负瀹屾垚
+ task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
+ var result = _task_HtyService.DeleteAndMoveIntoHty(task, OperateTypeEnum.鑷姩瀹屾垚);
+
+ // 鎻愪氦浜嬪姟
+ _unitOfWorkManage.CommitTran();
+
+ // 浠诲姟褰掓。澶辫触鍒欑洿鎺ュ垹闄�
+ if (!result)
+ {
+ await Db.Deleteable(task).ExecuteCommandAsync();
+ }
+
+ // 6. 澶勭悊鍑哄簱鍗�+璋冩嫧鐗╂枡淇℃伅
+ Dt_OutboundOrder outboundOrder = null;
+ //var firstDetail = stockInfo.Details.FirstOrDefault();
+ if (stockLockInfo != null && !string.IsNullOrEmpty(stockLockInfo.OrderNo))
+ {
+ outboundOrder = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>()
+ .Where(x => x.OrderNo == stockLockInfo.OrderNo)
+ .Includes(x => x.Details)
+ .First();
+
+ if (outboundOrder != null)
+ {
+ var allocatInfo =_allocateMaterialInfo.Db.Queryable<Dt_AllocateMaterialInfo>().Where(x => x.OrderNo == outboundOrder.OrderNo).ToList();
+ // 鍒犻櫎璋冩嫧鐗╂枡淇℃伅
+ foreach (var item in allocatInfo)
+ {
+ var inbounddetail = _allocateMaterialInfo.QueryFirst(x => x.OrderNo == item.OrderNo && x.Barcode == item.Barcode);
+ if (inbounddetail != null)
+ {
+ var alldelete = _allocateMaterialInfo.DeleteAndMoveIntoHty(inbounddetail, OperateTypeEnum.鑷姩鍒犻櫎);
+ if (!alldelete)
+ {
+ await Db.Deleteable(task).ExecuteCommandAsync();
+ }
+ }
+ }
+
+ // 7. 鍥炶皟MES
+ string Operator = outboundOrder.Modifier;
+ HttpResponseResult<MesResponseDTO> httpResponseResult = new HttpResponseResult<MesResponseDTO>();
+ string reqCode = Guid.NewGuid().ToString();
+ string reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ string requestData = string.Empty;
+ List<string> lineNos = new List<string>();
+
+ Dt_AllocateMaterialInfo allocateMaterialInfo = _allocateMaterialInfo.QueryFirst(x => x.OrderNo == outboundOrder.OrderNo);
+ // 绉诲簱鍦烘櫙锛氬嚭搴撳畬鎴愪笖鏈洖浼燤ES銆佹棤璋冩嫧鐗╂枡淇℃伅鏃跺洖璋�
+ if (outboundOrder.OrderStatus == OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt() && outboundOrder.ReturnToMESStatus == 0 && allocateMaterialInfo == null)
+ {
+ Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.OrderNo == outboundOrder.OrderNo);
+ if (allocateOrder == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒板搴旂殑璋冩嫧鍗昜{outboundOrder.OrderNo}]");
+ }
+
+ // 鏋勫缓绉诲簱鍥炶皟鏁版嵁
+ AllocationReturnDTO? returnDTO = BuildAllocationFeedbackData(
+ outboundOrder,
+ allocateOrder.FromWarehouse,
+ allocateOrder.ToWarehouse,
+ Operator);
+
+ if (returnDTO == null)
+ {
+ return WebResponseContent.Instance.Error($"鏋勫缓绉诲簱鍥炶皟瀵硅薄澶辫触");
+ }
+
+ string apiUrl = AppSettings.GetValue("AllocationFeedbackUrl");
+ returnDTO.ReqCode = reqCode;
+ returnDTO.ReqTime = reqTime;
+ JsonSerializerSettings settings = new JsonSerializerSettings
+ {
+ ContractResolver = new CamelCasePropertyNamesContractResolver()
+ };
+ requestData = JsonConvert.SerializeObject(returnDTO, settings);
+ lineNos = returnDTO.Details.Select(x => x.LineNo).ToList();
+ httpResponseResult = _httpClientHelper.Post<MesResponseDTO>(apiUrl, requestData);
+ httpResponseResult.ApiUrl = apiUrl;
+ }
+
+ // 8. 澶勭悊MES鍥炶皟缁撴灉
+ bool isSuccess = httpResponseResult.IsSuccess && httpResponseResult.Data?.Code == "200";
+ string message = "鎴愬姛";
+ if (!isSuccess)
+ {
+ if (!httpResponseResult.IsSuccess)
+ {
+ message = $"MES鎺ュ彛杩斿洖閿欒锛孒TTP浠g爜锛歿httpResponseResult.StatusCode}锛屼俊鎭細{httpResponseResult.ErrorMessage}";
+ }
+ else if (httpResponseResult?.Data?.Code != "200")
+ {
+ message = $"璋冪敤MES鎺ュ彛澶辫触锛屼唬鐮侊細{httpResponseResult?.Data?.Code}锛屼俊鎭細{httpResponseResult?.Data?.Message}";
+ }
+ }
+
+ // 9. 璁板綍MES鍥炰紶璁板綍
+ Dt_MesReturnRecord mesReturnRecord = new Dt_MesReturnRecord()
+ {
+ ApiUrl = httpResponseResult.ApiUrl,
+ InterfaceType = outboundOrder.OrderType == 0 ? 1 : 3, // 绉诲簱鎺ュ彛绫诲瀷锛氬鐢ㄨ皟鎷ㄧ被鍨�3
+ OrderId = outboundOrder.Id,
+ OrderNo = outboundOrder.OrderNo,
+ RequestCode = reqCode,
+ RequestData = requestData,
+ FailureReason = message,
+ LastReturnTime = DateTime.Now,
+ HttpStatusCode = httpResponseResult.StatusCode.ObjToInt(),
+ ResponseData = httpResponseResult.Content,
+ ReturnType = 0,
+ ReturnCount = 1,
+ ReturnStatus = isSuccess ? 1 : 2,
+ SuccessTime = isSuccess ? DateTime.Now : null
+ };
+
+ // 寮�鍚簨鍔′繚瀛楳ES璁板綍+鏇存柊鍑哄簱鍗曠姸鎬�
+ _unitOfWorkManage.BeginTran();
+ _unitOfWorkManage.Db.Insertable(mesReturnRecord).ExecuteCommand();
+
+ List<Dt_OutboundOrderDetail> outboundOrderDetails = outboundOrder.Details.Where(x => lineNos.Contains(x.lineNo)).ToList();
+ outboundOrderDetails.ForEach(x =>
+ {
+ if (x.OverOutQuantity == x.OrderQuantity - x.MoveQty)
+ {
+ x.ReturnToMESStatus = isSuccess ? 1 : 2;
+ }
+ else
+ {
+ x.ReturnToMESStatus = isSuccess ? 3 : 4;
+ }
+ x.CurrentDeliveryQty = 0;
+ x.ReturnJsonData = "";
+ });
+
+ mesReturnRecord.ReturnType = outboundOrder.Details.Count == outboundOrderDetails.Count ? 1 : 2;
+
+ if (outboundOrder.Details.Count == outboundOrderDetails.Count && outboundOrderDetails.All(x => x.ReturnToMESStatus == 1 || x.ReturnToMESStatus == 2))
+ {
+ outboundOrder.ReturnToMESStatus = isSuccess ? 1 : 2;
+ }
+ else
+ {
+ outboundOrder.ReturnToMESStatus = isSuccess ? 3 : 4;
+ }
+
+ _outboundOrderService.Db.Updateable(outboundOrderDetails).ExecuteCommand();
+ _outboundOrderService.UpdateData(outboundOrder);
+
+ _unitOfWorkManage.CommitTran();
+ }
+ }
+
+ // 10. 璁板綍璐т綅鐘舵�佸彉鏇达紙鐩爣璐т綅+鍘熻揣浣嶏級
+ try
+ {
+ // 璁板綍鐩爣璐т綅鐘舵�佸彉鏇�
+ _locationStatusChangeRecordService.AddLocationStatusChangeRecord(
+ targetLocationInfo,
+ beforeTargetLocationStatus,
+ StockChangeType.Inbound.ObjToInt(),
+ $"绉诲簱鍏ュ簱锛堝師璐т綅锛歿oldLocationCode}锛�",
+ task.TaskNum);
+
+ // 璁板綍鍘熻揣浣嶇姸鎬佸彉鏇达紙鑻ユ湁锛�
+ if (oldLocationInfo != null)
+ {
+ _locationStatusChangeRecordService.AddLocationStatusChangeRecord(
+ oldLocationInfo,
+ beforeOldLocationStatus,
+ StockChangeType.Outbound.ObjToInt(),
+ $"绉诲簱鍑哄簱锛堢洰鏍囪揣浣嶏細{targetLocationInfo.LocationCode}锛�",
+ task.TaskNum);
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogInformation($"RelocationTaskCompleted AddLocationStatusChangeRecord : {ex.Message} ");
+ }
+
+ return content;
+ }
+ catch (Exception ex)
+ {
+ // 浜嬪姟鍥炴粴
+ _unitOfWorkManage.RollbackTran();
+ _logger.LogError($"RelocationTaskCompleted 澶勭悊澶辫触锛歿ex.Message}", ex);
+ return await Task.FromResult(WebResponseContent.Instance.Error($"绉诲簱浠诲姟澶勭悊澶辫触锛歿ex.Message}"));
+ }
+ }
+
public HttpResponseResult<MesResponseDTO> responseModel(Dt_InboundOrder order, int InterfaceType, FeedbackInboundRequestModel model = null, AllocateDto allocateDto = null)
{
HttpResponseResult<MesResponseDTO> httpResponseResult = new HttpResponseResult<MesResponseDTO>();
@@ -529,7 +821,7 @@
ResponseData = httpResponseResult.Content,
ReturnType = 0,
ReturnCount = 1,
- ReturnStatus = httpResponseResult.IsSuccess ? 1 : 2,
+ ReturnStatus = isSuccess ? 1 : 2,
SuccessTime = httpResponseResult.IsSuccess ? DateTime.Now : null
};
_unitOfWorkManage.Db.Insertable(mesReturnRecord).ExecuteCommand();
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_TaskInfoService/TaskService_Outbound.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_TaskInfoService/TaskService_Outbound.cs"
index 79d9d7f..32ae529 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_TaskInfoService/TaskService_Outbound.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_TaskInfoService/TaskService_Outbound.cs"
@@ -4,6 +4,7 @@
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
using SqlSugar;
using System;
+using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
@@ -43,12 +44,47 @@
WebResponseContent content = new WebResponseContent();
try
{
- var stockInfos = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt() && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt()).WhereIF(locationType != 0, x => x.LocationType == locationType).Take(num).ToList();
+ Dictionary<string, SqlSugar.OrderByType> orderByDict = new Dictionary<string, SqlSugar.OrderByType>()
+ {
+ { nameof(Dt_LocationInfo.Layer), SqlSugar.OrderByType.Asc },
+ { nameof(Dt_LocationInfo.Row), SqlSugar.OrderByType.Asc },
+ { nameof(Dt_LocationInfo.Column), SqlSugar.OrderByType.Asc },
+ { nameof(Dt_LocationInfo.Depth), SqlSugar.OrderByType.Desc },
+ };
- if (stockInfos.Count() == 0)
+ var query = _stockRepository.Db.Queryable<Dt_StockInfo>()
+ .Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt()
+ && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt())
+ .WhereIF(locationType != 0, x => x.LocationType == locationType)
+ .LeftJoin<Dt_LocationInfo>((s, l) => s.LocationCode == l.LocationCode);
+
+ if (query.Count() == 0)
{
return WebResponseContent.Instance.Error("鏈壘鍒扮┖鎵樼洏搴撳瓨");
}
+
+ bool isFirstOrder = true;
+ foreach (var item in orderByDict)
+ {
+ string fieldName = item.Key.Equals("Column", StringComparison.OrdinalIgnoreCase)
+ ? $"l.[{item.Key}]"
+ : $"l.{item.Key}";
+
+ string sortSql = $"{fieldName} {(item.Value == SqlSugar.OrderByType.Asc ? "ASC" : "DESC")}";
+
+ if (isFirstOrder)
+ {
+ query = query.OrderBy(sortSql);
+ isFirstOrder = false;
+ }
+ else
+ {
+ query = query.OrderBy(sortSql);
+ }
+ }
+
+ var stockInfos = await query.Take(num).ToListAsync();
+
foreach (var stockInfo in stockInfos)
{
Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode);
@@ -97,6 +133,8 @@
}
}
+
+
/// <summary>
/// 鍑哄簱浠诲姟鏁版嵁澶勭悊
--
Gitblit v1.9.3