From cfda752a37242ba2ed68124293498abce7fc974f Mon Sep 17 00:00:00 2001 From: wyb <1qaz@123> Date: 星期四, 06 五月 2021 18:14:37 +0800 Subject: [PATCH] 委外工单下推委外工序派工单完成 --- WebAPI/Controllers/Sc_ProcessMangementController.cs | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 174 insertions(+), 0 deletions(-) diff --git a/WebAPI/Controllers/Sc_ProcessMangementController.cs b/WebAPI/Controllers/Sc_ProcessMangementController.cs index ccf0739..dc74d15 100644 --- a/WebAPI/Controllers/Sc_ProcessMangementController.cs +++ b/WebAPI/Controllers/Sc_ProcessMangementController.cs @@ -465,6 +465,180 @@ } /// <summary> + /// 淇濆瓨濮斿娲惧伐鍗曚俊鎭� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveWWProcessSendWork")] + [HttpPost] + public object SaveWWProcessSendWork([FromBody] JObject msg) + { + var _value = msg["msg"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); + string msg3 = sArray[1].ToString(); + + string UserName = ""; + ListModels oListModels = new ListModels(); + + try + { + WebAPI.DLL.ClsSc_ProcessSendWork Sendwork = new WebAPI.DLL.ClsSc_ProcessSendWork(); + List<WebAPI.Models.ClsSc_ProcessSendWorkMain> lsmain = new List<WebAPI.Models.ClsSc_ProcessSendWorkMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); + lsmain = oListModels.getObjectByJson_WWSendWorkMain(msg2); + foreach (WebAPI.Models.ClsSc_ProcessSendWorkMain oItem in lsmain) + { + UserName = oItem.HMaker; + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HDate = DateTime.Now; + oItem.HMainSourceInterID = oItem.HInterID; + oItem.HInterID = 0; + if (DBUtility.ClsPub.isStrNull(oItem.HPlanBeginDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊~鍐欒鍒掑紑宸ユ棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + + Sendwork.omodel = oItem; + + + } + + //琛ㄤ綋鏁版嵁 + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + msg3 = msg3.Substring(1, msg3.Length - 2); + msg3 = msg3.Replace("\\", ""); + msg3 = msg3.Replace("\n", ""); //\n + List<WebAPI.Models.WW_EntrustWorkOrderViewModel> ls = new List<WebAPI.Models.WW_EntrustWorkOrderViewModel>(); + ls = oListModels.getObjectByJson_WWSendWorkSub(msg3); + int i = 0; + List<Model.ClsSc_ProcessSendWorkSub> lss = new List<Model.ClsSc_ProcessSendWorkSub>(); + foreach (WebAPI.Models.WW_EntrustWorkOrderViewModel oItemSub in ls) + { + + i++; + Model.ClsSc_ProcessSendWorkSub sendworksub = new Model.ClsSc_ProcessSendWorkSub(); + sendworksub.HProcID = 0;//--宸ュ簭ID + sendworksub.HSourceInterID = (long)oItemSub.hmainid;//婧愬崟id + sendworksub.HSourceEntryID = oItemSub.hsubid; //--婧愬崟瀛怚D + sendworksub.HSourceBillNo = oItemSub.鍗曟嵁鍙�; //--婧愬崟鍗曞彿 + sendworksub.HSourceBillType = oItemSub.HBillType; //--婧愬崟绫诲瀷 + sendworksub.HQty = oItemSub.鏁伴噺; //--鏁伴噺 + sendworksub.HICMOBillNo = ""; //--浠诲姟鍗曞彿 + sendworksub.HSeOrderBillNo = ""; //--閿�鍞鍗曞彿 + sendworksub.HSeOrderEntryID = 0; //--閿�鍞瓙ID + sendworksub.HSeOrderInterID = 0; //--閿�鍞鍗曚富ID + sendworksub.HPlanTimes = 0; //--璁″垝宸ユ椂 + sendworksub.HPlanEndDate = DateTime.Now; //--璁″垝瀹屽伐鏃ユ湡 + sendworksub.HPlanBeginDate = DateTime.Now; //--璁″垝寮�宸ユ棩鏈� + sendworksub.HQty = (double)oItemSub.鏁伴噺; //--娲惧伐鏁伴噺 + sendworksub.HWorkerNumber = ""; //--鎿嶄綔宸ヤ唬鐮� + sendworksub.HWorkerID = 0; //--鎿嶄綔宸D + sendworksub.HGroupNumber = ""; //鐝粍浠g爜 + sendworksub.HGroupID =0; //--鐝粍ID + sendworksub.HSourceNumber = ""; //--鐢熶骇璧勬簮浠g爜 + //--鐢熶骇璧勬簮ID + sendworksub.HProcNumber = ""; //--宸ュ簭浠g爜 + + if (oItemSub.鏁伴噺 <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佺" + i.ToString() + "琛屾暟閲忎笉澶т簬0鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + if (Convert.ToInt32(sendworksub.HQty) > Convert.ToInt32(oItemSub.鏁伴噺)) + { + 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; + //} + + sendworksub.HEntryID = i; + sendworksub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + sendworksub.HRemark = ""; + sendworksub.HCloseMan = ""; + sendworksub.HCloseType = false; + lss.Add(sendworksub);//鍏堟妸鏁版嵁瀛樻斁鍒版淳宸ュ崟瀛愯〃闆嗗悎閲� + + + } + if (lss.Count > 0) + { + //鐒跺悗鍐嶅惊鐜繚瀛樺埌娲惧伐鍗曞瓙琛ㄧ殑闆嗗悎閲� + foreach (Model.ClsSc_ProcessSendWorkSub Itemsendwork in lss) + { + Sendwork.DetailColl.Add(Itemsendwork); + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛乴ss闆嗗悎灏忎簬0"; + objJsonResult.data = 1; + return objJsonResult; + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (Sendwork.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = Sendwork.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = Sendwork.ModifyBill(Sendwork.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; + } + } + catch (Exception e) + { + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + + /// <summary> /// 杩斿洖濮斿宸ュ崟鍒楄〃 /// </summary> /// <param name="sWhere"></param> -- Gitblit v1.9.1