From 663e2ea4eb6ee3c4411443b8b5757a0be826a6cc Mon Sep 17 00:00:00 2001 From: WYB <908761037@qq.com> Date: 星期一, 12 四月 2021 22:01:02 +0800 Subject: [PATCH] 工序汇报单保存逻辑完成 --- WebAPI/Controllers/Sc_ProcessMangementController.cs | 212 ++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 147 insertions(+), 65 deletions(-) diff --git a/WebAPI/Controllers/Sc_ProcessMangementController.cs b/WebAPI/Controllers/Sc_ProcessMangementController.cs index 5867b53..465aafb 100644 --- a/WebAPI/Controllers/Sc_ProcessMangementController.cs +++ b/WebAPI/Controllers/Sc_ProcessMangementController.cs @@ -693,76 +693,158 @@ msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n - //msg2 = msg2.Replace("'", "鈥�"); - //List<Model.ClsCg_POInStockBillSub> ls = new List<Model.ClsCg_POInStockBillSub>(); - //ls = oListModels.getObjectByJson_POInStockSub(msg3); - //int i = 0; - //foreach (Model.ClsCg_POInStockBillSub oItemSub in ls) - //{ - // i++; - // if (oItemSub.HQty <= 0) - // { - // objJsonResult.code = "0"; - // objJsonResult.count = 0; - // objJsonResult.Message = "淇濆瓨澶辫触锛佺" + i.ToString() + "琛屾暟閲忎笉澶т簬0鏃犳硶淇濆瓨锛�"; - // objJsonResult.data = 1; - // return objJsonResult; - // } - // if (oItemSub.HQty > oItemSub.HRQty) - // { - // objJsonResult.code = "0"; - // objJsonResult.count = 0; - // objJsonResult.Message = "淇濆瓨澶辫触锛佺" + i.ToString() + "琛屾暟閲忎笉鑳藉ぇ浜庢湭鍏宠仈鏁伴噺锛�"; - // objJsonResult.data = 1; - // return objJsonResult; - // } - // if (DBUtility.ClsPub.isStrNull(oItemSub.HBatChNo) == "") - // { - // objJsonResult.code = "0"; - // objJsonResult.count = 0; - // objJsonResult.Message = "淇濆瓨澶辫触锛佺" + i.ToString() + "琛屾湭濉啓鎵瑰彿锛�"; - // objJsonResult.data = 1; - // return objJsonResult; - // } + msg2 = msg2.Replace("'", "鈥�"); + List<WebAPI.Models.Sc_ProcessSendWorkViewModel> ls = new List<WebAPI.Models.Sc_ProcessSendWorkViewModel>(); + ls = oListModels.getObjectByJson_ViewReportlist(msg3); + int i = 0; + //瀹氫箟姹囨姤鍗曞瓙琛ㄩ泦鍚堢敤浜庡瓨鏀句笅鎺ㄦ淳宸ュ崟鐨勫琛屾暟鎹� + List<Model.ClsSc_ProcessReportSub> lsReportSub = new List<Model.ClsSc_ProcessReportSub>(); + foreach (WebAPI.Models.Sc_ProcessSendWorkViewModel ItemView in ls) + { + + i++; + Model.ClsSc_ProcessReportSub reportSub = new Model.ClsSc_ProcessReportSub(); + if (ItemView.鏁伴噺 <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佺" + i.ToString() + "琛屾暟閲忎笉澶т簬0鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + if ((double)ItemView.鏁伴噺 < ReportModel.omodel.HPlanQty) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佸伐搴忔眹鎶ュ崟绱姹囨姤鏁伴噺涓嶈兘澶т簬婧愬崟鏁伴噺锛�"; + objJsonResult.data = 1; + return objJsonResult; + } - // oItemSub.HEntryID = i; - // oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); - // oItemSub.HRemark = ""; - // oItemSub.HCloseMan = ""; - // oItemSub.HCloseType = false; - // oBill.DetailColl.Add(oItemSub); - //} + reportSub.HEntryID = i; + reportSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + reportSub.HRemark = ""; + reportSub.HCloseMan = ""; + reportSub.HCloseType = false; + reportSub.HEmpID =0; + reportSub.HICMOBillNo =""; + reportSub.HICMOInterID = (long)ItemView.HICMOInterID; + reportSub.HEntryID = i; + reportSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + reportSub.HRemark = ""; + reportSub.HCloseMan = ""; + reportSub.HCloseType = false; + reportSub.HSourceBillType = "3712"; + reportSub.HQty = (double)ItemView.鏁伴噺; + reportSub.HProcID = (long)ItemView.HprocID; + reportSub.HProcNumber = ItemView.宸ュ簭浠g爜; + reportSub.HOutPrice = 0; + reportSub.HOutMoney = 0; + reportSub.HSourceID = (long)ItemView.HSourceID; + reportSub.HEmpNumber = ""; + reportSub.HRelBeginDate = DateTime.Now; + reportSub.HRelEndDate = DateTime.Now; + reportSub.HTimes = 3; + reportSub.HSeOrderInterID = 0; + reportSub.HSeOrderEntryID = 0; + reportSub.HSeOrderBillNo = ""; + reportSub.HProcPlanInterID = 0; + reportSub.HProcPlanBillNo = ""; + reportSub.HSourceInterID = 0; + reportSub.HSourceBillNo = ""; + reportSub.HRelationQty = 0; + reportSub.HRelationMoney = 0; + reportSub.HMaterID = (long)ItemView.HMaterID; + reportSub.HMaterNumber = ItemView.鐗╂枡浠g爜; + reportSub.HCheckQty = 0; + reportSub.HBadCount = 0; + reportSub.HWasterQty = 0; + reportSub.HWasterQty2 = 0; + reportSub.HPrice = 0; + reportSub.HMoney = 0; + reportSub.HProcPlanInterID = 0; + reportSub.HProcPlanEntryID = 0; + reportSub.HProcPlanBillNo = ""; + reportSub.HSourceEntryID = 0; + reportSub.HSourceBillType = ""; + reportSub.HRelationQty = 0; + reportSub.HRelationMoney = 0; + reportSub.HBadPrirce = 0; + reportSub.HBadMoney = 0; + reportSub.HWasterPrice = 0; + reportSub.HWasterMoney = 0; + reportSub.HQualityRate = 0; + reportSub.HSecUnitQty1 = 0; + reportSub.HSecUnitRate1 = 0; + reportSub.HSecUnitQty2 = 0; + reportSub.HSecUnitRate2 = 0; + reportSub.HUsingQty = 0; + reportSub.HSelfBadCount = 0; + reportSub.HPreBadCount = 0; + reportSub.HPayMentQty = 0; + reportSub.HOtherDeduct = 0; + reportSub.HRelPay = 0; + reportSub.HOtherItem1 = ""; + reportSub.HOtherItem2 = ""; + reportSub.HOtherItem3 = ""; + reportSub.HOtherItem4 = ""; + reportSub.HOtherItem5 = ""; + reportSub.HPackType = ""; + reportSub.HCheckEmpID = 0; + reportSub.HWeight = 0; + reportSub.HBatchNo = ""; + + lsReportSub.Add(reportSub); + + } + if (lsReportSub.Count>0) + { + //鐒跺悗鍦ㄥ惊鐜繚瀛樺埌姹囨姤浣嗗瓙琛� + foreach (Model.ClsSc_ProcessReportSub item in lsReportSub) + { + + ReportModel.DetailColl.Add(item); + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛乴sReportSub闆嗗悎灏忎簬0"; + objJsonResult.data = 1; + return objJsonResult; + } ////淇濆瓨鍓嶅垽鏂�(鍗曟嵁鍙烽噸澶嶏紝绗斿綍椤圭洰) ////淇濆瓨 ////淇濆瓨瀹屾瘯鍚庡鐞� - //bool bResult; - //if (oBill.omodel.HInterID == 0) - //{ - // // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); - // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); - //} - //else - //{ - // bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); - //} - //if (bResult) - //{ - // objJsonResult.code = "0"; - // objJsonResult.count = 1; - // objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; - // WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); - // objJsonResult.data = 1; - // return objJsonResult; - //} - //else - //{ - // objJsonResult.code = "0"; - // objJsonResult.count = 0; - // objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; - // objJsonResult.data = 1; - // return objJsonResult; - //} + bool bResult; + if (ReportModel.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = ReportModel.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = ReportModel.ModifyBill(ReportModel.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + objJsonResult.data = 1; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = 1; + return objJsonResult; + } } -- Gitblit v1.9.1