From d38136e8b743a3186dc873d0f18e5a58e84e86d9 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期四, 24 十一月 2022 08:51:40 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/工资管理/Pay_GroupBalBillController.cs | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 173 insertions(+), 7 deletions(-) diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_GroupBalBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_GroupBalBillController.cs" index 5a974ca..3a64eb2 100644 --- "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_GroupBalBillController.cs" +++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_GroupBalBillController.cs" @@ -23,18 +23,27 @@ /// <summary> - /// 杩斿洖宸ヨ祫缁撶畻涓汉鍒楄〃 + /// 杩斿洖宸ヨ祫缁撶畻涓汉鍒楄〃(闆嗕綋) ///鍙傛暟锛歴tring sql銆� ///杩斿洖鍊硷細object銆� /// </summary> [Route("Pay_GroupBalBill/GetGroupBalBill")] [HttpGet] - public object GetGroupBalBill(string sWhere) + public object GetGroupBalBill(string sWhere,string user) { try { + if (!DBUtility.ClsPub.Security_Log("Pay_SingleBalBillList", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } ds = Sc_GetGroupBalBill(sWhere); + objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; @@ -55,12 +64,12 @@ { if (sWhere == null || sWhere.Equals("")) { - return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Pay_GroupBalBillList order by 鏃ユ湡 desc", "h_v_Pay_GroupBalBillList"); + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Pay_GroupBalBillList order by hmainid desc", "h_v_Pay_GroupBalBillList"); } else { string sql1 = "select * from h_v_Pay_GroupBalBillList where 1 = 1 "; - string sql = sql1 + sWhere + "order by 鏃ユ湡 desc"; + string sql = sql1 + sWhere + " order by hmainid desc"; return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Pay_GroupBalBillList"); } @@ -94,13 +103,13 @@ try { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); - string sql = @"SELECT HMaterID,HMaterCode,HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HUnitID,HUnitNumber,HUnitName + string sql = @"SELECT HMaterID,HMaterCode,HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HUnitID,HUnitNumber,HUnitName, HProcID,HProcNumber,HProcName,HSourceID,HSourceNumber,HSourceName,宸ユ椂 HTimes,鏁伴噺 HQty,宸ヤ环 HPrice,閲戦 HMoney, HSumMoney,HOtherSubsidy,HOtherDeduct,HPayMoney FROM h_v_Pay_GroupBalBillList where 1 = 1 " + sqlWhere; ds = oCN.RunProcReturn(sql, "h_v_Pay_GroupBalBillList"); string sql1 = @"select HEmpID ,b.HNumber HEmpNumber, b.HName HEmpName, b.HEmpRate HEmpRate, HBaseTimes, HMoney, HOtherSubsidy, HOtherSubsidy, HYF,'' HISZF ,'' HISFT , a.HRemark from Pay_GroupBalBillEmp a - left join Gy_Employee b on a.HEmpID = b.HItemID " + sqlWhere.Replace("hmainid", "HInterID"); + left join Gy_Employee b on a.HEmpID = b.HItemID where 1 = 1 " + sqlWhere.Replace("hmainid", "HInterID"); ds1 = oCN.RunProcReturn(sql1, "Pay_GroupBalBillEmp"); list.Add(ds.Tables[0]); list.Add(ds1.Tables[0]); @@ -120,16 +129,173 @@ } #endregion + + + #region 璁惧淇濆吇璁″垝琛� 淇濆瓨/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿缁翠慨鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Pay_GroupBalBill/AddBill")] + [HttpPost] + public object AddBill([FromBody] JObject sMainSub) + { + var _value = sMainSub["sMainSub"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); + string msg3 = sArray[1].ToString(); + string msg4 = sArray[2].ToString(); + string msg5 = sArray[3].ToString(); + string UserName = ""; + ListModels oListModels = new ListModels(); + try + { + if (!DBUtility.ClsPub.Security_Log("Pay_SingleBalBill_Edit", 1, false, msg5)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + DLL.ClsPay_GroupBalBill oBill = new DLL.ClsPay_GroupBalBill(); + List<Models.ClsPay_GroupBalBillMain> lsmain = new List<Models.ClsPay_GroupBalBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Pay_GroupBalBillMain(msg2); + foreach (Models.ClsPay_GroupBalBillMain oItem in lsmain) + { + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "2202"; + oItem.HBillSubType = "2202"; + //oItem.HInterID =0; + //oItem.HBillNo = ""; + oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + //淇濆吇椤硅〃浣撴暟鎹� + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + msg3 = msg3.Substring(1, msg3.Length - 2); + msg3 = msg3.Replace("\\", ""); + msg3 = msg3.Replace("\n", ""); //\n + //msg2 = msg2.Replace("'", "鈥�"); + List<Models.ClsPay_GroupBalBillSub> ls = new List<Models.ClsPay_GroupBalBillSub>(); + ls = oListModels.getObjectByJson_Pay_GroupBalBillSub(msg3); + int i = 0; + foreach (Models.ClsPay_GroupBalBillSub item in ls) + { + i++; + item.HEntryID = i; + //oItemSub.HCloseMan = ""; //琛屽叧闂� + item.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + item.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + item.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + item.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + item.HRelationQty = 0; //鍏宠仈鏁伴噺 + oBill.DetailColl.Add(item); + + } + //閰嶄欢椤硅〃浣撴暟鎹� + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + msg4 = msg4.Substring(1, msg4.Length - 2); + msg4 = msg4.Replace("\\", ""); + msg4 = msg4.Replace("\n", ""); //\n + //msg2 = msg2.Replace("'", "鈥�"); + List<Models.ClsPay_GroupBalBillEmp> ls1 = new List<Models.ClsPay_GroupBalBillEmp>(); + ls1 = oListModels.getObjectByJson_Pay_GroupBalBillEmp(msg4); + int j = 0; + foreach (Models.ClsPay_GroupBalBillEmp oItemSub in ls1) + { + + j++; + oItemSub.HEntryID = j; + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + oBill.DetailEmpColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.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; + } + } + #endregion + /// <summary> ///宸ヨ祫缁撶畻涓汉鍗曞垹闄ゅ姛鑳� /// </summary> /// <returns></returns> [Route("Pay_GroupBalBill/DeltetGroupBalBill")] [HttpGet] - public object Pay_GroupBalBill(string HInterID) + public object Pay_GroupBalBill(string HInterID,string user) { try { + if (!DBUtility.ClsPub.Security_Log("Pay_SingleBalBill_Delete", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran(); oCN.RunProc("Delete From Pay_GroupBalBillMain where HInterID = " + HInterID); oCN.RunProc("Delete From Pay_GroupBalBillSub where HInterID = " + HInterID); -- Gitblit v1.9.1