From 475fc7c0176aafe0e0833ba4dd5cab9fd5c18160 Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期三, 03 十二月 2025 15:26:37 +0800
Subject: [PATCH] 1
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs | 12
项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue | 21
项目代码/WIDESEA_WMSClient/src/extension/outbound/outboundOrder.js | 492 +++++++-------
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs | 165 ++--
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs | 96 +-
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm | 0
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs | 15
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm | 0
项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue | 76 ++
项目代码/WIDESEA_WMSClient/src/views/inbound/allocateinboundOrder.vue | 14
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_OutboundLockInfo.cs | 2
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs | 91 +-
项目代码/WIDESEA_WMSClient/src/extension/check/extend/StockSelect.vue | 2
项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/PickingRetuenPallet.vue | 15
项目代码/WIDESEA_WMSClient/src/views/outbound/allocateoutboundOrder.vue | 14
项目代码/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js | 16
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_PickingRecord.cs | 2
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateService.cs | 45 +
项目代码/WIDESEA_WMSClient/src/views/stock/stockInfoDetail.vue | 1
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/PickingReturnController.cs | 2
项目代码/WIDESEA_WMSClient/config/buttons.js | 8
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs | 6
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 535 ++++++++-------
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs | 281 +++++---
24 files changed, 1,137 insertions(+), 774 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/config/buttons.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/config/buttons.js"
index 703977c..32004c1 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/config/buttons.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/config/buttons.js"
@@ -199,6 +199,14 @@
type: 'warning',
onClick: function () {
}
+},{
+ name: "绌烘墭鍑哄簱",
+ // icon: 'el-icon-upload2',
+ class: '',
+ value: 'EmptyTrayOutbound',
+ type: 'primary',
+ onClick: function () {
+ }
},
]
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/check/extend/StockSelect.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/check/extend/StockSelect.vue"
index 388b79d..2c950a6 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/check/extend/StockSelect.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/check/extend/StockSelect.vue"
@@ -209,7 +209,7 @@
? "api/Task/GenerateOutboundTask?orderDetailId="
: "api/Task/GenerateOutboundTask?orderDetailId=";
this.http
- .post(url + this.row.id, this.selection, "鏁版嵁澶勭悊涓�")
+ .post(url + this.row.id+"&station="+this.outboundForm.selectedPlatform, this.selection, "鏁版嵁澶勭悊涓�")
.then((x) => {
if (!x.status) return this.$message.error(x.message);
this.$message.success("鎿嶄綔鎴愬姛");
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js"
index a3e70ed..38f5145 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js"
@@ -235,6 +235,7 @@
const mountNode = document.createElement('div');
document.body.appendChild(mountNode);
+ const boxCodeReg = /^[A-Z]\d{9}$/;
// 鍝嶅簲寮忚〃鍗曟暟鎹細鏂欑鐮侊紙蹇呭~锛屾壂鐮佹灙/鎵嬪姩杈撳叆锛�
const formData = reactive({
boxCode: '',
@@ -269,15 +270,23 @@
// 鎻愪氦琛ㄥ崟鐨勭粺涓�閫昏緫锛堜緵鍥炶溅瑙﹀彂鍜屾寜閽偣鍑诲叡鐢級
const submitForm = async () => {
const formRef = vnode.component.refs.batchInForm;
+
+ if (!boxCodeReg.test(formData.boxCode.trim())) {
+ ElMessage.warning('鏂欑鐮佹牸寮忛敊璇�');
+ selectBoxCodeInput();
+ return;
+ }
+
try {
// 鎵ц琛ㄥ崟鏍¢獙锛堟枡绠辩爜蹇呭~锛�
await formRef.validate();
} catch (err) {
- ElMessage.warning('璇疯緭鍏ユ湁鏁堢殑鏂欑鐮�');
+ const errorMsg = err?.[0]?.message || '璇疯緭鍏ユ湁鏁堢殑鏂欑鐮�';
+ ElMessage.warning(errorMsg);
+ selectBoxCodeInput();
return;
}
-
http.post('/api/InboundOrder/EmptyMaterielGroup', {
palletCode: formData.boxCode.trim(),
warehouseCode:formData.warehouseCode
@@ -333,7 +342,8 @@
model: formData,
rules: {
boxCode: [
- { required: true, message: '璇疯緭鍏ユ枡绠辩爜', trigger: ['blur', 'enter'] }
+ { required: true, message: '璇疯緭鍏ユ枡绠辩爜', trigger: ['blur', 'change'] },
+ { pattern: boxCodeReg, message: '鏂欑鐮佹牸寮忛敊璇�', trigger: ['blur', 'change'] }
],
warehouseCode:[
{ required: true, message: '璇烽�夋嫨鍖哄煙', trigger: ['change', 'blur'] }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
index db36e69..290038c 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
@@ -169,6 +169,7 @@
data() {
return {
palletVisible: this.visible,
+ trayBarcodeReg:/^[A-Z]\d{9}$/,
trayBarcode: '',
barcode: '',
materials: [],
@@ -209,9 +210,16 @@
trigger: 'change'
}
],
+ trayBarcode:[
+ {
+ pattern: this.trayBarcodeReg,
+ message: '鎵樼洏鍙锋牸寮忛敊璇紙闇�涓�1涓ぇ鍐欏瓧姣�+9涓暟瀛楋紝濡侫000008024锛�',
+ trigger: 'blur'
+ }
+ ],
warehouseType: [
{
- massage: '璇烽�夋嫨浠撳簱',
+ message: '璇烽�夋嫨浠撳簱',
trigger: 'change'
}
]
@@ -516,6 +524,7 @@
inputEl.focus();
this.currentFocus = 'tray';
this.scanTarget = 'tray';
+ inputEl.select();
}
}
},
@@ -705,6 +714,16 @@
this.error = '';
+ if(!this.trayBarcodeReg.test(currentTrayBarcode)){
+ ElMessage.warning({
+ message: '鎵樼洏鍙锋牸寮忛敊璇�',
+ type: 'warning',
+ duration: 3000
+ })
+ this.focusTrayInput();
+ return;
+ }
+
// 璁剧疆鎵樼洏鏉$爜鍚庯紝鑷姩鑱氱劍鍒扮墿鏂欒緭鍏ユ
this.focusBarcodeInput();
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/PickingRetuenPallet.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/PickingRetuenPallet.vue"
index a99859c..4aa4e57 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/PickingRetuenPallet.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/PickingRetuenPallet.vue"
@@ -169,6 +169,7 @@
data() {
return {
palletVisible: this.visible,
+ trayBarcodeReg: /^[A-Z]\d{9}$/,
trayBarcode: '',
barcode: '',
materials: [],
@@ -209,6 +210,13 @@
trigger: 'change'
}
],
+ trayBarcode: [
+ {
+ pattern: /^[A-Z]\d{9}$/,
+ message: '鎵樼洏鍙锋牸寮忛敊璇�',
+ trigger: 'blur'
+ }
+ ],
warehouseType: [
{
massage: '璇烽�夋嫨浠撳簱',
@@ -516,6 +524,7 @@
inputEl.focus();
this.currentFocus = 'tray';
this.scanTarget = 'tray';
+ inputEl.select();
}
}
},
@@ -705,6 +714,12 @@
this.error = '';
+ if (!this.trayBarcodeReg.test(currentTrayBarcode)) {
+ ElMessage.error('鎵樼洏鏉$爜鏍煎紡閿欒');
+ this.focusTrayInput();
+ return;
+ }
+
// 璁剧疆鎵樼洏鏉$爜鍚庯紝鑷姩鑱氱劍鍒扮墿鏂欒緭鍏ユ
this.focusBarcodeInput();
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue"
new file mode 100644
index 0000000..5db787b
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue"
@@ -0,0 +1,76 @@
+<template>
+ <vol-box v-model="show" title="绌烘墭鍑哄簱" :width="800" :height="600">
+ <template #content>
+ <el-form ref="form" :model="form" label-width="90px">
+ <el-form-item label="鍑哄簱鍖哄煙:">
+ <el-select v-model="locationType" placeholder="璇烽�夋嫨鍑哄簱鍖哄煙">
+ <el-option v-for="item in locationTypes" :key="item.locationType" :label="item.locationTypeDesc.toString()" :value="item.locationType">
+ </el-option>
+ </el-select>
+ </el-form-item>
+ </el-form>
+ <el-form ref="form" :model="form" label-width="90px">
+ <el-form-item label="鍑哄簱鏁伴噺:">
+ <el-select v-model="num" placeholder="璇烽�夋嫨鍑哄簱鏁伴噺">
+ <el-option v-for="item in 6" :key="item" :label="item.toString()" :value="item">
+ </el-option>
+ </el-select>
+ </el-form-item>
+ </el-form>
+ </template>
+ <template #footer>
+ <div>
+ <el-button type="danger" size="small" plain @click="submit">
+ <i class="el-icon-check">纭</i>
+ </el-button>
+ <el-button size="small" type="primary" plain @click="() => { this.show = false }">
+ <i class="el-icon-close">鍏抽棴</i>
+ </el-button>
+ </div>
+ </template>
+ </vol-box>
+</template>
+
+<script>
+import VolBox from '@/components/basic/VolBox.vue'
+export default {
+ components: {
+ 'vol-box': VolBox
+ },
+ data() {
+ return {
+ num: 1,
+ show: false,
+ locationTypes: [],
+ locationType:"",
+ }
+ },
+ methods: {
+ open() {
+ this.show = true
+ this.getData();
+ },
+ submit() {
+ this.$emit('parentCall', ($vue) => {
+ this.http.post(`/api/Task/PalletOutboundTask?num=${this.num}&locationType=${this.locationType}`, {}, '鏁版嵁澶勭悊涓�...')
+ .then((x) => {
+ if (!x.status) {
+ this.$message.error(x.message)
+ } else {
+ this.show = false
+ this.$Message.success(x.message)
+ $vue.refresh();
+ }
+ })
+ })
+ },
+
+ getData() {
+ this.http.post("api/LocationInfo/GetLocationTypes",null, "鏌ヨ涓�")
+ .then((x) => {
+ this.locationTypes = x.data;
+ })
+ },
+ }
+}
+</script>
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 5c024ce..bbd9987 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"
@@ -6,12 +6,13 @@
import gridBody from './extend/outOrderDetail.vue'
import gridHeader from './extend/NoStockOut.vue'
+import gridFooter from './extend/EmptyTrayOutbound.vue'
let extension = {
components: {
//鏌ヨ鐣岄潰鎵╁睍缁勪欢
gridHeader: gridHeader,
gridBody: gridBody,
- gridFooter: '',
+ gridFooter: gridFooter,
//鏂板缓銆佺紪杈戝脊鍑烘鎵╁睍缁勪欢
modelHeader: '',
modelBody: '',
@@ -20,6 +21,8 @@
tableAction: '', //鎸囧畾鏌愬紶琛ㄧ殑鏉冮檺(杩欓噷濉啓琛ㄥ悕,榛樿涓嶇敤濉啓)
buttons: {
view: [
+
+
/* {
name: '鍑哄簱',
type: 'primary',
@@ -45,260 +48,260 @@
});
}
}, */
- {
- name: '绌烘墭鐩樺嚭搴�',
- type: 'primary',
- value: '绌烘墭鐩樺嚭搴�',
- onClick: function () {
+ // {
+ // name: '绌烘墭鐩樺嚭搴�',
+ // type: 'primary',
+ // value: '绌烘墭鐩樺嚭搴�',
+ // onClick: function () {
- const platformOptions = Array.from({ length: 1 }, (_, i) => {
- const num = 1;
- return { label: `绔欏彴${num}`, value: `1-2` };
- });
+ // const platformOptions = Array.from({ length: 1 }, (_, i) => {
+ // const num = 1;
+ // return { label: `绔欏彴${num}`, value: `1-2` };
+ // });
- const quantityOptions = Array.from({ length: 6 }, (_, i) => ({
- label: (i + 1).toString(),
- value: i + 1
- }));
+ // const quantityOptions = Array.from({ length: 6 }, (_, i) => ({
+ // label: (i + 1).toString(),
+ // value: i + 1
+ // }));
- const warehouseOptions = ref([]);
- const isLoadingWarehouses = ref(false);
+ // const warehouseOptions = ref([]);
+ // const isLoadingWarehouses = ref(false);
- const getWarehouseList = async () => {
- isLoadingWarehouses.value = true;
- try {
- const { data, status } = await http.post('/api/LocationInfo/GetLocationTypes');
- if (status && Array.isArray(data)) {
- // 鏍煎紡鍖栦粨搴撻�夐」锛氶�傞厤ElSelect鐨刲abel-value鏍煎紡
- warehouseOptions.value = data.map(item => ({
- label: item.locationTypeDesc,
- value: item.locationType
- }));
- } else {
- ElMessage.error('鑾峰彇鍖哄煙鍒楄〃澶辫触');
- warehouseOptions.value = [];
- }
- } catch (err) {
- ElMessage.error('鍖哄煙鏁版嵁璇锋眰寮傚父锛岃绋嶅悗閲嶈瘯');
- warehouseOptions.value = [];
- } finally {
- isLoadingWarehouses.value = false;
- }
- };
+ // const getWarehouseList = async () => {
+ // isLoadingWarehouses.value = true;
+ // try {
+ // const { data, status } = await http.post('/api/LocationInfo/GetLocationTypes');
+ // if (status && Array.isArray(data)) {
+ // // 鏍煎紡鍖栦粨搴撻�夐」锛氶�傞厤ElSelect鐨刲abel-value鏍煎紡
+ // warehouseOptions.value = data.map(item => ({
+ // label: item.locationTypeDesc,
+ // value: item.locationType
+ // }));
+ // } else {
+ // ElMessage.error('鑾峰彇鍖哄煙鍒楄〃澶辫触');
+ // warehouseOptions.value = [];
+ // }
+ // } catch (err) {
+ // ElMessage.error('鍖哄煙鏁版嵁璇锋眰寮傚父锛岃绋嶅悗閲嶈瘯');
+ // warehouseOptions.value = [];
+ // } finally {
+ // isLoadingWarehouses.value = false;
+ // }
+ // };
- const mountNode = document.createElement('div');
- document.body.appendChild(mountNode);
+ // const mountNode = document.createElement('div');
+ // document.body.appendChild(mountNode);
- const formData = reactive({
- warehouseCode: '',
- palletCode: '',
- selectedPlatform: platformOptions[0].value,
- quantity: 1
- });
+ // const formData = reactive({
+ // warehouseCode: '',
+ // palletCode: '',
+ // selectedPlatform: platformOptions[0].value,
+ // quantity: 1
+ // });
- const vnode = createVNode(ElDialog, {
- title: '绌烘墭鐩樺嚭搴�',
- width: '500px',
- modelValue: true,
- appendToBody: true,
- onOpened: async () => {
- await getWarehouseList();
- const inputRef = vnode.component.refs.boxCodeInput;
- inputRef?.focus();
- },
- 'onUpdate:modelValue': (isVisible) => {
- if (!isVisible) {
- render(null, mountNode);
- document.body.removeChild(mountNode);
- }
- },
- style: {
- padding: '20px 0',
- borderRadius: '8px'
- }
- }, {
- default: () => h(ElForm, {
- model: formData,
- rules: {
- warehouseCode: [
- { required: true, message: '璇烽�夋嫨鍖哄煙', trigger: ['change', 'blur'] }
- ],
- palletCode: [
- { type: 'string', message: '鏂欑鍙峰繀椤讳负瀛楃涓�', trigger: 'blur' }
- ],
- selectedPlatform: [
- { required: true, message: '璇烽�夋嫨鍑哄簱绔欏彴', trigger: 'change' }
- ],
- quantity: [
- { required: true, message: '璇烽�夋嫨绌虹鏁伴噺', trigger: 'change' }
- ]
- },
- ref: 'batchOutForm',
- labelWidth: '100px',
- style: {
- padding: '0 30px',
- }
- },
- [
- // h(ElFormItem, {
- // label: '浠撳簱鍖哄煙',
- // prop: 'warehouseCode',
- // style: {
- // marginBottom: '24px'
- // }
- // }, [
- // h(ElSelect, {
- // placeholder: '璇烽�夋嫨浠撳簱鍖哄煙',
- // modelValue: formData.warehouseCode,
- // 'onUpdate:modelValue': (val) => {
- // formData.warehouseCode = val;
- // },
- // style: {
- // width: '100%',
- // height: '40px',
- // borderRadius: '4px',
- // borderColor: '#dcdfe6'
- // }
- // }, warehouseOptions.value.map(platform =>
- // h(ElOption, { label: platform.label, value: platform.value })
- // ))
- // ]),
- h(ElFormItem, {
- label: '鍑哄簱绔欏彴',
- prop: 'selectedPlatform',
- style: {
- marginBottom: '24px'
- }
- }, [
- h(ElSelect, {
- placeholder: '璇烽�夋嫨鍑哄簱绔欏彴',
- modelValue: formData.selectedPlatform,
- 'onUpdate:modelValue': (val) => {
- formData.selectedPlatform = val;
- },
- style: {
- width: '100%',
- height: '40px',
- borderRadius: '4px',
- borderColor: '#dcdfe6'
- }
- }, platformOptions.map(platform =>
- h(ElOption, { label: platform.label, value: platform.value })
- ))
- ]),
- // h(ElFormItem,{
- // label:'鍑哄簱鏁伴噺',
- // prop:'quantity',
- // style:{
- // marginBottom:'24px'
- // }
- // },[h(ElSelect,{
- // placeholder:'璇烽�夋嫨绌虹鏁伴噺',
- // modelValue:formData.quantity,
- // 'onUpdate:modelValue':(val)=>{
- // formData.quantity=val;
- // },
- // style:{
- // width:'100%',
- // height:'40px',
- // borderRadius:'4px',
- // borderColor:'#dcdfe6'
- // },
- // filterable:false
- // },
- // quantityOptions.map(option=>
- // h(ElOption,{
- // label:option.label,
- // value:option.value
- // })
- // )
- // )]),
- h(ElFormItem, {
- label: '鏂欑鍙�',
- prop: 'palletCode',
- style: {
- marginBottom: '16px'
- }
- }, [
- h(ElInput, {
- type: 'text',
- placeholder: '鍙�夎緭鍏ユ枡绠卞彿锛屼笉濉垯鑷姩鍒嗛厤绌烘枡绠�',
- modelValue: formData.palletCode,
- 'onUpdate:modelValue': (val) => {
- formData.palletCode = val;
- },
- style: {
- width: '100%',
- height: '40px',
- borderRadius: '4px',
- borderColor: '#dcdfe6'
- },
- attrs: {
- placeholderStyle: 'color: #909399;'
- }
- })
- ]),
+ // const vnode = createVNode(ElDialog, {
+ // title: '绌烘墭鐩樺嚭搴�',
+ // width: '500px',
+ // modelValue: true,
+ // appendToBody: true,
+ // onOpened: async () => {
+ // await getWarehouseList();
+ // const inputRef = vnode.component.refs.boxCodeInput;
+ // inputRef?.focus();
+ // },
+ // 'onUpdate:modelValue': (isVisible) => {
+ // if (!isVisible) {
+ // render(null, mountNode);
+ // document.body.removeChild(mountNode);
+ // }
+ // },
+ // style: {
+ // padding: '20px 0',
+ // borderRadius: '8px'
+ // }
+ // }, {
+ // default: () => h(ElForm, {
+ // model: formData,
+ // rules: {
+ // warehouseCode: [
+ // { required: true, message: '璇烽�夋嫨鍖哄煙', trigger: ['change', 'blur'] }
+ // ],
+ // palletCode: [
+ // { type: 'string', message: '鏂欑鍙峰繀椤讳负瀛楃涓�', trigger: 'blur' }
+ // ],
+ // selectedPlatform: [
+ // { required: true, message: '璇烽�夋嫨鍑哄簱绔欏彴', trigger: 'change' }
+ // ],
+ // quantity: [
+ // { required: true, message: '璇烽�夋嫨绌虹鏁伴噺', trigger: 'change' }
+ // ]
+ // },
+ // ref: 'batchOutForm',
+ // labelWidth: '100px',
+ // style: {
+ // padding: '0 30px',
+ // }
+ // },
+ // [
+ // // h(ElFormItem, {
+ // // label: '浠撳簱鍖哄煙',
+ // // prop: 'warehouseCode',
+ // // style: {
+ // // marginBottom: '24px'
+ // // }
+ // // }, [
+ // // h(ElSelect, {
+ // // placeholder: '璇烽�夋嫨浠撳簱鍖哄煙',
+ // // modelValue: formData.warehouseCode,
+ // // 'onUpdate:modelValue': (val) => {
+ // // formData.warehouseCode = val;
+ // // },
+ // // style: {
+ // // width: '100%',
+ // // height: '40px',
+ // // borderRadius: '4px',
+ // // borderColor: '#dcdfe6'
+ // // }
+ // // }, warehouseOptions.value.map(platform =>
+ // // h(ElOption, { label: platform.label, value: platform.value })
+ // // ))
+ // // ]),
+ // h(ElFormItem, {
+ // label: '鍑哄簱绔欏彴',
+ // prop: 'selectedPlatform',
+ // style: {
+ // marginBottom: '24px'
+ // }
+ // }, [
+ // h(ElSelect, {
+ // placeholder: '璇烽�夋嫨鍑哄簱绔欏彴',
+ // modelValue: formData.selectedPlatform,
+ // 'onUpdate:modelValue': (val) => {
+ // formData.selectedPlatform = val;
+ // },
+ // style: {
+ // width: '100%',
+ // height: '40px',
+ // borderRadius: '4px',
+ // borderColor: '#dcdfe6'
+ // }
+ // }, platformOptions.map(platform =>
+ // h(ElOption, { label: platform.label, value: platform.value })
+ // ))
+ // ]),
+ // // h(ElFormItem,{
+ // // label:'鍑哄簱鏁伴噺',
+ // // prop:'quantity',
+ // // style:{
+ // // marginBottom:'24px'
+ // // }
+ // // },[h(ElSelect,{
+ // // placeholder:'璇烽�夋嫨绌虹鏁伴噺',
+ // // modelValue:formData.quantity,
+ // // 'onUpdate:modelValue':(val)=>{
+ // // formData.quantity=val;
+ // // },
+ // // style:{
+ // // width:'100%',
+ // // height:'40px',
+ // // borderRadius:'4px',
+ // // borderColor:'#dcdfe6'
+ // // },
+ // // filterable:false
+ // // },
+ // // quantityOptions.map(option=>
+ // // h(ElOption,{
+ // // label:option.label,
+ // // value:option.value
+ // // })
+ // // )
+ // // )]),
+ // h(ElFormItem, {
+ // label: '鏂欑鍙�',
+ // prop: 'palletCode',
+ // style: {
+ // marginBottom: '16px'
+ // }
+ // }, [
+ // h(ElInput, {
+ // type: 'text',
+ // placeholder: '鍙�夎緭鍏ユ枡绠卞彿锛屼笉濉垯鑷姩鍒嗛厤绌烘枡绠�',
+ // modelValue: formData.palletCode,
+ // 'onUpdate:modelValue': (val) => {
+ // formData.palletCode = val;
+ // },
+ // style: {
+ // width: '100%',
+ // height: '40px',
+ // borderRadius: '4px',
+ // borderColor: '#dcdfe6'
+ // },
+ // attrs: {
+ // placeholderStyle: 'color: #909399;'
+ // }
+ // })
+ // ]),
- h('div', {
- style: {
- textAlign: 'right',
- marginTop: '8px',
- paddingRight: '4px'
- }
- }, [
- h(ElButton, {
- type: 'text',
- onClick: () => {
- render(null, mountNode);
- document.body.removeChild(mountNode);
- ElMessage.info('鍙栨秷鍑哄簱鎿嶄綔');
- },
- style: {
- marginRight: '8px',
- color: '#606266'
- }
- }, '鍙栨秷'),
- h(ElButton, {
- type: 'primary',
- onClick: async () => {
- const formRef = vnode.component.refs.batchOutForm;
- try {
- await formRef.validate();
- } catch (err) {
- return;
- }
+ // h('div', {
+ // style: {
+ // textAlign: 'right',
+ // marginTop: '8px',
+ // paddingRight: '4px'
+ // }
+ // }, [
+ // h(ElButton, {
+ // type: 'text',
+ // onClick: () => {
+ // render(null, mountNode);
+ // document.body.removeChild(mountNode);
+ // ElMessage.info('鍙栨秷鍑哄簱鎿嶄綔');
+ // },
+ // style: {
+ // marginRight: '8px',
+ // color: '#606266'
+ // }
+ // }, '鍙栨秷'),
+ // h(ElButton, {
+ // type: 'primary',
+ // onClick: async () => {
+ // const formRef = vnode.component.refs.batchOutForm;
+ // try {
+ // await formRef.validate();
+ // } catch (err) {
+ // return;
+ // }
- http.post('/api/Task/PalletOutboundTask?palletCode=' + formData.palletCode + '&endStation=' + formData.selectedPlatform, {
+ // http.post('/api/Task/PalletOutboundTask?palletCode=' + formData.palletCode + '&endStation=' + formData.selectedPlatform, {
- }).then(({ data, status, message }) => {
- if (status) {
+ // }).then(({ data, status, message }) => {
+ // if (status) {
- ElMessage.success(`鍑哄簱鎴愬姛`);
- this.refresh();
- render(null, mountNode);
- document.body.removeChild(mountNode);
- } else {
- ElMessage.error(message || data?.message || '鍑哄簱澶辫触');
- }
- }).catch(() => {
- ElMessage.error('璇锋眰澶辫触锛岃绋嶅悗閲嶈瘯');
- });
- },
- style: {
- borderRadius: '4px',
- padding: '8px 20px'
- }
- }, '纭畾')
- ])
- ])
- });
+ // ElMessage.success(`鍑哄簱鎴愬姛`);
+ // this.refresh();
+ // render(null, mountNode);
+ // document.body.removeChild(mountNode);
+ // } else {
+ // ElMessage.error(message || data?.message || '鍑哄簱澶辫触');
+ // }
+ // }).catch(() => {
+ // ElMessage.error('璇锋眰澶辫触锛岃绋嶅悗閲嶈瘯');
+ // });
+ // },
+ // style: {
+ // borderRadius: '4px',
+ // padding: '8px 20px'
+ // }
+ // }, '纭畾')
+ // ])
+ // ])
+ // });
- vnode.appContext = this.$.appContext;
- render(vnode, mountNode);
- }
- }
+ // vnode.appContext = this.$.appContext;
+ // render(vnode, mountNode);
+ // }
+ // }
], box: [], detail: []
}, //鎵╁睍鐨勬寜閽�
methods: {
@@ -364,6 +367,13 @@
}
}
+ var EmptyTrayOutboundBtn = this.buttons.find(x => x.value == "EmptyTrayOutbound");
+ if (EmptyTrayOutboundBtn != null) {
+ EmptyTrayOutboundBtn.onClick = () => {
+ this.$refs.gridFooter.open();
+ }
+ }
+
},
onInited() {
//妗嗘灦鍒濆鍖栭厤缃悗
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/allocateinboundOrder.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/allocateinboundOrder.vue"
index 33c7454..7015bbe 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/allocateinboundOrder.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/allocateinboundOrder.vue"
@@ -174,6 +174,20 @@
bind: { key: "createType", data: [] },
},
{
+ field: "fromWarehouse",
+ title: "璋冨嚭浠撳簱",
+ type: "string",
+ width: 120,
+ align: "left",
+ },
+ {
+ field: "toWarehouse",
+ title: "璋冨叆浠撳簱",
+ type: "string",
+ width: 120,
+ align: "left",
+ },
+ {
field: "factoryArea",
title: "鍘傚尯",
type: "string",
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/allocateoutboundOrder.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/allocateoutboundOrder.vue"
index 555ac55..2a9a15e 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/allocateoutboundOrder.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/allocateoutboundOrder.vue"
@@ -194,6 +194,20 @@
bind: { key: "createType", data: [] },
},
{
+ field: "fromWarehouse",
+ title: "璋冨嚭浠撳簱",
+ type: "string",
+ width: 120,
+ align: "left",
+ },
+ {
+ field: "toWarehouse",
+ title: "璋冨叆浠撳簱",
+ type: "string",
+ width: 120,
+ align: "left",
+ },
+ {
field: "factoryArea",
title: "鍘傚尯",
type: "string",
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetail.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetail.vue"
index 9287497..c5f6168 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetail.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetail.vue"
@@ -66,6 +66,7 @@
{ title: "鐗╂枡缂栧彿", field: "materielCode" ,type:'like'},
{ title: "鐗╂枡鍚嶇О", field: "materielName" ,type:'like'},
{ title: "鍗曟嵁缂栧彿", field: "orderNo" ,type:'like'},
+ { title: "鎵樼洏鍙�", field: "palletCode" ,type:'like'},
],
]);
const columns = ref([
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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm" "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm"
index 3009c83..fae3bf5 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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm"
+++ "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm"
Binary files differ
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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm" "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm"
index 7e80632..332c120 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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm"
+++ "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm"
Binary files differ
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_AllocateService/AllocateService.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_AllocateService/AllocateService.cs"
index 2a28e3e..f29e43e 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_AllocateService/AllocateService.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_AllocateService/AllocateService.cs"
@@ -439,6 +439,51 @@
}
}
+ public override PageGridData<Dt_AllocateOrder> GetPageData(PageDataOptions options)
+ {
+ string wheres = ValidatePageOptions(options);
+ //鑾峰彇鎺掑簭瀛楁
+ Dictionary<string, SqlSugar.OrderByType> orderbyDic = GetPageDataSort(options, TProperties);
+ List<OrderByModel> orderByModels = new List<OrderByModel>();
+ foreach (var item in orderbyDic)
+ {
+ OrderByModel orderByModel = new()
+ {
+ FieldName = item.Key,
+ OrderByType = item.Value
+ };
+ orderByModels.Add(orderByModel);
+ }
+
+
+ int totalCount = 0;
+ List<SearchParameters> searchParametersList = new List<SearchParameters>();
+ if (!string.IsNullOrEmpty(options.Wheres))
+ {
+ try
+ {
+ searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
+ options.Filter = searchParametersList;
+ }
+ catch { }
+ }
+ var data = BaseDal.Db.Queryable<Dt_AllocateOrder>()
+ .WhereIF(!wheres.IsNullOrEmpty(), wheres)
+ .OrderBy(orderByModels)
+ .ToPageList(options.Page, options.Rows, ref totalCount);
+
+ foreach (var item in data)
+ {
+ Dt_InboundOrder _InboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == item.UpperOrderNo).First();
+ if (_InboundOrder != null)
+ {
+ item.OrderStatus = _InboundOrder.OrderStatus;
+ item.OrderType = _InboundOrder.OrderType;
+ }
+ }
+ return new PageGridData<Dt_AllocateOrder>(totalCount, data);
+ }
+
public override PageGridData<Dt_InboundOrderDetail> GetDetailPage(PageDataOptions options)
{
string wheres = ValidatePageOptions(options);
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/InvokeMESService.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/InvokeMESService.cs"
index 37d7b72..ec173c2 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/InvokeMESService.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/InvokeMESService.cs"
@@ -1,4 +1,5 @@
锘縰sing Dm.filter;
+using MailKit.Search;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Org.BouncyCastle.Asn1.Ocsp;
@@ -8,6 +9,7 @@
using System.Linq;
using System.Net;
using System.Net.Http;
+using System.Reflection.Metadata;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
@@ -26,6 +28,30 @@
namespace WIDESEA_BasicService
{
+ public class TransferDataDto
+ {
+ public DateTime TransferTime { get; set; }
+ public List<TransferItemDto> Items { get; set; }
+ }
+
+ public class TransferItemDto
+ {
+ public string MaterialCode { get; set; }
+ public decimal TotalQuantity { get; set; }
+ public List<LocationInfoDto> Locations { get; set; }
+ }
+ public class LocationInfoDto
+ {
+ public string LocationCode { get; set; }
+ public decimal Quantity { get; set; }
+ public List<BarcodeInfoDto> Barcodes { get; set; }
+ }
+
+ public class BarcodeInfoDto
+ {
+ public string Barcode { get; set; }
+ public decimal Quantity { get; set; }
+ }
public class InvokeMESService : IInvokeMESService
{
private readonly IHttpClientFactory _httpClientFactory;
@@ -37,11 +63,12 @@
private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository;
private readonly IRepository<Dt_StockInfo> _stockInfoRepository;
private readonly IRepository<Dt_InboundOrder> _inboundOrderRepository;
+ private readonly IRepository<Dt_PickingRecord> _pickingRecoreRepository;
private readonly IMaterialUnitService _materialUnitService;
private readonly IOutboundOrderService _outboundOrderService;
private readonly IOutboundOrderDetailService _outboundOrderDetailService;
private readonly IOutStockLockInfoService _outStockLockInfoService;
- public InvokeMESService(IHttpClientFactory httpClientFactory, ILogger<InvokeMESService> logger, IRepository<Dt_FeedbackToMes> feedbacktomesRepository, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IOutStockLockInfoService outStockLockInfoService, IMaterialUnitService materialUnitService)
+ public InvokeMESService(IHttpClientFactory httpClientFactory, ILogger<InvokeMESService> logger, IRepository<Dt_FeedbackToMes> feedbacktomesRepository, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IOutStockLockInfoService outStockLockInfoService, IMaterialUnitService materialUnitService, IRepository<Dt_PickingRecord> pickingRecoreRepository)
{
_httpClientFactory = httpClientFactory;
_logger = logger;
@@ -53,6 +80,7 @@
_outboundOrderDetailService = outboundOrderDetailService;
_outStockLockInfoService = outStockLockInfoService;
_materialUnitService = materialUnitService;
+ _pickingRecoreRepository = pickingRecoreRepository;
}
/// <summary>
@@ -101,7 +129,7 @@
_client.DefaultRequestHeaders.Clear();
_client.DefaultRequestHeaders.Add("Accept", "application/json");
- _logger.LogInformation("InvokeMESService FeedbackOutbound : " + json);
+ _logger.LogInformation("InvokeMESService FeedbackOutbound : "+ model.orderNo +" , " + json);
var response = await _client.PostAsync("AldMaterialOutbound/MaterialOutbound", content);
string body = await response.Content.ReadAsStringAsync();
@@ -111,7 +139,7 @@
throw new HttpRequestException(body);
}
-
+ _logger.LogInformation("InvokeMESService FeedbackOutbound body: " + body);
return JsonConvert.DeserializeObject<ResponseModel>(body);
}
@@ -220,6 +248,7 @@
}
}
+
/// <summary>
///
/// </summary>
@@ -275,7 +304,7 @@
MaterialCode = group.Key.MaterielCode,
LineNo = group.Key.InboundOrderRowNo,
WarehouseCode = group.Key.WarehouseCode,
- Qty = group.Sum(x => x.BarcodeQty),
+ Qty = group.Sum(x => x.BarcodeQty),
Unit = group.Key.BarcodeUnit,
Barcodes = group.Select(row => new BarcodeInfo
{
@@ -283,7 +312,7 @@
Qty = row.BarcodeQty,
BatchNo = row.BatchNo,
SupplyCode = row.SupplyCode,
- Unit = row.Unit
+ Unit = row.BarcodeUnit
}).ToList()
}).ToList();
allocatefeedmodel.Details = groupedData;
@@ -366,11 +395,12 @@
}
return WebResponseContent.Instance.OK();
}
+
private async Task<WebResponseContent> HandleOutboundOrderBatchToMESCompletion(Dt_OutboundOrder outboundOrder, string orderNo)
{
// 瀹氫箟榛樿杩斿洖锛堟垚鍔熸�侊級
WebResponseContent response = WebResponseContent.Instance.OK("鍥炰紶MES澶勭悊瀹屾垚");
-
+ //0 = 鏈洖浼狅紝1 = 宸插洖浼犳垚鍔燂紝2 = 鍥炰紶澶辫触
try
{
// 鏍¢獙锛氬凡鍥炰紶鐩存帴杩斿洖閿欒
@@ -391,19 +421,111 @@
return WebResponseContent.Instance.Error("鏆傛棤闇�瑕佸鐞嗙殑璁㈠崟鏄庣粏");
}
- // 绛涢�夊凡瀹屾垚鍑哄簱鐨勬槑缁咺D
+
+ var pickingRecords = await _pickingRecoreRepository.Db.Queryable<Dt_PickingRecord>().Where(x => x.OrderNo == orderNo && x.ReturnToMESStatus != 1 && !x.IsCancelled).ToListAsync();
+
+ if (!pickingRecords.Any())
+ return WebResponseContent.Instance.Error("娌℃湁闇�瑕佸洖浼犵殑鍒嗘嫞璁板綍");
+
+
+ var documentNo = UniqueValueGenerator.Generate();
+
+
+ var feedModel = new FeedbackOutboundRequestModel
+ {
+ reqCode = Guid.NewGuid().ToString(),
+ reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+ business_type = outboundOrder.BusinessType,
+ factoryArea = outboundOrder.FactoryArea,
+ operationType = 1,
+ Operator = outboundOrder.Operator!=""? outboundOrder.Operator:App.User.UserName,
+ orderNo = outboundOrder.UpperOrderNo,
+ documentsNO = documentNo,
+ status = outboundOrder.OrderStatus,
+ details = new List<FeedbackOutboundDetailsModel>()
+ };
var detailIds = new List<int>();
+ // 濉厖鏄庣粏鍜屾潯鐮佷俊鎭�
+ foreach (var detail in orderDetails)
+ {
+ // 鏌ヨ璇ユ槑缁嗗搴旂殑閿佸畾鏉$爜璁板綍
+ var detailPicks = pickingRecords.Where(x => x.OrderNo == orderNo
+ && detail.Id == x.OrderDetailId).ToList();
+ if (!detailPicks.Any())
+ {
+ continue;
+ }
+ var detailModel = new FeedbackOutboundDetailsModel
+ {
+ materialCode = detail.MaterielCode,
+ lineNo = detail.lineNo,
+ warehouseCode = detail.WarehouseCode,
+ qty = detail.BarcodeQty,
+ currentDeliveryQty = 0,
+ unit = detail.BarcodeUnit,
+ barcodes = new List<WIDESEA_DTO.Outbound.BarcodesModel>()
+ };
+
+ // 濉厖鏉$爜淇℃伅锛堝惈鍗曚綅杞崲锛�
+ foreach (var item in detailPicks)
+ {
+ if (item.PickQuantity <= 0)
+ {
+ continue;
+ }
+ var barModel = new WIDESEA_DTO.Outbound.BarcodesModel
+ {
+ barcode = item.Barcode,
+ supplyCode = item.SupplyCode,
+ batchNo = item.BatchNo,
+ unit = item.BarcodeUnit,
+ qty = item.PickQuantity
+ };
+
+ // 鍗曚綅涓嶄竴鑷存椂杞崲
+ if (detail.BarcodeUnit != detail.Unit)
+ {
+ var convertResult = await _materialUnitService.ConvertAsync(
+ item.MaterielCode, item.PickQuantity, detail.Unit, detail.BarcodeUnit);
+ barModel.unit = convertResult.Unit;
+ barModel.qty = convertResult.Quantity;
+ }
+ else
+ {
+ barModel.qty = item.PickQuantity;
+ }
+ detailModel.currentDeliveryQty += barModel.qty;
+ detailModel.barcodes.Add(barModel);
+ }
+ detailIds.Add(detail.Id);
+ feedModel.details.Add(detailModel);
+ }
+
+ feedModel.details = feedModel.details.GroupBy(item => new { item.materialCode, item.lineNo, item.warehouseCode, item.unit,item.qty }).Select(group => new FeedbackOutboundDetailsModel
+ {
+ materialCode = group.Key.materialCode,
+ lineNo = group.Key.lineNo,
+ warehouseCode = group.Key.warehouseCode,
+ qty = group.Key.qty,
+ currentDeliveryQty = group.Sum(x => x.currentDeliveryQty),
+ unit = group.Key.unit,
+ barcodes = group.SelectMany(x => x.barcodes.GroupBy(o => new { o.barcode, o.supplyCode, o.batchNo, o.unit }).Select(row => new WIDESEA_DTO.Outbound.BarcodesModel
+ {
+ barcode = row.Key.barcode,
+ supplyCode = row.Key.supplyCode,
+ batchNo = row.Key.batchNo,
+ unit = row.Key.unit,
+ qty = row.Sum(y => y.qty)
+ })).ToList()
+ }).ToList();
+
var allCompleted = true;
// 绛涢�夊緟鍥炰紶鐨勬槑缁嗭紙ReturnToMESStatus=0锛�
var pendingDetails = orderDetails.Where(x => x.ReturnToMESStatus == 0).ToList();
foreach (var detail in pendingDetails)
{
- if (detail.OverOutQuantity >= detail.NeedOutQuantity)
- {
- detailIds.Add(detail.Id);
- }
- else
+ if (detail.OverOutQuantity < detail.NeedOutQuantity)
{
allCompleted = false;
}
@@ -419,7 +541,7 @@
int newStatus = allCompleted ? (int)OutOrderStatusEnum.鍑哄簱瀹屾垚 : (int)OutOrderStatusEnum.鍑哄簱涓�;
if (outboundOrder.OrderStatus != newStatus)
{
- // 淇鍘熸湁璇硶閿欒锛歋etColumns 鏄祴鍊硷紙=锛夎�岄潪鍒ゆ柇锛�==锛�
+
int updateCount = await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>()
.SetColumns(x => x.OrderStatus == newStatus)
.Where(x => x.OrderNo == orderNo)
@@ -428,82 +550,16 @@
if (updateCount <= 0)
{
_logger.LogWarning($"鏇存柊鍑哄簱鍗曠姸鎬佸け璐� - OrderNo: {orderNo}, 鐩爣鐘舵��: {newStatus}");
- // 鐘舵�佹洿鏂板け璐ヤ笉涓柇娴佺▼锛屼絾璁板綍璀﹀憡
+
}
}
- // 鏋勫缓鍥炰紶MES鐨勬ā鍨�
- var documentNo = UniqueValueGenerator.Generate();
- var feedModel = new FeedbackOutboundRequestModel
- {
- reqCode = Guid.NewGuid().ToString(),
- reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
- business_type = outboundOrder.BusinessType,
- factoryArea = outboundOrder.FactoryArea,
- operationType = 1,
- Operator = outboundOrder.Operator,
- orderNo = outboundOrder.UpperOrderNo,
- documentsNO = documentNo,
- status = outboundOrder.OrderStatus,
- details = new List<FeedbackOutboundDetailsModel>()
- };
-
- // 濉厖鏄庣粏鍜屾潯鐮佷俊鎭�
- foreach (var detail in orderDetails.Where(x => detailIds.Contains(x.Id)).ToList())
- {
- // 鏌ヨ璇ユ槑缁嗗搴旂殑閿佸畾鏉$爜璁板綍
- var detailLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
- .Where(x => x.OrderNo == orderNo
- && detail.Id == x.OrderDetailId
- && (x.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴�
- || x.Status == (int)OutLockStockStatusEnum.宸插洖搴�))
- .ToListAsync();
-
- var detailModel = new FeedbackOutboundDetailsModel
- {
- materialCode = detail.MaterielCode,
- lineNo = detail.lineNo,
- warehouseCode = detail.WarehouseCode,
- qty = detail.BarcodeQty,
- currentDeliveryQty = detail.BarcodeQty,
- unit = detail.BarcodeUnit,
- barcodes = new List<WIDESEA_DTO.Outbound.BarcodesModel>()
- };
-
- // 濉厖鏉$爜淇℃伅锛堝惈鍗曚綅杞崲锛�
- foreach (var item in detailLocks)
- {
- var barModel = new WIDESEA_DTO.Outbound.BarcodesModel
- {
- barcode = item.CurrentBarcode,
- supplyCode = item.SupplyCode,
- batchNo = item.BatchNo,
- unit = item.BarcodeUnit,
- qty = item.BarcodeQty
- };
-
- // 鍗曚綅涓嶄竴鑷存椂杞崲
- if (item.BarcodeUnit != item.Unit)
- {
- var convertResult = await _materialUnitService.ConvertAsync(
- item.MaterielCode, item.BarcodeQty, item.Unit, item.BarcodeUnit);
- barModel.unit = convertResult.Unit;
- barModel.qty = convertResult.Quantity;
- }
-
- detailModel.qty += barModel.qty;
- detailModel.currentDeliveryQty += barModel.qty;
- detailModel.barcodes.Add(barModel);
- }
-
- feedModel.details.Add(detailModel);
- }
// 璋冪敤MES鍥炰紶鎺ュ彛
var mesResult = await FeedbackOutbound(feedModel);
if (mesResult == null || mesResult.code != 200)
{
-
+
// 鏇存柊鏄庣粏涓哄洖浼犲け璐ワ紙ReturnToMESStatus=2锛�
await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
.SetColumns(it => new Dt_OutboundOrderDetail
@@ -516,17 +572,28 @@
return WebResponseContent.Instance.Error($"鍥炰紶MES澶辫触");
}
-
- //MES鍥炰紶鎴愬姛锛氭洿鏂版槑缁嗕负鍥炰紶鎴愬姛鐘舵��
- await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
- .SetColumns(it => new Dt_OutboundOrderDetail
- {
- ReturnToMESStatus = 1,
- documentsNO = documentNo,
- })
- .Where(x => detailIds.Contains(x.Id))
- .ExecuteCommandAsync();
-
+ foreach (var record in pickingRecords.Where(x => detailIds.Contains(x.OrderDetailId)).ToList())
+ {
+ record.ReturnToMESStatus = 1;
+ }
+ var updates = pickingRecords.Where(x => detailIds.Contains(x.OrderDetailId)).ToList();
+ updates.ForEach(x =>
+ {
+ x.ReturnToMESStatus = 1;
+ });
+ await _pickingRecoreRepository.Db.Updateable(updates).ExecuteCommandAsync();
+ if (allCompleted)
+ {
+ //MES鍥炰紶鎴愬姛锛氭洿鏂版槑缁嗕负鍥炰紶鎴愬姛鐘舵��
+ await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
+ .SetColumns(it => new Dt_OutboundOrderDetail
+ {
+ ReturnToMESStatus = 1,
+ documentsNO = documentNo,
+ })
+ .Where(x => detailIds.Contains(x.Id))
+ .ExecuteCommandAsync();
+ }
// 鏍¢獙鏄惁鎵�鏈夋槑缁嗛兘瀹屾垚锛屾洿鏂拌鍗曟渶缁堢姸鎬�
if (allCompleted && newStatus == (int)OutOrderStatusEnum.鍑哄簱瀹屾垚)
{
@@ -674,8 +741,8 @@
materialCode = group.Key.MaterielCode,
lineNo = group.Key.lineNo,
warehouseCode = group.Key.WarehouseCode,
- qty = group.Sum(x => x.BarcodeQty),
- currentDeliveryQty = group.Sum(x => x.BarcodeQty),
+ qty = group.Sum(x => x.PickedQty),
+ currentDeliveryQty = group.Sum(x => x.PickedQty),
unit = group.Key.BarcodeUnit,
barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel
{
@@ -683,7 +750,7 @@
supplyCode = lockInfo.SupplyCode,
batchNo = lockInfo.BatchNo,
unit = lockInfo.BarcodeUnit,
- qty = lockInfo.BarcodeQty
+ qty = lockInfo.PickedQty
}).ToList()
}).ToList();
@@ -710,6 +777,11 @@
.Where(x => x.OrderNo == orderNo)
.ExecuteCommandAsync();
+ await _pickingRecoreRepository.Db.Updateable<Dt_PickingRecord>()
+ .SetColumns(x => x.ReturnToMESStatus == 1)
+ .Where(x => x.OrderNo == orderNo)
+ .ExecuteCommandAsync();
+
return WebResponseContent.Instance.OK("鍥炰紶MES鎴愬姛");
}
else
@@ -729,7 +801,7 @@
return WebResponseContent.Instance.Error("澶勭悊鍥炰紶MES鏃跺彂鐢熷紓甯革紝璇疯仈绯荤鐞嗗憳");
}
}
- }
+ }
public static class UniqueValueGenerator
{
@@ -743,14 +815,27 @@
public static string Generate()
{
var now = DateTime.Now;
- string datePart = now.ToString("yyyyMMdd");
+ string datePart = now.ToString("MMdd");
long ticksPart = now.Ticks;
// 鍘熷瓙閫掑璁℃暟鍣紙鍙栨ā1000锛岀‘淇濊鏁板櫒浠�3浣嶏紝鎺у埗闀垮害锛�
long counterPart = Interlocked.Increment(ref _counter) % 1000;
// 鎷兼帴锛氳鏁板櫒琛�0涓�3浣嶏紙閬垮厤浣嶆暟涓嶄竴鑷达級
- return $"{datePart}{ticksPart}{counterPart:D3}";
+ return $"{datePart}{ticksPart}";
+ }
+
+ public static string GenerateCount()
+ {
+ var now = DateTime.Now;
+ string datePart = now.ToString("yyyyMMddHHmmss");
+
+
+ // 鍘熷瓙閫掑璁℃暟鍣紙鍙栨ā1000锛岀‘淇濊鏁板櫒浠�3浣嶏紝鎺у埗闀垮害锛�
+ long counterPart = Interlocked.Increment(ref _counter) % 1000;
+
+ // 鎷兼帴锛氳鏁板櫒琛�0涓�3浣嶏紙閬垮厤浣嶆暟涓嶄竴鑷达級
+ return $"{datePart}{counterPart:D3}";
}
}
}
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_ITaskInfoService/ITaskService.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_ITaskInfoService/ITaskService.cs"
index 584d501..7f01bf2 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_ITaskInfoService/ITaskService.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_ITaskInfoService/ITaskService.cs"
@@ -40,16 +40,16 @@
Task<WebResponseContent> RequestInboundTask(string palletCode, string stationCode);
- Task<WebResponseContent> PalletOutboundTask(string endStation, string palletCode = "");
+ Task<WebResponseContent> PalletOutboundTask(int num, int locationType);
Task<WebResponseContent> TaskCompleted(string taskNum);
Task<WebResponseContent> GenerateOutboundTasksAsync(int[] keys, string outStation);
- Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews);
+ Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews,string station=null);
Task<WebResponseContent> GenerateOutboundBatchTasksAsync(int orderDetailId, decimal batchQuantity, string outStation);
- Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews);
+ Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews, string station);
}
}
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_Model/Models/Outbound/Dt_OutboundLockInfo.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_Model/Models/Outbound/Dt_OutboundLockInfo.cs"
index de23f20..3e953a2 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_Model/Models/Outbound/Dt_OutboundLockInfo.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_Model/Models/Outbound/Dt_OutboundLockInfo.cs"
@@ -147,5 +147,7 @@
[SqlSugar.SugarColumn(IsIgnore = true)]
public decimal RemainQuantity => AssignQuantity - PickedQty;
+ public int ReturnToMESStatus { get; set; }
+
}
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_PickingRecord.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_Model/Models/Outbound/Dt_PickingRecord.cs"
index e0015f7..d642e34 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_Model/Models/Outbound/Dt_PickingRecord.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_Model/Models/Outbound/Dt_PickingRecord.cs"
@@ -91,6 +91,8 @@
///</summary>
[SugarColumn(ColumnName = "barcodemoveQty", ColumnDescription = "鏁伴噺")]
public decimal BarcodeMoveQty { get; set; }
+
+ public int ReturnToMESStatus { get; set; }
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.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/OutboundOrderDetailService.cs"
index d222228..a47f0c3 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/OutboundOrderDetailService.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/OutboundOrderDetailService.cs"
@@ -558,8 +558,7 @@
}
- public (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>)
- AssignStockOutbound(Dt_OutboundOrderDetail outboundOrderDetail, List<StockSelectViewDTO> stockSelectViews)
+ public (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>)AssignStockOutbound(Dt_OutboundOrderDetail outboundOrderDetail, List<StockSelectViewDTO> stockSelectViews)
{
// 楠岃瘉鐢ㄦ埛閫夋嫨
(bool, string) checkResult = CheckSelectStockDeital(outboundOrderDetail, stockSelectViews);
@@ -575,12 +574,9 @@
decimal totalAssignedFromUserSelection = 0;
// 鎸夊厛杩涘厛鍑烘帓搴忕敤鎴烽�夋嫨鐨勫簱瀛�
- var userSelectedStocks = _stockService.StockInfoService.GetStockInfosByPalletCodes(
- stockSelectViews.Select(x => x.PalletCode).ToList());
+ var userSelectedStocks = _stockService.StockInfoService.GetStockInfosByPalletCodes(stockSelectViews.Select(x => x.PalletCode).ToList());
- var sortedUserSelectedStocks = userSelectedStocks
- .OrderBy(x => x.CreateDate)
- .ToList();
+ var sortedUserSelectedStocks = userSelectedStocks.OrderBy(x => x.CreateDate).ToList();
// 鍒嗛厤鐢ㄦ埛閫夋嫨鐨勫簱瀛�
foreach (var stock in sortedUserSelectedStocks)
@@ -596,9 +592,7 @@
outboundOrderDetail.BatchNo, outboundOrderDetail.SupplyCode);
// 纭畾鍒嗛厤鏁伴噺锛氬彇鐢ㄦ埛閫夋嫨鏁伴噺銆佸彲鐢ㄦ暟閲忓拰鍓╀綑闇�姹傜殑鏈�灏忓��
- var assignQuantity = Math.Min(
- Math.Min(userSelection.UseableQuantity, availableQuantity),
- remainingNeedQuantity);
+ var assignQuantity = Math.Min(Math.Min(userSelection.UseableQuantity, availableQuantity),remainingNeedQuantity);
if (assignQuantity <= 0) continue;
@@ -623,42 +617,57 @@
}
// 濡傛灉鐢ㄦ埛閫夋嫨鐨勫簱瀛樹笉澶燂紝鑷姩鍒嗛厤鍓╀綑閮ㄥ垎
- decimal autoAssignedQuantity = 0;
+
if (remainingNeedQuantity > 0)
{
- List<Dt_StockInfo> autoStocks = _stockService.StockInfoService.GetUseableStocks(
- outboundOrderDetail.MaterielCode, outboundOrderDetail.BatchNo, "");
+ //// 鍙�夛細杩欓噷鍙互鏍规嵁涓氬姟闇�姹傚喅瀹氭槸鍚﹀厑璁歌嚜鍔ㄥ垎閰�
+ //// 濡傛灉瑕佹眰涓ユ牸鎸夌敤鎴烽�夋嫨鍑哄簱锛屽彲浠ユ姏鍑哄紓甯�
+ //// throw new Exception($"鐢ㄦ埛閫夋嫨鐨勫簱瀛樻暟閲忎笉瓒筹紝杩橀渶{remainingNeedQuantity}锛岃閲嶆柊閫夋嫨");
- // 鎺掗櫎鐢ㄦ埛宸查�夋嫨鐨勬墭鐩�
- autoStocks = autoStocks
- .Where(x => !stockSelectViews.Select(v => v.PalletCode).Contains(x.PalletCode))
- .ToList();
+ //// 濡傛灉闇�瑕佽嚜鍔ㄥ垎閰嶏紝璁板綍鏃ュ織
+ //_logger.LogInformation($"鐢ㄦ埛閫夋嫨鐨勫簱瀛樻暟閲忎笉瓒筹紝杩橀渶{remainingNeedQuantity}锛岀郴缁熷皢鑷姩鍒嗛厤");
- var (autoAssignStocks, stockAllocations) = _stockService.StockInfoService.GetOutboundStocks(
- autoStocks, outboundOrderDetail.MaterielCode, remainingNeedQuantity, out decimal residueQuantity);
+ //List<Dt_StockInfo> autoStocks = _stockService.StockInfoService.GetUseableStocks(
+ // outboundOrderDetail.MaterielCode,
+ // outboundOrderDetail.BatchNo,
+ // "");
- // 妫�鏌ヨ嚜鍔ㄥ垎閰嶇粨鏋�
- autoAssignedQuantity = remainingNeedQuantity - residueQuantity;
- if (autoAssignedQuantity <= 0 && remainingNeedQuantity > 0)
- {
- // 閮ㄥ垎鍒嗛厤鏄彲浠ユ帴鍙楃殑锛岃褰曡鍛婁絾涓嶆姤閿�
- _logger.LogWarning($"鑷姩鍒嗛厤澶辫触锛屽墿浣欓渶姹倇remainingNeedQuantity}鏃犳硶婊¤冻");
- }
- else if (autoAssignedQuantity > 0)
- {
- outStocks.AddRange(autoAssignStocks);
+ //// 鎺掗櫎鐢ㄦ埛宸查�夋嫨涓斿凡鍒嗛厤鐨勬墭鐩�
+ //var assignedPalletCodes = outStocks.Select(x => x.PalletCode).ToList();
+ //autoStocks = autoStocks
+ // .Where(x => !assignedPalletCodes.Contains(x.PalletCode))
+ // .ToList();
- // 涓鸿嚜鍔ㄥ垎閰嶇殑搴撳瓨鍒涘缓閿佸畾璁板綍
- var autoLockInfos = CreateLockInfosForAutoAssign(outboundOrder, outboundOrderDetail, autoAssignStocks, stockAllocations);
- outStockLockInfos.AddRange(autoLockInfos);
- }
+ //var (autoAssignStocks, stockAllocations) = _stockService.StockInfoService.GetOutboundStocks(
+ // autoStocks,
+ // outboundOrderDetail.MaterielCode,
+ // remainingNeedQuantity,
+ // out decimal residueQuantity);
+
+ //if (autoAssignStocks != null && autoAssignStocks.Any())
+ //{
+ // outStocks.AddRange(autoAssignStocks);
+
+ // // 涓鸿嚜鍔ㄥ垎閰嶇殑搴撳瓨鍒涘缓閿佸畾璁板綍
+ // var autoLockInfos = CreateLockInfosForAutoAssign(outboundOrder, outboundOrderDetail, autoAssignStocks, stockAllocations);
+ // outStockLockInfos.AddRange(autoLockInfos);
+
+ // // 鏇存柊宸插垎閰嶆暟閲�
+ // decimal autoAssignedQuantity = remainingNeedQuantity - residueQuantity;
+ // totalAssignedFromUserSelection += autoAssignedQuantity;
+ // remainingNeedQuantity = residueQuantity; // 鏇存柊鍓╀綑闇�姹�
+ //}
+ //else if (remainingNeedQuantity > 0)
+ //{
+ // _logger.LogWarning($"鑷姩鍒嗛厤澶辫触锛屽墿浣欓渶姹倇remainingNeedQuantity}鏃犳硶婊¤冻");
+ //}
}
// 鏇存柊閿佸畾鏁伴噺
- outboundOrderDetail.LockQuantity += totalAssignedFromUserSelection + autoAssignedQuantity;
+ outboundOrderDetail.LockQuantity += totalAssignedFromUserSelection + totalAssignedFromUserSelection;
// 鏇存柊鐘舵��
- UpdateOrderDetailStatus(outboundOrderDetail, remainingNeedQuantity - autoAssignedQuantity);
+ UpdateOrderDetailStatus(outboundOrderDetail, remainingNeedQuantity);
List<Dt_LocationInfo> locationInfos = _locationInfoService.GetLocationInfos(outStocks.Select(x => x.LocationCode).ToList());
@@ -682,17 +691,21 @@
decimal remainingAssign = assignQuantity;
// 鎸夊厛杩涘厛鍑哄垎閰嶅簱瀛樻槑缁�
- var sorteds = stock.Details
+ var query = stock.Details.AsQueryable()
.Where(d => d.MaterielCode == detail.MaterielCode &&
(d.StockQuantity - d.OutboundQuantity) > 0);
// .OrderBy(d => d.CreateDate);
if (!string.IsNullOrEmpty(detail.BatchNo))
{
- sorteds= stock.Details.Where(x => x.BatchNo == detail.BatchNo);
+ query = query.Where(x => x.BatchNo == detail.BatchNo);
}
-
- var sortedDetails= sorteds.ToList().OrderBy(d => d.CreateDate);
+ // 濡傛灉鍑哄簱鍗曟湁渚涘簲鍟嗚姹傦紝鎸変緵搴斿晢杩囨护
+ if (!string.IsNullOrEmpty(detail.SupplyCode))
+ {
+ query = query.Where(d => d.SupplyCode == detail.SupplyCode);
+ }
+ var sortedDetails= query.ToList().OrderBy(d => d.CreateDate);
foreach (var stockDetail in sortedDetails)
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 4f86ab1..341570f 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"
@@ -477,10 +477,21 @@
var completedLockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
.Where(it => it.CurrentBarcode == barcode &&
(it.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴� ||
+ it.Status == (int)OutLockStockStatusEnum.宸查噴鏀� ||
+ it.Status == (int)OutLockStockStatusEnum.宸插彇璧� ||
it.PickedQty >= it.AssignQuantity)).FirstAsync();
if (completedLockInfo != null)
- throw new Exception($"鏉$爜{barcode}宸茬粡瀹屾垚鍒嗘嫞锛屼笉鑳介噸澶嶅垎鎷�");
+ {
+ string statusMsg = completedLockInfo.Status switch
+ {
+ (int)OutLockStockStatusEnum.鎷i�夊畬鎴� => "宸茬粡瀹屾垚鍒嗘嫞",
+ (int)OutLockStockStatusEnum.宸查噴鏀� => "宸茬粡閲婃斁",
+ (int)OutLockStockStatusEnum.宸插彇璧� => "宸茬粡鍙栬蛋",
+ _ => "宸茬粡瀹屾垚鍒嗘嫞"
+ };
+ throw new Exception($"鏉$爜{barcode}{statusMsg}锛屼笉鑳介噸澶嶅垎鎷�");
+ }
else
return null;
}
@@ -816,13 +827,13 @@
private async Task<bool> CanCancelPicking(Dt_OutStockLockInfo lockInfo, Dt_StockInfoDetail stockDetail)
{
+ if (lockInfo.Status == (int)OutLockStockStatusEnum.宸查噴鏀� || lockInfo.Status == (int)OutLockStockStatusEnum.宸插彇璧�)
+ return false;
// 閿佸畾淇℃伅鐘舵�佹鏌�
if (lockInfo.Status != (int)OutLockStockStatusEnum.鎷i�夊畬鎴�)
return false;
- ////// 搴撳瓨鐘舵�佹鏌�
- ////if (stockDetail.Status == StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt())
- //// return false;
+
// 濡傛灉鏄媶鍖呰褰曪紝杩橀渶瑕佹鏌ョ埗閿佸畾淇℃伅鐘舵��
if (lockInfo.IsSplitted == 1 && lockInfo.ParentLockId.HasValue)
@@ -830,7 +841,9 @@
var parentLock = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
.FirstAsync(x => x.Id == lockInfo.ParentLockId.Value);
- if (parentLock == null || parentLock.Status == (int)OutLockStockStatusEnum.鍥炲簱涓�)
+ if (parentLock == null || parentLock.Status == (int)OutLockStockStatusEnum.鍥炲簱涓� ||
+ parentLock.Status == (int)OutLockStockStatusEnum.宸查噴鏀� ||
+ parentLock.Status == (int)OutLockStockStatusEnum.宸插彇璧�)
return false;
}
@@ -1388,8 +1401,8 @@
await _outStockLockInfoService.Db.Updateable<Dt_OutStockLockInfo>()
.SetColumns(it => new Dt_OutStockLockInfo
{
- Status = (int)OutLockStockStatusEnum.宸查噴鏀�, // 闇�瑕佹柊澧炶繖涓姸鎬�
- // ReleaseTime = DateTime.Now,
+ Status = (int)OutLockStockStatusEnum.宸查噴鏀�,
+
Operator = App.User.UserName
})
.Where(it => lockIds.Contains(it.Id))
@@ -1805,7 +1818,7 @@
_logger.LogInformation($"璁㈠崟鐘舵�佹洿鏂� - OrderNo: {orderNo}, 鏃х姸鎬�: {outboundOrder.OrderStatus}, 鏂扮姸鎬�: {newStatus}");
-
+
}
}
catch (Exception ex)
@@ -1953,7 +1966,7 @@
.Where(x => x.OrderNo == orderNo && x.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴�)
.ToListAsync();
- var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.lineNo, item.Unit, item.WarehouseCode })
+ var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
.Select(group => new AllocateDtoDetail
{
MaterialCode = group.Key.MaterielCode,
@@ -1961,13 +1974,13 @@
WarehouseCode = group.Key.WarehouseCode,
Qty = group.Sum(x => x.PickedQty),
- Unit = group.Key.Unit,
+ Unit = group.Key.BarcodeUnit,
Barcodes = group.Select(row => new BarcodeInfo
{
Barcode = row.CurrentBarcode,
SupplyCode = row.SupplyCode,
BatchNo = row.BatchNo,
- Unit = row.Unit,
+ Unit = row.BarcodeUnit,
Qty = row.PickedQty
}).ToList()
@@ -2023,8 +2036,8 @@
materialCode = group.Key.MaterielCode,
lineNo = group.Key.lineNo,
warehouseCode = group.Key.WarehouseCode,
- qty = group.Sum(x => x.BarcodeQty),
- currentDeliveryQty = group.Sum(x => x.BarcodeQty),
+ qty = group.Sum(x => x.PickedQty),
+ currentDeliveryQty = group.Sum(x => x.PickedQty),
unit = group.Key.BarcodeUnit,
barcodes = group.Select(row => new WIDESEA_DTO.Outbound.BarcodesModel
{
@@ -2032,7 +2045,7 @@
supplyCode = row.SupplyCode,
batchNo = row.BatchNo,
unit = row.BarcodeUnit,
- qty = row.BarcodeQty
+ qty = row.PickedQty
}).ToList()
}).ToList();
@@ -2847,33 +2860,34 @@
(x.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴� || x.Status == (int)OutLockStockStatusEnum.宸插洖搴�))
.ToListAsync();
- var groupdata = detailLocks.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
- .Select(group => new FeedbackOutboundDetailsModel
- {
- materialCode = group.Key.MaterielCode,
- lineNo = group.Key.lineNo,
- warehouseCode = group.Key.WarehouseCode,
- qty = group.Sum(x => x.BarcodeQty),
- currentDeliveryQty = group.Sum(x => x.BarcodeQty),
- unit = group.Key.BarcodeUnit,
- barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel
- {
- barcode = lockInfo.CurrentBarcode,
- supplyCode = lockInfo.SupplyCode,
- batchNo = lockInfo.BatchNo,
- unit = lockInfo.BarcodeUnit,
- qty = lockInfo.BarcodeQty
- }).ToList()
- }).ToList();
- outfeedmodel.details.AddRange(groupdata);
- }
- var result = await _invokeMESService.FeedbackOutbound(outfeedmodel);
- if (result != null && result.code == 200)
- {
- await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
- .SetColumns(x => x.ReturnToMESStatus == 1)
- .Where(x => x.OrderId == outboundOrder.Id)
- .ExecuteCommandAsync();
+ var groupdata = detailLocks.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
+ .Select(group => new FeedbackOutboundDetailsModel
+ {
+
+ materialCode = group.Key.MaterielCode,
+ lineNo = group.Key.lineNo,
+ warehouseCode = group.Key.WarehouseCode,
+ qty = group.Sum(x => x.PickedQty),
+ currentDeliveryQty = group.Sum(x => x.PickedQty),
+ unit = group.Key.BarcodeUnit,
+ barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel
+ {
+ barcode = lockInfo.CurrentBarcode,
+ supplyCode = lockInfo.SupplyCode,
+ batchNo = lockInfo.BatchNo,
+ unit = lockInfo.BarcodeUnit,
+ qty = lockInfo.PickedQty
+ }).ToList()
+ }).ToList();
+ feedmodel.details.AddRange(groupdata);
+ }
+ var result = await _invokeMESService.FeedbackOutbound(feedmodel);
+ if (result != null && result.code == 200)
+ {
+ await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
+ .SetColumns(x => x.ReturnToMESStatus == 1)
+ .Where(x => x.OrderId == outboundOrder.Id)
+ .ExecuteCommandAsync();
await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>()
.SetColumns(x => x.ReturnToMESStatus == 1)
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 b00aac2..956fcca 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"
@@ -18,6 +18,7 @@
using AutoMapper;
using Dm.filter;
using MailKit.Search;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Org.BouncyCastle.Asn1.Ocsp;
@@ -67,10 +68,10 @@
private readonly IRepository<Dt_StockInfo> _stockRepository;
private readonly ILocationInfoService _locationInfoService;
private readonly IInboundOrderService _inboundOrderService;
- private readonly IInboundOrderDetailService _inboundOrderDetailService;
+ private readonly IInboundOrderDetailService _inboundOrderDetailService;
private readonly IRepository<Dt_AllocateOrderDetail> _allocateOrderDetailRepository;
- private readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository;
+ private readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository;
private readonly IRepository<Dt_ReCheckOrder> _reCheckOrderRepository;
private readonly IRepository<Dt_OutboundBatch> _OutboundBatchRepository;
private readonly IOutboundOrderService _outboundOrderService;
@@ -340,7 +341,7 @@
}
else if (inboundOrder.OrderType == InOrderTypeEnum.InternalAllocat.ObjToInt()) //鏅轰粨璋冩櫤浠�
{
- _logger.LogInformation($"InboundTaskCompleted 鍥炲啓MES : {inboundOrder.InboundOrderNo } ,ordertype: {InOrderTypeEnum.InternalAllocat.ObjToInt()} " );
+ _logger.LogInformation($"InboundTaskCompleted 鍥炲啓MES : {inboundOrder.InboundOrderNo} ,ordertype: {InOrderTypeEnum.InternalAllocat.ObjToInt()} ");
// BusinessTypeEnum.鏅轰粨璋冩櫤浠�
if (inboundOrder != null && inboundOrder.OrderStatus == InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt())
{
@@ -454,7 +455,7 @@
{
_logger.LogInformation($"TaskService OutAllocateTaskCompleted: {task.TaskNum}");
- return await OutboundTaskCompleted(task);
+ return await OutboundTaskCompleted(task);
}
public async Task<WebResponseContent> OutboundTaskCompleted(Dt_Task task)
{
@@ -557,7 +558,7 @@
}
}
-
+
public async Task<WebResponseContent> InPickTaskCompleted(Dt_Task task)
{
_logger.LogInformation($"TaskService InPickTaskCompleted: {task.TaskNum}");
@@ -616,32 +617,24 @@
// 鏇存柊搴撳瓨淇℃伅
stockInfo.LocationCode = task.TargetAddress;
- stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+ stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
// 鏇存柊搴撳瓨鏄庣粏鐘舵��
if (stockInfo.Details != null && stockInfo.Details.Any())
{
foreach (var detail in stockInfo.Details)
{
- detail.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
-
- // 纭繚搴撳瓨鏁伴噺涓庡嚭搴撴暟閲忎竴鑷�
- if (detail.Status == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt())
- {
- detail.OutboundQuantity = 0; // 鍏ュ簱瀹屾垚鏃跺嚭搴撴暟閲忔竻闆�
- }
+ detail.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+ detail.OutboundQuantity = 0; // 鍏ュ簱瀹屾垚鏃跺嚭搴撴暟閲忔竻闆�
}
- _stockService.StockInfoDetailService.Repository.UpdateData(stockInfo.Details);
+ _stockService.StockInfoDetailService.Repository.UpdateData(stockInfo.Details);
}
- _stockService.StockInfoService.Repository.UpdateData(stockInfo);
-
- // 澶勭悊鍥炲簱鐩稿叧鐨勫簱瀛樻槑缁�
- await ProcessStockDetailsForReturn(task, stockInfo.Id);
-
+ _stockService.StockInfoService.Repository.UpdateData(stockInfo);
// 鍒犻櫎闆跺簱瀛樻暟鎹�
await DeleteZeroQuantityStockDetails(stockInfo.Id);
+ await UpdateAffectedOrderDetails(task.OrderNo, returnLocks);
// 鏇存柊璐т綅鐘舵��
if (stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt())
{
@@ -651,17 +644,10 @@
{
locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
}
-
- _locationInfoService.Repository.UpdateData(locationInfo);
- // 鏇存柊璁㈠崟鐩稿叧鏁版嵁
- await UpdateOrderDataAfterReturn(task.OrderNo, returnLocks);
+ _locationInfoService.Repository.UpdateData(locationInfo);
- // 鑾峰彇骞舵洿鏂板嚭搴撹鍗�
- var outboundOrder = await _outboundOrderService.Db.Queryable<Dt_OutboundOrder>()
- .FirstAsync(x => x.OrderNo == task.OrderNo);
-
- task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
+ task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
// 鍒犻櫎浠诲姟璁板綍
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
@@ -675,23 +661,35 @@
"",
task.TaskNum
);
-
- if (outboundOrder != null)
- {
- // 妫�鏌ヨ鍗曠姸鎬佹槸鍚﹂渶瑕佹洿鏂�
- await CheckAndUpdateOrderStatusAfterReturn(task.OrderNo);
-
- // 澶勭悊MES鍙嶉
- await HandleOutboundOrderToMESCompletion(outboundOrder, outboundOrder.OrderNo);
- }
- else
- {
- _logger.LogInformation($"TaskService InPickTaskCompleted: {task.TaskNum} ,鏈壘鍒板嚭搴撳崟銆�");
- }
+ await RecalculateOrderStatus(task.OrderNo);
_unitOfWorkManage.CommitTran(); // 鎻愪氦浜嬪姟
+ _logger.LogInformation($"鎵樼洏鍥炲簱瀹屾垚澶勭悊鎴愬姛 - 浠诲姟鍙�: {task.TaskNum}, 鎵樼洏: {task.PalletCode}, 璁㈠崟: {task.OrderNo}");
+ _ = Task.Run(async () =>
+ {
+ try
+ {
+ var outboundOrder = await _outboundOrderService.Db.Queryable<Dt_OutboundOrder>()
+ .FirstAsync(x => x.OrderNo == task.OrderNo);
- _logger.LogInformation($"鍥炲簱浠诲姟瀹屾垚澶勭悊鎴愬姛 - 浠诲姟鍙�: {task.TaskNum}, 鎵樼洏: {task.PalletCode}");
+ if (outboundOrder != null)
+ {
+ // 妫�鏌ヨ鍗曟槸鍚﹀凡瀹屾垚锛屽彧鏈夊畬鎴愭椂鎵嶅悜MES鍙嶉
+ if (outboundOrder.OrderStatus == (int)OutOrderStatusEnum.鍑哄簱瀹屾垚)
+ {
+ await HandleOutboundOrderToMESCompletion(outboundOrder, outboundOrder.OrderNo);
+ }
+ else
+ {
+ _logger.LogInformation($"璁㈠崟{task.OrderNo}鐘舵�佷负{outboundOrder.OrderStatus}锛屾殏涓嶅悜MES鍙嶉");
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError($"寮傛MES鍙嶉澶勭悊澶辫触 - OrderNo: {task.OrderNo}, Error: {ex.Message}");
+ }
+ });
}
catch (Exception ex)
{
@@ -702,107 +700,151 @@
return WebResponseContent.Instance.OK();
}
-
- /// <summary>
- /// 鍥炲簱鍚庢洿鏂拌鍗曟暟鎹�
+ // <summary>
+ /// 鏇存柊鍙楀奖鍝嶇殑璁㈠崟鏄庣粏閿佸畾鏁伴噺
/// </summary>
- private async Task UpdateOrderDataAfterReturn(string orderNo, List<Dt_OutStockLockInfo> returnLocks)
+ private async Task UpdateAffectedOrderDetails(string orderNo, List<Dt_OutStockLockInfo> returnLocks)
{
try
{
- // 鑾峰彇鎵�鏈夊彈褰卞搷鐨勮鍗曟槑缁咺D
+ // 鑾峰彇鍙楀奖鍝嶇殑璁㈠崟鏄庣粏ID锛堝幓閲嶏級
var affectedDetailIds = returnLocks
.Select(x => x.OrderDetailId)
.Distinct()
.ToList();
+ if (!affectedDetailIds.Any())
+ {
+ _logger.LogInformation($"娌℃湁鍙楀奖鍝嶇殑璁㈠崟鏄庣粏 - OrderNo: {orderNo}");
+ return;
+ }
+
+ _logger.LogInformation($"鏇存柊{affectedDetailIds.Count}涓彈褰卞搷鐨勮鍗曟槑缁� - OrderNo: {orderNo}");
+
foreach (var detailId in affectedDetailIds)
{
- // 璁$畻璇ヨ鍗曟槑缁嗙殑鍥炲簱鎬绘暟閲�
- var detailReturnLocks = returnLocks
- .Where(x => x.OrderDetailId == detailId)
- .ToList();
+ // 閲嶆柊璁$畻璇ヨ鍗曟槑缁嗙殑閿佸畾鏁伴噺
+ decimal currentLockQty = await CalculateOrderDetailLockQuantity(detailId);
- decimal totalReturnQty = detailReturnLocks.Sum(x => x.AssignQuantity - x.PickedQty);
-
- if (totalReturnQty > 0)
+ // 妫�鏌ユ暟鎹竴鑷存��
+ if (currentLockQty < 0)
{
- // 鑾峰彇璁㈠崟鏄庣粏
- var orderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
- .FirstAsync(x => x.Id == detailId);
-
- if (orderDetail != null)
- {
- // 鏇存柊閿佸畾鏁伴噺锛堝洖搴撳悗閿佸畾鏁伴噺搴斿噺灏戯級
- var remainingLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
- .Where(x => x.OrderDetailId == detailId &&
- x.Status == (int)OutLockStockStatusEnum.鍑哄簱涓�)
- .ToListAsync();
-
- decimal remainingLockQty = remainingLocks.Sum(x => x.AssignQuantity - x.PickedQty);
-
- // 鏇存柊璁㈠崟鏄庣粏
- await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
- .SetColumns(it => new Dt_OutboundOrderDetail
- {
- LockQuantity = remainingLockQty,
- })
- .Where(it => it.Id == detailId)
- .ExecuteCommandAsync();
-
- // 鏇存柊璁㈠崟鏄庣粏鐘舵��
- await UpdateOrderDetailStatus(detailId);
-
- _logger.LogInformation($"鍥炲簱鏇存柊璁㈠崟鏄庣粏 - OrderDetailId: {detailId}, " +
- $"鎵e噺閿佸畾鏁伴噺: {totalReturnQty}, 鏂伴攣瀹氭暟閲�: {remainingLockQty}");
- }
+ _logger.LogWarning($"閿佸畾鏁伴噺璁$畻涓鸿礋鍊� - OrderDetailId: {detailId}, 褰撳墠鍊�: {currentLockQty}锛岄噸缃负0");
+ currentLockQty = 0;
}
+
+ // 鑾峰彇璁㈠崟鏄庣粏
+ var orderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
+ .FirstAsync(x => x.Id == detailId);
+
+ if (orderDetail == null)
+ {
+ _logger.LogWarning($"鏈壘鍒拌鍗曟槑缁� - OrderDetailId: {detailId}");
+ continue;
+ }
+
+ // 鏇存柊閿佸畾鏁伴噺
+ if (orderDetail.LockQuantity != currentLockQty)
+ {
+ await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
+ .SetColumns(it => new Dt_OutboundOrderDetail
+ {
+ LockQuantity = currentLockQty,
+ })
+ .Where(it => it.Id == detailId)
+ .ExecuteCommandAsync();
+
+ _logger.LogInformation($"鏇存柊璁㈠崟鏄庣粏閿佸畾鏁伴噺 - OrderDetailId: {detailId}, " +
+ $"鏃у��: {orderDetail.LockQuantity}, 鏂板��: {currentLockQty}");
+ }
+
+ // 鏇存柊璁㈠崟鏄庣粏鐘舵��
+ await UpdateOrderDetailStatus(orderDetail);
}
}
catch (Exception ex)
{
- _logger.LogError($"UpdateOrderDataAfterReturn澶辫触 - OrderNo: {orderNo}, Error: {ex.Message}");
+ _logger.LogError($"UpdateAffectedOrderDetails澶辫触 - OrderNo: {orderNo}, Error: {ex.Message}");
throw;
}
}
+
/// <summary>
- /// 鏇存柊璁㈠崟鏄庣粏鐘舵��
+ /// 閲嶆柊璁$畻璁㈠崟鏄庣粏閿佸畾鏁伴噺
/// </summary>
- private async Task UpdateOrderDetailStatus(int orderDetailId)
+ private async Task<decimal> CalculateOrderDetailLockQuantity(int orderDetailId)
{
try
{
- var orderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
- .FirstAsync(x => x.Id == orderDetailId);
+ // 鏌ユ壘璇ヨ鍗曟槑缁嗕笅鎵�鏈夌姸鎬佷负"鍑哄簱涓�"鐨勯攣瀹氳褰�
+ var activeLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
+ .Where(x => x.OrderDetailId == orderDetailId &&
+ x.Status == (int)OutLockStockStatusEnum.鍑哄簱涓�)
+ .ToListAsync();
- if (orderDetail == null)
+ // 杩囨护鎷嗗寘璁板綍
+ var filteredLocks = new List<Dt_OutStockLockInfo>();
+
+ foreach (var lockInfo in activeLocks)
{
- _logger.LogWarning($"UpdateOrderDetailStatus澶辫触锛氭湭鎵惧埌璁㈠崟鏄庣粏锛孖D: {orderDetailId}");
- return;
+ // 濡傛灉鏄媶鍖呰褰曪紝闇�瑕佺壒娈婂鐞�
+ if (lockInfo.IsSplitted == 1 && lockInfo.ParentLockId.HasValue)
+ {
+ // 鏌ユ壘鐖堕攣瀹氳褰�
+ var parentLock = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
+ .Where(x => x.Id == lockInfo.ParentLockId.Value)
+ .FirstAsync();
+
+ // 濡傛灉鐖惰褰曞瓨鍦ㄤ笖鐘舵�佷篃鏄嚭搴撲腑锛屽垯鍙绠楃埗璁板綍
+ if (parentLock != null && parentLock.Status == (int)OutLockStockStatusEnum.鍑哄簱涓�)
+ {
+ // 鐖惰褰曞凡缁忓湪鍒楄〃涓紝璺宠繃褰撳墠鎷嗗寘璁板綍
+ continue;
+ }
+ }
+
+ filteredLocks.Add(lockInfo);
}
+ decimal totalLockQty = filteredLocks.Sum(x => x.AssignQuantity - x.PickedQty);
+
+ _logger.LogDebug($"璁$畻閿佸畾鏁伴噺 - OrderDetailId: {orderDetailId}, " +
+ $"鎵惧埌{filteredLocks.Count}涓湁鏁堥攣瀹氳褰�, " +
+ $"鎬婚攣瀹氭暟閲�: {totalLockQty}");
+
+ return totalLockQty;
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError($"CalculateOrderDetailLockQuantity澶辫触 - OrderDetailId: {orderDetailId}, Error: {ex.Message}");
+ return 0;
+ }
+ }
+
+ /// <summary>
+ /// 鏇存柊璁㈠崟鏄庣粏鐘舵��
+ /// </summary>
+ private async Task UpdateOrderDetailStatus(Dt_OutboundOrderDetail orderDetail)
+ {
+ try
+ {
int newStatus = orderDetail.OrderDetailStatus;
- // 1. 妫�鏌ユ槸鍚﹀凡瀹屾垚
+ // 鏍规嵁瀹為檯鏋氫妇鍊艰皟鏁�
+ // 妫�鏌ユ槸鍚﹀凡瀹屾垚锛堝凡鍑哄簱鏁伴噺 >= 闇�姹傛暟閲忥級
if (orderDetail.OverOutQuantity >= orderDetail.NeedOutQuantity)
{
- newStatus = (int)OrderDetailStatusEnum.Over;
+ newStatus = (int)OrderDetailStatusEnum.Over; // 宸插畬鎴�
}
- // 2. 妫�鏌ユ槸鍚︽鍦ㄨ繘琛屼腑锛堟湁閿佸畾鏁伴噺鎴栭儴鍒嗘嫞閫夛級
- else if (orderDetail.LockQuantity > 0 ||
- (orderDetail.OverOutQuantity > 0 && orderDetail.OverOutQuantity < orderDetail.NeedOutQuantity))
+ // 妫�鏌ユ槸鍚︽湁閮ㄥ垎鍑哄簱鎴栨湁閿佸畾鏁伴噺
+ else if (orderDetail.OverOutQuantity > 0 || orderDetail.LockQuantity > 0)
{
- newStatus = (int)OrderDetailStatusEnum.Outbound;
+ newStatus = (int)OrderDetailStatusEnum.Outbound; // 閮ㄥ垎瀹屾垚/杩涜涓�
}
- // 3. 妫�鏌ユ槸鍚︽湁閿佸畾浣嗘湭鎷i��
- else if (orderDetail.LockQuantity > 0 && orderDetail.OverOutQuantity == 0)
- {
- newStatus = (int)OrderDetailStatusEnum.AssignOverPartial;
- }
- // 4. 鍚﹀垯涓烘柊璁㈠崟
+ // 鍚﹀垯涓烘柊璁㈠崟
else
{
- newStatus = (int)OrderDetailStatusEnum.New;
+ newStatus = (int)OrderDetailStatusEnum.New; // 鏂板缓
}
// 鍙湁鐘舵�佸彉鍖栨椂鎵嶆洿鏂�
@@ -811,12 +853,12 @@
await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
.SetColumns(it => new Dt_OutboundOrderDetail
{
- OrderDetailStatus = newStatus,
+ OrderDetailStatus = newStatus,
})
- .Where(it => it.Id == orderDetailId)
+ .Where(it => it.Id == orderDetail.Id)
.ExecuteCommandAsync();
- _logger.LogInformation($"鏇存柊璁㈠崟鏄庣粏鐘舵�� - OrderDetailId: {orderDetailId}, " +
+ _logger.LogInformation($"鏇存柊璁㈠崟鏄庣粏鐘舵�� - OrderDetailId: {orderDetail.Id}, " +
$"鏃х姸鎬�: {orderDetail.OrderDetailStatus}, 鏂扮姸鎬�: {newStatus}, " +
$"宸插嚭搴�: {orderDetail.OverOutQuantity}/{orderDetail.NeedOutQuantity}, " +
$"閿佸畾鏁伴噺: {orderDetail.LockQuantity}");
@@ -824,23 +866,32 @@
}
catch (Exception ex)
{
- _logger.LogError($"UpdateOrderDetailStatus澶辫触 - OrderDetailId: {orderDetailId}, Error: {ex.Message}");
+ _logger.LogError($"UpdateOrderDetailStatus澶辫触 - OrderDetailId: {orderDetail.Id}, Error: {ex.Message}");
throw;
}
}
+
/// <summary>
- /// 鍥炲簱鍚庢鏌ュ苟鏇存柊璁㈠崟鐘舵��
+ /// 閲嶆柊璁$畻骞舵洿鏂拌鍗曠姸鎬�
/// </summary>
- private async Task CheckAndUpdateOrderStatusAfterReturn(string orderNo)
+ private async Task RecalculateOrderStatus(string orderNo)
{
try
{
+ // 鑾峰彇璁㈠崟鐨勬墍鏈夋槑缁�
var orderDetails = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
.LeftJoin<Dt_OutboundOrder>((o, item) => o.OrderId == item.Id)
.Where((o, item) => item.OrderNo == orderNo)
.Select((o, item) => o)
.ToListAsync();
+ if (!orderDetails.Any())
+ {
+ _logger.LogWarning($"鏈壘鍒拌鍗曟槑缁� - OrderNo: {orderNo}");
+ return;
+ }
+
+ // 妫�鏌ョ姸鎬�
bool allCompleted = true;
bool hasInProgress = false;
@@ -854,7 +905,7 @@
// 妫�鏌ユ槸鍚︽湁杩涜涓殑浠诲姟锛堥攣瀹氭垨閮ㄥ垎鎷i�夛級
if (detail.LockQuantity > 0 ||
- detail.OrderDetailStatus == OrderDetailStatusEnum.Outbound.ObjToInt())
+ detail.OrderDetailStatus == (int)OrderDetailStatusEnum.Outbound)
{
hasInProgress = true;
}
@@ -863,7 +914,11 @@
var outboundOrder = await _outboundOrderService.Db.Queryable<Dt_OutboundOrder>()
.FirstAsync(x => x.OrderNo == orderNo);
- if (outboundOrder == null) return;
+ if (outboundOrder == null)
+ {
+ _logger.LogWarning($"鏈壘鍒板嚭搴撹鍗� - OrderNo: {orderNo}");
+ return;
+ }
int newStatus;
if (allCompleted)
@@ -890,57 +945,16 @@
.Where(x => x.OrderNo == orderNo)
.ExecuteCommandAsync();
- _logger.LogInformation($"鍥炲簱鍚庢洿鏂拌鍗曠姸鎬� - OrderNo: {orderNo}, 鏂扮姸鎬�: {newStatus}");
+ _logger.LogInformation($"鏇存柊璁㈠崟鐘舵�� - OrderNo: {orderNo}, 鏃х姸鎬�: {outboundOrder.OrderStatus}, 鏂扮姸鎬�: {newStatus}");
}
}
catch (Exception ex)
{
- _logger.LogError($"CheckAndUpdateOrderStatusAfterReturn澶辫触 - OrderNo: {orderNo}, Error: {ex.Message}");
+ _logger.LogError($"RecalculateOrderStatus澶辫触 - OrderNo: {orderNo}, Error: {ex.Message}");
throw;
}
}
- /// <summary>
- /// 澶勭悊鍥炲簱鐨勫簱瀛樻槑缁嗭紙澧炲己鐗堬級
- /// </summary>
- private async Task ProcessStockDetailsForReturn(Dt_Task task, int stockId)
- {
- try
- {
- // 鑾峰彇鎵�鏈夐渶瑕佸鐞嗙殑搴撳瓨鏄庣粏
- var stockDetails = await _stockService.StockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
- .Where(x => x.StockId == stockId)
- .ToListAsync();
-
- foreach (var detail in stockDetails)
- {
- // 纭繚搴撳瓨鐘舵�佹纭�
- if (detail.Status == StockStatusEmun.鍏ュ簱纭.ObjToInt())
- {
- // 濡傛灉宸茬粡鏄叆搴撶‘璁ょ姸鎬侊紝鏇存柊涓哄叆搴撳畬鎴�
- detail.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
- detail.OutboundQuantity = 0;
-
- await _stockService.StockInfoDetailService.Db.Updateable(detail).ExecuteCommandAsync();
-
- _logger.LogInformation($"鏇存柊搴撳瓨鏄庣粏鐘舵�� - 鏉$爜: {detail.Barcode}, " +
- $"鏂扮姸鎬�: {detail.Status}, 鍑哄簱鏁伴噺: {detail.OutboundQuantity}");
- }
- else if (detail.Status == StockStatusEmun.鍑哄簱閿佸畾.ObjToInt() ||
- detail.Status == StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt())
- {
- // 杩欎簺鐘舵�佷笉搴旇瀛樺湪锛岃褰曡鍛�
- _logger.LogWarning($"寮傚父搴撳瓨鐘舵�� - 鏉$爜: {detail.Barcode}, 鐘舵��: {detail.Status}, " +
- $"浠诲姟鍙�: {task.TaskNum}");
- }
- }
- }
- catch (Exception ex)
- {
- _logger.LogError($"ProcessStockDetailsForReturn澶辫触 - StockId: {stockId}, Error: {ex.Message}");
- throw;
- }
- }
/// <summary>
/// 鍒犻櫎闆跺簱瀛樻暟鎹紙澧炲己鐗堬級
@@ -1033,51 +1047,57 @@
var detailModel = new AllocateDtoDetail
{
MaterialCode = detail.MaterielCode,
- LineNo = detail.lineNo,
+ LineNo = detail.lineNo,
WarehouseCode = detail.WarehouseCode,
- Qty = detailLocks.Sum(x=>x.PickedQty),
+ Qty = 0,
Unit = detail.BarcodeUnit,
- Barcodes = new List<BarcodeInfo> ()
+ Barcodes = new List<BarcodeInfo>()
};
foreach (var item in detailLocks)
{
- var barModel = new BarcodeInfo
+ if (item.PickedQty > 0)
{
- Barcode = item.CurrentBarcode,
- SupplyCode = item.SupplyCode,
- BatchNo = item.BatchNo,
- Unit = item.BarcodeUnit,
- Qty = item.PickedQty
- };
- // 鍗曚綅涓嶄竴鑷存椂杞崲
- if (item.BarcodeUnit != item.Unit)
- {
- var convertResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.PickedQty, item.Unit, item.BarcodeUnit);
- barModel.Unit = convertResult.Unit;
- barModel.Qty = convertResult.Quantity;
+ var barModel = new BarcodeInfo
+ {
+ Barcode = item.CurrentBarcode,
+ SupplyCode = item.SupplyCode,
+ BatchNo = item.BatchNo,
+ Unit = detail.BarcodeUnit,
+ Qty = 0
+ };
+ // 鍗曚綅涓嶄竴鑷存椂杞崲
+ if (detail.BarcodeUnit != detail.Unit)
+ {
+ var convertResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.PickedQty, detail.Unit, detail.BarcodeUnit);
+ barModel.Unit = convertResult.Unit;
+ barModel.Qty = convertResult.Quantity;
+ }
+ else
+ {
+ barModel.Qty = item.PickedQty;
+ }
+ detailModel.Qty += barModel.Qty;
+ detailModel.Barcodes.Add(barModel);
}
- detailModel.Qty += barModel.Qty;
- detailModel.Barcodes.Add(barModel);
+
+ allocatefeedmodel.Details.Add(detailModel);
}
+ var result = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
+ if (result != null && result.code == 200)
+ {
+ await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
+ .SetColumns(x => x.ReturnToMESStatus == 1)
+ .Where(x => x.OrderId == outboundOrder.Id).ExecuteCommandAsync();
- allocatefeedmodel.Details.Add(detailModel);
- }
-
- var result = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
- if (result != null && result.code == 200)
- {
- await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
- .SetColumns(x => x.ReturnToMESStatus == 1)
- .Where(x => x.OrderId == outboundOrder.Id).ExecuteCommandAsync();
-
- await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>()
- .SetColumns(x => new Dt_OutboundOrder
- {
- ReturnToMESStatus = 1,
- Operator = App.User.UserName,
- }).Where(x => x.OrderNo == orderNo).ExecuteCommandAsync();
+ await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>()
+ .SetColumns(x => new Dt_OutboundOrder
+ {
+ ReturnToMESStatus = 1,
+ Operator = App.User.UserName,
+ }).Where(x => x.OrderNo == orderNo).ExecuteCommandAsync();
+ }
}
}
else if (outboundOrder.OrderType == OutOrderTypeEnum.ReCheck.ObjToInt())
@@ -1085,78 +1105,91 @@
//涓嶇敤鍥炰紶
}
else
- {
- var feedmodel = new FeedbackOutboundRequestModel
+ {
+ if (outboundOrder != null && outboundOrder.IsBatch == 0)
{
- reqCode = Guid.NewGuid().ToString(),
- reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
- business_type = outboundOrder.BusinessType,
- factoryArea = outboundOrder.FactoryArea,
- operationType = 1,
- Operator = outboundOrder.Operator,
- orderNo = outboundOrder.UpperOrderNo,
- documentsNO = outboundOrder.OrderNo,
- status = outboundOrder.OrderStatus,
- details = new List<FeedbackOutboundDetailsModel>()
- };
-
-
- foreach (var detail in orderDetails)
- {
- // 鑾峰彇璇ユ槑缁嗗搴旂殑鏉$爜淇℃伅锛堜粠閿佸畾璁板綍锛�
- var detailLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
- .Where(x => x.OrderNo == orderNo &&
- x.OrderDetailId == detail.Id &&
- (x.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴� || x.Status == (int)OutLockStockStatusEnum.宸插洖搴�))
- .ToListAsync();
-
- var detailModel = new FeedbackOutboundDetailsModel
+ var feedmodel = new FeedbackOutboundRequestModel
{
- materialCode = detail.MaterielCode,
- lineNo = detail.lineNo, // 娉ㄦ剰锛氳繖閲屽彲鑳介渶瑕佽皟鏁村瓧娈靛悕
- warehouseCode = detail.WarehouseCode,
- qty = detail.PickedQty,
- currentDeliveryQty = detail.PickedQty,
- unit = detail.Unit,
- barcodes = new List<WIDESEA_DTO.Outbound.BarcodesModel>()
+ reqCode = Guid.NewGuid().ToString(),
+ reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+ business_type = outboundOrder.BusinessType,
+ factoryArea = outboundOrder.FactoryArea,
+ operationType = 1,
+ Operator = outboundOrder.Operator,
+ orderNo = outboundOrder.UpperOrderNo,
+ documentsNO = outboundOrder.OrderNo,
+ status = outboundOrder.OrderStatus,
+ details = new List<FeedbackOutboundDetailsModel>()
};
- foreach (var item in detailLocks)
+ foreach (var detail in orderDetails)
{
- var barModel = new WIDESEA_DTO.Outbound.BarcodesModel
+ // 鑾峰彇璇ユ槑缁嗗搴旂殑鏉$爜淇℃伅锛堜粠閿佸畾璁板綍锛�
+ var detailLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
+ .Where(x => x.OrderNo == orderNo &&
+ x.OrderDetailId == detail.Id &&
+ (x.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴� || x.Status == (int)OutLockStockStatusEnum.宸插洖搴�))
+ .ToListAsync();
+
+ var detailModel = new FeedbackOutboundDetailsModel
{
- barcode = item.CurrentBarcode,
- supplyCode = item.SupplyCode,
- batchNo = item.BatchNo,
- unit = item.BarcodeUnit,
- qty = item.PickedQty
+ materialCode = detail.MaterielCode,
+ lineNo = detail.lineNo, // 娉ㄦ剰锛氳繖閲屽彲鑳介渶瑕佽皟鏁村瓧娈靛悕
+ warehouseCode = detail.WarehouseCode,
+ qty = 0,
+ currentDeliveryQty = 0,
+ unit = detail.Unit,
+ barcodes = new List<WIDESEA_DTO.Outbound.BarcodesModel>()
};
- // 鍗曚綅涓嶄竴鑷存椂杞崲
- if (item.BarcodeUnit != item.Unit)
+ foreach (var item in detailLocks)
{
- var convertResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.PickedQty, item.Unit, item.BarcodeUnit);
- barModel.unit = convertResult.Unit;
- barModel.qty = convertResult.Quantity;
+ if (item.PickedQty > 0)
+ {
+ var barModel = new WIDESEA_DTO.Outbound.BarcodesModel
+ {
+ barcode = item.CurrentBarcode,
+ supplyCode = item.SupplyCode,
+ batchNo = item.BatchNo,
+ unit = item.BarcodeUnit,
+ qty = item.PickedQty
+ };
+ // 鍗曚綅涓嶄竴鑷存椂杞崲
+ if (detail.BarcodeUnit != detail.Unit)
+ {
+ var convertResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.PickedQty, detail.Unit, detail.BarcodeUnit);
+ barModel.unit = convertResult.Unit;
+ barModel.qty = convertResult.Quantity;
+ }
+ else
+ {
+ barModel.qty = item.PickedQty;
+ }
+ detailModel.qty += barModel.qty;
+ detailModel.currentDeliveryQty += barModel.qty;
+ detailModel.barcodes.Add(barModel);
+ }
}
-
- detailModel.qty += barModel.qty;
- detailModel.currentDeliveryQty += barModel.qty;
- detailModel.barcodes.Add(barModel);
+ feedmodel.details.Add(detailModel);
}
- feedmodel.details.Add(detailModel);
- }
- var result = await _invokeMESService.FeedbackOutbound(feedmodel);
- if (result != null && result.code == 200)
- {
- await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
- .SetColumns(x => x.ReturnToMESStatus == 1)
- .Where(x => x.OrderId == outboundOrder.Id)
- .ExecuteCommandAsync();
- await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>()
- .SetColumns(x => x.ReturnToMESStatus == 1)
- .Where(x => x.OrderNo == orderNo)
- .ExecuteCommandAsync();
+ var result = await _invokeMESService.FeedbackOutbound(feedmodel);
+ if (result != null && result.code == 200)
+ {
+ await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
+ .SetColumns(x => x.ReturnToMESStatus == 1)
+ .Where(x => x.OrderId == outboundOrder.Id)
+ .ExecuteCommandAsync();
+
+ await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>()
+ .SetColumns(x => x.ReturnToMESStatus == 1)
+ .Where(x => x.OrderNo == orderNo)
+ .ExecuteCommandAsync();
+ }
}
+ else if (outboundOrder != null && outboundOrder.IsBatch == 1)
+ {
+ await _invokeMESService.BatchOrderFeedbackToMes(new List<string>(){outboundOrder.OrderNo },2);
+ }
+
}
}
}
@@ -1167,7 +1200,7 @@
}
-
+
public async Task<WebResponseContent> OutEmptyTaskCompleted(Dt_Task task)
{
WebResponseContent content = new WebResponseContent();
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 73516ab..db099ac 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"
@@ -31,95 +31,83 @@
/// </summary>
/// <param name="inTask"></param>
/// <returns></returns>
- public async Task<WebResponseContent> PalletOutboundTask(string endStation, string palletCode = "")
+ public async Task<WebResponseContent> PalletOutboundTask(int num, int locationType)
{
+ WebResponseContent content = new WebResponseContent();
try
{
- Dt_StockInfo stockInfo;
- if (string.IsNullOrEmpty(palletCode))
- {
- stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt() && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && !string.IsNullOrWhiteSpace(x.LocationCode)).First();
- }
- else
- {
- stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt() && x.PalletCode == palletCode && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt()).First();
- }
+ 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();
- if (stockInfo == null)
+ if (stockInfos.Count() == 0)
{
return WebResponseContent.Instance.Error("鏈壘鍒扮┖鎵樼洏搴撳瓨");
}
- Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode);
- if (locationInfo == null)
+ foreach (var stockInfo in stockInfos)
{
- return WebResponseContent.Instance.Error("鏈壘鍒扮┖鎵樼洏搴撳瓨瀵瑰簲鐨勮揣浣嶄俊鎭�");
- }
-
- Dt_Task task = new Dt_Task()
- {
- CurrentAddress = stockInfo.LocationCode,
- Grade = 0,
- NextAddress = endStation,
- PalletCode = stockInfo.PalletCode,
- Roadway = locationInfo.RoadwayNo,
- SourceAddress = stockInfo.LocationCode,
- TargetAddress = endStation,
- TaskStatus = TaskStatusEnum.New.ObjToInt(),
- TaskType = TaskTypeEnum.OutEmpty.ObjToInt(),
- WarehouseId = stockInfo.WarehouseId,
- PalletType = stockInfo.PalletType
-
- };
- int beforeStatus = locationInfo.LocationStatus;
- _unitOfWorkManage.BeginTran();
- stockInfo.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
- locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
-
- int taskId = BaseDal.AddData(task);
- task.TaskId = taskId;
-
- _stockService.StockInfoService.UpdateData(stockInfo);
-
- _locationInfoService.UpdateData(locationInfo);
-
- _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), "", task.TaskNum);
-
- _unitOfWorkManage.CommitTran();
-
- TaskModel esstask = new TaskModel()
- {
- taskType = "carry",
- taskGroupCode = "",
- groupPriority = 0,
- tasks = new List<TasksType>
+ Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode);
+ if (locationInfo == null)
{
- new()
- {
- taskCode=task.TaskNum.ToString(),
- taskPriority=0,
- taskDescribe=new TaskDescribeType{
- containerCode=stockInfo.PalletCode,
- containerType= "CT_KUBOT_STANDARD",
- fromLocationCode=stockInfo.LocationCode??"",
- toStationCode="",
- toLocationCode=endStation,
- deadline=0,storageTag=""
- }
- }
+ return WebResponseContent.Instance.Error("鏈壘鍒扮┖鎵樼洏搴撳瓨瀵瑰簲鐨勮揣浣嶄俊鎭�");
}
- };
- var result = await _eSSApiService.CreateTaskAsync(esstask);
- _logger.LogInformation("鍒涘缓浠诲姟PalletOutboundTask 杩斿洖: " + result);
- if (result)
- {
- return WebResponseContent.Instance.OK(200);
- }
- else
- {
- return WebResponseContent.Instance.Error("涓嬪彂鏈哄櫒浜轰换鍔″け璐ワ紒");
- }
+ Dt_Task task = new Dt_Task()
+ {
+ CurrentAddress = stockInfo.LocationCode,
+ Grade = 0,
+ NextAddress = "1-2",
+ PalletCode = stockInfo.PalletCode,
+ Roadway = locationInfo.RoadwayNo,
+ SourceAddress = stockInfo.LocationCode,
+ TargetAddress = "1-2",
+ TaskStatus = TaskStatusEnum.New.ObjToInt(),
+ TaskType = TaskTypeEnum.OutEmpty.ObjToInt(),
+ WarehouseId = stockInfo.WarehouseId,
+ PalletType = stockInfo.PalletType
+ };
+ int beforeStatus = locationInfo.LocationStatus;
+ _unitOfWorkManage.BeginTran();
+ stockInfo.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+ locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
+
+ int taskId = BaseDal.AddData(task);
+ task.TaskId = taskId;
+
+ _stockService.StockInfoService.UpdateData(stockInfo);
+
+ _locationInfoService.UpdateData(locationInfo);
+
+ _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), "", task.TaskNum);
+
+ _unitOfWorkManage.CommitTran();
+
+ TaskModel esstask = new TaskModel()
+ {
+ taskType = "carry",
+ taskGroupCode = "",
+ groupPriority = 0,
+ tasks = new List<TasksType>
+ {
+ new()
+ {
+ taskCode=task.TaskNum.ToString(),
+ taskPriority=0,
+ taskDescribe=new TaskDescribeType{
+ containerCode=stockInfo.PalletCode,
+ containerType= "CT_KUBOT_STANDARD",
+ fromLocationCode=stockInfo.LocationCode??"",
+ toStationCode="",
+ toLocationCode="1-2",
+ deadline=0,storageTag=""
+ }
+ }
+ }
+ };
+ var result = await _eSSApiService.CreateTaskAsync(esstask);
+
+ _logger.LogInformation("鍒涘缓浠诲姟PalletOutboundTask 杩斿洖: " + result);
+ }
+ return content.OK("绌烘墭鍑哄簱鎴愬姛!");
}
catch (Exception ex)
{
@@ -477,7 +465,14 @@
}
}
- public async Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews)
+ /// <summary>
+ /// 鏅轰粨璋冩櫤浠�
+ /// </summary>
+ /// <param name="orderDetailId"></param>
+ /// <param name="stockSelectViews"></param>
+ /// <param name="station"></param>
+ /// <returns></returns>
+ public async Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews, string station = null)
{
try
{
@@ -504,7 +499,7 @@
return WebResponseContent.Instance.Error("鎵句笉鍒板嚭搴撴槑缁嗗崟鎹�");
}
- (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(outboundOrder.Details.First().Id, stockSelectViews);
+ (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(outboundOrder.Details.First().Id, stockSelectViews,station);
WebResponseContent content =await GenerateOutboundTaskDataUpdate(result.Item1, result.Item2, result.Item3, result.Item4, result.Item5);
@@ -521,7 +516,7 @@
/// <param name="orderDetailId"></param>
/// <param name="stockSelectViews"></param>
/// <returns></returns>
- public async Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews)
+ public async Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews,string station=null)
{
try
{
@@ -531,7 +526,7 @@
{
return WebResponseContent.Instance.Error("鎵句笉鍒板崟鎹�");
}
- (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(outboundOrder.Details.First().Id, stockSelectViews);
+ (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(outboundOrder.Details.First().Id, stockSelectViews,station);
WebResponseContent content =await GenerateOutboundTaskDataUpdate(result.Item1, result.Item2, result.Item3, result.Item4, result.Item5);
@@ -550,7 +545,7 @@
/// <param name="stockSelectViews"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
- public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutboundTaskDataHandle(int orderDetailId, List<StockSelectViewDTO> stockSelectViews)
+ public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutboundTaskDataHandle(int orderDetailId, List<StockSelectViewDTO> stockSelectViews,string station=null)
{
List<Dt_Task> tasks = new List<Dt_Task>();
Dt_OutboundOrderDetail outboundOrderDetail = _outboundOrderDetailService.Repository.QueryFirst(x => x.Id == orderDetailId);
@@ -573,15 +568,15 @@
(List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundOrderDetailService.AssignStockOutbound(outboundOrderDetail, stockSelectViews);
if (result.Item1 != null && result.Item1.Count > 0)
{
- Dt_OutboundOrder outboundOrder = _outboundOrderService.Repository.QueryFirst(x => x.Id == outboundOrderDetail.OrderId);
+ Dt_OutboundOrder outboundOrder = _outboundOrderService.Repository.QueryFirst(x => x.Id == outboundOrderDetail.OrderId);
TaskTypeEnum typeEnum = outboundOrder.OrderType switch
{
(int)OutOrderTypeEnum.Issue => TaskTypeEnum.Outbound,
(int)OutOrderTypeEnum.Allocate => TaskTypeEnum.OutAllocate,
(int)OutOrderTypeEnum.Quality => TaskTypeEnum.OutQuality,
- _ => new TaskTypeEnum()
+ _ => TaskTypeEnum.Outbound
};
- tasks = GetTasks(result.Item1, typeEnum);
+ tasks = GetTasks(result.Item1, typeEnum,station);
result.Item2.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt();
result.Item3.ForEach(x =>
{
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/Inbound/InboundOrderController.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/Inbound/InboundOrderController.cs"
index d17e070..69bc686 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/Inbound/InboundOrderController.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/Inbound/InboundOrderController.cs"
@@ -1,4 +1,5 @@
锘縰sing Autofac.Core;
+using MailKit.Search;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@@ -8,15 +9,19 @@
using System.Threading.Tasks;
using WIDESEA_BasicService;
using WIDESEA_Common.OrderEnum;
+using WIDESEA_Common.StockEnum;
using WIDESEA_Core;
using WIDESEA_Core.Attributes;
using WIDESEA_Core.BaseController;
+using WIDESEA_DTO.Allocate;
using WIDESEA_DTO.Inbound;
using WIDESEA_DTO.Mes;
using WIDESEA_IBasicService;
using WIDESEA_IInboundService;
using WIDESEA_InboundService;
+using WIDESEA_IOutboundService;
using WIDESEA_Model.Models;
+using WIDESEA_OutboundService;
namespace WIDESEA_WMSServer.Controllers.Inbound
{
@@ -35,8 +40,10 @@
private readonly ILocationInfoService _locationInfoService;
private readonly IDailySequenceService _dailySequenceService;
private readonly IMaterialUnitService _materialUnitService;
+ private readonly IOutStockLockInfoService _outStockLockInfoService;
+ private readonly IOutboundOrderDetailService _outboundOrderDetailService;
private readonly ILogger<InboundOrderController> _logger;
- public InboundOrderController(IInboundOrderService service, WIDESEA_IBasicService.IErpApiService erpApiService, WIDESEA_IBasicService.IInvokeMESService invokeMESService, IESSApiService eSSApiService, IDailySequenceService dailySequenceService, ILocationInfoService locationInfoService, ILogger<InboundOrderController> logger, IMaterialUnitService materialUnitService, IInboundService inboundService) : base(service)
+ public InboundOrderController(IInboundOrderService service, WIDESEA_IBasicService.IErpApiService erpApiService, WIDESEA_IBasicService.IInvokeMESService invokeMESService, IESSApiService eSSApiService, IDailySequenceService dailySequenceService, ILocationInfoService locationInfoService, ILogger<InboundOrderController> logger, IMaterialUnitService materialUnitService, IInboundService inboundService, IOutStockLockInfoService outStockLockInfoService, IOutboundOrderDetailService outboundOrderDetailService) : base(service)
{
this.erpApiService = erpApiService;
_invokeMESService = invokeMESService;
@@ -46,11 +53,14 @@
_logger = logger;
_materialUnitService = materialUnitService;
_inboundService = inboundService;
+ _outStockLockInfoService = outStockLockInfoService;
+ _outboundOrderDetailService = outboundOrderDetailService;
}
[HttpPost, Route("Test"), AllowAnonymous, MethodParamsValidate]
public async Task<WebResponseContent> Test()
{
+
// Service.Db.Deleteable<Dt_InboundOrder>().Where(x=>x.UpperOrderNo== "12020251100040").ExecuteCommand();
//_inboundService.InboundOrderDetailService.Db.Deleteable<Dt_InboundOrderDetail>()
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/PickingReturnController.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/PickingReturnController.cs"
index 45460a8..d51d094 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/PickingReturnController.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/PickingReturnController.cs"
@@ -26,7 +26,7 @@
}
/// <summary>
- ///
+ /// 閲嶆 鏅轰粨璋冩櫤浠� 缁勭洏鍏ュ簱
/// </summary>
/// <param name="materielGroupDTO"></param>
/// <returns></returns>
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/TaskInfo/TaskController.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/TaskInfo/TaskController.cs"
index 6918098..a8b86b7 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/TaskInfo/TaskController.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/TaskInfo/TaskController.cs"
@@ -56,12 +56,9 @@
}
[HttpPost, Route("PalletOutboundTask"), AllowAnonymous, MethodParamsValidate]
- public async Task<WebResponseContent> PalletOutboundTask(string endStation, string palletCode = "")
+ public async Task<WebResponseContent> PalletOutboundTask(int num, int locationType)
{
-
- var result = await Service.PalletOutboundTask(endStation, palletCode);
-
- return result;
+ return await Service.PalletOutboundTask(num, locationType);
}
@@ -83,9 +80,9 @@
/// <param name="stockSelectViews"></param>
/// <returns></returns>
[HttpPost, HttpGet, Route("GenerateOutboundTask"), AllowAnonymous]
- public async Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, [FromBody] List<StockSelectViewDTO> stockSelectViews)
+ public async Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, string station, [FromBody] List<StockSelectViewDTO> stockSelectViews)
{
- return await Service.GenerateOutboundTask(orderDetailId, stockSelectViews);
+ return await Service.GenerateOutboundTask(orderDetailId, stockSelectViews, station);
}
/// <summary>
@@ -95,9 +92,9 @@
/// <param name="stockSelectViews"></param>
/// <returns></returns>
[HttpPost, HttpGet, Route("GenerateAllocatOutboundTask"), AllowAnonymous]
- public async Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, [FromBody] List<StockSelectViewDTO> stockSelectViews)
+ public async Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, string station, [FromBody] List<StockSelectViewDTO> stockSelectViews)
{
- return await Service.GenerateAllocatOutboundTask(orderDetailId, stockSelectViews);
+ return await Service.GenerateAllocatOutboundTask(orderDetailId, stockSelectViews,station);
}
/// <summary>
--
Gitblit v1.9.3