From a87ff9576d6b0521f5a4f9a5ef09747908f8c06b Mon Sep 17 00:00:00 2001 From: ch <37327@LLOOCCY> Date: 星期二, 13 七月 2021 20:59:41 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MESWMS-API --- WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs | 262 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 237 insertions(+), 25 deletions(-) diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs index a24cb6d..63a3916 100644 --- a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs +++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs @@ -69,7 +69,7 @@ } /// <summary> - /// 濮斿宸ュ簭鍙戝嚭鍗曟祦姘村彿鍥炶溅鑾峰彇娴佽浆鍗′俊鎭� + /// 濮斿宸ュ簭鍙戝嚭鍗曟祦姘村彿鍥炶溅鑾峰彇娴佽浆鍗′俊鎭紙濮斿宸ュ簭鎺ユ敹銆佸伐搴忚繘绔欐帴鏀堕�氱敤锛� ///鍙傛暟锛歴tring sql銆� ///杩斿洖鍊硷細object銆� /// </summary> @@ -139,7 +139,7 @@ //濮斿宸ュ簭鍙戝嚭鍙嶅簭鍒楀寲 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;//鍗曚环 @@ -148,8 +148,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 @@ -167,7 +167,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;//濮斿宸ュ崟鍙蜂富鍐呭悧 @@ -180,27 +180,137 @@ string HBarCode = list[0].HBarCode;//鏉″舰鐮� string HAddr = ""; string HBarCodeMaker = ""; - + 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 (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 (HProcID <= 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; + } //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� oCN.BeginTran(); - //涓昏〃 - oCN.RunProc("Insert Into Sc_StationInBillMain " + - "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + - ",HYear,HPeriod,HRemark,HInnerBillNo" + - ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + - ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationInTime,HSourceID" + - ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + - ",HSupID,HTaxRate,HQty,HPrice,HMoney,HPieceQty" + - ",HProcNo,HOrderProcNO,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID" + - ") " + - " values('3792','3792'," + HInterID.ToString() + ",'" + HBillNo + "','" + HBillStatus.ToString() + "',getdate(),'" + HMaker + "',getdate()" + - ",'" + HYear.ToString() + "','" + HPeriod.ToString() + "','" + HRemark + "','" + HInnerBillNo + "'" + - "," + 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 + "," + HPieceQty + - ",'" + HProcNo + "','" + HOrderProcNO + "'" + ",'" + 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_StationInBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark,HInnerBillNo" + + ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + + ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationInTime,HSourceID" + + ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + + ",HSupID,HTaxRate,HQty,HPrice,HMoney,HPieceQty" + + ",HProcNo,HOrderProcNO,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID" + + ") " + + " values('3792','3792'," + HInterID.ToString() + ",'" + HBillNo + "','" + HBillStatus.ToString() + "',getdate(),'" + HMaker + "',getdate()" + + ",'" + HYear.ToString() + "','" + HPeriod.ToString() + "','" + HRemark + "','" + HInnerBillNo + "'" + + "," + 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 + "," + HPieceQty + + ",'" + HProcNo + "','" + HOrderProcNO + "'" + ",'" + HWWWorkOrderBillNo + "'" + "," + HWWWorkOrderInterID + "" + "," + HWWWorkOrderEntryID + "" + + ") "); + } + else if ("Modify".Equals(eventType)) + { + + //鍒犻櫎鍏宠仈 + oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_In " + HInterID + ",-1"); + oCN.RunProc("exec h_p_WW_EntrustWorkOrderRelationQty_In " + HInterID + ",-1"); + + //鏇存柊涓昏〃 + oCN.RunProc("UpDate Sc_StationInBillMain set " + + "HBillNo='" + HBillNo + "'" + + ",HRemark='" + HRemark + "'" + + ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" + + ",HUpDateDate=getdate()" + + ",HInnerBillNo='" + HInnerBillNo + "'" + + ",HSupID=" + HSupID + + ",HQty=" + HQty + + ",HPieceQty=" + HPieceQty + + ",HPrice=" + HPrice + + ",HMoney=" + HMoney + + ",HTaxRate=" + HTaxRate + + ",HMaterID=" + HMaterID + + ",HProcID=" + HProcID + + ",HProcNo=" + HProcNo + + ",HOrderProcNO='" + HOrderProcNO + "'" + + " 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_StationInBill_QtyCtrl " + HInterID + "", "h_p_MES_StationInBill_QtyCtrl"); if (ds == null) { @@ -240,7 +350,6 @@ } catch (Exception e) { - oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception锛�" + e.Message; @@ -248,5 +357,108 @@ return objJsonResult; } } + + private bool AllowbillNo(string HBillNo) + { + ds = oCN.RunProcReturn("select HBillNo from Sc_StationInBillMain where HBillNo = '" + HBillNo + "'", "Sc_StationInBillMain"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + return true; + } + return false; + } + + /// <summary> + /// 缂栬緫椤甸潰鏍规嵁id鑾峰彇濮斿宸ュ簭鎺ユ敹鍗曚俊鎭� + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Cj_StationEntrustInBill/GetStationEntrustInBill")] + [HttpGet] + public object GetStationEntrustInBill(int HInterID) + { + try + { + ds = oCN.RunProcReturn("select * from h_v_GetStationInBill 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; + } + } + + + /// <summary> + /// 濮斿宸ュ簭鍙戝嚭鍗曟祦姘村彿鍥炶溅鑾峰彇宸ュ簭淇℃伅 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Cj_StationEntrustInBill/txtHProcNo_KeyDown")] + [HttpGet] + public object txtHProcNo_KeyDown(string sBillNo, string sProcNo) + { + try + { + if (sBillNo.Equals("") || sProcNo.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏉″舰鐮佷笉鑳戒负绌猴紒"; + objJsonResult.data = null; + return objJsonResult; + } + + //寰楀埌淇℃伅锛堝澶栨爣璁颁负0鏃讹紝娴佽浆鏍囪涓�1鏃讹級 + ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList where 鍗曟嵁鍙�= '" + sBillNo + "' and 涓嬮亾娴佽浆宸ュ簭<>'杞�' and 濮斿鏍囪=1 and 娴佽浆鏍囪=1 and 宸ュ簭鍙�='" + sProcNo + "'", "h_v_Sc_ProcessExchangeBillList"); + //Ds = oCn.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList where 鍗曟嵁鍙�= '" + sBillNo + "' and 宸ュ簭鍙�='" + sProcNo + "' and 濮斿鏍囪=0 and 娴佽浆鏍囪=1 ", "h_v_Sc_ProcessExchangeBillList"); + //鍐欏叆淇℃伅 + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "宸ュ簭鍙烽敊璇垨鑰呭綋鍓嶅伐搴忓彿涓嶅厑璁歌繘绔欙紝璇烽噸鏂拌緭鍏ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + 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; + } + } + + + + + // } } \ No newline at end of file -- Gitblit v1.9.1