From 2fbbc3ccaa4123a2d550fa64d91fa8ac25323a58 Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期五, 11 七月 2025 15:32:03 +0800 Subject: [PATCH] 上传最新 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IErpProScrapSheetDetailService.cs | 6 代码管理/WMS/WIDESEA_WMSClient/src/extension/outbound/extend/ScrapSheet.vue | 387 ++++++++++++++++++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ErpProScrapSheetService.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutProStockInfoService.cs | 30 + 代码管理/WMS/WIDESEA_WMSClient/src/extension/outbound/erpProScrapSheet.js | 5 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs | 164 +++++++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_ErpProScrapSheetDetail.cs | 6 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs | 8 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IStockRepository/IProStockInfoRepository.cs | 1 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs | 1 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs | 1 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskTypeEnum.cs | 7 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 86 ++++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs | 9 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundRepository/OutboundRepository.cs | 6 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_ErpProScrapSheet.cs | 2 代码管理/WMS/WIDESEA_WMSClient/src/views/outbound/erpProScrapSheet.vue | 16 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutProStockInfoService.cs | 4 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundRepository/IOutboundRepository.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderService.cs | 10 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs | 16 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ErpProScrapSheetDetailService.cs | 330 +++++++++++++++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/ProStockInfoService.cs | 66 +++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundService.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IProStockInfoService.cs | 6 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/ErpProScrapSheetDetailController.cs | 18 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_CheckService/CheckOrderResultService.cs | 13 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/ProStockInfoRepository.cs | 21 + 28 files changed, 1,185 insertions(+), 40 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" index 7fe6c29..b73d2c1 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" @@ -14,19 +14,16 @@ /// </summary> [Description("棰嗘枡鍑哄簱")] Outbound = 100, - /// <summary> /// 鐩樼偣鍑哄簱 /// </summary> [Description("鐩樼偣鍑哄簱")] OutInventory = 110, - /// <summary> /// 鍒嗘嫞鍑哄簱 /// </summary> [Description("鍒嗘嫞鍑哄簱")] OutPick = 120, - /// <summary> /// 璐ㄦ鍑哄簱 /// </summary> @@ -67,13 +64,16 @@ /// </summary> [Description("鎴愬搧鍑哄簱")] OutProduct = 230, - + /// <summary> + /// 鎴愬搧鎶ュ簾鍑哄簱 + /// </summary> + [Description("鎴愬搧鎶ュ簾鍑哄簱")] + OutProScrap = 235, /// <summary> /// 鎴愬搧瀵勫敭鍑哄簱 /// </summary> [Description("鎴愬搧瀵勫敭鍑哄簱")] OutSendProduct = 240, - /// <summary> /// 鎴愬搧MES鎻愬簱 /// </summary> @@ -91,7 +91,6 @@ /// </summary> [Description("闃茬剨鍓嶆淳宸ュぇ浠�")] MaskOutNoticeLarge = 265, - /// <summary> /// 闃茬剨鍒扮嚎杈瑰皬浠� /// </summary> @@ -103,25 +102,21 @@ /// </summary> [Description("闃茬剨鍒扮嚎杈瑰ぇ浠�")] MaskOutLarge = 275, - /// <summary> /// 閲囪喘鍏ュ簱 /// </summary> [Description("閲囪喘鍏ュ簱")] Inbound = 510, - /// <summary> /// 鐩樼偣鍏ュ簱 /// </summary> [Description("鐩樼偣鍏ュ簱")] InInventory = 520, - /// <summary> /// 鍒嗘嫞鍏ュ簱 /// </summary> [Description("鍒嗘嫞鍏ュ簱")] InPick = 530, - /// <summary> /// 璐ㄦ鍏ュ簱 /// </summary> @@ -195,6 +190,7 @@ /// </summary> [Description("宸烽亾鍐呯Щ搴�")] Relocation = 900 + } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/outbound/erpProScrapSheet.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/outbound/erpProScrapSheet.js" index 9e7c04a..e351097 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/outbound/erpProScrapSheet.js" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/outbound/erpProScrapSheet.js" @@ -1,11 +1,10 @@ //姝s鏂囦欢鏄敤鏉ヨ嚜瀹氫箟鎵╁睍涓氬姟浠g爜锛屽彲浠ユ墿灞曚竴浜涜嚜瀹氫箟椤甸潰鎴栬�呴噸鏂伴厤缃敓鎴愮殑浠g爜 -import gridBody from './extend/MesOutOrderDetail.vue' -import gridHeader from './extend/addMesOutOrder.vue' +import gridBody from './extend/ScrapSheet.vue' let extension = { components: { //鏌ヨ鐣岄潰鎵╁睍缁勪欢 - gridHeader: gridHeader, + gridHeader: '', gridBody: gridBody, gridFooter: '', //鏂板缓銆佺紪杈戝脊鍑烘鎵╁睍缁勪欢 diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/outbound/extend/ScrapSheet.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/outbound/extend/ScrapSheet.vue" new file mode 100644 index 0000000..431fe01 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/outbound/extend/ScrapSheet.vue" @@ -0,0 +1,387 @@ +<template> + <div> + <vol-box + v-model="dialogFormVisible" + :on-model-close="closeCustomModel" + :lazy="true" + width="20%" + :padding="15" + title="閫夋嫨鍑哄簱绾夸綋" + > + <div> + <VolForm + ref="myform" + :label-width="120" + :loadKey="true" + :formFields="formFields2" + :formRules="formRules2" + > + + </VolForm> + </div> + <template #footer> + <!-- <el-button type="primary" size="small" @click="submit">纭</el-button> --> + <el-button type="danger" size="small" @click="outbound" + >鍑哄簱</el-button + > + </template> + </vol-box> + <vol-box + v-model="showDetialBox" + :lazy="true" + width="75%" + :padding="15" + title="鎶ュ簾鏄庣粏" + > + <div class="box-head"> + <el-alert :closable="false" style="width: 100%"> + <el-row> + <el-col :span="18"> + <span class="less-style">鎶ュ簾鍗曞彿锛� {{ row.proScrapSheetOrderNo }} </span> + </el-col> + <el-col :span="6"> + <span>宸查�変腑 {{ selection.length }} 椤�</span> + <!-- <el-link + type="primary" + size="small" + style="float: right; height: 20px" + @click="lockstocks" + >閿佸畾搴撳瓨</el-link + > --> + <el-link + type="primary" + size="small" + v-if="row.proScrapStatus == 0" + style="float: right; height: 20px; margin-right: 10px" + @click="UpProScrap" + >鎻愪氦鎶ュ簾</el-link + > + <el-link + type="primary" + size="small" + style="float: right; height: 20px; margin-right: 10px" + @click="outSelect" + >鐩存帴鍑哄簱</el-link + > + <el-link + type="primary" + size="small" + style="float: right; height: 20px; margin-right: 10px" + @click="getData" + >鍒锋柊</el-link + ></el-col> + </el-row> + + </el-alert> + </div> + <div class="box-table" style="margin-top: 1%"> + <el-table + ref="singleTable" + :data="tableData" + style="width: 100%; height: 100%" + highlight-current-row + @current-change="handleCurrentChange" + height="500px" + @row-click="handleRowClick" + @selection-change="handleSelectionChange" + > + > + <el-table-column type="selection" width="55"> </el-table-column> + <el-table-column + label="搴忓彿" + type="index" + fixed="left" + width="55" + align="center" + ></el-table-column> + <el-table-column + v-for="(item, index) in tableColumns.filter((x) => !x.hidden)" + :key="index" + :prop="item.prop" + :label="item.title" + :width="item.width" + align="center" + > + <template #default="scoped" v-if="item.type == 'icon'"> + <el-tooltip + class="item" + effect="dark" + :content="item.title" + placement="bottom" + ><el-button + type="text" + @click="tableButtonClick(scoped.row, item)" + ><i :class="item.icon" style="font-size: 22px"></i></el-button + ></el-tooltip> + </template> + </el-table-column> + </el-table> + </div> + <template #footer> + <!-- <el-button type="primary" size="small" @click="submit">纭</el-button> --> + <el-button type="danger" size="small" @click="showDetialBox = false" + >鍏抽棴</el-button + > + </template> + </vol-box> + </div> + </template> + <script> + import VolBox from "@/components/basic/VolBox.vue"; + import VolForm from "@/components/basic/VolForm.vue"; + export default { + components: { VolBox,VolForm }, + data() { + return { + row: null, + showDetialBox: false, + flag: false, + currentRow: null, + selection: [], + tableData: [], + dialogFormVisible:false, + formLabelWidth: '160px', + formFields2: { + LineCode: "", + Grade: "0", + }, + formRules2:[[ + { + dataKey: "line", + title: "閫夋嫨绾夸綋", + required: true, + field: "LineCode", + data: [ + { key: "5236", value: "1鍙风嚎" }, + { key: "5243", value: "2鍙风嚎" }, + { key: "5250", value: "3鍙风嚎" }, + ], + type: "select", + extra: { + + }, + }], + [ + { + title: "鏄惁浼樺厛", + field: "Grade", + data: [], + required: false, + type: "switch", + }, + ]], + form: { + name: '', + region: '', + date1: '', + date2: '', + delivery: false, + type: [], + resource: '', + desc: '', + }, + tableColumns: [ + { + prop: "id", + title: "涓婚敭", + type: "string", + width: 150, + hidden: true, + }, + { + prop: "proScrapSheetId", + title: "鎴愬搧鎶ュ簾鍗曚富閿�", + type: "string", + width: 150, + hidden: true, + }, + { + prop: "scrapProCode", + title: "浜у搧缂栫爜", + type: "string", + width: 150, + }, + { + prop: "scrapProVersion", + title: "鎶ュ簾鐗堟湰", + type: "string", + width: 120, + }, + { + prop: "scrapProLotNo", + title: "鎵规鍙�", + type: "string", + width: 150, + }, + { + prop: "scrapSETQty", + title: "鎶ュ簾SET鏁伴噺", + type: "int", + width: 180, + hidden: true, + }, + { + prop: "scrapPcsQty", + title: "鎶ュ簾PCS鏁�", + type: "int", + width: 180, + }, + // { + // prop: "assignQuantity", + // title: "鍒嗛厤鍑哄簱閲�", + // type: "string", + // width: 100, + // }, + { + prop: "overScrapSETQty", + title: "宸叉姤搴烻ET鏁�", + type: "int", + width: 180, + }, + { + prop: "overScrapPcsQty", + title: "宸叉姤搴烶CS鏁�", + type: "string", + width: 180, + }, + { + prop: "scrapProDetailStatus", + title: "璁㈠崟鏄庣粏鐘舵��", + type: "string", + width: 180, + } + ], + }; + }, + methods: { + open(row) { + this.row = row; + console.log(row); + this.showDetialBox = true; + this.getData(); + }, + handleCurrentChange(val) { + this.currentRow = val; + }, + outSelect(){ + if (this.selection.length === 0) { + return this.$message.error("璇烽�夋嫨鍗曟嵁鏄庣粏"); + } + this.dialogFormVisible=true; + }, + handleRowClick(row) { + this.$refs.singleTable.toggleRowSelection(row); + }, + handleSelectionChange(val) { + this.selection = val; + }, + UpProScrap() { + var keys = this.selection.map((item) => item.id); // 鑾峰彇閫変腑琛岀殑id + this.http + .post("api/ErpProScrapSheetDetail/UpProScrap?scrapNo="+ + this.row.proScrapSheetOrderNo, keys, "鏁版嵁澶勭悊涓�") + .then((x) => { + if (!x.status) return this.$message.error(x.message); + this.$message.success("鎿嶄綔鎴愬姛"); + this.$parent.refresh(); + this.$emit("parentCall", ($vue) => { + $vue.getData(); + }); + }); + }, + closeCustomModel() { + this.formFields2.LineCode=""; + this.formFields2.Grade="0"; + this.dialogFormVisible=false; + this.$parent.refresh(); + }, + outbound() { + if (this.selection.length === 0) { + return this.$message.error("璇烽�夋嫨鍗曟嵁鏄庣粏"); + } + //璇烽�夋嫨鍗曟潯鏁版嵁 + if (this.selection.length > 1) { + return this.$message.error("璇烽�夋嫨鍗曟潯鏁版嵁"); + } + var keys = this.selection.map((item) => item.id); // 鑾峰彇閫変腑琛岀殑id + + this.http + .post("api/Task/OutProductTask?stationCode="+this.formFields2.LineCode +"&grade="+this.formFields2.Grade, keys, "鏁版嵁澶勭悊涓�") + .then((x) => { + if (!x.status) return this.$message.error(x.message); + this.$message.success("鎿嶄綔鎴愬姛"); + this.formFields2.LineCode=""; + this.formFields2.Grade="0"; + this.dialogFormVisible=false; + this.$parent.refresh(); + this.showDetialBox = false; + this.$emit("parentCall", ($vue) => { + $vue.getData(); + }); + }); + }, + getData() { + this.http + .post( + "api/ErpProScrapSheetDetail/GetByDetails?scrapNo=" + + this.row.proScrapSheetOrderNo, + null, + "鏌ヨ涓�" + ) + .then((x) => { + var label=[ + { label: '鏈紑濮�', value: 0 }, + { label: '鍑哄簱涓�', value: 1 }, + { label: '鍑哄簱瀹屾垚', value: 2 }, + { label: '鍙栨秷', value: 98 }, + { label: '鎻愪氦鍏抽棴', value: 99 } + ] + this.tableData=x.map((i) => ({ + ...i, + scrapProDetailStatus:label.find((j) => j.value === i.scrapProDetailStatus).label + })) + }); + }, + }, + }; + </script> + <style scoped> + .less-style { + color: black; + } + .equle-style { + color: green; + } + .more-style { + color: red; + } + </style> + + <style> + .text-button:hover { + background-color: #f0f9eb !important; + } + .el-table .warning-row { + background: oldlace; + } + .box-table .el-table tbody tr:hover > td { + background-color: #d8e0d4 !important; + /* color: #ffffff; */ + } + + .box-table .el-table tbody tr.current-row > td { + background-color: #f0f9eb !important; + /* color: #ffffff; */ + } + + .el-table .success-row { + background: #f0f9eb; + } + + .box-table .el-table { + border: 1px solid #ebeef5; + } + .box-head .el-alert__content { + width: 100%; + } + </style> \ No newline at end of file diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/views/outbound/erpProScrapSheet.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/views/outbound/erpProScrapSheet.vue" index 8683b1b..0de7b24 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/views/outbound/erpProScrapSheet.vue" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/views/outbound/erpProScrapSheet.vue" @@ -130,14 +130,14 @@ table: "erpProScrapSheetDetail", columns: [ { - field: "id", - title: "Id", - type: "int", - width: 90, - hidden: true, - readonly: true, - require: true, - align: "left", + field: "id", + title: "Id", + type: "int", + width: 90, + hidden: true, + readonly: true, + require: true, + align: "left", }, { field: "proScrapSheetId", diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_CheckService/CheckOrderResultService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_CheckService/CheckOrderResultService.cs" index bb5a54d..6a77d8a 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_CheckService/CheckOrderResultService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_CheckService/CheckOrderResultService.cs" @@ -264,12 +264,15 @@ } _purchaseOrderDetailRepository.UpdateData(purchaseOrderDetail); } - //ERP涓婃姤 - WebResponseContent responseContent = _checkOrderService.FeedbackCheckResult(checkOrder, checkOrderResult != null ? new List<Dt_CheckOrderResult> { checkOrderResult } : new List<Dt_CheckOrderResult>()); - if (!responseContent.Status) + if (string.IsNullOrEmpty(checkModel.CreatorCode)) { - throw new Exception(responseContent.Message); - } + //ERP涓婃姤 + WebResponseContent responseContent = _checkOrderService.FeedbackCheckResult(checkOrder, checkOrderResult != null ? new List<Dt_CheckOrderResult> { checkOrderResult } : new List<Dt_CheckOrderResult>()); + if (!responseContent.Status) + { + throw new Exception(responseContent.Message); + } + } checkOrder.UploadStatus = CheckUploadEnum.UploadOk.ObjToInt(); _checkOrderRepository.UpdateData(checkOrder); _unitOfWorkManage.CommitTran(); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskTypeEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskTypeEnum.cs" index 90c524e..3d17fc0 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskTypeEnum.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/TaskTypeEnum.cs" @@ -65,6 +65,11 @@ [Description("鎴愬搧鍑哄簱")] OutProduct = 230, /// <summary> + /// 鎴愬搧鎶ュ簾鍑哄簱 + /// </summary> + [Description("鎴愬搧鎶ュ簾鍑哄簱")] + OutProScrap = 235, + /// <summary> /// 鎴愬搧瀵勫敭鍑哄簱 /// </summary> [Description("鎴愬搧瀵勫敭鍑哄簱")] @@ -74,7 +79,7 @@ /// </summary> [Description("鎴愬搧MES鎻愬簱")] OutMesRworkProduct =250, - + /// <summary> /// 闃茬剨鍓嶆淳宸ュ皬浠� /// </summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundRepository/IOutboundRepository.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundRepository/IOutboundRepository.cs" index 9ed3de3..18225f6 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundRepository/IOutboundRepository.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundRepository/IOutboundRepository.cs" @@ -19,5 +19,7 @@ IProOutOrderRepository ProOutOrderRepository { get; } IProOutOrderDetailRepository ProOutOrderDetailRepository { get; } IMesRworkOutboundOrderRepository RworkOutboundOrderRepository { get; } + IErpProScrapSheetRepository ErpProScrapSheetRepository { get;} + IErpProScrapSheetDetailRepository ErpProScrapDetailRepository { get;} } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IErpProScrapSheetDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IErpProScrapSheetDetailService.cs" index 74d29cb..28fac2a 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IErpProScrapSheetDetailService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IErpProScrapSheetDetailService.cs" @@ -3,6 +3,8 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using WIDESEA_Common.LocationEnum; +using WIDESEA_Core; using WIDESEA_Core.BaseServices; using WIDESEA_IOutboundRepository; using WIDESEA_Model.Models; @@ -12,5 +14,9 @@ public interface IErpProScrapSheetDetailService : IService<Dt_ErpProScrapSheetDetail> { IErpProScrapSheetDetailRepository Repository { get; } + List<Dt_ErpProScrapSheetDetail> GetByDetails(string scrapNo); + WebResponseContent UpProScrap(string scrapNo,int[] keys); + (List<Dt_ProStockInfo>, List<Dt_ErpProScrapSheetDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(List<Dt_ErpProScrapSheetDetail> proOutOrderDetails, Dt_ErpProScrapSheet scrapSheet); + WebResponseContent LockOutboundStockDataUpdate(List<Dt_ProStockInfo> proStockInfos, List<Dt_ErpProScrapSheetDetail> scrapSheetDetails, List<Dt_OutProStockInfo> outProStockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutProStockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutProStockInfoService.cs" index f27c514..ce59d59 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutProStockInfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutProStockInfoService.cs" @@ -16,6 +16,10 @@ Dt_OutProStockInfo GetOutStockLockInfo(Dt_ProOutOrder proOutOrder, Dt_ProOutOrderDetail proOutOrderDetail, Dt_ProStockInfo proStockInfo, float assignQty, int? taskNum = null); //澶勭悊鎻愬簱鍑哄簱璇︽儏 Dt_OutProStockInfo GetOutStockLockInfo(Dt_MesRworkOutboundOrder mesOutboundOrder, Dt_ProStockInfo outStock, float assignQuantity, int? taskNum = null); + /// <summary> + /// 鎴愬搧鎶ュ簾鍑哄簱璇︽儏 + /// </summary> + Dt_OutProStockInfo GetOutStockLockInfo(Dt_ErpProScrapSheet proScrapSheet, Dt_ErpProScrapSheetDetail scrapSheetDetail, Dt_ProStockInfo proStockInfo, float assignQty, int? taskNum = null); List<Dt_OutProStockInfo> GetByOrderDetailId(int orderDetailId, OutLockStockStatusEnum? outStockStatus); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundService.cs" index 991ad73..3f408b2 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundService.cs" @@ -29,5 +29,7 @@ IMesRworkOutboundOrderService RworkOutboundOrderService { get; } IErpProTransferOrderService ErpProTransferOrderService { get; } + IErpProScrapSheetService ErpProScrapSheetService { get; } + IErpProScrapSheetDetailService ErpProScrapSheetDetailService { get;} } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockRepository/IProStockInfoRepository.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockRepository/IProStockInfoRepository.cs" index 4d8d4c7..05fcc95 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockRepository/IProStockInfoRepository.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockRepository/IProStockInfoRepository.cs" @@ -18,5 +18,6 @@ /// 鑾峰彇鎴愬搧搴撳瓨 /// </summary> List<Dt_ProStockInfo> GetProStocks(Dt_MesRworkOutboundOrder mesRworkOutboundOrder, List<string> locationInfos); + List<Dt_ProStockInfo> GetProStocks(Dt_ErpProScrapSheetDetail erpProScrapSheetDetail, List<string> locationInfos); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IProStockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IProStockInfoService.cs" index 6e082b8..2b323b0 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IProStockInfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IProStockInfoService.cs" @@ -33,9 +33,15 @@ /// </summary> /// <returns></returns> public List<Dt_ProStockInfo> GetUseableStocks(Dt_MesRworkOutboundOrder mesRworkOutboundOrder); + + List<Dt_ProStockInfo> GetUseableStocks(int warehoseId, Dt_ErpProScrapSheetDetail erpProScrapSheetDetail); /// <summary> /// 鑾峰彇MES鎻愬簱搴撳瓨 /// </summary> List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_MesRworkOutboundOrder mesRworkOutboundOrder, float needQuantity, out float residueQuantity); + /// <summary> + /// 鑾峰彇鎴愬搧鎶ュ簾鐨勫簱瀛� + /// </summary> + List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_ErpProScrapSheetDetail outOrderDetail, float needQuantity, out float residueQuantity); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" index 9488d88..d37cbe2 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" @@ -371,6 +371,7 @@ /// <param name="StationCode">绔欏彴鍦板潃</param> /// <returns></returns> Task<WebResponseContent> OutProductTask(int[] keys, string StationCode, int Grade); + Task<WebResponseContent> OutProScrapTask(int[] keys, string StationCode, int Grade); /// <summary> /// 鎴愬搧浣欐枡閫�搴撳叆浠� /// </summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_ErpProScrapSheet.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_ErpProScrapSheet.cs" index 4427524..2afe795 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_ErpProScrapSheet.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_ErpProScrapSheet.cs" @@ -41,7 +41,7 @@ /// 宸叉牳鍑�<br/> /// </summary> [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "鎶ュ簾鐘舵��")] - public string ProScrapStatus { get; set; } + public int ProScrapStatus { get; set; } /// <summary> /// 澶囨敞 diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_ErpProScrapSheetDetail.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_ErpProScrapSheetDetail.cs" index 8d93ff0..0cd4448 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_ErpProScrapSheetDetail.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_ErpProScrapSheetDetail.cs" @@ -57,6 +57,12 @@ public int ScrapPcsQty { get; set; } /// <summary> + /// 閿佸畾PCS鏁� + /// </summary> + [SugarColumn(IsNullable = false, ColumnDescription = "鎶ュ簾PCS鏁�")] + public int LockPcsQty { get; set; } + + /// <summary> /// 宸叉姤搴烻ET鏁伴噺 /// </summary> [SugarColumn(IsNullable = false, ColumnDescription = "宸蹭笅鎶ュ簾SET鏁伴噺")] diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundRepository/OutboundRepository.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundRepository/OutboundRepository.cs" index 81ed156..da9358a 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundRepository/OutboundRepository.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundRepository/OutboundRepository.cs" @@ -19,8 +19,10 @@ public IProOutOrderRepository ProOutOrderRepository { get; } public IProOutOrderDetailRepository ProOutOrderDetailRepository { get; } public IMesRworkOutboundOrderRepository RworkOutboundOrderRepository { get; } + public IErpProScrapSheetRepository ErpProScrapSheetRepository { get;} + public IErpProScrapSheetDetailRepository ErpProScrapDetailRepository { get;} - public OutboundRepository(IOutboundOrderDetailRepository outboundOrderDetailRepository, IOutboundOrderRepository outboundOrderRepository, IOutStockLockInfoRepository outboundStockLockInfoRepository,IMesPPCutOutboundOrderRepository mesPPCutOutboundOrderRepository, IProOutOrderRepository proOutOrderRepository, IProOutOrderDetailRepository proOutOrderDetailRepository, IMesRworkOutboundOrderRepository rworkOutboundOrderRepository) + public OutboundRepository(IOutboundOrderDetailRepository outboundOrderDetailRepository, IOutboundOrderRepository outboundOrderRepository, IOutStockLockInfoRepository outboundStockLockInfoRepository,IMesPPCutOutboundOrderRepository mesPPCutOutboundOrderRepository, IProOutOrderRepository proOutOrderRepository, IProOutOrderDetailRepository proOutOrderDetailRepository, IMesRworkOutboundOrderRepository rworkOutboundOrderRepository, IErpProScrapSheetRepository erpProScrapSheetRepository, IErpProScrapSheetDetailRepository erpProScrapSheetDetailRepository) { OutboundOrderDetailRepository = outboundOrderDetailRepository; OutboundOrderRepository = outboundOrderRepository; @@ -29,6 +31,8 @@ ProOutOrderRepository = proOutOrderRepository; ProOutOrderDetailRepository = proOutOrderDetailRepository; RworkOutboundOrderRepository = rworkOutboundOrderRepository; + ErpProScrapSheetRepository= erpProScrapSheetRepository; + ErpProScrapDetailRepository = erpProScrapSheetDetailRepository; } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ErpProScrapSheetDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ErpProScrapSheetDetailService.cs" index e911579..7fb5094 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ErpProScrapSheetDetailService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ErpProScrapSheetDetailService.cs" @@ -1,13 +1,28 @@ -锘縰sing System; +锘縰sing OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using WIDESEA_Common.LocationEnum; +using WIDESEA_Common.OrderEnum; +using WIDESEA_Common.StockEnum; +using WIDESEA_Common.WareHouseEnum; +using WIDESEA_Core; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.BaseServices; +using WIDESEA_Core.Helper; +using WIDESEA_DTO.ERP; +using WIDESEA_External.ERPService; +using WIDESEA_External.Model; +using WIDESEA_IBasicService; using WIDESEA_IOutboundRepository; using WIDESEA_IOutboundService; +using WIDESEA_IRecordService; +using WIDESEA_IStockRepository; +using WIDESEA_IStockService; using WIDESEA_Model.Models; +using WIDESEA_OutboundRepository; namespace WIDESEA_OutboundService { @@ -15,10 +30,321 @@ { private readonly IUnitOfWorkManage _unitOfWorkManage; public IErpProScrapSheetDetailRepository Repository => BaseDal; + public IErpProScrapSheetRepository _proScrapSheetRepository; + public IInvokeERPService _invokeERPService; + public IStockRepository _stockRepository; + public IStockService _stockService; + public IOutProStockInfoService _outProStockInfoService; + public IBasicService _basicService; + public IRecordService _recordService; - public ErpProScrapSheetDetailService(IErpProScrapSheetDetailRepository BaseDal, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) + public ErpProScrapSheetDetailService(IErpProScrapSheetDetailRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IErpProScrapSheetRepository proScrapSheetRepository, IInvokeERPService invokeERPService, IStockRepository stockRepository, IStockService stockService, IOutProStockInfoService outProStockInfoService, IRecordService recordService) : base(BaseDal) { _unitOfWorkManage = unitOfWorkManage; + _proScrapSheetRepository = proScrapSheetRepository; + _invokeERPService = invokeERPService; + _stockRepository = stockRepository; + _stockService = stockService; + _outProStockInfoService = outProStockInfoService; + _recordService = recordService; + } + //鑾峰彇瀵瑰簲鍗曞彿鐨勬姤搴熸槑缁� + public List<Dt_ErpProScrapSheetDetail> GetByDetails(string scrapNo) + { + List<Dt_ErpProScrapSheetDetail> proScrapSheetDetails = _proScrapSheetRepository.Db.Queryable<Dt_ErpProScrapSheet, Dt_ErpProScrapSheetDetail>((master, detail) => master.Id == detail.ProScrapSheetId) + .Where((master, detail) => master.ProScrapSheetOrderNo==scrapNo) + .Select((master, detail) => detail) + .ToList(); + return proScrapSheetDetails; + } + /// <summary> + /// 鎻愪氦鎶ュ簾鎿嶄綔 + /// </summary> + /// <returns></returns> + public WebResponseContent UpProScrap(string scrapNo,int[] keys) + { + WebResponseContent content = new WebResponseContent(); + try + { + //鑾峰彇鎵�鏈夌殑鎶ュ簾鏄庣粏 + Dt_ErpProScrapSheet erpProScrapSheet = _proScrapSheetRepository.Db.Queryable<Dt_ErpProScrapSheet>().Where(x => x.ProScrapSheetOrderNo == scrapNo).Includes(x => x.Details).First(); + if (erpProScrapSheet == null) + { + return content.Error($"鏈壘鍒板搴旀姤搴熷崟{scrapNo}"); + } + if (erpProScrapSheet.Details == null || erpProScrapSheet.Details.Count<=0) + { + return content.Error($"鏈壘鍒板搴旀姤搴熷崟{scrapNo}鏄庣粏"); + } + List<Dt_ErpProScrapSheetDetail> erpProScrapSheetDetails = erpProScrapSheet.Details.Where(x=> keys.Contains(x.Id) && x.ScrapProDetailStatus== OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt()).ToList(); + List<Dt_ErpProScrapSheetDetail> overDetails= erpProScrapSheet.Details.Where(x => x.ScrapProDetailStatus == OutOrderStatusEnum.鍏抽棴.ObjToInt()).ToList(); + int overCount = overDetails.Count; + //杩涜鎶ュ簾鎻愪氦鎿嶄綔 + if (erpProScrapSheetDetails.Count!= keys.Length) + { + return content.Error($"鎻愪氦浜嗗凡鎶ュ簾鏄庣粏鎴栨鍦ㄥ嚭搴撲腑,璇锋鏌�"); + } + if ((overCount + keys.Length) == erpProScrapSheet.Details.Count) + { + erpProScrapSheet.ProScrapStatus = ProScrapSheetStatusEnum.Valid.ObjToInt(); + } + List<ScrapSheetItem> scrapSheetItems = new List<ScrapSheetItem>(); + foreach (var item in erpProScrapSheetDetails) + { + item.ScrapProDetailStatus = OutOrderStatusEnum.鍏抽棴.ObjToInt(); + item.OverScrapPcsQty = item.ScrapPcsQty; + item.OverScrapSETQty = item.ScrapSETQty; + ScrapSheetItem scrapSheetItem = new ScrapSheetItem() + { + PartNum = item.ScrapProCode, + PartRev = item.ScrapProVersion, + Lotno = item.ScrapProVersion, + QtyOfArray = item.ScrapSETQty, + QtyOfUnit = item.ScrapPcsQty, + QtyOfArray_Alloc = 0, + QtyOfUnit_Alloc = 0, + }; + scrapSheetItems.Add(scrapSheetItem); + } + _unitOfWorkManage.BeginTran(); + _proScrapSheetRepository.UpdateData(erpProScrapSheet); + BaseDal.UpdateData(erpProScrapSheetDetails); + if (erpProScrapSheet.ProScrapStatus == ProScrapSheetStatusEnum.Valid.ObjToInt()) + { + ERPScrapSheetModel scrapSheetModel = new ERPScrapSheetModel() + { + Way = 1, + UniqueTag = erpProScrapSheet.Id.ToString(), + Code = erpProScrapSheet.ProScrapSheetOrderNo, + Status = ProScrapSheetStatusEnum.Valid.ToString(), + Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + Createuser = erpProScrapSheet.Creater, + WarehouseCode = WarehouseEnum.HA71.ToString(), + DataItem = new List<ScrapSheetItem>() + }; + if (overCount>0) + { + foreach (var item in overDetails) + { + ScrapSheetItem scrapSheetItem = new ScrapSheetItem() + { + PartNum = item.ScrapProCode, + PartRev = item.ScrapProVersion, + Lotno = item.ScrapProVersion, + QtyOfArray = item.ScrapSETQty, + QtyOfUnit = item.ScrapPcsQty, + QtyOfArray_Alloc = 0, + QtyOfUnit_Alloc = 0, + }; + scrapSheetItems.Add(scrapSheetItem); + } + } + scrapSheetModel.DataItem = scrapSheetItems; + //涓婁紶ERP鎶ュ簾 + string response = _invokeERPService.InvokeProScrapSheetApi(scrapSheetModel); + ErpRequestContent requestContent = response.DeserializeObject<ErpRequestContent>(); + if (requestContent.res != 1) + { + throw new Exception($"{requestContent.Data}"); + } + } + _unitOfWorkManage.CommitTran(); + content.OK(); + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + content.Error(ex.Message); + } + return content; + } + /// <summary> + /// 鎶ュ簾鏁版嵁澶勭悊 + /// </summary> + public WebResponseContent LockOutboundStockDataUpdate(List<Dt_ProStockInfo> proStockInfos, List<Dt_ErpProScrapSheetDetail> scrapSheetDetails, List<Dt_OutProStockInfo> outProStockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null) + { + try + { + //鏇存柊搴撳瓨灞炴�� + _stockService.ProStockInfoService.Repository.UpdateData(proStockInfos); + List<Dt_ProStockInfoDetail> proStockInfoDetails = new List<Dt_ProStockInfoDetail>(); + foreach (var item in proStockInfos) + { + proStockInfoDetails.AddRange(item.proStockInfoDetails); + } + //鏇存柊搴撳瓨鏄庣粏 + proStockInfoDetails.ForEach(x => x.ProOutDetailStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt()); + _stockService.ProStockInfoDetailService.Repository.UpdateData(proStockInfoDetails); + + BaseDal.UpdateData(scrapSheetDetails); + + List<Dt_OutProStockInfo> addOutStockLockInfos = outProStockInfos.Where(x => x.Id == 0).ToList(); + if (addOutStockLockInfos != null && addOutStockLockInfos.Any()) + { + if (tasks != null) + { + addOutStockLockInfos.ForEach(x => + { + x.TaskNum = tasks.FirstOrDefault(v => v.PalletCode == x.PalletCode)?.TaskNum; + }); + } + + _outProStockInfoService.Repository.AddData(addOutStockLockInfos); + } + List<Dt_OutProStockInfo> updateOutStockLockInfos = outProStockInfos.Where(x => x.Id > 0).ToList(); + if (updateOutStockLockInfos != null && updateOutStockLockInfos.Any()) + { + _outProStockInfoService.Repository.UpdateData(updateOutStockLockInfos); + } + + _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, locationStatus, LocationChangeType.OutboundAssignLocation, "", tasks?.Select(x => x.TaskNum).ToList()); + _basicService.LocationInfoService.Repository.UpdateLocationStatus(locationInfos, locationStatus); + return WebResponseContent.Instance.OK(); + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } + public (List<Dt_ProStockInfo>, List<Dt_ErpProScrapSheetDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(List<Dt_ErpProScrapSheetDetail> proOutOrderDetails, Dt_ErpProScrapSheet scrapSheet) + { + List<Dt_ProStockInfo> outStocks = new List<Dt_ProStockInfo>(); + List<Dt_OutProStockInfo> outProStockInfos = new List<Dt_OutProStockInfo>(); + List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); + //List<Dt_ProOutOrderDetail> groupDetails = proOutOrderDetails.GroupBy(x => new { x.SaleOrder, x.PCode, x.PVer, x.PLot, x.DateCode }).Select(x => new Dt_ProOutOrderDetail() + //{ + // QtyPcs = x.Sum(x => x.QtyPcs) - x.Sum(x => x.OverQtyPcs), + // SaleOrder = x.Key.SaleOrder, + // PCode = x.Key.PCode, + // PVer = x.Key.PVer, + // PLot = x.Key.PLot, + // DateCode = x.Key.DateCode, + //}).ToList(); + //foreach (var item in groupDetails) + //{ + // float needQty = item.QtyPcs; + // //鏌ユ壘鍙敤搴撳瓨 + // List<Dt_ProStockInfo> stockInfoss = _stockInfoService.ProStockInfoService.GetUseableStocks(proOutOrder.WarehouseId, item); + // if (!stockInfoss.Any()) + // { + // throw new Exception("鏈壘鍒板彲鍒嗛厤搴撳瓨"); + // } + // //鑾峰彇鍑哄簱搴撳瓨 + // List<Dt_ProStockInfo> assignOutStocks = _stockInfoService.ProStockInfoService.GetOutboundStocks(stockInfoss, item, needQty, out float residueQuantity); + // item.LockQtyPcs += needQty - residueQuantity; + // if (item.QtyPcs> item.LockQtyPcs) + // { + // throw new Exception($"浜у搧缂栫爜{item.PCode}鍙垎閰嶆暟閲忎笉瓒�,鍙敤鏁伴噺{item.LockQtyPcs}"); + // } + // outStocks.AddRange(assignOutStocks); + // float assignQuantity = needQty - residueQuantity; + // bool isCanLot = string.IsNullOrEmpty(item.PLot); + // bool isCanDate = string.IsNullOrEmpty(item.DateCode); + // List<Dt_ProOutOrderDetail> details = proOutOrderDetails + // .Where(x =>x.PCode == item.PCode && x.PVer == item.PVer + // && (isCanLot ? isCanLot : x.PLot == item.PLot) + // && (isCanDate ? isCanDate : x.DateCode == item.DateCode)) + // .ToList(); + + // for (int i = 0; i < details.Count; i++) + // { + // float orderQuantity = details[i].QtyPcs; + // for (int j = 0; j < assignOutStocks.Count; j++) + // { + // //鍑哄簱璁㈠崟鏄庣粏宸插垎閰嶆暟閲� + // float detailAssignQuantity = outProStockInfos.Where(x => x.PCode == item.PCode && x.PVer == item.PVer + // && (isCanLot ? isCanLot : x.PLot == item.PLot) + // && (isCanDate ? isCanDate : x.DateCode == item.DateCode) + // && x.OrderDetailId == details[i].Id).Sum(x => x.AssignQuantity); + + // float palletAssignQuantity = outProStockInfos.Where(x => x.PCode == item.PCode && x.PVer == item.PVer + // && (isCanLot ? isCanLot : x.PLot == item.PLot) + // && (isCanDate ? isCanDate : x.DateCode == item.DateCode) + // && x.PalletCode == assignOutStocks[j].PalletCode).Sum(x => x.AssignQuantity); + // //鍑哄簱璇︽儏宸插垎閰嶆暟閲� + // palletAssignQuantity = outProStockInfos.Where(x => x.PCode == item.PCode && x.PVer == item.PVer + // && (isCanLot ? isCanLot : x.PLot == item.PLot) + // && (isCanDate ? isCanDate : x.DateCode == item.DateCode) + // && x.PalletCode == assignOutStocks[j].PalletCode).Sum(x => x.AssignQuantity);//鍑哄簱璇︽儏宸插垎閰嶆暟閲� + // float palletOutboundQuantity = assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity); + // if (palletAssignQuantity < palletOutboundQuantity)//濡傛灉鍑哄簱璇︽儏宸插垎閰嶆暟閲忓皬浜庢墭鐩樺凡鍒嗛厤鏁伴噺锛屽垯鍙互缁х画娣诲姞璇ユ墭鐩樺嚭搴撲俊鎭� + // { + // float orderDetailNeedQuantity = details[i].QtyPcs - detailAssignQuantity; + // if (orderDetailNeedQuantity > assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity) - palletAssignQuantity) + // { + // details[i].LockQtyPcs += assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity) - palletAssignQuantity; + // Dt_OutProStockInfo outStockLockInfo = _outProStockInfoService.GetOutStockLockInfo(proOutOrder, details[i], assignOutStocks[j], assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity) - palletAssignQuantity); + // outProStockInfos.Add(outStockLockInfo); + // } + // else + // { + // Dt_OutProStockInfo outStockLockInfo = _outProStockInfoService.GetOutStockLockInfo(proOutOrder, details[i], assignOutStocks[j], details[i].QtyPcs - details[i].LockQtyPcs); + // outProStockInfos.Add(outStockLockInfo); + // details[i].LockQtyPcs = details[i].QtyPcs; + // break; + // } + + // } + // } + // } + // List<string> locationArr = outStocks.Select(x => x.LocationCode).ToList(); + + // locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(locationArr)); + + //} + foreach (var item in proOutOrderDetails) + { + float needQty = item.ScrapPcsQty; + //鏌ユ壘鍙敤搴撳瓨 + List<Dt_ProStockInfo> stockInfoss = _stockService.ProStockInfoService.GetUseableStocks(scrapSheet.WarehouseId, item); + if (!stockInfoss.Any()) + { + throw new Exception("鏈壘鍒板彲鍒嗛厤搴撳瓨"); + } + //鑾峰彇鍑哄簱搴撳瓨 + List<Dt_ProStockInfo> assignOutStocks = _stockService.ProStockInfoService.GetOutboundStocks(stockInfoss, item, needQty, out float residueQuantity); + item.LockPcsQty += (int)(needQty - residueQuantity); + if (item.ScrapPcsQty > item.LockPcsQty) + { + throw new Exception($"浜у搧缂栫爜{item.ScrapProCode}鍙垎閰嶆暟閲忎笉瓒�,鍙敤鏁伴噺{item.LockPcsQty}"); + } + outStocks.AddRange(assignOutStocks); + item.LockPcsQty = 0; + for (int j = 0; j < assignOutStocks.Count; j++) + { + //鍑哄簱璁㈠崟鏄庣粏宸插垎閰嶆暟閲� + float detailAssignQuantity = outProStockInfos.Where(x => x.OrderDetailId == item.Id).Sum(x => x.AssignQuantity); + ////鍑哄簱璇︽儏宸插垎閰嶆暟閲� + //float palletAssignQuantity = outProStockInfos.Where(x => x.PCode == item.PCode && x.PVer == item.PVer + // && (isCanLot ? isCanLot : x.PLot == item.PLot) + // && (isCanDate ? isCanDate : x.DateCode == item.DateCode) + // && x.PalletCode == assignOutStocks[j].PalletCode).Sum(x => x.AssignQuantity); + ////鍑哄簱璇︽儏宸插垎閰嶆暟閲� + //float palletOutboundQuantity = assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity); + //if (palletAssignQuantity < palletOutboundQuantity)//濡傛灉鍑哄簱璇︽儏宸插垎閰嶆暟閲忓皬浜庢墭鐩樺凡鍒嗛厤鏁伴噺锛屽垯鍙互缁х画娣诲姞璇ユ墭鐩樺嚭搴撲俊鎭� + //{ + float orderDetailNeedQuantity = item.ScrapPcsQty - detailAssignQuantity; + if (orderDetailNeedQuantity > assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity)) + { + item.LockPcsQty += (int)assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity); + Dt_OutProStockInfo outStockLockInfo = _outProStockInfoService.GetOutStockLockInfo(scrapSheet, item, assignOutStocks[j], assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity)); + outProStockInfos.Add(outStockLockInfo); + } + else + { + Dt_OutProStockInfo outStockLockInfo = _outProStockInfoService.GetOutStockLockInfo(scrapSheet, item, assignOutStocks[j], item.ScrapPcsQty - detailAssignQuantity); + outProStockInfos.Add(outStockLockInfo); + item.LockPcsQty = item.ScrapPcsQty; + break; + } + //} + } + List<string> locationArr = outStocks.Select(x => x.LocationCode).ToList(); + + locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(locationArr)); + + } + return (outStocks, proOutOrderDetails, outProStockInfos, locationInfos); } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ErpProScrapSheetService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ErpProScrapSheetService.cs" index 40a0e79..8ccb2c2 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ErpProScrapSheetService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ErpProScrapSheetService.cs" @@ -55,7 +55,7 @@ } if (!item.ContainsKey(nameof(Dt_ErpProScrapSheetDetail.ScrapProDetailStatus).FirstLetterToLower())) { - item.Add(nameof(Dt_ErpProScrapSheetDetail.ScrapProDetailStatus).FirstLetterToLower(), OutOrderStatusEnum.鍑哄簱涓�.ObjToInt()); + item.Add(nameof(Dt_ErpProScrapSheetDetail.ScrapProDetailStatus).FirstLetterToLower(), OutOrderStatusEnum.鏈紑濮�.ObjToInt()); } } return base.AddData(saveModel); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutProStockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutProStockInfoService.cs" index 07bbbb5..891e797 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutProStockInfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutProStockInfoService.cs" @@ -77,6 +77,36 @@ return outProStockInfo; } + /// <summary> + /// 鎴愬搧鎶ュ簾鍑哄簱璇︽儏 + /// </summary> + /// <returns></returns> + public Dt_OutProStockInfo GetOutStockLockInfo(Dt_ErpProScrapSheet proScrapSheet, Dt_ErpProScrapSheetDetail scrapSheetDetail, Dt_ProStockInfo proStockInfo, float assignQty, int? taskNum = null) + { + Dt_OutProStockInfo outProStockInfo = new Dt_OutProStockInfo() + { + OrderNo = proScrapSheet.ProScrapSheetOrderNo, + OrderDetailId = scrapSheetDetail.Id, + OrderType = 1, + BatchNo = scrapSheetDetail.ScrapProLotNo, + SaleOrder = "", + Customer = "", + PCode = scrapSheetDetail.ScrapProCode, + PVer = scrapSheetDetail.ScrapProVersion, + PLot = proStockInfo.proStockInfoDetails.FirstOrDefault()?.LotNumber ?? "", + DateCode = proStockInfo.proStockInfoDetails.FirstOrDefault()?.DateCode ?? "", + StockId = proStockInfo.Id, + OrderQuantity = scrapSheetDetail.ScrapPcsQty, + OriginalQuantity = proStockInfo.proStockInfoDetails.Sum(x => x.StockPcsQty), + AssignQuantity = assignQty, + LocationCode = proStockInfo.LocationCode, + PalletCode = proStockInfo.PalletCode, + Unit = "PCS", + TaskNum = taskNum, + Status = taskNum == null ? OutLockStockStatusEnum.宸插垎閰�.ObjToInt() : OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt() + }; + return outProStockInfo; + } public List<Dt_OutProStockInfo> GetByOrderDetailId(int orderDetailId, OutLockStockStatusEnum? outStockStatus) { return BaseDal.QueryData(x => x.OrderDetailId == orderDetailId && outStockStatus == null ? true : x.Status == outStockStatus.ObjToInt()); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs" index e97371f..8e775e6 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs" @@ -30,8 +30,10 @@ public IMesRworkOutboundOrderService RworkOutboundOrderService { get; } public IErpProTransferOrderService ErpProTransferOrderService { get; } - - public OutboundService(IOutboundOrderDetailService outboundOrderDetailService, IMesRworkOutboundOrderService rworkOutboundOrderService,IMesPPOutboundOrderDetailService mesPPOutboundOrderDetailService, IMesPPCutOutboundOrderDetailService mesPPCutOutboundOrderDetailService, IMesPPCutOutboundOrderService mesPPCutOutboundOrderService, IMesPPOutboundOrderService mesPPOutboundOrderService, IOutboundOrderService outboundOrderService, IOutStockLockInfoService outboundStockLockInfoService, IMesOutboundOrderService mesOutboundOrderService,IProOutOrderService proOutOrderService, IProOutOrderDetailService proOutOrderDetailService,IErpProTransferOrderService erpProTransferOrderService) + public IErpProScrapSheetService ErpProScrapSheetService { get; } + public IErpProScrapSheetDetailService ErpProScrapSheetDetailService { get; } + public OutboundService(IOutboundOrderDetailService outboundOrderDetailService, IMesRworkOutboundOrderService rworkOutboundOrderService,IMesPPOutboundOrderDetailService mesPPOutboundOrderDetailService, IMesPPCutOutboundOrderDetailService mesPPCutOutboundOrderDetailService, IMesPPCutOutboundOrderService mesPPCutOutboundOrderService, IMesPPOutboundOrderService mesPPOutboundOrderService, IOutboundOrderService outboundOrderService, IOutStockLockInfoService outboundStockLockInfoService, IMesOutboundOrderService mesOutboundOrderService,IProOutOrderService proOutOrderService, IProOutOrderDetailService proOutOrderDetailService,IErpProTransferOrderService erpProTransferOrderService, + IErpProScrapSheetService erpProScrapSheetService, IErpProScrapSheetDetailService erpProScrapSheetDetailService) { OutboundOrderDetailService = outboundOrderDetailService; OutboundOrderService = outboundOrderService; @@ -45,6 +47,8 @@ ProOutOrderDetailService = proOutOrderDetailService; RworkOutboundOrderService = rworkOutboundOrderService; ErpProTransferOrderService = erpProTransferOrderService; + ErpProScrapSheetService = erpProScrapSheetService; + ErpProScrapSheetDetailService = erpProScrapSheetDetailService; } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderService.cs" index 9ea6759..2ea2ca9 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/ProOutOrderService.cs" @@ -804,20 +804,20 @@ //鏇存柊鍑哄簱鏄庣粏鍗曟暟閲� proOutOrderDetail.OverQtyPcs += item.Quantity; - item.Quantity -= item.Quantity; - float Range = itemOut.StockPcsQty / itemOut.SETQty; + int Range = (int)itemOut.StockPcsQty / (int)itemOut.SETQty; if (Range == 0) { - return content.Error($"{itemOut.BagNo}鍗曞厓鏁伴噺杞崲澶辫触,璇锋鏌�"); + return content.Error($"{itemOut.BagNo}鍗曞厓鏁伴噺杞崲澶辫触,璇锋鏌�,Range:{Range}"); } - int outSet = (int)(item.Quantity / Range); + int outSet =item.Quantity / Range; if (outSet == 0) { - return content.Error($"{itemOut.BagNo}鍗曞厓鏁伴噺杞崲澶辫触,璇锋鏌�"); + return content.Error($"{itemOut.BagNo}鍗曞厓鏁伴噺杞崲澶辫触,璇锋鏌�,outSet:{outSet}"); } itemOut.SETQty -= outSet; itemOut.StockPcsQty -= item.Quantity; + item.Quantity = 0; if (proOutOrderDetail.OverQtyPcs > proOutOrderDetail.QtyPcs) { return content.Error($"鍑哄簱鍗晎proOutOrder.ProOutOrderNo}閿�鍞鍗晎item.SoNumber}鏁伴噺婧㈠嚭{proOutOrderDetail.OverQtyPcs - proOutOrderDetail.QtyPcs}"); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/ProStockInfoRepository.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/ProStockInfoRepository.cs" index 2675255..f27bff3 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/ProStockInfoRepository.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/ProStockInfoRepository.cs" @@ -86,5 +86,26 @@ proStockInfos = proStockInfos.OrderBy(x => x.proStockInfoDetails.FirstOrDefault()?.DateCode).ThenBy(x => x.proStockInfoDetails.Sum(x => x.StockPcsQty)).ToList(); return proStockInfos; } + /// <summary> + /// 鑾峰彇MES鎻愬簱搴撳瓨(灏炬暟浠�) + /// </summary> + /// <param name="mesRworkOutboundOrder"></param> + /// <param name="locationInfos"></param> + /// <returns></returns> + public List<Dt_ProStockInfo> GetProStocks(Dt_ErpProScrapSheetDetail erpProScrapSheetDetail, List<string> locationInfos) + { + List<Dt_ProStockInfo>? proStockInfos = null; + proStockInfos = Db.Queryable<Dt_ProStockInfo>().Where(x => locationInfos.Contains(x.LocationCode) && x.ProStockAttribute == ProStockAttributeEnum.鎴愬搧.ObjToInt()) + .Includes(x => x.proStockInfoDetails) + .Where(x => x.proStockInfoDetails + .Any(v => + v.ProductCode == erpProScrapSheetDetail.ScrapProLotNo + && v.ProductCode == erpProScrapSheetDetail.ScrapProCode + && v.ProductVersion == erpProScrapSheetDetail.ScrapProVersion + )) + .ToList(); + proStockInfos = proStockInfos.OrderBy(x => x.proStockInfoDetails.FirstOrDefault()?.DateCode).ThenBy(x => x.proStockInfoDetails.Sum(x => x.StockPcsQty)).ToList(); + return proStockInfos; + } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/ProStockInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/ProStockInfoService.cs" index 3db069b..00a3ae1 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/ProStockInfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/ProStockInfoService.cs" @@ -113,6 +113,12 @@ List<string> locationCodes = _basicRepository.LocationInfoRepository.GetCanOutLocationCodes(warehouse.WarehouseId); return BaseDal.GetProStocks(mesRworkOutboundOrder, locationCodes); } + //鏌ユ壘鍙敤鎶ュ簾搴撳瓨 + public List<Dt_ProStockInfo> GetUseableStocks(int warehoseId, Dt_ErpProScrapSheetDetail erpProScrapSheetDetail) + { + List<string> locationCodes = _basicRepository.LocationInfoRepository.GetCanOutLocationCodes(warehoseId); + return BaseDal.GetProStocks(erpProScrapSheetDetail, locationCodes); + } /// <summary> /// 鑾峰彇鍑哄簱搴撳瓨 /// </summary> @@ -222,6 +228,66 @@ return assignOutStocks; } /// <summary> + /// 鑾峰彇鎶ュ簾搴撳瓨 + /// </summary> + public List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_ErpProScrapSheetDetail outOrderDetail, float needQuantity, out float residueQuantity) + { + List<Dt_ProStockInfo> assignOutStocks = new List<Dt_ProStockInfo>(); + float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x); + //stockInfos = stockInfos.OrderBy(x => x.Id).ToList(); + if (stockTotalQuantity >= needQuantity)//搴撳瓨澶� + { + int index = 0; + while (needQuantity > 0) + { + Dt_ProStockInfo stockInfo = stockInfos[index]; + float useableStockQuantity = stockInfo.proStockInfoDetails + .Where(x => + x.ProductCode == outOrderDetail.ScrapProCode + && x.ProductVersion==outOrderDetail.ScrapProVersion + && x.LotNumber == outOrderDetail.ScrapProLotNo) + .Sum(x => x.StockPcsQty - x.OutboundQuantity); + if (useableStockQuantity < needQuantity && useableStockQuantity > 0) + { + stockInfo.proStockInfoDetails.Where(x => + x.ProductCode == outOrderDetail.ScrapProCode + && x.ProductVersion == outOrderDetail.ScrapProVersion + && x.LotNumber == outOrderDetail.ScrapProLotNo).ToList().ForEach(x => x.OutboundQuantity = x.StockPcsQty); + needQuantity -= useableStockQuantity; + } + else + { + stockInfo.proStockInfoDetails.ForEach(x => + { + //婊¤冻鏉′欢杩涜鍒嗛厤 + if ((x.StockPcsQty > x.OutboundQuantity) + && x.ProductCode == outOrderDetail.ScrapProCode + && x.ProductVersion == outOrderDetail.ScrapProVersion + && x.LotNumber == outOrderDetail.ScrapProLotNo) + { + if (x.StockPcsQty - x.OutboundQuantity >= needQuantity) + { + x.OutboundQuantity += needQuantity; + needQuantity = 0; + x.OutDetailId = outOrderDetail.Id; + } + else + { + needQuantity -= (x.StockPcsQty - x.OutboundQuantity); + x.OutboundQuantity = x.StockPcsQty; + x.OutDetailId = outOrderDetail.Id; + } + } + }); + } + assignOutStocks.Add(stockInfo); + index++; + } + } + residueQuantity = needQuantity; + return assignOutStocks; + } + /// <summary> /// 鑾峰彇MES鎻愬簱搴撳瓨 /// </summary> public List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_MesRworkOutboundOrder mesRworkOutboundOrder, float needQuantity, out float residueQuantity) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" index b3dcf34..b453a70 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" @@ -829,6 +829,9 @@ case (int)TaskTypeEnum.OutMesRworkProduct: content = OutMesRworkCompleted(task); break; + case (int)TaskTypeEnum.OutProScrap: + content = OutProScrapCompleted(task); + break; default: content.Error("鏈煡浠诲姟绫诲瀷"); break; @@ -1023,6 +1026,89 @@ } return content; } + public WebResponseContent OutProScrapCompleted(Dt_Task task) + { + WebResponseContent content = new WebResponseContent(); + try + { + //鑾峰彇璐т綅 + Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress); + if (locationInfo == null) + { + return content.Error("鏈壘鍒拌揣浣嶄俊鎭�"); + } + //鏍规嵁浠诲姟鑾峰彇鎴愬搧鍑哄簱璇︽儏浠诲姟鍙婄墿鏂欎俊鎭� + Dt_OutProStockInfo outProStockInfo = _outProStockInfoRepository.QueryFirst(x => x.TaskNum == task.TaskNum); + if (outProStockInfo == null) + { + return content.Error("鏈壘鍒版垚鍝佸嚭搴撹鎯�"); + } + //鑾峰彇鎴愬搧鎶ュ簾鍗� + + Dt_ErpProScrapSheet erpProScrapSheet = _outboundRepository.ErpProScrapSheetRepository.Db.Queryable<Dt_ErpProScrapSheet>().Where(x => x.ProScrapSheetOrderNo == outProStockInfo.OrderNo).Includes(x=>x.Details).First(); + if (erpProScrapSheet == null) + { + return content.Error("鏈壘鍒版垚鍝佹姤搴熷崟"); + } + Dt_ErpProScrapSheetDetail erpProScrapSheetDetail = erpProScrapSheet.Details.FirstOrDefault(x => x.Id == outProStockInfo.OrderDetailId); + if (erpProScrapSheetDetail == null) + { + return content.Error("鏈壘鍒版垚鍝佹姤搴熷崟鏄庣粏"); + } + if (erpProScrapSheetDetail.ScrapProDetailStatus == OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt()) + { + return content.Error($"鎴愬搧鎶ュ簾鍗曟槑缁嗚{erpProScrapSheetDetail.Id}宸插畬鎴�"); + } + erpProScrapSheetDetail.ScrapProDetailStatus = OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt(); + //鑾峰彇褰撳墠搴撳瓨 + Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>().Where(x => x.PalletCode == task.PalletCode).Includes(x => x.proStockInfoDetails).First(); + if (proStockInfo == null) + { + return content.Error($"鏈壘鍒皗task.PalletCode}搴撳瓨淇℃伅"); + } + List<Dt_ProStockInfoDetail> proStockInfoDetails = proStockInfo.proStockInfoDetails; + if (proStockInfoDetails.Count <= 0) + { + return content.Error("鎴愬搧搴撳瓨鏄庣粏涓虹┖"); + } + proStockInfoDetails.ForEach(x => + { + x.OutboundQuantity = 0; + x.ProOutDetailStatus = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt(); + }); + proStockInfo.StockStatus = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt(); + //鑾峰彇鎴愬搧骞冲簱 + Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA101.ToString()); + proStockInfo.WarehouseId = warehouse.WarehouseId; + proStockInfo.LocationCode = "鎴愬搧鍖呰鎷h揣鍖�"; + task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); + outProStockInfo.Status = OutLockStockStatusEnum.鍑哄簱瀹屾垚.ObjToInt(); + _unitOfWorkManage.BeginTran(); + //璐т綅鍙樺姩璁板綍 + int beforeStatus = locationInfo.LocationStatus; + locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); + _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, proStockInfo.PalletType, LocationStatusEnum.Free, locationInfo.WarehouseId); + _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, (LocationStatusEnum)beforeStatus, LocationStatusEnum.Free, LocationChangeType.OutboundCompleted, erpProScrapSheet?.ProScrapSheetOrderNo ?? "", task.TaskNum); + _stockRepository.ProStockInfoRepository.UpdateData(proStockInfo); + _stockRepository.ProStockInfoDetailRepository.UpdateData(proStockInfoDetails); + _outProStockInfoRepository.UpdateData(outProStockInfo); + BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚); + //MES鎴愬搧搴撳瓨鏉垮嚭搴撳悓姝� + //WebResponseContent responseContent = ProductOutBoundSync(MesProOutBound(mesRworkOutboundOrder, proStockInfoDetails)); + //if (!responseContent.Status) + //{ + // throw new Exception("鍚屾MES搴撳瓨鏉垮嚭搴撳け璐�,閿欒:"+ responseContent.Message); + //} + _unitOfWorkManage.CommitTran(); + content.OK(); + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + content.Error(ex.Message); + } + return content; + } /// <summary> /// 鐩樼偣鍑哄簱瀹屾垚 /// </summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs" index 98f3311..c6482fb 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs" @@ -260,6 +260,85 @@ return content; } /// <summary> + /// 鐢熸垚鎴愬搧鎶ュ簾浠诲姟 + /// </summary> + /// <param name="ProOutNo">鍑哄簱璁㈠崟鍙�</param> + /// <param name="StationCode">绔欏彴鍦板潃</param> + /// <returns></returns> + public async Task<WebResponseContent> OutProScrapTask(int[] keys, string StationCode, int Grade) + { + WebResponseContent content = new WebResponseContent(); + try + { + if (StationCode.IsNullOrEmpty()) + { + return await Task.FromResult(content.Error("鍐呴儴閿欒")); + } + //鑾峰彇鎴愬搧鎶ュ簾璁㈠崟 + List<Dt_ErpProScrapSheetDetail> _ProOutOrderDetails = await _outboundRepository.ErpProScrapDetailRepository.QueryDataAsync(x => keys.Contains(x.Id) && x.ScrapProDetailStatus == OutOrderStatusEnum.鏈紑濮�.ObjToInt()); + if (_ProOutOrderDetails.Count <= 0) + { + return await Task.FromResult(content.Error("鍕鹃�夎鍗曟槑缁嗙姸鎬佷负鍑哄簱涓�")); + } + List<Dt_Task> tasks = new List<Dt_Task>(); + List<Dt_ProStockInfo> proStockInfos = new List<Dt_ProStockInfo>(); + List<Dt_ErpProScrapSheetDetail> proOutOrderDetails = new List<Dt_ErpProScrapSheetDetail>(); + List<Dt_OutProStockInfo> outProStockInfos = new List<Dt_OutProStockInfo>(); + List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); + (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ErpProScrapSheetDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) result = + OutProScrapTaskDataHandle(_ProOutOrderDetails); + if (result.Item2 != null && result.Item2.Count > 0) + { + proStockInfos.AddRange(result.Item2); + } + if (result.Item3 != null && result.Item3.Count > 0) + { + proOutOrderDetails.AddRange(result.Item3); + } + if (result.Item4 != null && result.Item4.Count > 0) + { + outProStockInfos.AddRange(result.Item4); + } + if (result.Item5 != null && result.Item5.Count > 0) + { + locationInfos.AddRange(result.Item5); + } + if (result.Item1 != null && result.Item1.Count > 0) + { + Dt_Task? task = BaseDal.QueryData(x => x.TaskType == TaskTypeEnum.OutProScrap.ObjToInt()).OrderBy(x => x.Grade).FirstOrDefault(); + //鏇存柊鍑哄簱鐩殑浣嶇疆 + result.Item1.ForEach(x => + { + x.TargetAddress = StationCode; + if (Grade == 1 || task == null) + { + x.Grade = 127; + } + else + { + if (task.Grade == 0 || task.Grade == 1) + { + x.Grade = 1; + } + else + { + x.Grade = task.Grade - 1; + } + } + }); + tasks.AddRange(result.Item1); + } + //澶勭悊鍑哄簱鏁版嵁 + return await Task.FromResult(GenerateOutboundTaskDataUpdate(tasks, proStockInfos, proOutOrderDetails, outProStockInfos, locationInfos)); + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + content.Error(ex.Message); + } + return content; + } + /// <summary> /// 浜哄伐閫夊畾搴撳瓨鍑哄簱 /// </summary> /// <returns></returns> @@ -505,6 +584,51 @@ } /// <summary> + /// 澶勭悊鍑哄簱鏁版嵁 + /// </summary> + public WebResponseContent GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_ProStockInfo>? proStockInfos = null, List<Dt_ErpProScrapSheetDetail>? scrapSheetDetails = null, List<Dt_OutProStockInfo>? outProStockInfos = null, List<Dt_LocationInfo>? locationInfos = null) + { + try + { + _unitOfWorkManage.BeginTran(); + //鑾峰彇鎴愬搧鍑哄簱鍗曚富琛� + Dt_ErpProScrapSheet scrapSheet = _outboundRepository.ErpProScrapSheetRepository.QueryFirst(x => x.Id == scrapSheetDetails.FirstOrDefault().ProScrapSheetId); + BaseDal.AddData(tasks); + if (proStockInfos != null && proStockInfos.Count > 0 && scrapSheetDetails != null && scrapSheetDetails.Count > 0 && outProStockInfos != null && outProStockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0) + { + proStockInfos.ForEach(x => + { + x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt(); + }); + WebResponseContent content = _outboundService.ErpProScrapSheetDetailService.LockOutboundStockDataUpdate(proStockInfos, scrapSheetDetails, outProStockInfos, locationInfos, tasks: tasks); + + if (!content.Status) + { + _unitOfWorkManage.RollbackTran(); + return content; + } + } + else if (scrapSheetDetails != null && scrapSheetDetails.Count > 0) + { + scrapSheetDetails.ForEach(x => + { + x.ScrapProDetailStatus = OutOrderStatusEnum.鍑哄簱涓�.ObjToInt(); + }); + + _outboundRepository.ErpProScrapDetailRepository.UpdateData(scrapSheetDetails); + } + _unitOfWorkManage.CommitTran(); + PushTasksToWCS(tasks); + return WebResponseContent.Instance.OK(); + } + catch (Exception ex) + { + _unitOfWorkManage.RollbackTran(); + return WebResponseContent.Instance.Error(ex.Message); + } + + } + /// <summary> /// 澶勭悊鎴愬搧鍑哄簱鏁版嵁 /// </summary> /// <returns></returns> @@ -552,6 +676,46 @@ } return (tasks, proStockInfos, proOutOrderDetails, outProStockInfos, locationInfos); } + public (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ErpProScrapSheetDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) OutProScrapTaskDataHandle(List<Dt_ErpProScrapSheetDetail> scrapSheetDetails) + { + List<Dt_Task> tasks = new List<Dt_Task>(); + List<Dt_ProStockInfo> proStockInfos = new List<Dt_ProStockInfo>(); + List<Dt_ErpProScrapSheetDetail> assignOutOrderDetails = new List<Dt_ErpProScrapSheetDetail>(); + List<Dt_OutProStockInfo> outProStockInfos = new List<Dt_OutProStockInfo>(); + List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); + + //鑾峰彇鎶ュ簾鍗� + Dt_ErpProScrapSheet scrapSheet = _outboundRepository.ErpProScrapSheetRepository.QueryFirst(x => x.Id == scrapSheetDetails.FirstOrDefault().ProScrapSheetId); + if (scrapSheet == null) + { + throw new Exception("鏈壘鍒版垚鍝佹姤搴熻鍗�"); + } + //鍒嗛厤搴撳瓨 + (List<Dt_ProStockInfo>, List<Dt_ErpProScrapSheetDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) result = _outboundService.ErpProScrapSheetDetailService.AssignProStockOut(scrapSheetDetails, scrapSheet); + if (result.Item1 != null && result.Item1.Count > 0) + { + TaskTypeEnum typeEnum = TaskTypeEnum.OutProScrap; + tasks = GetTasks(result.Item1, typeEnum); + result.Item2.ForEach(x => + { + x.ScrapProDetailStatus = OutOrderStatusEnum.鍑哄簱涓�.ObjToInt(); + }); + result.Item3.ForEach(x => + { + x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt(); + }); + tasks.ForEach(x => x.OrderNo = scrapSheet.ProScrapSheetOrderNo); + proStockInfos = result.Item1; + assignOutOrderDetails = result.Item2; + outProStockInfos = result.Item3; + locationInfos = result.Item4; + } + else + { + throw new Exception("鏃犲彲鍒嗛厤搴撳瓨"); + } + return (tasks, proStockInfos, assignOutOrderDetails, outProStockInfos, locationInfos); + } /// <summary> /// 鐢熸垚浠诲姟 /// </summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs" index d9fe9c0..5330a30 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs" @@ -292,6 +292,7 @@ { return MesResponseContent.Instance.Error(responseContent.Message); } + model.Content.CreatorCode = "QMS"; string content = _invokeERPService.InvokeCheckOrderApi(model.Content); ErpRequestContent requestContent = content.DeserializeObject<ErpRequestContent>(); if (requestContent.res != 1) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/ErpProScrapSheetDetailController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/ErpProScrapSheetDetailController.cs" index 986bfa7..ae53f35 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/ErpProScrapSheetDetailController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/ErpProScrapSheetDetailController.cs" @@ -1,4 +1,7 @@ -锘縰sing Microsoft.AspNetCore.Mvc; +锘縰sing Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using WIDESEA_Core; +using WIDESEA_Core.Attributes; using WIDESEA_Core.BaseController; using WIDESEA_IOutboundService; using WIDESEA_Model.Models; @@ -16,5 +19,18 @@ { } + /// <summary> + /// 鎶ュ簾鍗曟槑缁嗘煡璇� + /// </summary> + [HttpPost, Route("GetByDetails"), AllowAnonymous] + public List<Dt_ErpProScrapSheetDetail> GetByDetails(string scrapNo) + { + return Service.GetByDetails(scrapNo); + } + [HttpPost, Route("UpProScrap"), AllowAnonymous] + public WebResponseContent UpProScrap([FromBody] int[] keys, string scrapNo) + { + return Service.UpProScrap(scrapNo,keys); + } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" index 21ebc59..3a7cf2e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" @@ -228,6 +228,15 @@ { return await Service.OutProductTask(keys, StationCode, Grade); } + + /// <summary> + /// 鐢熸垚鎴愬搧鎶ュ簾浠诲姟 + /// </summary> + [HttpPost, HttpGet, Route("OutProScrapTask"), AllowAnonymous] + public async Task<WebResponseContent> OutProScrapTask([FromBody] int[] keys, string StationCode, int Grade) + { + return await Service.OutProScrapTask(keys, StationCode, Grade); + } ///// <summary> ///// 鐢熸垚MESPP浠撳ぇ鍗峰嚭搴撲换鍔� ///// </summary> -- Gitblit v1.9.3