From f29f358f589f5b1c2589c07b65845650be7aafef Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期一, 08 十二月 2025 21:21:08 +0800
Subject: [PATCH] 代码优化
---
项目代码/WIDESEA_WMSClient/src/extension/stock/stockView.js | 164 ++++++++----
项目代码/WIDESEA_WMSClient/src/views/stock/stockView.vue | 64 ++++
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundPickingController.cs | 6
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs | 24 +
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundPickingService.cs | 7
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs | 133 ++++++---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_DictionaryService.cs | 62 ++++
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_RoleService.cs | 23 +
项目代码/WIDESEA_WMSClient/src/extension/basic/locationInfo.js | 16 -
项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/NoStockOut.vue | 176 ++++++++++--
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs | 64 ++++
11 files changed, 560 insertions(+), 179 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/basic/locationInfo.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/basic/locationInfo.js"
index d805115..8fd6b94 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/basic/locationInfo.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/basic/locationInfo.js"
@@ -48,21 +48,7 @@
}
}
- this.columns.push({
- field: '鎿嶄綔',
- title: '鎿嶄綔',
- width: 90,
- fixed: 'right',
- align: 'center',
- formatter: (row) => {
- return (
- '<i style="cursor: pointer;color: #2d8cf0;"class="el-icon-view">鏌ョ湅鏄庣粏</i>'
- );
- },
- click: (row) => {
- this.$refs.gridBody.open(row);
- }
- });
+
},
onInited() {
//妗嗘灦鍒濆鍖栭厤缃悗
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 95df14e..7e80215 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"
@@ -10,7 +10,12 @@
>
<div>
<!-- 鍗曟嵁杈撳叆鍖哄煙锛堟敮鎸佹壂鐮侊級 -->
- <el-form :inline="true" :model="orderForm" style="margin-bottom: 20px; align-items: flex-end;">
+ <el-form
+ :inline="true"
+ :model="orderForm"
+ style="margin-bottom: 20px; align-items: flex-end;"
+ @submit.prevent
+ >
<el-form-item label="鍑哄簱鍗曟嵁:" name="outboundOrderNo">
<el-input
v-model="orderForm.outboundOrderNo"
@@ -18,25 +23,35 @@
clearable
style="width: 220px; margin-right: 10px;"
@input="handleOutboundInput"
- @keyup.enter="focusPurchaseInput"
+ @keyup.enter="(e) => {
+ e.stopPropagation(); // 闃绘浜嬩欢鍐掓场
+ e.preventDefault(); // 闃绘榛樿琛屼负
+ focusBarcodeInputDirectly();
+ }"
ref="outboundInputRef"
></el-input>
</el-form-item>
<el-form-item label="閲囪喘鍗曟嵁:" name="purchaseOrderNo">
<el-input
v-model="orderForm.purchaseOrderNo"
- placeholder="璇疯緭鍏ユ垨鎵弿閲囪喘鍗曟嵁鍙�"
+ placeholder="鎵爜鏉$爜鍚庤嚜鍔ㄥ~鍏�"
clearable
style="width: 220px; margin-right: 10px;"
@input="handlePurchaseInput"
- @keyup.enter="focusBarcodeInput"
+ readonly
ref="purchaseInputRef"
></el-input>
</el-form-item>
</el-form>
<!-- 涓婃柟杈撳叆妗� -->
- <el-form :inline="true" :model="formData" ref="formRef" style="margin-bottom: 20px; align-items: flex-end;">
+ <el-form
+ :inline="true"
+ :model="formData"
+ ref="formRef"
+ style="margin-bottom: 20px; align-items: flex-end;"
+ @submit.prevent
+ >
<el-form-item
label="鎵弿鏉$爜:"
style="width: 80%"
@@ -47,10 +62,10 @@
ref="barcodeInputRef"
v-model="formData.barcode"
placeholder="璇蜂娇鐢ㄦ壂鐮佹灙鎵弿鏉$爜锛屾垨鎵嬪姩杈撳叆"
- @keyup.enter="handleScan"
+ @keydown.enter="debouncedHandleScan"
autofocus
class="custom-input"
- :disabled="!orderForm.outboundOrderNo || !orderForm.purchaseOrderNo"
+ :disabled="!orderForm.outboundOrderNo || loading"
></el-input>
</el-form-item>
<el-form-item>
@@ -59,7 +74,7 @@
size="small"
@click="handleScan"
class="custom-button"
- :disabled="!orderForm.outboundOrderNo || !orderForm.purchaseOrderNo || loading"
+ :disabled="!orderForm.outboundOrderNo || loading"
>
<Search /> 纭鎵弿
</el-button>
@@ -87,7 +102,7 @@
</div>
</transition-group>
<div class="empty-tip" v-if="scannedBarcodes.length === 0">
- <span>鏆傛棤鎵弿璁板綍锛岃鍏堣緭鍏ュ崟鎹悗鎵弿鏉$爜</span>
+ <span>鏆傛棤鎵弿璁板綍锛岃鍏堣緭鍏ュ嚭搴撳崟鎹悗鎵弿鏉$爜</span>
</div>
</el-scrollbar>
</div>
@@ -106,7 +121,17 @@
>
<Check /> 鎻愪氦鍑哄簱
</el-button>
- <el-button type="text" size="small" @click="showDetailBox = false" class="cancel-btn" :disabled="loading">
+ <el-button
+ type="text"
+ size="small"
+ @click="(e) => {
+ e.stopPropagation();
+ e.preventDefault();
+ showDetailBox = false;
+ }"
+ class="cancel-btn"
+ :disabled="loading"
+ >
鍙栨秷
</el-button>
</div>
@@ -116,9 +141,9 @@
</template>
<script setup>
-import { ref, reactive, onMounted, nextTick } from 'vue';
+import { ref, reactive, onMounted, nextTick, watch } from 'vue';
import { ElMessage } from 'element-plus';
-import { Search } from '@element-plus/icons-vue';
+import { Search, Check } from '@element-plus/icons-vue';
import VolBox from "@/components/basic/VolBox.vue";
import http from '@/api/http';
@@ -134,6 +159,8 @@
});
const scannedBarcodes = ref([]);
const loading = ref(false);
+// 鏂板锛氬瓨鍌ㄩ娆℃壂鎻忕殑閲囪喘鍗曞彿锛堢敤浜庝竴鑷存�ф牎楠岋級
+const firstPurchaseOrderNo = ref(null);
// 妯℃澘寮曠敤
const formRef = ref(null);
@@ -148,6 +175,25 @@
});
});
+// 鐩戝惉鎵弿鍒楄〃锛岃嫢涓虹┖鍒欓噸缃娆¢噰璐崟鍙�
+watch(scannedBarcodes, (newVal) => {
+ if (newVal.length === 0) {
+ firstPurchaseOrderNo.value = null;
+ orderForm.purchaseOrderNo = ""; // 鍚屾娓呯┖閲囪喘鍗曡緭鍏ユ
+ }
+}, { deep: true });
+
+// 绠�鍗曢槻鎶栧嚱鏁帮紙鏃犻渶渚濊禆lodash锛�
+const debounce = (fn, delay = 100) => {
+ let timer = null;
+ return (...args) => {
+ if (timer) clearTimeout(timer);
+ timer = setTimeout(() => {
+ fn.apply(this, args);
+ }, delay);
+ };
+};
+
// 鎵撳紑寮圭獥
const open = () => {
showDetailBox.value = true;
@@ -155,6 +201,8 @@
formData.barcode = "";
orderForm.outboundOrderNo = "";
orderForm.purchaseOrderNo = "";
+ // 閲嶇疆棣栨閲囪喘鍗曞彿
+ firstPurchaseOrderNo.value = null;
nextTick(() => {
outboundInputRef.value?.focus();
});
@@ -162,43 +210,55 @@
// 鍑哄簱鍗曡緭鍏ュ鐞嗭紙鎵爜鎴栨墜鍔ㄨ緭鍏ワ級
const handleOutboundInput = (value) => {
- // 鎵爜鏋緭鍏ラ�氬父浼氳嚜鍔ㄨЕ鍙慹nter浜嬩欢锛岃繖閲屼富瑕佸鐞嗘墜鍔ㄨ緭鍏ョ殑鎯呭喌
if (value && value.trim()) {
- // 鍙互鍦ㄨ繖閲屾坊鍔犲嚭搴撳崟鍙风殑鏍煎紡楠岃瘉閫昏緫
+ // 鍑哄簱鍗曞彿鏍煎紡楠岃瘉閫昏緫锛堟寜闇�淇濈暀锛�
}
};
// 閲囪喘鍗曡緭鍏ュ鐞嗭紙鎵爜鎴栨墜鍔ㄨ緭鍏ワ級
const handlePurchaseInput = (value) => {
if (value && value.trim()) {
- // 鍙互鍦ㄨ繖閲屾坊鍔犻噰璐崟鍙风殑鏍煎紡楠岃瘉閫昏緫
+ // 閲囪喘鍗曞彿鏍煎紡楠岃瘉閫昏緫锛堟寜闇�淇濈暀锛�
}
};
-// 鐒︾偣璺宠浆鍑芥暟
-const focusPurchaseInput = () => {
+// 鐩存帴璺宠浆鍒版潯鐮佽緭鍏ユ锛堟棤闇�鍏堝~閲囪喘鍗曪級
+const focusBarcodeInputDirectly = () => {
if (orderForm.outboundOrderNo.trim()) {
- purchaseInputRef.value?.focus();
+ barcodeInputRef.value?.focus();
} else {
ElMessage.warning("璇峰厛杈撳叆鏈夋晥鐨勫嚭搴撳崟鎹彿");
}
};
-const focusBarcodeInput = () => {
- if (orderForm.purchaseOrderNo.trim()) {
- barcodeInputRef.value?.focus();
- } else {
- ElMessage.warning("璇峰厛杈撳叆鏈夋晥鐨勯噰璐崟鎹彿");
+/**
+ * 鏍规嵁鏉$爜鏌ヨ閲囪喘鍗曟帴鍙o紙瀹屽叏瀵归綈绀轰緥璇锋眰鏍煎紡锛�
+ * @param {string} barcode 鏉$爜
+ * @returns {Promise<string>} 閲囪喘鍗曞彿
+ */
+const getPurchaseOrderByBarcode = async (barcode) => {
+ // 瀹屽叏鎸夌収绀轰緥鏍煎紡锛歶rl鎷兼帴鍙傛暟 + 绗簩涓弬鏁颁紶鎻愮ず鏂囨湰
+ const res = await http.post(`/api/OutboundPicking/GetPurchaseOrderByBarcode?barCode=${encodeURIComponent(barcode)}`, "鏌ヨ閲囪喘鍗曚腑...");
+
+ if (res.status !== true) {
+ throw new Error(res.message || "鏌ヨ閲囪喘鍗曞け璐�");
}
+ if (!res.data?.purchaseOrderNo) {
+ throw new Error("鏈煡璇㈠埌璇ユ潯鐮佸搴旂殑閲囪喘鍗�");
+ }
+ return res.data.purchaseOrderNo;
};
-// 鎵弿鏉$爜澶勭悊
+// 鎵弿鏉$爜鏍稿績閫昏緫
const handleScan = async () => {
if (!formRef.value) return;
+ // 楠岃瘉鏉$爜蹇呭~
await formRef.value.validateField('barcode');
const barcode = formData.barcode.trim();
-
+ const outboundOrderNo = orderForm.outboundOrderNo.trim();
+
+ // 妫�鏌ユ潯鐮佹槸鍚﹀凡鎵弿
if (scannedBarcodes.value.some(item => item.barcode === barcode)) {
ElMessage.warning(`鏉$爜 ${barcode} 宸叉壂鎻忚繃锛岃鍕块噸澶嶆壂鎻廯);
formData.barcode = "";
@@ -208,33 +268,72 @@
try {
loading.value = true;
- // 杩欓噷淇濈暀浜嗗師鏈夌殑鏉$爜楠岃瘉鎺ュ彛锛屼綘鍙互鏍规嵁瀹為檯闇�姹備慨鏀规垨淇濈暀
- const res = await http.post("/api/OutboundPicking/BarcodeValidate", {
- outOder: orderForm.outboundOrderNo, // 娉ㄦ剰锛氳繖閲岀幇鍦ㄤ紶閫掔殑鏄崟鎹彿瀛楃涓诧紝鑰屼笉鏄疘D
- inOder: orderForm.purchaseOrderNo, // 娉ㄦ剰锛氳繖閲岀幇鍦ㄤ紶閫掔殑鏄崟鎹彿瀛楃涓诧紝鑰屼笉鏄疘D
+
+ // 姝ラ1锛氫粎浼犳潯鐮佹煡璇㈤噰璐崟锛堜娇鐢ㄧず渚嬫牸寮忕殑璇锋眰锛�
+ const purchaseOrderNo = await getPurchaseOrderByBarcode(barcode);
+
+ // 鏍稿績鏍¢獙锛氶噰璐崟涓�鑷存�ф鏌�
+ if (firstPurchaseOrderNo.value) {
+ // 闈為娆℃壂鎻忥紝鏍¢獙閲囪喘鍗曞彿鏄惁涓�鑷�
+ if (purchaseOrderNo !== firstPurchaseOrderNo.value) {
+ throw new Error(`褰撳墠鏉$爜瀵瑰簲鐨勯噰璐崟銆�${purchaseOrderNo}銆戜笌棣栨鎵弿鐨勯噰璐崟銆�${firstPurchaseOrderNo.value}銆戜笉涓�鑷达紝绂佹鎵弿锛乣);
+ }
+ } else {
+ // 棣栨鎵弿锛岃褰曢噰璐崟鍙�
+ firstPurchaseOrderNo.value = purchaseOrderNo;
+ }
+
+ // 璧嬪�奸噰璐崟鍒拌緭鍏ユ
+ orderForm.purchaseOrderNo = purchaseOrderNo;
+ ElMessage.success(`鎴愬姛鏌ヨ鍒伴噰璐崟锛�${purchaseOrderNo}`);
+
+ // 姝ラ2锛氳皟鐢ㄥ師鏈夋潯鐮侀獙璇佹帴鍙o紙濡傞渶瀵归綈鏍煎紡鍙悓姝ヤ慨鏀癸紝姝ゅ淇濈暀鍘熸湁鏍煎紡锛�
+ const validateRes = await http.post("/api/OutboundPicking/BarcodeValidate", {
+ outOder: outboundOrderNo,
+ inOder: purchaseOrderNo,
barCode: barcode
});
- if (res.status === true) {
+ if (validateRes.status === true) {
scannedBarcodes.value.push({ barcode });
ElMessage.success("鎵弿鎴愬姛");
formData.barcode = "";
} else {
- ElMessage.error("鎵弿澶辫触锛�" + (res.message || '楠岃瘉澶辫触'));
+ ElMessage.error("鎵弿澶辫触锛�" + (validateRes.message || '鏉$爜楠岃瘉澶辫触'));
}
} catch (error) {
- ElMessage.error("鎵弿楠岃瘉寮傚父锛�" + error.message);
+ // 鎹曡幏閲囪喘鍗曚笉涓�鑷寸瓑閿欒骞舵彁绀�
+ ElMessage.error(error.message);
+ // 娓呯┖褰撳墠杈撳叆妗嗭紝鑱氱劍鏉$爜杈撳叆妗�
+ formData.barcode = "";
+ nextTick(() => barcodeInputRef.value?.focus());
} finally {
loading.value = false;
- nextTick(() => barcodeInputRef.value?.focus());
+ // 寮哄埗鑱氱劍鏉$爜杈撳叆妗嗭紝閬垮厤鐒︾偣璺冲埌寮圭獥澶�
+ nextTick(() => {
+ if (barcodeInputRef.value) {
+ barcodeInputRef.value.focus();
+ // 娓呯┖杈撳叆妗嗛�変腑鐘舵�侊紙鎵爜鏋彲鑳芥畫鐣欓�変腑锛�
+ if (barcodeInputRef.value.input) {
+ barcodeInputRef.value.input.select = () => {};
+ }
+ }
+ });
}
};
+
+// 甯﹂槻鎶栧拰浜嬩欢鎷︽埅鐨勬壂鎻忓鐞嗭紙閫傞厤鎵爜鏋級
+const debouncedHandleScan = debounce(async (e) => {
+ // 闃绘浜嬩欢鍐掓场鍜岄粯璁よ涓�
+ e.stopPropagation();
+ e.preventDefault();
+ await handleScan();
+}, 100);
// 绉婚櫎鍗曟潯鎵弿璁板綍
const removeItem = async (index, barcode) => {
try {
loading.value = true;
- // 杩欓噷淇濈暀浜嗗師鏈夌殑鍒犻櫎鏉$爜鎺ュ彛锛屼綘鍙互鏍规嵁瀹為檯闇�姹備慨鏀规垨淇濈暀
const res = await http.post("/api/OutboundPicking/DeleteBarcode", {
outOder: orderForm.outboundOrderNo,
inOder: orderForm.purchaseOrderNo,
@@ -244,6 +343,11 @@
if (res.status === true) {
scannedBarcodes.value.splice(index, 1);
ElMessage.success("鍒犻櫎鎴愬姛");
+ // 鑻ュ垹闄ゅ悗鏃犳潯鐮侊紝鑷姩閲嶇疆棣栨閲囪喘鍗曞彿鍜岄噰璐崟杈撳叆妗�
+ if (scannedBarcodes.value.length === 0) {
+ firstPurchaseOrderNo.value = null;
+ orderForm.purchaseOrderNo = "";
+ }
} else {
ElMessage.error("鍒犻櫎澶辫触锛�" + (res.message || '鍒犻櫎澶辫触'));
}
@@ -265,7 +369,6 @@
try {
loading.value = true;
- // 杩欓噷淇濈暀浜嗗師鏈夌殑鎻愪氦鎺ュ彛锛屾敞鎰忓弬鏁扮幇鍦ㄤ紶閫掔殑鏄崟鎹彿瀛楃涓�
const res = await http.post("/api/OutboundPicking/NoStockOutSubmit", {
OutOderSubmit: orderForm.outboundOrderNo,
InOderSubmit: orderForm.purchaseOrderNo,
@@ -275,6 +378,9 @@
if (res.status === true) {
ElMessage.success("鍑哄簱鎻愪氦鎴愬姛");
showDetailBox.value = false;
+ // 鎻愪氦鎴愬姛鍚庨噸缃姸鎬�
+ firstPurchaseOrderNo.value = null;
+ scannedBarcodes.value = [];
} else {
ElMessage.error("鍑哄簱鎻愪氦澶辫触锛�" + (res.message || '鎻愪氦澶辫触'));
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/stock/stockView.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/stock/stockView.js"
index 047c354..6e73be0 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/stock/stockView.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/stock/stockView.js"
@@ -31,65 +31,117 @@
// });
// }
// }
- // this.columns.forEach(column => {
- // if (column.field == 'materielCode') {
- // column.formatter = (row) => {
- // var str = '';
- // var list = row.materielCode.split(',');
- // for (let index = 0; index < list.length; index++) {
- // str += list[index] + '<br>';
- // }
- // return str = list[0] == "" ? "绌虹" : str;
- // }
- // }
- // if (column.field == 'batchNo') {
- // column.formatter = (row) => {
- // var str = '';
- // var list = row.batchNo.split(',');
- // for (let index = 0; index < list.length; index++) {
- // str += list[index] + '<br>';
- // }
- // return str = list[0] == "" ? "鏃�" : str;
- // }
- // }
- // if (column.field == 'materielInfo') {
- // const today = new Date()
- // column.formatter = (row) => {
- // if (row.details.length > 0) {
- // const today = new Date();
- // const closestDate = row.details
- // .map(x => {
- // const date = new Date(x.effectiveDate);
- // const diffInDays = Math.ceil(Math.abs((today - date) / (1000 * 60 * 60 * 24)));
- // return { date, diffInDays };
- // })
- // .reduce((closest, current) => (current.diffInDays < closest.diffInDays ? current : closest))
- // .date;
+ this.columns.forEach(column => {
+ // if (column.field == 'materielCode') {
+ // column.formatter = (row) => {
+ // var str = '';
+ // var list = row.materielCode.split(',');
+ // for (let index = 0; index < list.length; index++) {
+ // str += list[index] + '<br>';
+ // }
+ // return str = list[0] == "" ? "绌虹" : str;
+ // }
+ // }
+ // if (column.field == 'batchNo') {
+ // column.formatter = (row) => {
+ // var str = '';
+ // var list = row.batchNo.split(',');
+ // for (let index = 0; index < list.length; index++) {
+ // str += list[index] + '<br>';
+ // }
+ // return str = list[0] == "" ? "鏃�" : str;
+ // }
+ // }
+ // if (column.field == 'materielInfo') {
+ // const today = new Date()
+ // column.formatter = (row) => {
+ // if (row.details.length > 0) {
+ // const today = new Date();
+ // const closestDate = row.details
+ // .map(x => {
+ // const date = new Date(x.effectiveDate);
+ // const diffInDays = Math.ceil(Math.abs((today - date) / (1000 * 60 * 60 * 24)));
+ // return { date, diffInDays };
+ // })
+ // .reduce((closest, current) => (current.diffInDays < closest.diffInDays ? current : closest))
+ // .date;
- // const daysSinceClosest = Math.ceil(Math.abs((today - closestDate) / (1000 * 60 * 60 * 24)));
- // return '<span style="color: #F56C6C">' + daysSinceClosest + "澶�" + '</span>';
- // } else {
- // return '<span style="color: #F56C6C">' + "鏃犱繚璐ㄦ湡" + '</span>';
- // }
+ // const daysSinceClosest = Math.ceil(Math.abs((today - closestDate) / (1000 * 60 * 60 * 24)));
+ // return '<span style="color: #F56C6C">' + daysSinceClosest + "澶�" + '</span>';
+ // } else {
+ // return '<span style="color: #F56C6C">' + "鏃犱繚璐ㄦ湡" + '</span>';
+ // }
- // }
- // }
- // if (column.field == 'sumStock') {
- // column.formatter = (row) => {
- // if (row.details.length > 0) {
- // var sum = 0;
- // const closestDate = row.details
- // .map(x => {
- // sum += (x.stockQuantity)
- // })
- // return '<span style="color: #F56C6C">' + sum + row.details[0].unit + '</span>';
- // } else {
- // return '<span style="color: #F56C6C">' + "1涓�" + '</span>';
- // }
+ // }
+ // }
+ if (column.field == 'sumStock') {
+ column.formatter = (row) => {
+ if (row.details.length > 0) {
+ var sum = 0;
+ const closestDate = row.details
+ .map(x => {
+ sum += (x.stockQuantity)
+ })
+ return '<span style="color: #F56C6C">' + sum + row.details[0].unit + '</span>';
+ } else {
+ return '<span style="color: #F56C6C">' + "1涓�" + '</span>';
+ }
- // }
- // }
- // })
+ }
+ }
+ if (column.field === 'orderStatistics') {
+ column.formatter = (row) => {
+ // 鏍¢獙details鏄惁瀛樺湪涓旀湁鏁版嵁
+ if (row.details && row.details.length > 0) {
+ // 鎸塵aterielCode鍒嗙粍缁熻stockQuantity鎬诲拰锛屽苟璁板綍鍗曚綅锛堝彇绗竴涓潪绌哄崟浣嶏級
+ const materielSumMap = row.details.reduce((acc, item) => {
+ const materielCode = item.materielCode || '鏈煡鐗╂枡';
+ const quantity = Number(item.stockQuantity) || 0;
+ const unit = item.unit || ''; // 鑾峰彇鍗曚綅锛屾棤鍒欎负绌�
+
+ // 绱姞鏁伴噺
+ acc[materielCode] = {
+ total: (acc[materielCode]?.total || 0) + quantity,
+ unit: acc[materielCode]?.unit || unit // 淇濈暀绗竴涓潪绌哄崟浣�
+ };
+ return acc;
+ }, {});
+
+ // 姣忎釜鐗╂枡椤圭敓鎴愮嫭绔媎iv锛岃法琛屾樉绀猴紙鍖呭惈鍗曚綅锛�
+ const displayItems = Object.entries(materielSumMap).map(([code, data]) => {
+ // 澶勭悊鍗曚綅鏄剧ず锛氭湁鍗曚綅鍒欏姞绌烘牸鏄剧ず锛屾棤鍒欎笉鏄剧ず
+ const unitText = data.unit ? ` ${data.unit}` : '';
+ return `<div style="line-height: 1.5; white-space: normal;">${code}锛�${data.total}${unitText}</div>`;
+ });
+ const displayContent = displayItems.join('');
+ return `<div style="color: #F56C6C; white-space: normal; word-break: break-all;">${displayContent}</div>`;
+ } else {
+ return '<span style="color: #F56C6C">绌虹</span>';
+ }
+ };
+ }
+ if (column.field == 'stockOrderNo') {
+ column.formatter = (row) => {
+ // 鏈夋槑缁嗘暟鎹椂澶勭悊
+ if (row.details && row.details.length > 0) {
+ // 鎻愬彇鎵�鏈夐潪绌虹殑orderNO骞跺幓閲�
+ const uniqueOrderNOs = [...new Set(
+ row.details.map(item => item.orderNo).filter(no => no) // 杩囨护绌哄崟鎹彿
+ )];
+
+ // 鏈夋湁鏁堝崟鎹彿鍒欐崲琛屾樉绀猴紝鍚﹀垯鏄剧ず榛樿鏂囨湰
+ if (uniqueOrderNOs.length > 0) {
+ return `<span style="color: #F56C6C">${uniqueOrderNOs.join('<br>')}</span>`;
+ } else {
+ return '<span style="color: #F56C6C">鏆傛棤鍗曟嵁</span>';
+ }
+ } else {
+ // 鏃犳槑缁嗘暟鎹椂鏄剧ず榛樿鏂囨湰
+ return '<span style="color: #F56C6C">鏆傛棤鍗曟嵁</span>';
+ }
+ }
+ }
+ })
},
onInited() {
//妗嗘灦鍒濆鍖栭厤缃悗
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockView.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockView.vue"
index 13ce26a..2b25f87 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockView.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockView.vue"
@@ -37,7 +37,7 @@
const searchFormOptions = ref([
[
{ title: "鎵樼洏缂栧彿", field: "palletCode",type: "like" },
- // { title: "璐т綅缂栧彿", field: "locationCode",type: "like" },
+ { title: "璐т綅缂栧彿", field: "locationCode",type: "like" },
{ title: "璐т綅鐘舵��", field: "locationStatus" ,type: "selectList",dataKey: "locationStatusEnum",data: [],},
{ title: "搴撳瓨鐘舵��", field: "stockStatus",type: "selectList",dataKey: "stockStatusEmun",data: [],},
],
@@ -77,16 +77,10 @@
field: "locationName",
title: "璐т綅鍚嶇О",
type: "string",
- width: 270,
+ width: 150,
align: "left",
},
- {
- field: "warehouseId",
- title: "鎵�灞炰粨搴�",
- type: "string",
- width: 80,
- align: "left",
- },
+
{
field: "roadwayNo",
title: "宸烽亾缂栧彿",
@@ -96,15 +90,22 @@
hidden:true
},
{
- field: "materielCode",
- title: "鎵�鍚墿鏂欑紪鍙�",
+ field: "orderStatistics",
+ title: "鎵�鍚墿鏂欐槑缁�",
type: "string",
- width: 120,
+ width: 240,
align: "left",
},
{
field: "sumStock",
title: "鎬诲簱瀛�",
+ type: "string",
+ width: 140,
+ align: "left",
+ },
+ {
+ field: "stockOrderNo",
+ title: "鎵�鍚崟鎹�",
type: "string",
width: 140,
align: "left",
@@ -125,6 +126,45 @@
align: "left",
},
{
+ field: "enalbeStatus",
+ title: "璐т綅绂佺敤鐘舵��",
+ type: "string",
+ width: 140,
+ align: "left",
+ bind: { key: "enableStatusEnum", data: [] },
+ },
+ {
+ field: "locationStatus",
+ title: "璐т綅鐘舵��",
+ type: "string",
+ width: 140,
+ align: "left",
+ bind: { key: "locationStatusEnum", data: [] },
+ },
+ {
+ field: "locationType",
+ title: "璐т綅绫诲瀷",
+ type: "string",
+ width: 140,
+ align: "left",
+ bind:{key: "locationTypeEnum", data: []}
+ },
+ {
+ field: "stockStatus",
+ title: "搴撳瓨鐘舵��",
+ type: "string",
+ width: 140,
+ align: "left",
+ bind:{key: "stockStatusEmun", data: []}
+ },
+ {
+ field: "warehouseId",
+ title: "鎵�灞炰粨搴�",
+ type: "string",
+ width: 80,
+ align: "left",
+ },
+ {
field: "modifier",
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_IOutboundService/IOutboundPickingService.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_IOutboundService/IOutboundPickingService.cs"
index dda5c65..cb38bdc 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_IOutboundService/IOutboundPickingService.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_IOutboundService/IOutboundPickingService.cs"
@@ -51,5 +51,12 @@
WebResponseContent UnPalletQuantity(string orderNo);
WebResponseContent BarcodeMaterielGroup(BarcodeMaterielGroupDTO materielGroupDTO);
+
+ /// <summary>
+ /// 鏉$爜鏌ヨ鍏ュ簱鍗�
+ /// </summary>
+ /// <param name="barcode"></param>
+ /// <returns></returns>
+ public WebResponseContent GetPurchaseOrderByBarcode(string barcode);
}
}
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 4d20ff1..6b06a77 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"
@@ -2948,6 +2948,30 @@
return WebResponseContent.Instance.Error(ex.Message);
}
}
+
+ public WebResponseContent GetPurchaseOrderByBarcode(string barcode)
+ {
+ try
+ {
+ Dt_InboundOrderDetail inboundOrderDetail = _stockInfoDetailService.Db.Queryable<Dt_InboundOrderDetail>().Where(x=>x.Barcode == barcode&& x.OrderDetailStatus !=OrderDetailStatusEnum.Over.ObjToInt()).First();
+ if(inboundOrderDetail == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒拌鏉$爜{barcode}鐨勫叆搴撴槑缁嗘垨鑰呮槑缁嗙姸鎬佸凡鍏ユ櫤浠撳畬鎴�");
+ }
+ Dt_InboundOrder inboundOrder = _inboundOrderRepository.QueryFirst(x => x.Id == inboundOrderDetail.OrderId && x.OrderStatus != InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt());
+ if (inboundOrder == null)
+ {
+ return WebResponseContent.Instance.Error($"璇ュ叆搴撳崟{inboundOrder}鐘舵�佸凡鍏ユ櫤浠撳畬鎴�");
+ }
+ var resultData = new { purchaseOrderNo = inboundOrder.UpperOrderNo };
+
+ return WebResponseContent.Instance.OK("鏌ヨ閲囪喘鍗曟垚鍔�", data: resultData);
+ }
+ catch(Exception ex)
+ {
+ return WebResponseContent.Instance.Error(ex.Message);
+ }
+ }
#endregion
public WebResponseContent UnPalletQuantity(string orderNo)
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/StockInfoDetailService.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/StockInfoDetailService.cs"
index 450f6a7..89e548a 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/StockInfoDetailService.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/StockInfoDetailService.cs"
@@ -2,6 +2,8 @@
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Enums;
+using WIDESEA_Core.Helper;
using WIDESEA_Core.HttpContextUser;
using WIDESEA_DTO.Stock;
using WIDESEA_IStockService;
@@ -31,16 +33,53 @@
public PageGridData<StockInfoDetailWithPalletDto> GetPageData2(PageDataOptions options)
{
- PageGridData<Dt_StockInfoDetail> lists = base.GetPageData (options);
+ // 1. 鑾峰彇鍩虹鍒嗛〉鏁版嵁
+ PageGridData<Dt_StockInfoDetail> pageData = base.GetPageData(options);
+ List<Dt_StockInfoDetail> filteredDetails = pageData.Rows.ToList(); // 鍏堟嫹璐濆師濮嬫暟鎹�
- List<int> stockIds = lists.Rows.Select(detail => detail.StockId).Distinct().ToList();
- var stocks= _stockinfoRepository.QueryData(x => stockIds.Contains(x.Id)).ToList();
-
+ if (!string.IsNullOrEmpty(options.Wheres))
+ {
+ try
+ {
+ List<SearchParameters> searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
+ if (searchParametersList?.Any() == true)
+ {
+ foreach (var param in searchParametersList)
+ {
+ // 鍖归厤鎵樼洏缂栧彿鏌ヨ鏉′欢锛堝皬鍐欏瓧娈靛悕锛�
+ if (param.Name.Equals(nameof(Dt_StockInfo.PalletCode).FirstLetterToLower(), StringComparison.OrdinalIgnoreCase)
+ && !string.IsNullOrEmpty(param.Value?.ToString()))
+ {
+ // 浼樺寲锛氭壒閲忔煡璇紙濡傛灉鏈夊涓墭鐩樼爜锛岃繖閲屼篃鍙互鎵╁睍锛�
+ string palletCode = param.Value.ToString().Trim();
+ var targetStock = _stockinfoRepository.QueryFirst(x => x.PalletCode == palletCode);
- List<StockInfoDetailWithPalletDto> dtoList = lists.Rows
+ // 绌哄�兼牎楠岋細鏈壘鍒板搴旀墭鐩樼殑搴撳瓨锛岀洿鎺ヨ繃婊や负绌�
+ if (targetStock != null)
+ {
+ filteredDetails = filteredDetails.Where(x => x.StockId == targetStock.Id).ToList();
+ }
+ else
+ {
+ filteredDetails = new List<Dt_StockInfoDetail>();
+ }
+ break; // 鍗曚釜鎵樼洏鐮佹煡璇紝鍖归厤鍚庨��鍑哄惊鐜�
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+
+ List<int> stockIds = filteredDetails.Select(detail => detail.StockId).Distinct().ToList();
+ var stockDict = _stockinfoRepository.QueryData(x => stockIds.Contains(x.Id))
+ .ToDictionary(x => x.Id, x => x.PalletCode ?? "鏃犳墭鐩樼紪鍙�");
+
+ List<StockInfoDetailWithPalletDto> dtoList = filteredDetails
.Select(detail => new StockInfoDetailWithPalletDto
{
-
Id = detail.Id,
StockId = detail.StockId,
MaterielCode = detail.MaterielCode,
@@ -64,14 +103,17 @@
CreateDate = detail.CreateDate,
Modifier = detail.Modifier,
ModifyDate = detail.ModifyDate,
- PalletCode= stocks
- .FirstOrDefault(stock => stock.Id == detail.StockId)?
- .PalletCode ?? "鏃犳墭鐩樼紪鍙�"
+ PalletCode = stockDict.TryGetValue(detail.StockId, out var palletCode) ? palletCode : "鏃犳墭鐩樼紪鍙�"
})
.ToList();
- return new PageGridData<StockInfoDetailWithPalletDto> { Rows = dtoList, Total = lists.Total, Summary = lists.Summary };
+ return new PageGridData<StockInfoDetailWithPalletDto>
+ {
+ Rows = dtoList,
+ Total = pageData.Total,
+ Summary = pageData.Summary
+ };
}
}
- }
+ }
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/StockViewService.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/StockViewService.cs"
index e6aadcc..98cd527 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/StockViewService.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/StockViewService.cs"
@@ -5,6 +5,7 @@
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.DB.Models;
+using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
//using WIDESEA_Core.HostedService;
using WIDESEA_Core.Utilities;
@@ -27,52 +28,98 @@
public virtual PageGridData<StockViewDTO> GetPageData(PageDataOptions options)
{
- string where = options.ValidatePageOptions(typeof(StockViewDTO).GetProperties());
- //鑾峰彇鎺掑簭瀛楁
- //Dictionary<string, OrderByType> orderbyDic = options.GetPageDataSort(typeof(StockViewDTO).GetProperties());
- //List<OrderByModel> orderByModels = new List<OrderByModel>();
- //foreach (var item in orderbyDic)
- //{
- // OrderByModel orderByModel = new OrderByModel()
- // {
- // FieldName = item.Key,
- // OrderByType = item.Value
- // };
- // orderByModels.Add(orderByModel);
- //}
- int totalCount = 0;
-
- ISugarQueryable<Dt_StockInfo> sugarQueryable1 = _dbBase.Queryable<Dt_StockInfo>().Includes(x=>x.Details);
- ISugarQueryable<Dt_LocationInfo> sugarQueryable = _dbBase.Queryable<Dt_LocationInfo>();
- ISugarQueryable<Dt_StockInfoDetail> sugarQueryable2 = _dbBase.Queryable<Dt_StockInfoDetail>();
-
-
- List<StockViewDTO> list = sugarQueryable1.InnerJoin(sugarQueryable, (b, a) => a.LocationCode == b.LocationCode).WhereIF(!string.IsNullOrEmpty(where), where).Select((b, a) => new StockViewDTO
+ try
{
- LocationCode = b.LocationCode,
- Column = a.Column,
- CreateDate = b.CreateDate,
- Creater = b.Creater,
- Depth = a.Depth,
- EnalbeStatus = a.EnableStatus,
- Layer = a.Layer,
- LocationName = a.LocationName,
- LocationStatus = a.LocationStatus,
- LocationType = a.LocationType,
- Modifier = b.Modifier,
- ModifyDate = b.ModifyDate,
- PalletCode = b.PalletCode,
- StockRemark = b.Remark,
- RoadwayNo = a.RoadwayNo,
- Row = a.Row,
- StockId = b.Id,
- StockStatus = b.StockStatus,
- Details = b.Details,
- }).ToPageList(options.Page, options.Rows, ref totalCount);
+ ISugarQueryable<Dt_StockInfo> sugarQueryable1 = _dbBase.Queryable<Dt_StockInfo>().Includes(x => x.Details);
+ if (!string.IsNullOrEmpty(options.Wheres))
+ {
+ try
+ {
+ List<SearchParameters> searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
+ if (searchParametersList?.Any() == true)
+ {
+ foreach (var param in searchParametersList)
+ {
+ switch (param.Name)
+ {
+ case var name when name == nameof(Dt_StockInfoDetail.MaterielCode).FirstLetterToLower():
+ if (!string.IsNullOrEmpty(param.Value?.ToString()))
+ {
+ sugarQueryable1 = sugarQueryable1
+ .Where(x => x.Details.Any(v => v.MaterielCode.Contains(param.Value.ToString())));
+ }
+ break;
+ case var name when name == nameof(Dt_StockInfoDetail.BatchNo).FirstLetterToLower():
+ if (!string.IsNullOrEmpty(param.Value?.ToString()))
+ {
+ sugarQueryable1 = sugarQueryable1
+ .Where(x => x.Details.Any(v => v.BatchNo.Contains(param.Value.ToString())));
+ }
+ break;
+ case var name when name == nameof(Dt_StockInfo.LocationCode).FirstLetterToLower():
+ if (!string.IsNullOrEmpty(param.Value?.ToString()))
+ {
+ sugarQueryable1 = sugarQueryable1
+ .Where(x => x.LocationCode == param.Value.ToString());
+ }
+ break;
+ case var name when name == nameof(Dt_StockInfo.CreateDate).FirstLetterToLower():
+ if (DateTime.TryParse(param.Value?.ToString(), out DateTime minDate))
+ {
+ LinqExpressionType expressionType = param.DisplayType.GetLinqCondition();
+ if (expressionType == LinqExpressionType.ThanOrEqual)
+ {
+ sugarQueryable1 = sugarQueryable1.Where(x => x.CreateDate >= minDate);
+ }
+ else if (expressionType == LinqExpressionType.LessThanOrEqual)
+ {
+ sugarQueryable1 = sugarQueryable1.Where(x => x.CreateDate <= minDate);
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ EntityProperties.ValidatePageOptions(options, ref sugarQueryable1);
+ ISugarQueryable<Dt_LocationInfo> sugarQueryable = _dbBase.Queryable<Dt_LocationInfo>();
+ ISugarQueryable<StockViewDTO> list = sugarQueryable1.InnerJoin(sugarQueryable, (b, a) => a.LocationCode == b.LocationCode).Select((b, a) => new StockViewDTO
+ {
+ LocationCode = b.LocationCode,
+ Column = a.Column,
+ WarehouseId = b.WarehouseId,
+ CreateDate = b.CreateDate,
+ Creater = b.Creater,
+ Depth = a.Depth,
+ EnalbeStatus = a.EnableStatus,
+ Layer = a.Layer,
+ LocationName = a.LocationName,
+ LocationStatus = a.LocationStatus,
+ LocationType = a.LocationType,
+ Modifier = b.Modifier,
+ ModifyDate = b.ModifyDate,
+ PalletCode = b.PalletCode,
+ StockRemark = b.Remark,
+ RoadwayNo = a.RoadwayNo,
+ Row = a.Row,
+ StockId = b.Id,
+ StockStatus = b.StockStatus,
+ Details = b.Details,
+ });
+ int totalCount = 0;
+ var stockViewDTOs = list.ToPageList(options.Page, options.Rows, ref totalCount);
+ return new PageGridData<StockViewDTO>(totalCount, stockViewDTOs);
- return new PageGridData<StockViewDTO>(totalCount, list);
-
+ }
+ catch (Exception ex)
+ {
+ }
+ return new PageGridData<StockViewDTO>();
}
public virtual object GetDetailPage(PageDataOptions pageData)
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_SystemService/Sys_DictionaryService.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_SystemService/Sys_DictionaryService.cs"
index 4e2449d..9fde9bf 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_SystemService/Sys_DictionaryService.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_SystemService/Sys_DictionaryService.cs"
@@ -24,6 +24,7 @@
using WIDESEA_DTO.System;
using WIDESEA_ISystemService;
using WIDESEA_Model.Models;
+using WIDESEA_Model.Models.Basic;
namespace WIDESEA_SystemService
{
@@ -211,9 +212,66 @@
{
switch (key)
{
- default:
- return result;
+ case "warehouses":
+ {
+ List<object> data = new List<object>();
+
+ {
+ List<Dt_WarehouseArea> warehouses = BaseDal.Db.Queryable<Dt_WarehouseArea>().ToList();
+ int index = 0;
+ foreach (var item in warehouses)
+ {
+ data.Add(new { key = item.Code, value = item.Name });
+ index++;
+ }
+ }
+
+ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
+ }
+ break;
+ case "locationTypes":
+ {
+ List<object> data = new List<object>();
+
+ {
+ List<Dt_LocationType> warehouses = BaseDal.Db.Queryable<Dt_LocationType>().ToList();
+ int index = 0;
+ foreach (var item in warehouses)
+ {
+ data.Add(new { key = item.LocationType, value = item.LocationTypeDesc });
+ index++;
+ }
+ }
+
+ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
+ }
+ break;
+ case "stockStatusEmun":
+ {
+ List<object> data = new List<object>();
+ Type type = typeof(StockStatusEmun);
+ List<int> enums = Enum.GetValues(typeof(StockStatusEmun)).Cast<int>().ToList();
+ int index = 0;
+ foreach (var item in enums)
+ {
+ FieldInfo? fieldInfo = typeof(StockStatusEmun).GetField(((StockStatusEmun)item).ToString());
+ DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
+ if (description != null)
+ {
+ data.Add(new { key = item.ToString(), value = description.Description });
+ }
+ else
+ {
+ data.Add(new { key = item.ToString(), value = item.ToString() });
+ }
+ index++;
+ }
+
+ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
+ }
+ break;
}
+ return result;
}
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_SystemService/Sys_RoleService.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_SystemService/Sys_RoleService.cs"
index fb668b1..8762d58 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_SystemService/Sys_RoleService.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_SystemService/Sys_RoleService.cs"
@@ -187,12 +187,11 @@
//褰撳墠鐢ㄦ埛鐨勬潈闄�
List<Permissions> permissions = _MenuService.GetPermissions(App.User.RoleId);
- List<int> menuIds = _MenuService.Repository.QueryData(x => x.MenuId, x => x.MenuType == 1);
-
List<int> originalMeunIds = new List<int>();
//琚垎閰嶈鑹茬殑鏉冮檺
- List<Sys_RoleAuth> roleAuths = _RoleAuthService.Repository.QueryData(x => x.RoleId == roleId && menuIds.Contains(x.MenuId));
+ List<Sys_RoleAuth> roleAuths = _RoleAuthService.Repository.QueryData(x => x.RoleId == roleId);
List<Sys_RoleAuth> updateAuths = new List<Sys_RoleAuth>();
+ List<Sys_RoleAuth> addAuths = new List<Sys_RoleAuth>();
foreach (UserPermissionDTO x in userPermissions)
{
Permissions per = permissions.FirstOrDefault(p => p.MenuId == x.Id);
@@ -208,7 +207,21 @@
var auth = roleAuths.Where(r => r.MenuId == x.Id).Select(s => new { s.AuthId, s.AuthValue, s.MenuId }).FirstOrDefault();
string newAuthValue = string.Join(",", arr);
//鏉冮檺娌℃湁鍙戠敓鍙樺寲鍒欎笉澶勭悊
- if (auth == null || auth.AuthValue != newAuthValue)
+ if (auth == null)
+ {
+ addAuths.Add(new Sys_RoleAuth()
+ {
+ RoleId = roleId,
+ MenuId = x.Id,
+ AuthValue = string.Join(",", arr),
+ AuthId = auth == null ? 0 : auth.AuthId,
+ ModifyDate = DateTime.Now,
+ Modifier = App.User.UserName,
+ CreateDate = DateTime.Now,
+ Creater = App.User.UserName
+ });
+ }
+ else if (auth.AuthValue != newAuthValue)
{
updateAuths.Add(new Sys_RoleAuth()
{
@@ -231,7 +244,7 @@
//鏇存柊鏉冮檺
_RoleAuthService.Repository.UpdateData(updateAuths);
//鏂板鐨勬潈闄�
- _RoleAuthService.Repository.AddData(updateAuths);
+ _RoleAuthService.Repository.AddData(addAuths);
//鑾峰彇鏉冮檺鍙栨秷鐨勬潈闄�
int[] authIds = roleAuths.Where(x => userPermissions.Select(u => u.Id)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundPickingController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundPickingController.cs"
index 051be09..d62ed14 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundPickingController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundPickingController.cs"
@@ -145,5 +145,11 @@
{
return await Service.NoStockOutSubmit(noStockOutSubmit);
}
+
+ [HttpPost, HttpGet, Route("GetPurchaseOrderByBarcode"), AllowAnonymous]
+ public WebResponseContent GetPurchaseOrderByBarcode(string barcode)
+ {
+ return Service.GetPurchaseOrderByBarcode(barcode);
+ }
}
}
--
Gitblit v1.9.3