From 872d06b33d8306b826054b044e1b6e58aaacddf0 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期四, 26 十二月 2024 13:24:48 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/工资管理/Pay_SingleBalBillController.cs | 462 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 433 insertions(+), 29 deletions(-)
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_SingleBalBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_SingleBalBillController.cs"
index bdb05bd..53361df 100644
--- "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_SingleBalBillController.cs"
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_SingleBalBillController.cs"
@@ -9,7 +9,7 @@
using System.Web.Http;
using WebAPI.Models;
using System.Windows.Forms;
-
+using SyntacticSugar.constant;
namespace WebAPI.Controllers
{
@@ -55,7 +55,20 @@
objJsonResult.data = null;
return objJsonResult;
}
-
+ //鍒ゆ柇鏄惁鏈夋煡鐪嬪叏閮ㄧ彮缁勭殑鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_Group_AllQuery", 3, false, HMaker))
+ {
+ //濡傛灉娌℃湁杩欎釜鏉冮檺
+ //鏍规嵁鐢ㄦ埛瀵瑰簲鐝粍鐨勫叧绯伙紝杩囨护鏉′欢涓鍔犲彧鏄剧ず瀵瑰簲鐨勭彮缁�
+ DataSet dsHitemID = oCn.RunProcReturn("exec h_p_Gy_GetSQLGroupByUser '" + HMaker + "'", "h_p_Gy_GetSQLGroupByUser");
+ string sqlGroupID = DBUtility.ClsPub.isStrNull(dsHitemID.Tables[0].Rows[0]["HBack"]);
+ if (sqlGroupID == "" || sqlGroupID == null)//濡傛灉娌℃湁缁戝畾鐝粍鍒欒浠栫湅涓嶅埌鎵�鏈�
+ {
+ sqlGroupID = "and 1 = 2";
+ }
+ sqlGroupID = sqlGroupID.Replace("HitemID", "HGroupID");//鏇挎崲sql璇彞涓殑HitemID
+ sWhere = sWhere + sqlGroupID;
+ }
//杩斿洖鍒楄〃淇℃伅
ds = oCn.RunProcReturn("select * from h_v_Pay_SingleBalBillList where 1=1 " + sWhere + " order by hmainid desc", "h_v_Pay_SingleBalBillList");
List<object> columnNameList = new List<object>();
@@ -80,6 +93,77 @@
objJsonResult.Message = "鏌ヨ鍒楄〃淇℃伅澶辫触锛�" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 宸ヨ祫缁撶畻鍗�(涓汉)鍒嗛〉鍒楄〃
+ [Route("Pay_SingleBalBillController/page")]
+ [HttpGet]
+ public json Pay_SingleBalBillPage(string sWhere, string user, int page, int size)
+ {
+ DataSet ds;
+ json res = new json();
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鍒ゆ柇鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameList, 3, false, user))
+ {
+ objJsonResult.code = CodeConstant.FAIL;
+ objJsonResult.count = CountConstant.FAIL;
+ objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍒ゆ柇鏄惁鏈夋煡鐪嬪叏閮ㄧ彮缁勭殑鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_Group_AllQuery", 3, false, user))
+ {
+ //濡傛灉娌℃湁杩欎釜鏉冮檺
+ //鏍规嵁鐢ㄦ埛瀵瑰簲鐝粍鐨勫叧绯伙紝杩囨护鏉′欢涓鍔犲彧鏄剧ず瀵瑰簲鐨勭彮缁�
+ DataSet dsHitemID = oCn.RunProcReturn("exec h_p_Gy_GetSQLGroupByUser '" + user + "'", "h_p_Gy_GetSQLGroupByUser");
+ string sqlGroupID = DBUtility.ClsPub.isStrNull(dsHitemID.Tables[0].Rows[0]["HBack"]);
+ if(sqlGroupID == ""||sqlGroupID==null)//濡傛灉娌℃湁缁戝畾鐝粍鍒欒浠栫湅涓嶅埌鎵�鏈�
+ {
+ sqlGroupID = "and 1 = 2";
+ }
+ sqlGroupID = sqlGroupID.Replace("HitemID", "HGroupID");//鏇挎崲sql璇彞涓殑HitemID
+ sWhere = sWhere + sqlGroupID;
+ }
+
+
+ sWhere = sWhere.Replace("'", "''");
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ ds = oCn.RunProcReturn("exec h_p_Pay_SingleBalBillList " + page + "," + size + ",''", "h_p_Pay_SingleBalBillList");
+ }
+ else
+ {
+ ds = oCn.RunProcReturn("exec h_p_Pay_SingleBalBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Pay_SingleBalBillList");
+ }
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ res.code = CodeConstant.SUCCEED;
+ res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+ res.Message = "Sucess锛�";
+ res.list = columnNameList;
+ res.data = ds.Tables[0];
+ return res;
+ }
+ catch (Exception e)
+ {
+ res.code = CodeConstant.FAIL;
+ res.count = CountConstant.FAIL;
+ res.Message = "Exception锛�" + e.ToString();
+ res.data = null;
+ return res;
}
}
#endregion
@@ -356,6 +440,65 @@
}
#endregion
+ #region 宸ヨ祫缁撶畻鍗�(涓汉) 鎵归噺瀹℃牳
+ /// <summary>
+ /// 瀹℃牳/鍙嶅鏍稿伐璧勭粨绠楀崟(涓汉)
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="Type">瀹℃牳(1),鍙嶅鏍�(2)</param>
+ /// <param name="HMaker">瀹℃牳浜�</param>
+ /// <returns></returns>
+ [Route("Pay_SingleBalBillController/CheckAll")]
+ [HttpGet]
+ public object CheckAll(string ids, int Type, string HMaker)
+ {
+ try
+ {
+ //澶勭悊瀛楃涓�
+ if (!string.IsNullOrEmpty(ids))
+ {
+ long[] idArray = Array.ConvertAll(ids.Split(','), long.Parse);
+ // 澶勭悊idArray...
+ oCn.BeginTran();
+ for (int i = 0; i < idArray.Length; i++)
+ {
+ objJsonResult = (json)GetPay_SingleBalBill_Check_Json(idArray[i], Type, HMaker);//瀹℃牳鎵ц
+ if (objJsonResult.count == 0)
+ {
+ oCn.RollBack();
+ objJsonResult.Message += "绗�" + (i + 1) + "琛屽嚭鐜伴棶棰樻棤娉曠户缁畬鎴�";
+ return objJsonResult;
+ }
+ }
+ oCn.Commit();
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "璇烽�夋嫨姝g‘琛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ objJsonResult.code = CodeConstant.SUCCEED;
+ objJsonResult.count = CountConstant.SUCCEED;
+ objJsonResult.Message = "鎵ц鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCn.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳鎴栧弽瀹℃牳宸ヨ祫缁撶畻鍗�(涓汉)澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
#region 宸ヨ祫缁撶畻鍗�(涓汉) 鍏抽棴/鍙嶅叧闂�
/// <summary>
/// 鍏抽棴/鍙嶅叧闂伐璧勭粨绠楀崟(涓汉)
@@ -592,7 +735,295 @@
}
#endregion
+ #region 宸ヨ祫缁撶畻鍗�(涓汉)妯″潡 浠庡垪琛ㄩ�変腑鎵撳紑鍗曟嵁锛岃繑鍥炲崟鎹俊鎭椂璋冪敤
+ /// <summary>
+ /// 宸ヨ祫缁撶畻鍗�(涓汉)缂栬緫鏃讹紝鏍规嵁鍗曟嵁ID鑾峰彇鍗曟嵁淇℃伅
+ /// </summary>
+ /// <returns></returns>
+ [Route("Pay_SingleBalBillController/GetPay_SingleBalBill_Json")]
+ [HttpGet]
+ public object GetPay_SingleBalBill_Json(Int64 HInterID, string HMaker)
+ {
+ try
+ {
+ //鍒ゆ柇鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 3, false, HMaker))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //杩斿洖鍒楄〃淇℃伅
+ ds = oCn.RunProcReturn("exec h_p_Pay_SingleBalBill_EditInit " + HInterID, "h_p_Pay_SingleBalBill_EditInit");
+ 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 = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鎴愬姛锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "杩斿洖宸ヨ祫缁撶畻鍗�(涓汉)淇℃伅澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 宸ヨ祫缁撶畻鍗�(涓汉)淇濆瓨
+ /// <summary>
+ /// 宸ヨ祫缁撶畻鍗�(涓汉)淇濆瓨
+ /// </summary>
+ [Route("Pay_SingleBalBillController/GetPay_SingleBalBill_Save_Json")]
+ [HttpPost]
+ public object GetPay_SingleBalBill_Save_Json([FromBody] JObject sMainSub)
+ {
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string sMainStr = sArray[0].ToString(); //涓昏〃鏁版嵁
+ string sSubStr = sArray[1].ToString(); //瀛愯〃鏁版嵁
+ string OperationType = sArray[2].ToString(); //鎿嶄綔绫诲瀷锛�1鏂板銆�2缂栬緫锛�
+ string HMaker = sArray[3].ToString(); //鍒跺崟浜�
+ try
+ {
+ //鍒ゆ柇鏉冮檺
+ if (OperationType == "1")
+ {
+ BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
+ //鍒ゆ柇鏂板鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(ModRightName, 1, false, HMaker))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏂板鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ else
+ {
+ BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify;
+ //鍒ゆ柇缂栬緫鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 1, false, HMaker))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ //琛ㄥご璧嬪��
+ sMainStr = sMainStr.Replace("\\", "");
+ sMainStr = sMainStr.Replace("\n", "");
+ sMainStr = "[" + sMainStr.ToString() + "]";
+ List<Model.ClsPay_SingleBalBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPay_SingleBalBillMain>>(sMainStr);
+ foreach (Model.ClsPay_SingleBalBillMain oItem in lsmain)
+ {
+ //鍗曟嵁鍙锋槸鍚﹂噸澶�
+ if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+ string s = "";
+ int sYear = 0;
+ int sPeriod = 0;
+ if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oItem.HDate, ref sYear, ref sPeriod, ref s) == false)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = s;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oItem.HYear = sYear;
+ oItem.HPeriod = sPeriod;
+ DBUtility.ClsPub.CurUserName = oItem.HMaker;
+ oBill.omodel = oItem;
+ }
+ //琛ㄤ綋璧嬪��
+ //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+ sSubStr = sSubStr.Substring(1, sSubStr.Length - 2);
+ sSubStr = sSubStr.Replace("\\", "");
+ sSubStr = sSubStr.Replace("\n", "");
+ sSubStr = "[" + sSubStr.ToString() + "]";
+ List<Model.ClsPay_SingleBalBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPay_SingleBalBillSub>>(sSubStr);
+ int i = 0;
+ foreach (Model.ClsPay_SingleBalBillSub oItemSub in ls)
+ {
+ i++;
+ oItemSub.HEntryID = i;
+ oBill.DetailColl.Add(oItemSub);
+ }
+
+ //淇濆瓨
+ bool bResult;
+ if (OperationType == "1") //鏂板淇濆瓨
+ {
+ 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 = DBUtility.ClsPub.sExeReturnInfo; //鎴愬姛锛�
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ #endregion
+
+ #region 鏍规嵁鐗╂枡ID銆佸伐搴廔D銆佽祫婧怚D鑾峰彇宸ヤ环
+ [Route("Pay_SingleBalBill/get_HPrice_BaseMaterHProcHSource")]
+ [HttpGet]
+ public object get_HPrice_BaseMaterHProcHSource(Int64 HMaterID, Int64 HProcID, Int64 HSourceID)
+ {
+ try
+ {
+ double HPrice=0;
+ ds = oCn.RunProcReturn("exec h_p_Pay_GetPriceByMaterHProcHSource " + HMaterID.ToString() + "," + HProcID.ToString() + "," + HSourceID.ToString(), "h_p_Pay_GetPriceByMaterHProcHSource");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ HPrice = 0;
+ }
+ else
+ {
+ HPrice = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[0]["HPrice"]);
+ }
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鎴愬姛锛�";
+ objJsonResult.data = HPrice;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 宸ヨ祫缁撶畻鍗曟壒閲忓鏍镐簩鐗�
+ /// <summary>
+ /// 宸ヨ祫缁撶畻鍗曟壒閲忓鏍镐簩鐗�
+ /// </summary>
+ /// <returns></returns>
+ [Route("Pay_SingleBalBillController/CheckAllByTimeAndGroup")]
+ [HttpGet]
+ public object CheckAllByTimeAndGroup(string sWhere, string HMaker)
+ {
+ try
+ {
+ //鍒ゆ柇鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 3, false, HMaker))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ds = oCn.RunProcReturn($"exec h_p_Pay_SingleBalBill_CheckAllByTimeAndGroup " + sWhere + "", "h_p_Pay_SingleBalBill_CheckAllByTimeAndGroup");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀛樺偍杩囩▼鍒ゆ柇澶辫触锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鎴愬姛锛�";
+ objJsonResult.data = ds.Tables[0].Rows[0]["HRemark"];
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ鍒楄〃淇℃伅澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+
+
+
+
+
+
+
+
+
+
+
+ //---------------------------------------------------------------------------------------------鏃ф柟娉�
#region 宸ヨ祫缁撶畻鍗曚釜浜�-鏌ヨ
/// <summary>
@@ -1375,33 +1806,6 @@
objJsonResult.data = null;
return objJsonResult;
}
- }
- }
- #endregion
-
- #region 鏍规嵁鐗╂枡ID銆佸伐搴廔D銆佽祫婧怚D鑾峰彇宸ヤ环
- [Route("Pay_SingleBalBill/get_HPrice_BaseMaterHProcHSource")]
- [HttpGet]
- public object get_HPrice_BaseMaterHProcHSource(Int64 HMaterID, Int64 HProcID, Int64 HSourceID)
- {
- try
- {
- DAL.ClsGy_ProcPrice_Ctl oProcPrice = new DAL.ClsGy_ProcPrice_Ctl();
- double HPrice = oProcPrice.LoadProcPrice(HMaterID, HProcID, HSourceID, true);
-
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "Sucess锛�";
- objJsonResult.data = HPrice;
- return objJsonResult;
- }
- catch(Exception e)
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = e.ToString();
- objJsonResult.data = null;
- return objJsonResult;
}
}
#endregion
--
Gitblit v1.9.1