From ef10f06e96034f6ab3db93ea103f2a4d78fcb2b9 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期一, 13 五月 2024 17:32:29 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
WebAPI/Controllers/工资管理/Pay_WorkTimesBillController.cs | 370 ++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 313 insertions(+), 57 deletions(-)
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_WorkTimesBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_WorkTimesBillController.cs"
index 10afe0f..3553906 100644
--- "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_WorkTimesBillController.cs"
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_WorkTimesBillController.cs"
@@ -18,6 +18,7 @@
public const string ModName = "2203"; //鍗曟嵁绫诲瀷
public const string ModCaption = "鑰冨嫟姹囨姤鍗�"; //鍗曟嵁鍚嶇О
public const string ModRightName = "Pay_WorkTimesBill";
+ public const string ModRightNameList = ModRightName + "List"; //鍒楄〃
public const string ModRightNameEdit = ModRightName + "_Edit"; //缂栬緫
public const string ModRightNameCheck = ModRightName + "_Check"; //瀹℃牳
public const string ModRightNameClose = ModRightName + "_Close"; //鍏抽棴
@@ -29,11 +30,11 @@
private json objJsonResult = new json();
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
public DAL.ClsPay_WorkTimesBill oBill = new DAL.ClsPay_WorkTimesBill();
- public DAL.ClsPay_WorkTimesBill BillNew = new DAL.ClsPay_WorkTimesBill(); //瀵瑰簲鍗曟嵁绫�
- public DAL.ClsPay_WorkTimesBill BillOld = new DAL.ClsPay_WorkTimesBill(); //瀵瑰簲鍗曟嵁绫�
+ public DLL.ClsPay_WorkTimesBill BillNew0 = new DLL.ClsPay_WorkTimesBill(); //
+ public DLL.ClsPay_WorkTimesBill BillOld0 = new DLL.ClsPay_WorkTimesBill(); //
- #region 鑰冨嫟姹囨姤鍗曞垪琛�
+ #region 鑰冨嫟姹囨姤鍗曞垪琛ㄤ俊鎭�
/// <summary>
/// 鑾峰彇鑰冨嫟姹囨姤鍗曞垪琛ㄤ俊鎭�
/// </summary>
@@ -45,7 +46,7 @@
try
{
//鍒ゆ柇鏉冮檺
- if (!DBUtility.ClsPub.Security_Log(ModRightName, 3, false, HMaker))
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameList, 3, false, HMaker))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -590,6 +591,252 @@
}
#endregion
+ #region 鑰冨嫟姹囨姤鍗曟ā鍧� 浠庡垪琛ㄩ�変腑鎵撳紑鍗曟嵁锛岃繑鍥炲崟鎹俊鎭椂璋冪敤
+ /// <summary>
+ /// 鑰冨嫟姹囨姤鍗曠紪杈戞椂锛屾牴鎹崟鎹甀D鑾峰彇鍗曟嵁淇℃伅
+ /// </summary>
+ /// <returns></returns>
+ [Route("Pay_WorkTimesBillController/GetPay_WorkTimesBill_Json")]
+ [HttpGet]
+ public object GetPay_WorkTimesBill_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_WorkTimesBill_EditInit " + HInterID, "h_p_Pay_WorkTimesBill_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_WorkTimesBillController/GetPay_WorkTimesBill_Save_Json")]
+ [HttpPost]
+ public object GetPay_WorkTimesBill_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_WorkTimesBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPay_WorkTimesBillMain>>(sMainStr);
+ foreach (Model.ClsPay_WorkTimesBillMain 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_WorkTimesBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPay_WorkTimesBillSub>>(sSubStr);
+ int i = 0;
+ foreach (Model.ClsPay_WorkTimesBillSub 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
+
+
+
+
+
+
+
+
+
+
+ //---------------------------------------------------------------------------------------------鏃ф柟娉�
+
+
+ /// <summary>
+ /// 杩斿洖鑰冨嫟姹囨姤鍗曞垪琛�
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Pay_WorkTimesBill/GetWorkTimesBill")]
+ [HttpGet]
+ public object GetWorkTimesBill(string sWhere, string user)
+ {
+ try
+ {
+ if (!DBUtility.ClsPub.Security_Log("Pay_WorkTimesBillList", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ ds = Sc_GetWorkTimesBill(sWhere);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ catch (Exception ex)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ public static DataSet Sc_GetWorkTimesBill(string sWhere)
+ {
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Pay_WorkTimesBillList order by hmainid desc", "h_v_Pay_WorkTimesBillList");
+ }
+ else
+ {
+ string sql1 = "select * from h_v_Pay_WorkTimesBillList where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by hmainid desc";
+ return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Pay_WorkTimesBillList");
+ }
+
+ }
#region[鑰冨嫟姹囨姤鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁]
@@ -612,64 +859,34 @@
#region[鑰冨嫟姹囨姤鍗曠紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁]
[Route("Pay_WorkTimesBill/Pay_WorkTimesBillListProjectDetai")]
[HttpGet]
- public object Pay_WorkTimesBillListProjectDetai(Int64 HInterID)
+ public object Pay_WorkTimesBillListProjectDetai(string sqlWhere)
{
+ DataSet ds;
try
{
- ds = oCn.RunProcReturn("exec h_p_Pay_WorkTimesBill_EditInit " + HInterID, "h_p_Pay_WorkTimesBill_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 = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "鎴愬姛锛�";
- objJsonResult.data = ds.Tables[0];
- return objJsonResult;
- }
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ string sql1 = "SELECT HDeptID,閮ㄩ棬浠g爜,閮ㄩ棬,HGroupID" +
+ ",鐝粍浠g爜,鐝粍,琛ㄥご澶囨敞,鍒跺崟浜�,鍒跺崟鏃ユ湡,瀹℃牳浜�" +
+ ",瀹℃牳鏃ユ湡,淇敼浜�,淇敼鏃ユ湡,鍏抽棴浜�, 鍏抽棴鏃ユ湡,HEmpID" +
+ ",HEmpNumber,HEmpName,鑱屽憳绯绘暟 HEmpRate,鍩烘湰澶╂暟 HBaseDays,鍩烘湰宸ユ椂 HBaseTimes,鍔犵彮宸ユ椂 HOverTimes,璇峰亣宸ユ椂 HLeaveTimes,鍔犵彮澶╂暟 HOverDays,璇峰亣澶╂暟 HLeaveDays,杩熷埌娆℃暟 HLateQty" +
+ ",鍏嚭 HOutForComQty,绉佸嚭 HOutForEmpQty,鍏嚭鏃堕棿 HOutForComTimes,绉佸嚭鏃堕棿 HOutForEmpTimes,杩熷埌鏃堕棿 HLateTimes,鏃╅��娆℃暟 HEarlyQty,鏃╅��鏃堕棿 HEarlyTimes" +
+ ",鏃峰伐澶╂暟 HAbsentDays,涓婂崍 HAMTimes,涓嬪崍 HPMTimes,HCTPrjID,HCTPrjNumber,HCTPrjName,HWorkTypeID,HWorkTypeNumber,HWorkTypeName,HPayMoney,HMoney" +
+ ",琛ㄤ綋澶囨敞 HRemark,HRestFlag,HSchClassID FROM h_v_Pay_WorkTimesBillList where 1 = 1 ";
+ string sql = sql1 + sqlWhere;
+ ds = oCN.RunProcReturn(sql, "h_v_Pay_WorkTimesBillList");
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+ objJsonResult.data = ds.Tables[0];
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "杩斿洖鑰冨嫟姹囨姤鍗曚俊鎭け璐ワ紒" + e.ToString();
+ objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
objJsonResult.data = null;
- return objJsonResult;
}
-
-
- //DataSet ds;
- //try
- //{
- // SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
- // string sql1 = "SELECT HDeptID,閮ㄩ棬浠g爜,閮ㄩ棬,HGroupID" +
- // ",鐝粍浠g爜,鐝粍,琛ㄥご澶囨敞,鍒跺崟浜�,鍒跺崟鏃ユ湡,瀹℃牳浜�" +
- // ",瀹℃牳鏃ユ湡,淇敼浜�,淇敼鏃ユ湡,鍏抽棴浜�, 鍏抽棴鏃ユ湡,HEmpID" +
- // ",HEmpNumber,HEmpName,鑱屽憳绯绘暟 HEmpRate,鍩烘湰澶╂暟 HBaseDays,鍩烘湰宸ユ椂 HBaseTimes,鍔犵彮宸ユ椂 HOverTimes,璇峰亣宸ユ椂 HLeaveTimes,鍔犵彮澶╂暟 HOverDays,璇峰亣澶╂暟 HLeaveDays,杩熷埌娆℃暟 HLateQty" +
- // ",鍏嚭 HOutForComQty,绉佸嚭 HOutForEmpQty,鍏嚭鏃堕棿 HOutForComTimes,绉佸嚭鏃堕棿 HOutForEmpTimes,杩熷埌鏃堕棿 HLateTimes,鏃╅��娆℃暟 HEarlyQty,鏃╅��鏃堕棿 HEarlyTimes" +
- // ",鏃峰伐澶╂暟 HAbsentDays,涓婂崍 HAMTimes,涓嬪崍 HPMTimes,HCTPrjID,HCTPrjNumber,HCTPrjName,HWorkTypeID,HWorkTypeNumber,HWorkTypeName,HPayMoney,HMoney" +
- // ",琛ㄤ綋澶囨敞 HRemark,HRestFlag,HSchClassID FROM h_v_Pay_WorkTimesBillList where 1 = 1 ";
- // string sql = sql1 + sqlWhere;
- // ds = oCN.RunProcReturn(sql, "h_v_Pay_WorkTimesBillList");
- // objJsonResult.code = "0";
- // objJsonResult.count = 1;
- // objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
- // objJsonResult.data = ds.Tables[0];
- //}
- //catch (Exception e)
- //{
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
- // objJsonResult.data = null;
- //}
- //return objJsonResult;
+ return objJsonResult;
}
#endregion
@@ -716,7 +933,7 @@
if (refSav == "Add")
{
//鍗曟嵁鍙锋槸鍚﹂噸澶�
- if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
+ if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld0.omodel.HInterID))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -727,7 +944,7 @@
}
if (refSav == "Update")
{
- if (BillOld.ShowBill(oItem.HInterID, ref s) == false)
+ if (BillOld0.ShowBill(oItem.HInterID, ref s) == false)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -736,7 +953,7 @@
return objJsonResult;
}
//鍒ゆ柇鏄惁鍙紪杈�
- if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
+ if (BillOld0.omodel.HChecker != "" && BillOld0.omodel.HChecker != null)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -744,7 +961,7 @@
objJsonResult.data = 1;
return objJsonResult;
}
- if (BillOld.omodel.HBillStatus > 1)
+ if (BillOld0.omodel.HBillStatus > 1)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -752,7 +969,7 @@
objJsonResult.data = 1;
return objJsonResult;
}
- if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s))
+ if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld0, ref s))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -838,6 +1055,45 @@
}
/// <summary>
+ ///宸ヨ祫缁撶畻涓汉鍗曞垹闄ゅ姛鑳�
+ /// </summary>
+ /// <returns></returns>
+ [Route("Pay_WorkTimesBill/DeltetWorkTimesBill")]
+ [HttpGet]
+ public object DeltetWorkTimesBill(string HInterID, string user)
+ {
+ try
+ {
+ if (!DBUtility.ClsPub.Security_Log("Pay_WorkTimesBill_Drop", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ oCn.BeginTran();
+ oCn.RunProc("Delete From Pay_WorkTimesBillMain where HInterID = " + HInterID);
+ oCn.RunProc("Delete From Pay_WorkTimesBillSub where HInterID = " + HInterID);
+ oCn.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCn.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ /// <summary>
/// 閫氳繃鐝粍鏌ヨ鑱屽憳淇℃伅
///鍙傛暟锛歴tring sql銆�
///杩斿洖鍊硷細object銆�
--
Gitblit v1.9.1