From 7141e956ca8488f6feb082828cd60653382b6c89 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期一, 24 十一月 2025 16:37:24 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/BaseSet/Gy_EmployeeController.cs | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 154 insertions(+), 6 deletions(-)
diff --git a/WebAPI/Controllers/BaseSet/Gy_EmployeeController.cs b/WebAPI/Controllers/BaseSet/Gy_EmployeeController.cs
index a354e80..2fcd8e6 100644
--- a/WebAPI/Controllers/BaseSet/Gy_EmployeeController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_EmployeeController.cs
@@ -26,6 +26,7 @@
DataSet ds;
string fileip = System.Configuration.ConfigurationManager.AppSettings["FileIP"];
+ #region 杩斿洖鑱屽憳鍒楄〃
/// <summary>
/// 杩斿洖鑱屽憳鍒楄〃
///鍙傛暟锛歴tring sql銆�
@@ -47,7 +48,8 @@
objJsonResult.data = null;
return objJsonResult;
}
- string sql1 = string.Format(@"select * from h_v_IF_EmployeeList where 缁勭粐鍚嶇О='" + Organization + "'");
+ //string sql1 = string.Format(@"select * from h_v_IF_EmployeeList where 缁勭粐鍚嶇О='" + Organization + "'");
+ string sql1 = string.Format(@"select * from h_v_IF_EmployeeList where 1=1 ");
if (sWhere == null || sWhere.Equals(""))
{
ds = oCN.RunProcReturn(sql1 + sWhere, "h_v_IF_EmployeeList");
@@ -82,6 +84,149 @@
return objJsonResult;
}
}
+
+ #endregion
+
+ #region 杩斿洖鑱屽憳鍒楄〃
+ /// <summary>
+ /// 杩斿洖鑱屽憳鍒楄〃
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Gy_Employee/listPage")]
+ [HttpGet]
+ public object lislistPaget(string sWhere, string user, string Organization, int page, int size)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //缂栬緫鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("Gy_Employee_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ ds = oCN.RunProcReturn($@"exec h_p_IF_EmployeeListPage {page}, {size}, ''", "h_p_IF_StockPlaceListPage");
+ }
+ else
+ {
+ sWhere = sWhere.Replace("'", "''");
+
+ ds = oCN.RunProcReturn($@"exec h_p_IF_EmployeeListPage {page}, {size}, '{sWhere}'", "h_p_IF_StockPlaceListPage");
+ }
+ //娣诲姞鍒楀悕
+ 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鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ #endregion
+
+
+ #region 鑱屽憳 鏍戝舰鍥�
+ public class TreeModel
+ {
+ public string id { get; set; }
+ public string title { get; set; }
+ public List<TreeModel> children = new List<TreeModel>();
+ }
+ [Route("Gy_Employee/Gy_EmployeeTreeList")]
+ [HttpGet]
+ public object Gy_SourceTreeList(string sWhere)
+ {
+ try
+ {
+ string sql1 = string.Format("select hitemid,hnumber,hname,HUSEORGID from Gy_Employee" + sWhere + " order by hnumber");
+
+ ds = oCN.RunProcReturn(sql1, "Gy_Employee");
+
+ List<TreeModel> treeModels = new List<TreeModel>();
+ TreeModel first = new TreeModel();
+ first.id = "0";
+ first.title = "鑱屽憳璁剧疆";
+ treeModels.Add(first);
+
+ foreach (DataRow row in ds.Tables[0].Rows)
+ {
+ var strLen = row["hitemid"].ToString().Split('.');
+ if (strLen.Length == 1)
+ {
+ TreeModel tree = new TreeModel();
+ tree.id = row["hitemid"].ToString();
+ tree.title = row["hname"].ToString();
+ treeModels[0].children.Add(tree);
+ }
+ }
+ digui(ds.Tables[0], treeModels[0].children, 2);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels);
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ /// <summary>
+ /// 閫掑綊鍑芥暟
+ /// </summary>
+ public void digui(DataTable dt, List<TreeModel> tree, int num)
+ {
+ for (int m = 0; m < tree.Count; m++)
+ {
+ tree[m].children = new List<TreeModel>();
+ for (int i = 0; i < dt.Rows.Count; i++)//绗竴娆″惊鐜紝寰楀埌鎵�鏈夋牴鑺傜偣鐨勫瓙闆�
+ {
+ var strLen = dt.Rows[i]["hnumber"].ToString().Split('.');
+ if (strLen.Length == num && dt.Rows[i]["hnumber"].ToString().Contains(tree[m].id + "."))
+ {
+ TreeModel tbjson = new TreeModel();
+ tbjson.id = dt.Rows[i]["hitemid"].ToString();
+ tbjson.title = dt.Rows[i]["hname"].ToString();
+ tree[m].children.Add(tbjson);
+ }
+ }
+ var strLens = tree[m].id.Split('.');
+ for (int i = 0; i < tree[m].children.Count; i++)
+ {
+ digui(dt, tree[m].children, strLens.Length + 2);//鍐嶆鐢ㄥ瓙闆嗗幓寰幆锛屾嬁鍑哄瓙闆嗙殑瀛愰泦
+ }
+ }
+
+ }
+ #endregion
///// <summary>
///// 鏂板鑱屽憳-淇濆瓨鎸夐挳
@@ -293,6 +438,7 @@
string msg4 = sArray[2].ToString();
//string msg4 = sArray[2].ToString();
//string msg5 = sArray[3].ToString();
+
oCN.BeginTran();
//缂栬緫鏉冮檺
if (!DBUtility.ClsPub.Security_Log_second("Gy_Employee_Edit", 1, false, msg3))
@@ -508,7 +654,6 @@
+ itemID + "," + listOne.HPostID +",N'" + listOne.HRemark + "');";
}
- LogService.Write(sql3);
oCN.RunProcReturn(sql3, "Gy_Employee_Post");
}
@@ -530,6 +675,7 @@
objJsonResult.data = null;
return objJsonResult;
}
+
oCN.RunProc("Update Gy_Employee set " +
" HNumber='" + HNumber + "'" +
",HName='" + HName + "'" +
@@ -616,15 +762,17 @@
",HAddress='" + HAddress.ToString() + "'" +
",HDeptID= '" + HDeptID + "' Where HItemID=" + HItemID);
+
+
oCN.RunProcReturn("delete from Gy_Employee_Post where HEmpID = " + HItemID, "Gy_Employee_Post");
string sql3 = "";
foreach (ClsGy_EmployeeSub listOne in list1)
{
sql3 += "insert into Gy_Employee_Post(HEmpID, HPostID, HRemark) Values("
- + HItemID + "," + listOne.HPostID + ",N'" + listOne.HRemark + "');";
+ + HItemID + ",N'" + listOne.HPostID + "',N'" + listOne.HRemark + "');";
+
}
- LogService.Write(sql3);
oCN.RunProcReturn(sql3, "Gy_WorkCenterSub");
}
@@ -1249,7 +1397,7 @@
string sql = string.Empty;
//淇濆瓨
oCN.BeginTran();
- sql = $"delete Gy_Employee where HItemID = {lsmain[0].HItemID}";
+ sql = $"delete Gy_Employee where HItemID = {lsmain[0].HItemID}";
oCN.RunProc(sql);
sql = "set identity_insert Gy_Employee on";
oCN.RunProc(sql);
@@ -1271,7 +1419,7 @@
,HPostalCode,HBank,HBasePay,HExamLevPostMoney,HBSTDeptID
,HOtherDeduct3,HInsurance,HMedicare,HDrydock
,HBankAccount,HGroupID,HDeptID,HWorkTypeID,HCTPrjID,HUSEORGID,HAddress)
- values({lsmain[0].HItemID},'{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HShortNumber}',{lsmain[0].HEmpRate},{lsmain[0].HExamRate},{lsmain[0].HLevel},{lsmain[0].HParentID},{Convert.ToString(lsmain[0].HEndFlag ? 1 : 0)},{lsmain[0].HHighestPay},{lsmain[0].HOverPayRate},{Convert.ToString(lsmain[0].HStopflag ? 1 : 0) },'{lsmain[0].HRemark}','{lsmain[0].HHelpCode}',{lsmain[0].HInsuranceSubsidy},'{lsmain[0].HBirthDay}','{lsmain[0].HGradDate}','{lsmain[0].HInsuranceDate}','{lsmain[0].HContractBDate}','{lsmain[0].HContractEDate}','{lsmain[0].HJobCardEDate}','{lsmain[0].HCheckCardEDate}','{lsmain[0].HStayCardEDate}','{lsmain[0].HHealthCardEDate}',{lsmain[0].HAge},'{lsmain[0].HSalaryLev}',{lsmain[0].HContractYear},{lsmain[0].HInsuranceStatus},{lsmain[0].HSignStatus},'{lsmain[0].HSex}','{lsmain[0].HMarr}','{lsmain[0].HBlighty}','{lsmain[0].HNation}','{lsmain[0].HBlightyType}','{lsmain[0].HGovStatus}','{lsmain[0].HBloodType}','{lsmain[0].HStature}','{lsmain[0].HAvoird}','{lsmain[0].HKnowLev}','{lsmain[0].HProTitleID}','{lsmain[0].HGradSchool}','{lsmain[0].HEngLev}','{lsmain[0].HCompLev}','{lsmain[0].HSpec}','{lsmain[0].HEmail}','{lsmain[0].HNowAdd}','{lsmain[0].HHomeAdd}','{lsmain[0].HIDCard}','{lsmain[0].HLinkPhone}','{lsmain[0].HMobilePhone}','{lsmain[0].HFax}','{lsmain[0].HOldCompany}','{lsmain[0].HInsuranceNo}','{lsmain[0].HJobCardNo}','{lsmain[0].HArchivesNo}','{lsmain[0].HWorkType}','{lsmain[0].HDimissionReason}','{lsmain[0].HDimissionDate}','{lsmain[0].HInComDate}','{lsmain[0].HSignDate}','{lsmain[0].HRelDate}',{lsmain[0].HPostID},{lsmain[0].HDormID},{lsmain[0].HDutyID},{lsmain[0].HLeftMoneyRate},'{lsmain[0].HEmpType}','{lsmain[0].HPayType}','{lsmain[0].HOverType}',{lsmain[0].HNoBrushFlag},{lsmain[0].HShiftFlag},{lsmain[0].HStopwagesFlag},'{lsmain[0].HPostalCode}','{lsmain[0].HBank}',{lsmain[0].HBasePay},{lsmain[0].HExamLevPostMoney},{lsmain[0].HBSTDeptID},{lsmain[0].HOtherDeduct3},{lsmain[0].HInsurance},{lsmain[0].HMedicare},{lsmain[0].HDrydock},'{lsmain[0].HBankAccount}',{lsmain[0].HGroupID},{lsmain[0].HDeptID},{lsmain[0].HWorkTypeID},{lsmain[0].HCTPrjID},{lsmain[0].HUSEORGID},'{lsmain[0].HAddress}')", ref DBUtility.ClsPub.sExeReturnInfo);
+ values('{lsmain[0].HItemID}','{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HShortNumber}','{lsmain[0].HEmpRate}','{lsmain[0].HExamRate}','{lsmain[0].HLevel}','{lsmain[0].HParentID}','{Convert.ToString(lsmain[0].HEndFlag ? 1 : 0)}','{lsmain[0].HHighestPay}','{lsmain[0].HOverPayRate}','{Convert.ToString(lsmain[0].HStopflag ? 1 : 0) }','{lsmain[0].HRemark}','{lsmain[0].HHelpCode}','{lsmain[0].HInsuranceSubsidy}','{lsmain[0].HBirthDay}','{lsmain[0].HGradDate}','{lsmain[0].HInsuranceDate}','{lsmain[0].HContractBDate}','{lsmain[0].HContractEDate}','{lsmain[0].HJobCardEDate}','{lsmain[0].HCheckCardEDate}','{lsmain[0].HStayCardEDate}','{lsmain[0].HHealthCardEDate}','{lsmain[0].HAge}','{lsmain[0].HSalaryLev}','{lsmain[0].HContractYear}','{lsmain[0].HInsuranceStatus}','{lsmain[0].HSignStatus}','{lsmain[0].HSex}','{lsmain[0].HMarr}','{lsmain[0].HBlighty}','{lsmain[0].HNation}','{lsmain[0].HBlightyType}','{lsmain[0].HGovStatus}','{lsmain[0].HBloodType}','{lsmain[0].HStature}','{lsmain[0].HAvoird}','{lsmain[0].HKnowLev}','{lsmain[0].HProTitleID}','{lsmain[0].HGradSchool}','{lsmain[0].HEngLev}','{lsmain[0].HCompLev}','{lsmain[0].HSpec}','{lsmain[0].HEmail}','{lsmain[0].HNowAdd}','{lsmain[0].HHomeAdd}','{lsmain[0].HIDCard}','{lsmain[0].HLinkPhone}','{lsmain[0].HMobilePhone}','{lsmain[0].HFax}','{lsmain[0].HOldCompany}','{lsmain[0].HInsuranceNo}','{lsmain[0].HJobCardNo}','{lsmain[0].HArchivesNo}','{lsmain[0].HWorkType}','{lsmain[0].HDimissionReason}','{lsmain[0].HDimissionDate}','{lsmain[0].HInComDate}','{lsmain[0].HSignDate}','{lsmain[0].HRelDate}','{lsmain[0].HPostID}','{lsmain[0].HDormID}','{lsmain[0].HDutyID}','{lsmain[0].HLeftMoneyRate}','{lsmain[0].HEmpType}','{lsmain[0].HPayType}','{lsmain[0].HOverType}','{lsmain[0].HNoBrushFlag}','{lsmain[0].HShiftFlag}','{lsmain[0].HStopwagesFlag}','{lsmain[0].HPostalCode}','{lsmain[0].HBank}','{lsmain[0].HBasePay}','{lsmain[0].HExamLevPostMoney}','{lsmain[0].HBSTDeptID}','{lsmain[0].HOtherDeduct3}','{lsmain[0].HInsurance}','{lsmain[0].HMedicare}','{lsmain[0].HDrydock}','{lsmain[0].HBankAccount}','{lsmain[0].HGroupID}','{lsmain[0].HDeptID}','{lsmain[0].HWorkTypeID}','{lsmain[0].HCTPrjID}','{lsmain[0].HUSEORGID}','{lsmain[0].HAddress}')", ref DBUtility.ClsPub.sExeReturnInfo);
//淇敼涓婄骇涓洪潪鏈骇浠g爜
sql = "set identity_insert Gy_Employee off";
oCN.RunProc(sql);
--
Gitblit v1.9.1