From 2e4f53844fc90e5b2603c83256488e73fa3a1e1a Mon Sep 17 00:00:00 2001 From: wtt <1985833171@qq.com> Date: 星期四, 01 八月 2024 11:24:23 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs | 177 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 131 insertions(+), 46 deletions(-) diff --git a/WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs b/WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs index 03f0323..0741fc4 100644 --- a/WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs +++ b/WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs @@ -38,14 +38,14 @@ { List<object> columnNameList = new List<object>(); //鏌ョ湅鏉冮檺 - //if (!DBUtility.ClsPub.Security_Log("Xs_ReceivableBill_Query", 1, false, user)) - //{ - // objJsonResult.code = "0"; - // objJsonResult.count = 0; - // objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; - // objJsonResult.data = null; - // return objJsonResult; - //} + if (!DBUtility.ClsPub.Security_Log("Xs_ReceivableBill_Query", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } if (sWhere == null || sWhere.Equals("")) { @@ -94,10 +94,11 @@ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); //琛ㄥご鏁版嵁 string msg3 = sArray[1].ToString(); //瀛愯〃1鏁版嵁 - string refSav = sArray[2].ToString(); //鎿嶄綔鏂瑰紡 - string msg4 = sArray[3].ToString(); //鐢ㄦ埛 + string msg4 = sArray[2].ToString(); //瀛愯〃2鏁版嵁 + string refSav = sArray[3].ToString(); //鎿嶄綔鏂瑰紡 + string msg5 = sArray[4].ToString(); //鐢ㄦ埛 - DBUtility.ClsPub.CurUserName = msg4; + DBUtility.ClsPub.CurUserName = msg5; string UserName = ""; string s = ""; @@ -105,14 +106,14 @@ try { //缂栬緫鏉冮檺 - //if (!DBUtility.ClsPub.Security_Log_second("Xs_ReceivableBill_Edit", 1, false, msg4)) - //{ - // objJsonResult.code = "0"; - // objJsonResult.count = 0; - // objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; - // objJsonResult.data = null; - // return objJsonResult; - //} + if (!DBUtility.ClsPub.Security_Log_second("Xs_ReceivableBill_Edit", 1, false, msg5)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } DAL.ClsXs_ReceivableBill oBill = new DAL.ClsXs_ReceivableBill(); List<Model.ClsXs_ReceivableBillMain> lsmain = new List<Model.ClsXs_ReceivableBillMain>(); @@ -207,6 +208,39 @@ } + //瀛愯〃Entry + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + msg4 = msg4.Substring(1, msg4.Length - 2); + msg4 = msg4.Replace("\\", ""); + msg4 = msg4.Replace("\n", ""); //\n + //msg2 = msg2.Replace("'", "鈥�"); + List<Model.ClsXs_ReceivableBillSub> ls2 = new List<Model.ClsXs_ReceivableBillSub>(); + ls2 = oListModels.getObjectByJson_Xs_ReceivableBillSub(msg4); + int j = 0; + foreach (Model.ClsXs_ReceivableBillSub oItemSub in ls2) + { + j++; + oItemSub.HEntryID = j; + + oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + + oBill.DetailCol2.Add(oItemSub); + + } + + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + //淇濆瓨 //淇濆瓨瀹屾瘯鍚庡鐞� bool bResult; @@ -259,6 +293,7 @@ try { ds = oCN.RunProcReturn("select * from h_v_Xs_ReceivableBillList_EditInit where hmainid=" + HInterID, "h_v_Xs_ReceivableBillList_EditInit"); + objJsonResult.data = ds.Tables[0]; if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; @@ -269,10 +304,15 @@ } else { + ds = oCN.RunProcReturn(@"select a.*,mater.HNumber AS 鐗╂枡浠g爜, mater.HName AS 鐗╂枡鍚嶇О, mater.HModel AS 瑙勬牸鍨嬪彿, mater.HUnitID, unit.HName AS 璁¢噺鍗曚綅 from Xs_ReceivableBillSub_Entry AS a LEFT OUTER JOIN + dbo.Gy_Material AS mater ON a.HMaterID = mater.HItemID LEFT OUTER JOIN + dbo.Gy_Unit AS unit ON mater.HUnitID = unit.HItemID where HInterID=" + HInterID, "Xs_ReceivableBillSub_Entry"); + List<Object> dataTables = new List<Object>(); + dataTables.Add(ds.Tables[0]); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess锛�"; - objJsonResult.data = ds.Tables[0]; + objJsonResult.list = dataTables; return objJsonResult; } } @@ -301,14 +341,14 @@ string s = ""; //鏌ョ湅鏉冮檺 - //if (!DBUtility.ClsPub.Security_Log("Xs_ReceivableBill_Drop", 1, false, user)) - //{ - // objJsonResult.code = "0"; - // objJsonResult.count = 0; - // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; - // objJsonResult.data = null; - // return objJsonResult; - //} + if (!DBUtility.ClsPub.Security_Log("Xs_ReceivableBill_Drop", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } if (HInterID == null || HInterID.Equals("")) { @@ -357,15 +397,38 @@ // objJsonResult.data = null; // return objJsonResult; //} - ////================================================================================== + ////================================================================================== + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } oCN.BeginTran(); + ds = oCN.RunProcReturn("select * from h_v_Xs_ReceivableBillList_Query where hmainid=" + HInterID, "h_v_Xs_ReceivableBillList_Query"); + string hSourceBillType = ds.Tables[0].Rows[0]["HSourceBillType"].ToString(); + if (hSourceBillType == "1401") + { + //搴旀敹鍗� 鍒犻櫎鍥炲~ 閿�鍞鍗� 鍏宠仈鏁伴噺 + oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToPOStockIn_Del " + HInterID); + } + else if (hSourceBillType == "1205") + { + //搴旀敹鍗� 鍒犻櫎鍥炲~ 閿�鍞嚭搴撳崟 鍏宠仈鏁伴噺 + oCN.RunProc("exec h_p_Xs_UpDateRelation_ICStockoPOStockIn_Del " + HInterID); + } + + oCN.RunProc("delete from Xs_ReceivableBillMain where HInterID = " + HInterID); oCN.RunProc("delete from Xs_ReceivableBillSub where HInterID= " + HInterID); - + oCN.RunProc("delete from Xs_ReceivableBillSub_Entry where HInterID= " + HInterID); ////鍒犻櫎鍚庢帶鍒�================================================================================== //string sql2 = "exec h_p_Xs_ReceivableBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; //ds = oCN.RunProcReturn(sql2, "h_p_Xs_ReceivableBill_AfterDelCtrl"); @@ -427,14 +490,14 @@ try { //瀹℃牳鏉冮檺 - //if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) - //{ - // objJsonResult.code = "0"; - // objJsonResult.count = 0; - // objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; - // objJsonResult.data = null; - // return objJsonResult; - //} + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } //HInterID鏁版嵁鍒ゆ柇 if (HInterID <= 0) { @@ -505,6 +568,17 @@ //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣� if (IsAudit == 0) //瀹℃牳鎻愪氦 { + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + oCN.BeginTran(); //璁板綍杩斿洖淇℃伅 @@ -581,6 +655,17 @@ //} ////=========================================================== + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + //鍙嶅鏍告彁浜bandonCheck //if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Xs_ReceivableBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) if (oBill.AbandonCheck(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo) == true) @@ -631,14 +716,14 @@ try { //妫�鏌ユ潈闄� - //if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) - //{ - // objJsonResult.code = "0"; - // objJsonResult.count = 0; - // objJsonResult.Message = "鍏抽棴澶辫触锛佹棤鏉冮檺锛�"; - // objJsonResult.data = null; - // return objJsonResult; - //} + if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍏抽棴澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } //HInterID鏁版嵁鍒ゆ柇 if (HInterID <= 0) { -- Gitblit v1.9.1