From 45e245505f33ba0e4866a4e1d49f5ab93c771f1d Mon Sep 17 00:00:00 2001 From: 陈雯静 <1134865194@qq.com> Date: 星期一, 11 三月 2024 09:04:06 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs | 234 ++++++++++++++++++++++++++++++++++------------------------ 1 files changed, 138 insertions(+), 96 deletions(-) diff --git a/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs b/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs index a8ec430..0583214 100644 --- a/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs +++ b/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs @@ -40,13 +40,14 @@ /// </summary> [Route("Kf_POStockInBill/list")] [HttpGet] - public object list(string sWhere) + public object list(string sWhere, string user) { try { if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from h_v_Kf_POStockInBillList order by hmainid desc", "h_v_Kf_POStockInBillList"); + string sql = "select * from h_v_Kf_POStockInBillList order by hmainid desc"; + ds = oCN.RunProcReturn(sql, "h_v_Kf_POStockInBillList"); } else { @@ -202,19 +203,19 @@ String sql =$@"Insert Into Kf_ICStockBillMain (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus ,HAddress,HSupID,HCurID,HWHID,HEmpID,HManagerID,HSecManagerID,HKeeperID,HDeptID,HExplanation,HRemark - ,HInnerBillNo,HSTOCKORGID,HOWNERID ,HChecker,HCheckDate,HMaker,HMakeDate) + ,HInnerBillNo,HSTOCKORGID,HOWNERID,HMaker,HMakeDate) values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1201 + "','" + HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + HAddress + "'," + HSupID + "," + HCurID + "," + HWHID + "," + HEmpID + "," + HManagerID + "," + HSecManagerID + ","+ HKeeperID +"," + HDeptID + ",'" + HExplanation + "','" + HRemark - + "','" + HInnerBillNo + "'," + HSTOCKORGID + "," + HOWNERID + ",'" + HChecker + "',getdate()" + ",'" + HMaker + "',getdate()" +")"; + + "','" + HInnerBillNo + "'," + HSTOCKORGID + "," + HOWNERID + ",'" + HMaker + "',getdate()" +")"; oCN.RunProc(sql); } else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) { //淇敼 String sql = $@"update Kf_ICStockBillMain set " + - "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + + "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" + ",HSupID=" + HSupID + ",HCurID=" + HCurID + ",HSecManagerID=" + HSecManagerID + ", HSTOCKORGID=" + HSTOCKORGID + ",HKeeperID=" + HKeeperID + ",HWHID = " + HWHID + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID + ",HOWNERID=" + HOWNERID + ",HAddress='" + HAddress + "'where HInterID=" + HInterID; @@ -334,17 +335,17 @@ ,{(oSub.HPropertyID == null ? 0 : oSub.HPropertyID)},{(oSub.HSecUnitID == null ? 0 : oSub.HSecUnitID)},{(oSub.HSecUnitRate == null ? 0 : oSub.HSecUnitRate)} ,{(oSub.HPlanMode == null ? 0 : oSub.HPlanMode)},'{oSub.HRemark}',{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{oSub.HSeOrderBillNo}')"; - string sReturn = ""; - ds = oCN.RunProcReturn("exec h_p_Cg_POInStockBillMain " + oSub.HQty + ", '" +oSub.HSourceInterID + "', '" + oSub.HSourceEntryID + "','" + user+" '", "h_p_Cg_POInStockBillMain"); - if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0) - { - sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString(); - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = sReturn; - objJsonResult.data = null; - return objJsonResult; - } + //string sReturn = ""; + //ds = oCN.RunProcReturn("exec h_p_Cg_POInStockBillMain " + oSub.HQty + ", '" +oSub.HSourceInterID + "', '" + oSub.HSourceEntryID + "','" + user+" '", "h_p_Cg_POInStockBillMain"); + //if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0) + //{ + // sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString(); + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = sReturn; + // objJsonResult.data = null; + // return objJsonResult; + //} oCN.RunProc(sql); @@ -392,7 +393,7 @@ try { //鍒犻櫎鏉冮檺 - if (!DBUtility.ClsPub.Security_Log("Kf_POStockInBackBill_Delete", 1, false, user)) + if (!DBUtility.ClsPub.Security_Log("Kf_POStockInBackBill_Drop", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -583,7 +584,6 @@ #region 閲囪喘鍏ュ簱鍗� 瀹℃牳/鍙嶅鏍� /// <summary> - /// /// </summary> /// <param name="HInterID">鍗曟嵁ID</param> /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param> @@ -591,55 +591,95 @@ /// <returns></returns> [Route("Kf_POStockInBill/AuditKf_POStockInBill")] [HttpGet] - public object AuditKf_POStockInBill(string HInterID, int Type, string user) + public object AuditKf_POStockInBill(int HInterID, int IsAudit, string CurUserName) { - string sql = ""; + string ModRightNameCheck = "Kf_POStockInBill_Check"; + DBUtility.ClsPub.CurUserName = CurUserName; try { - //鍒ゆ柇鏄惁鏈夊鏍告潈闄� - if (!DBUtility.ClsPub.Security_Log("Kf_POStockInBill_Check", 1, false, user)) + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鏃犳潈闄愬鏍�!"; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + if (HInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID灏忎簬0锛�"; objJsonResult.data = null; return objJsonResult; } - if (string.IsNullOrWhiteSpace(HInterID)) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "HInterID涓虹┖锛�"; - objJsonResult.data = null; - return objJsonResult; - } - ClsPub.CurUserName = user; - ds = oCN.RunProcReturn("select * from Kf_ICStockBillMain where HInterID = " + int.Parse(HInterID), "Kf_ICStockBillMain"); - string HBillNo = ""; - DAL.ClsKf_POStockInBill oBill = new DAL.ClsKf_POStockInBill(); - oCN.BeginTran();//寮�濮嬩簨鍔� + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsKf_POStockInBill oBill = new DAL.ClsKf_POStockInBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� - if (ds == null || ds.Tables[0].Rows.Count == 0) + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!"; - objJsonResult.data = null; - return objJsonResult; + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍稿垽鏂� + { + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + } } else { - HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; } - //Type 1 瀹℃牳 2 鍙嶅鏍� - if (Type == 1) + + + //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣� + if (IsAudit == 0) //瀹℃牳鎻愪氦 { - //瀹℃牳鍓嶆帶鍒� - sql = "h_p_Kf_POStockInBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'"; - ds = oCN.RunProcReturn(sql, "h_p_Kf_POStockInBill_BeforeCheckCtrl"); + //瀹℃牳鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Kf_POStockInBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Kf_POStockInBill_BeforeCheckCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; @@ -647,8 +687,8 @@ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; objJsonResult.data = null; return objJsonResult; - } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; @@ -657,71 +697,73 @@ objJsonResult.data = null; return objJsonResult; } + //================================================================================== - if (!BillOld.CheckBill(int.Parse(HInterID), HBillNo, "h_p_Kf_POStockInBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo)) + //瀹℃牳鎻愪氦 + if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_POStockInBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { - objJsonResult.code = "0"; + objJsonResult.code = "1"; objJsonResult.count = 1; - objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.Message = "瀹℃牳鎴愬姛"; objJsonResult.data = null; return objJsonResult; - } - } - else - { - //鍙嶅鏍稿墠鎺у埗 - sql = "exec h_p_Kf_POStockInBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'"; - ds = oCN.RunProcReturn(sql, "h_p_Kf_POStockInBill_BeforeUnCheckCtrl"); - if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; - objJsonResult.data = null; - return objJsonResult; - - } - if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; - objJsonResult.data = null; - return objJsonResult; - } - - if (BillOld.AbandonCheck(int.Parse(HInterID), HBillNo, "h_p_Kf_POStockInBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo)) - { - SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); - //DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl"); - } else { objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } + if (IsAudit == 1) //鍙嶅鏍告彁浜� + { + //鍙嶅鏍稿墠鎺у埗========================================= + DataSet ds = oCN.RunProcReturn("Exec h_p_Kf_POStockInBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Kf_POStockInBill_BeforeUnCheckCtrl"); + if (ds == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + "鍙嶅鏍稿墠鍒ゆ柇澶辫触锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + //========================================================= - - - oCN.Commit();//鎻愪氦浜嬪姟 - - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鎵ц鎴愬姛锛�"; - objJsonResult.data = null; - return objJsonResult; ; - + //鍙嶅鏍告彁浜bandonCheck + if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_POStockInBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍告垚鍔�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); + objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString(); objJsonResult.data = null; return objJsonResult; } @@ -884,7 +926,7 @@ try { //鍒ゆ柇鏄惁鏈変綔搴熸潈闄� - if (!DBUtility.ClsPub.Security_Log("Kf_POStockInBill_Drop", 1, false, user)) + if (!DBUtility.ClsPub.Security_Log("Kf_POStockInBill_Delete", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; -- Gitblit v1.9.1