From fcc99f2648369ea6aa20e59f59653ac872bba091 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期日, 19 十月 2025 13:01:03 +0800
Subject: [PATCH] 分支合并
---
WebAPI/Controllers/BaseSet/Xt_ORGANIZATIONSController.cs | 285 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 281 insertions(+), 4 deletions(-)
diff --git a/WebAPI/Controllers/BaseSet/Xt_ORGANIZATIONSController.cs b/WebAPI/Controllers/BaseSet/Xt_ORGANIZATIONSController.cs
index f2747a8..297df22 100644
--- a/WebAPI/Controllers/BaseSet/Xt_ORGANIZATIONSController.cs
+++ b/WebAPI/Controllers/BaseSet/Xt_ORGANIZATIONSController.cs
@@ -40,7 +40,8 @@
objJsonResult.data = null;
return objJsonResult;
}
- string sql1 = string.Format(@"select * from h_v_IF_ORGANIZATIONSList where 缁勭粐鍚嶇О='" + Organization + "'");
+ //string sql1 = string.Format(@"select * from h_v_IF_ORGANIZATIONSList where 缁勭粐鍚嶇О='" + Organization + "'");
+ string sql1 = string.Format(@"select * from h_v_IF_ORGANIZATIONSList where 1=1 ");
if (sWhere == null || sWhere.Equals(""))
{
ds = oCN.RunProcReturn(sql1 + sWhere + " order by 缁勭粐浠g爜 ", "h_v_IF_ORGANIZATIONSList");
@@ -252,6 +253,17 @@
// objJsonResult.data = null;
// return objJsonResult;
//}
+ //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
+ ds = oCN.RunProcReturn("Select HItemID from Xt_ORGANIZATIONS Where HItemID<>" + HItemID + " and HNumber='" + HNumber.Trim()+"'", "Xt_ORGANIZATIONS");
+
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
//淇濆瓨
//淇濆瓨瀹屾瘯鍚庡鐞�
if (AddOrEdit == "1")
@@ -260,10 +272,10 @@
oCN.RunProc("Insert into Xt_ORGANIZATIONS " +
" (HNumber,HName,HParentID" +
",HStopflag,HMakeTime,HItemID" +
- ",HRemark) " +
+ ",HRemark,HMakeEmp) " +
" Values('" + HNumber + "','" + HName + "','" + HParentID.ToString() +
"','" + ChangeHStopflag + "'," + "getdate()" + ",'" + HItemID + "'" +
- ",'" + HRemark + "')", ref DBUtility.ClsPub.sExeReturnInfo);
+ ",'" + HRemark + "','"+ msg3 + "')", ref DBUtility.ClsPub.sExeReturnInfo);
//淇敼涓婄骇涓洪潪鏈骇浠g爜
oCN.RunProc("Update Xt_ORGANIZATIONS set HStopflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
@@ -271,6 +283,19 @@
}
else if(AddOrEdit == "3")
{
+ //宸插鏍镐笉鍏佽淇敼
+ DataSet dss;
+ dss = oCN.RunProcReturn("select * from Xt_ORGANIZATIONS where HItemID=" + HItemID, "Xt_ORGANIZATIONS");
+ //鍒ゆ柇鏄惁鍙紪杈�
+ if (dss.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+ {
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹姸鎬佸凡缁忓鏍革紝涓嶅厑璁镐慨鏀癸紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
int Stopflag;
if (HStopflag)
{
@@ -286,7 +311,9 @@
" HNumber='" + HNumber + "'" +
",HName='" + HName + "'" +
",HParentID='" + HParentID + "'" +
- ",HMakeTime='" + HMakeTime + "'" +
+ //",HMakeTime='" + HMakeTime + "'" +
+ ",HModifyEmp='" + msg3 + "'" +
+ ",HModifyTime=getdate()" +
",HStopflag='" + Stopflag + "'" +
",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
oCN.RunProc("Update Xt_ORGANIZATIONS set HStopflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
@@ -412,6 +439,256 @@
}
}
+ #region 缁勭粐瀹℃牳銆佸弽瀹℃牳
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+ /// <param name="CurUserName">瀹℃牳浜�</param>
+ /// <returns></returns>
+ [Route("Xt_ORGANIZATIONS/AuditXt_ORGANIZATIONS")]
+ [HttpGet]
+ public object AuditXt_ORGANIZATIONS(int HInterID, int IsAudit, string CurUserName)
+ {
+ try
+ {
+ //瀹℃牳鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("Xt_ORGANIZATIONS_Check", 1, false, CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ var ds = oCN.RunProcReturn("select * from Xt_ORGANIZATIONS where HItemID=" + HInterID, "Xt_ORGANIZATIONS");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ if (IsAudit == 0) //瀹℃牳鍒ゆ柇
+ {
+ if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+ {
+ if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ if (IsAudit == 0) //瀹℃牳鍒ゆ柇
+ {
+ oCN.RunProc("update Xt_ORGANIZATIONS set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳鎴愬姛";
+ objJsonResult.data = null;
+ }
+ if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+ {
+ oCN.RunProc("update Xt_ORGANIZATIONS set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+ objJsonResult.data = null;
+ }
+ oCN.Commit();
+
+ 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>
+ ///
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="IsStop">绂佺敤(0),鍙嶇鐢�(1)</param>
+ /// <param name="CurUserName">瀹℃牳浜�</param>
+ /// <returns></returns>
+ [Route("Xt_ORGANIZATIONS/StopXt_ORGANIZATIONS")]
+ [HttpGet]
+ public object StopXt_ORGANIZATIONS(int HInterID, int IsStop, string CurUserName)
+ {
+ try
+ {
+ //瀹℃牳鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("Xt_ORGANIZATIONS_Stop", 1, false, CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绂佺敤澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ var ds = oCN.RunProcReturn("select * from Xt_ORGANIZATIONS where HItemID=" + HInterID, "Xt_ORGANIZATIONS");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ if (IsStop == 0) //绂佺敤鍒ゆ柇
+ {
+ if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘鍐嶆绂佺敤锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂�
+ {
+ if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鏈鐢�!涓嶉渶瑕佸弽绂佺敤!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ if (IsStop == 0) //绂佺敤鍒ゆ柇
+ {
+ oCN.RunProc("update Xt_ORGANIZATIONS set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "绂佺敤鎴愬姛";
+ objJsonResult.data = null;
+ }
+ if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂�
+ {
+ oCN.RunProc("update Xt_ORGANIZATIONS set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶇鐢ㄦ垚鍔�";
+ objJsonResult.data = null;
+ }
+ oCN.Commit();
+
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绂佺敤澶辫触鎴栬�呭弽绂佺敤澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+
+ #region 缁勭粐鏈烘瀯鎺ュ彛淇濆瓨
+ [Route("Xt_ORGANIZATIONS/SaveXt_ORGANIZATIONSAPI")]
+ [HttpPost]
+ public object SaveXt_ORGANIZATIONSAPI([FromBody] JObject oMain)
+ {
+ try
+ {
+ var model = oMain["model"].ToString();
+ LogService.Write("1" + model);
+ //鍙嶅簭鍒楀寲
+ model = "[" + model + "]";
+ List<Xt_ORGANIZATIONS> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Xt_ORGANIZATIONS>>(model);
+ string sql = string.Empty;
+ oCN.BeginTran();
+ foreach (var item in lsmain)
+ {
+ // 浣跨敤褰撳墠item鐨凥ItemID鍒犻櫎
+ sql = $"delete from Xt_ORGANIZATIONS where HItemID = {item.HItemID}";
+ oCN.RunProc(sql);
+ // 寮�鍚痠dentity_insert
+ sql = "set identity_insert Xt_ORGANIZATIONS on";
+ oCN.RunProc(sql);
+
+ LogService.Write("缁勭粐鏈烘瀯" + @"Insert into Xt_ORGANIZATIONS (HItemID,HNumber,HName,HParentID,HStopflag,HMakeTime,HRemark)" +
+ " values('" + item.HItemID + "','" + item.HNumber + "','" + item.HName + "','" + item.HParentID + "','" + item.HStopflag + "'," +
+ ",getdate(),'" + item.HRemark +
+ "') ");
+
+ // 鎻掑叆褰撳墠item鐨勮褰�
+ sql = "Insert into Xt_ORGANIZATIONS (HItemID,HNumber,HName,HParentID,HStopflag,HMakeTime,HRemark)" +
+ " values('" + item.HItemID + "','" + item.HNumber + "','" + item.HName + "','" + item.HParentID + "','" + item.HStopflag + "'," +
+ ",getdate(),'" + item.HRemark +
+ "') ";
+ oCN.RunProc(sql);
+ // 鍏抽棴identity_insert
+ sql = "set identity_insert Xt_ORGANIZATIONS off";
+ oCN.RunProc(sql);
+
+ // 鎻愪氦褰撳墠浜嬪姟
+ 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.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+
+ }
+ }
+ #endregion
//
}
--
Gitblit v1.9.1