From b88e886227a7ecceb48ded35603daf6940e9c504 Mon Sep 17 00:00:00 2001 From: YL <YL@LAPTOP-SE03PLUR> Date: 星期四, 17 六月 2021 17:35:29 +0800 Subject: [PATCH] 生产管理:增加 生产汇报单 编辑模块(新增,修改,删除功能)及列表 --- WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs | 232 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 206 insertions(+), 26 deletions(-) diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs index db30083..5c82b3c 100644 --- a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs +++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs @@ -81,10 +81,10 @@ string msg1 = _value.ToString(); try { - //濮斿宸ュ簭鍙戝嚭鍙嶅簭鍒楀寲 + //閮ㄩ棬鍩虹璧勬枡鍙嶅簭鍒楀寲 msg1 = "[" + msg1.ToString() + "]"; List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg1); - + string eventType = list[0].eventType; long HInterID = list[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D int HYear = 2021; double HPeriod = list[0].HPeriod;//鍗曚环 @@ -93,8 +93,8 @@ string HInnerBillNo = list[0].HInnerBillNo;//閫佽揣鍗曞彿 string HICMOBillNo = list[0].HICMOBillNo;//鐢熶骇璁㈠崟鍙� long HICMOInterID = list[0].HICMOInterID;//鐢熶骇璁㈠崟鍙稩D - int HProcExchInterID = 0; - int HProcExchEntryID = 0; + long HProcExchInterID = list[0].lngBillKey; + long HProcExchEntryID = list[0].lngBillSubKey; string HProcExchBillNo = list[0].HProcExchBillNo;//娴佽浆鍗� long HProcID = list[0].HProcID;//褰撳墠宸ュ簭 long HMaterID = list[0].HMaterID;//浜у搧ID @@ -111,7 +111,7 @@ double HMoney = list[0].HMoney;//閲戦 string HRemark = list[0].HRemark;//澶囨敞 double HTaxRate = list[0].HTaxRate;//绋庣巼 - string HProcNo = list[0].HProcNo;//娴佹按鍙� + long HProcNo = list[0].HProcNo;//娴佹按鍙� string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙� int HWWWorkOrderInterID = 0;//濮斿宸ュ崟鍙峰瓙鍐呯爜 int HWWWorkOrderEntryID = 0;//濮斿宸ュ崟鍙蜂富鍐呭悧 @@ -136,27 +136,162 @@ double HMainSourceInterID = 0; string HMainSourceBillNo = ""; string HMainSourceBillType = "3792"; - + if (HProcExchInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佽浆鍗℃病鏈夐�夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcExchEntryID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佹按鍙�2娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcNo <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佹按鍙锋病鏈夐�夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcExchBillNo == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佽浆鍗″彿娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HInnerBillNo == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙戣揣鍙锋病鏈夎緭鍏ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "褰撳墠宸ュ簭娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HMaterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浜у搧娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HSupID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "渚涘簲鍟嗘病鏈夐�夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HQty <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎺ユ敹涓暟涓嶈兘灏忎簬绛変簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HWasterQty < 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "涓嶅悎鏍兼暟涓嶈兘灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HTaxRate < 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "绋庣巼涓嶈兘涓鸿礋锛�"; + objJsonResult.data = null; + return objJsonResult; + } //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� oCN.BeginTran(); - //涓昏〃 - oCN.RunProc("Insert Into Sc_StationOutBillMain " + - "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + - ",HYear,HPeriod,HRemark,HInnerBillNo,HSourceName,HPieceQty,HWasterQty,HPlanPieceQty,HBadPNL" + - ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + - ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationOutTime,HSourceID" + - ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + - ",HSupID,HTaxRate,HQty,HPrice,HMoney,HPrice_BHS,HMoney_BHS,HBadCount" + - ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HProcNo,HOrderProcNO,HLastSubProc,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID" + - ") " + - " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" + - "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HInnerBillNo + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL + - "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID + - ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID + - "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" + - "," + HSupID + "," + HTaxRate + "," + HQty + "," + HPrice + "," + HMoney + "," + HPrice_BHS + "," + HMoney_BHS + "," + HBadCount + - "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + HProcNo + ",'" + HOrderProcNO + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + ",'" + HWWWorkOrderBillNo + "'," + HWWWorkOrderInterID + "," + HWWWorkOrderEntryID + - ") "); + if ("Add".Equals(eventType)) + { + if (!AllowbillNo(HBillNo)) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒"; + objJsonResult.data = null; + return objJsonResult; + } + //涓昏〃 + oCN.RunProc("Insert Into Sc_StationOutBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark,HInnerBillNo,HSourceName,HPieceQty,HWasterQty,HPlanPieceQty,HBadPNL" + + ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + + ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationOutTime,HSourceID" + + ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + + ",HSupID,HTaxRate,HQty,HPrice,HMoney,HPrice_BHS,HMoney_BHS,HBadCount" + + ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HProcNo,HOrderProcNO,HLastSubProc,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID" + + ") " + + " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" + + "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HInnerBillNo + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL + + "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID + + ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID + + "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" + + "," + HSupID + "," + HTaxRate + "," + HQty + "," + HPrice + "," + HMoney + "," + HPrice_BHS + "," + HMoney_BHS + "," + HBadCount + + "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + HProcNo + ",'" + HOrderProcNO + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + ",'" + HWWWorkOrderBillNo + "'," + HWWWorkOrderInterID + "," + HWWWorkOrderEntryID + + ") "); + } + else if ("Modify".Equals(eventType)) + { + oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + HInterID + ",-1"); + oCN.RunProc("exec h_p_WW_EntrustWorkOrderRelationQty_Out " + HInterID + ",-1"); + //鏇存柊涓昏〃 + oCN.RunProc("UpDate Sc_StationOutBillMain set " + + " HBillNo='" + HBillNo + "'" + + ",HRemark='" + HRemark + "'" + + ",HUpDater='" + HMaker + "'" + + ",HUpDateDate=getdate()" + + ",HInnerBillNo='" + HInnerBillNo + "'" + + ",HSupID=" + HSupID + + ",HQty=" + HQty + + ",HPieceQty=" + HPieceQty + + ",HPrice=" + HPrice + + ",HMoney=" + HMoney + + ",HProcNo=" + HProcNo + + ",HPrice_BHS=" + HPrice_BHS + + ",HMoney_BHS=" + HMoney_BHS + + ",HTaxRate=" + HTaxRate + + ",HOrderProcNO='" + HOrderProcNO + "'" + + ",HMaterID=" + HMaterID + + ",HProcID=" + HProcID + + ",HBadPNL=" + HBadPNL + + ",HWasterQty=" + HWasterQty + + " where HInterID=" + HInterID); + } + else + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎿嶄綔绫诲瀷鏃犳晥锛�"; + objJsonResult.data = null; + return objJsonResult; + } ds = oCN.RunProcReturn("exec h_p_MES_StationOutBill_QtyCtrl " + HInterID + "", "h_p_MES_StationOutBill_QtyCtrl"); if (ds == null) { @@ -196,7 +331,6 @@ } catch (Exception e) { - oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception锛�" + e.ToString(); @@ -204,7 +338,53 @@ return objJsonResult; } } - + private bool AllowbillNo(string HBillNo) + { + ds = oCN.RunProcReturn("select HBillNo from Sc_StationOutBillMain where HBillNo = '" + HBillNo + "'", "Sc_StationOutBillMain"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + return true; + } + return false; + } + /// <summary> + /// 缂栬緫椤甸潰鏍规嵁id鑾峰彇濮斿宸ュ簭鎺ユ敹鍗曚俊鎭� + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Cj_StationEntrustOutBill/GetStationEntrustOutBill")] + [HttpGet] + public object GetStationEntrustOutBill(int HInterID) + { + try + { + ds = oCN.RunProcReturn("select * from h_v_GetStationOutBill where HInterID = " + HInterID, "h_v_GetStationOutBill"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "濮斿宸ュ簭鎺ユ敹鍗曚俊鎭幏鍙栧け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } // } -- Gitblit v1.9.1