From f5e447f7bdcab43a2a05d8d1cc12d1cece39328b Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期日, 18 十二月 2022 23:58:20 +0800
Subject: [PATCH] 业务员
---
WebAPI/Controllers/基础资料/基础资料/Gy_OperatorController.cs | 620 +++++++++++++++++++++++++++++++++++++++-----------------
Model/基础资料/基础资料/ClsGy_Operator_Model.cs | 1
2 files changed, 434 insertions(+), 187 deletions(-)
diff --git "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_Operator_Model.cs" "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_Operator_Model.cs"
index a6ec2fe..4dad853 100644
--- "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_Operator_Model.cs"
+++ "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_Operator_Model.cs"
@@ -15,5 +15,6 @@
public Int64 HSEQ;//搴忓彿
public Int64 HStaffId;//鑱屽憳
public Int64 HIsUse;//鍚敤
+ public Int64 HIsPseDel;//鏄惁浼垹闄�
}
}
diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_OperatorController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_OperatorController.cs"
index 739f98a..277f0fe 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_OperatorController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_OperatorController.cs"
@@ -1,4 +1,6 @@
-锘縰sing Newtonsoft.Json;
+锘縰sing DBUtility;
+using Model;
+using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -34,6 +36,20 @@
// objJsonResult.data = null;
// return objJsonResult;
//}
+
+ #region 杩欓噷灏嗕负鍒犻櫎鐨勬暟鎹� HIsPseDel 鎭㈠涓�0
+ DataSet Cs;
+ Cs = oCN.RunProcReturn("select HItemID from Gy_Operator where HIsPseDel = 1", "Gy_Operator");
+ string sqlupdate = string.Empty;
+ for (var i = 0; i< Cs.Tables[0].Rows.Count; i++)
+ {
+ sqlupdate = $"update Gy_Operator set HIsPseDel = 0 where HItemID = {Cs.Tables[0].Rows[i]["HItemID"]} ";
+ oCN.RunProc(sqlupdate);
+ }
+ #endregion
+
+
+
string sql1 = string.Format(@"select * from h_v_Gy_OperatorList where 1 = 1 ");
string sql = sql1 + sWhere;
@@ -65,216 +81,359 @@
}
#endregion
- #region 涓氬姟鍛� 缂栬緫
+ #region 涓氬姟鍛� 淇濆瓨/缂栬緫鍔熻兘
[Route("Gy_Operator/OperatorEdit")]
[HttpPost]
- public object OperatorEdit([FromBody] JObject msg)
+ public object OperatorEdit([FromBody] JObject sMainSub)
{
- DataSet ds;
- var _value = msg["msg"].ToString();
- string msg3 = _value.ToString();
- string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
- string msg1 = sArray[0].ToString();
- string msg2 = sArray[1].ToString();
- //string msg_HUSEORGID = sArray[2].ToString();
- Int64 HItemID = 0;
- SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ try
+ {
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ oCN.BeginTran();
+ //淇濆瓨琛�
+ objJsonResult = AddBill(msg1);
+ if (objJsonResult.code == "0")
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍗曟嵁淇濆瓨鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
- //缂栬緫鏉冮檺
- //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Edit", 1, false, msg2))
- //{
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // 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;
+ }
+ }
- //鑾峰彇鏈�澶D鍊艰祴鍊�
- //DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_TaxRate ", "Gy_TaxRate");
- //if (Maxds != null || Maxds.Tables[0].Rows.Count > 0)
- //{
- // //HItemID= Maxds.Tables[0].Rows[0]["HItemID"]
- // var maxid = Convert.ToInt32((Maxds.Tables[0].Rows[0]["HItemID"].ToString()==""?0: Maxds.Tables[0].Rows[0]["HItemID"]));
- // maxid += 1;
- // HItemID = maxid;
- //}
- ListModels oListModels = new ListModels();
+ public json AddBill(string msg1)
+ {
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString(); //涓昏〃鏁版嵁
+ string msg3 = sArray[1].ToString(); //瀛愯〃鏁版嵁
try
{
- DAL.ClsGy_Operator_Ctl oBill = new DAL.ClsGy_Operator_Ctl();
- List<Model.ClsGy_Operator_Model> lsmain = new List<Model.ClsGy_Operator_Model>();
- msg1 = msg1.Replace("\\", "");
- msg1 = msg1.Replace("\n", ""); //\n
- lsmain = oListModels.getObjectByJson_Gy_Operator(msg1);
- foreach (Model.ClsGy_Operator_Model oItem in lsmain)
- {
- if (oItem.HNumber.Trim() == "")
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒";
- objJsonResult.data = 1;
- return objJsonResult;
- }
- if (oItem.HName.Trim() == "")
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒";
- objJsonResult.data = 1;
- return objJsonResult;
- }
+ msg2 = "[" + msg2.ToString() + "]";
+ List<ClsGy_Operator_Model> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsGy_Operator_Model>>(msg2);
- //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
- ds = oCN.RunProcReturn("select * from Gy_Operator where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_Operator");
- if (oItem.HItemID == 0)
+ string HOperatorType = mainList[0].HOperatorType;//涓氬姟鍛樼被鍨�
+
+
+ List<ClsGy_Operator_Model> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsGy_Operator_Model>>(msg3);
+
+ long HItemID = mainList2[0].HItemID;
+ string HNumber = mainList2[0].HNumber;
+ string HName = mainList2[0].HName;
+ string HHelpCode = mainList2[0].HHelpCode;
+ string HShortNumber = mainList2[0].HShortNumber;
+ long HParentID = mainList2[0].HParentID;
+ long HLevel = mainList2[0].HLevel;
+ bool HEndFlag = mainList2[0].HEndFlag;
+ bool HStopflag = mainList2[0].HStopflag;
+ string HRemark = mainList2[0].HRemark;
+ string HUseFlag = mainList2[0].HUseFlag;
+ long HUSEORGID = mainList2[0].HUSEORGID;
+ long HOperatorId = mainList2[0].HOperatorId;
+ long HSEQ = mainList2[0].HSEQ;
+ long HStaffId = mainList2[0].HStaffId;
+ long HIsUse = mainList2[0].HIsUse;
+ long HIsPseDel = mainList2[0].HIsPseDel;
+
+ int i = 0;
+ string sql = string.Empty;
+ sql = "set identity_insert Gy_Operator on";
+ oCN.RunProc(sql);
+ foreach (ClsGy_Operator_Model oSub in mainList2)
+ {
+ i++;
+
+ sql = $"delete Gy_Operator where HItemID = {oSub.HItemID}";
+ oCN.RunProc(sql);
+
+ if(oSub.HItemID == 0)
{
- if (ds.Tables[0].Rows.Count > 0)
+ DataSet Cs;
+ Cs = oCN.RunProcReturn("select MAX(HItemID)HItemID from Gy_Operator", "Gy_Operator");
+ if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HItemID"].ToString()) != 0)
{
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
- objJsonResult.data = null;
- return objJsonResult;
+ oSub.HItemID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HItemID"].ToString());
+ oSub.HItemID += 1;
}
+ }
+ //杩欓噷杩涜鏁版嵁鐨勭湡鍒犻櫎
+ if(oSub.HIsPseDel == 1)
+ {
+ sql = $"delete Gy_Operator where HItemID = {oSub.HItemID} and HIsPseDel = 1 ";
+ oCN.RunProc(sql);
}
else
{
- if (ds.Tables[0].Rows.Count > 0)
- {
- if (ds.Tables[0].Rows[0]["HItemID"].ToString() != oItem.HItemID.ToString())
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
- objJsonResult.data = null;
- return objJsonResult;
- }
- }
+ oCN.RunProc($@"Insert into Gy_Operator
+ (HItemID,HNumber,HName,HHelpCode,HShortNumber,HParentID,HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HUSEORGID
+ ,HOperatorId,HOperatorType,HSEQ,HStaffId,HIsUse)
+ values({oSub.HItemID},'{oSub.HNumber}','{oSub.HName}','{oSub.HHelpCode}','{oSub.HShortNumber}',{oSub.HParentID},{oSub.HLevel},'{oSub.HEndFlag}','{oSub.HStopflag}','{oSub.HRemark}','{oSub.HUseFlag}',{oSub.HUSEORGID},{oSub.HOperatorId},'{HOperatorType}',{oSub.HSEQ},{oSub.HStaffId},{oSub.HIsUse})");
}
+ }
+ sql = "set identity_insert Gy_Operator off";
+ oCN.RunProc(sql);
- //鏂板鏃跺垽鏂�
- #region 鐖剁骇鏍¢獙鏂规硶锛坅pi璋冪敤鍏堟敞閲婃帀锛岋級
- /*
- if (oItem.HItemID == 0)
- {
- if (ds == null || ds.Tables[0].Rows.Count > 0)
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
- objJsonResult.data = 1;
- return objJsonResult;
- }
- //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
- string sParent;
- sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
- if (sParent.Trim() == "")
- {
- oBill.oModel.HParentID = 0;
- }
- else
- {
- if (oBill.HavParentCode(sParent.Trim(), HItemID))
- {
- oBill.oModel.HParentID = oBill.oModel.HItemID;
- }
- else
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
- objJsonResult.data = 1;
- return objJsonResult;
- }
- }
- }
- else//缂栬緫鏃跺垽鏂�
- {
- //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
- string sParent;
- sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
- if (sParent.Trim() == "")
- {
- oBill.oModel.HParentID = 0;
- }
- else
- {
- if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID))
- {
- oBill.oModel.HParentID = oBill.oModel.HItemID;
- }
- else
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
- objJsonResult.data = 1;
- return objJsonResult;
- }
- }
- }
- */
- #endregion
- //寰楀埌鐭唬鐮�
- string sShortNumber;
- sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
- if (sShortNumber.Trim() == "")
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
- objJsonResult.data = 1;
- return objJsonResult;
- }
- //oItem.HUSEORGID = Convert.ToInt32(msg_HUSEORGID); //缁勭粐id
- oItem.HShortNumber = sShortNumber;//鐭唬鐮�
- oItem.HEndFlag = true;//鏈骇鏍囧織
- oItem.HLevel = 1; //绛夌骇 DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim())
- oBill.oModel = oItem;
- }
- //淇濆瓨
- //淇濆瓨瀹屾瘯鍚庡鐞�
- bool bResult;
- if (oBill.oModel.HItemID == 0)
- {
- bResult = oBill.AddNew();
- }
- else
- {
- bResult = oBill.ModifyByID(oBill.oModel.HItemID);
- }
- if (bResult)
- {
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
- //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
- objJsonResult.data = 1;
- return objJsonResult;
- }
- else
+
+ if (objJsonResult.code == "0")
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
- objJsonResult.data = 1;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
return objJsonResult;
}
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
}
catch (Exception e)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
- objJsonResult.data = 1;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
return objJsonResult;
}
}
#endregion
+
+ ////#region 涓氬姟鍛� 缂栬緫
+ //[Route("Gy_Operator/OperatorEdit")]
+ //[HttpPost]
+ //public object OperatorEdit([FromBody] JObject msg)
+ //{
+ // DataSet ds;
+ // var _value = msg["msg"].ToString();
+ // string msg3 = _value.ToString();
+ // string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ // string msg1 = sArray[0].ToString();
+ // string msg2 = sArray[1].ToString();
+ // //string msg_HUSEORGID = sArray[2].ToString();
+ // Int64 HItemID = 0;
+ // SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
+ // //缂栬緫鏉冮檺
+ // //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Edit", 1, false, msg2))
+ // //{
+ // // objJsonResult.code = "0";
+ // // objJsonResult.count = 0;
+ // // objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ // // objJsonResult.data = null;
+ // // return objJsonResult;
+ // //}
+
+ // //鑾峰彇鏈�澶D鍊艰祴鍊�
+ // //DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_TaxRate ", "Gy_TaxRate");
+ // //if (Maxds != null || Maxds.Tables[0].Rows.Count > 0)
+ // //{
+ // // //HItemID= Maxds.Tables[0].Rows[0]["HItemID"]
+ // // var maxid = Convert.ToInt32((Maxds.Tables[0].Rows[0]["HItemID"].ToString()==""?0: Maxds.Tables[0].Rows[0]["HItemID"]));
+ // // maxid += 1;
+ // // HItemID = maxid;
+ // //}
+ // ListModels oListModels = new ListModels();
+ // List<ClsGy_Operator_Model> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsGy_Operator_Model>>(msg2);
+ // List<ClsGy_Operator_Model> mainList22 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsGy_Operator_Model>>(msg3);
+ // string main = mainList + ";" + mainList22;
+
+ // try
+ // {
+ // DAL.ClsGy_Operator_Ctl oBill = new DAL.ClsGy_Operator_Ctl();
+ // List<Model.ClsGy_Operator_Model> lsmain = new List<Model.ClsGy_Operator_Model>();
+ // msg1 = msg1.Replace("\\", "");
+ // msg1 = msg1.Replace("\n", ""); //\n
+ // lsmain = oListModels.getObjectByJson_Gy_Operator(msg1);
+ // foreach (Model.ClsGy_Operator_Model oItem in lsmain)
+ // {
+ // if (oItem.HNumber.Trim() == "")
+ // {
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒";
+ // objJsonResult.data = 1;
+ // return objJsonResult;
+ // }
+ // if (oItem.HName.Trim() == "")
+ // {
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒";
+ // objJsonResult.data = 1;
+ // return objJsonResult;
+ // }
+
+ // //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
+ // ds = oCN.RunProcReturn("select * from Gy_Operator where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_Operator");
+ // if (oItem.HItemID == 0)
+ // {
+ // if (ds.Tables[0].Rows.Count > 0)
+ // {
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ // }
+ // }
+ // else
+ // {
+ // if (ds.Tables[0].Rows.Count > 0)
+ // {
+ // if (ds.Tables[0].Rows[0]["HItemID"].ToString() != oItem.HItemID.ToString())
+ // {
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ // }
+ // }
+ // }
+
+
+ // //鏂板鏃跺垽鏂�
+ // #region 鐖剁骇鏍¢獙鏂规硶锛坅pi璋冪敤鍏堟敞閲婃帀锛岋級
+ // /*
+ // if (oItem.HItemID == 0)
+ // {
+ // if (ds == null || ds.Tables[0].Rows.Count > 0)
+ // {
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+ // objJsonResult.data = 1;
+ // return objJsonResult;
+ // }
+ // //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
+ // string sParent;
+ // sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
+ // if (sParent.Trim() == "")
+ // {
+ // oBill.oModel.HParentID = 0;
+ // }
+ // else
+ // {
+ // if (oBill.HavParentCode(sParent.Trim(), HItemID))
+ // {
+ // oBill.oModel.HParentID = oBill.oModel.HItemID;
+ // }
+ // else
+ // {
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+ // objJsonResult.data = 1;
+ // return objJsonResult;
+ // }
+ // }
+ // }
+ // else//缂栬緫鏃跺垽鏂�
+ // {
+ // //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
+ // string sParent;
+ // sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
+ // if (sParent.Trim() == "")
+ // {
+ // oBill.oModel.HParentID = 0;
+ // }
+ // else
+ // {
+ // if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID))
+ // {
+ // oBill.oModel.HParentID = oBill.oModel.HItemID;
+ // }
+ // else
+ // {
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+ // objJsonResult.data = 1;
+ // return objJsonResult;
+ // }
+ // }
+ // }
+ // */
+ // #endregion
+ // //寰楀埌鐭唬鐮�
+ // string sShortNumber;
+ // sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
+ // if (sShortNumber.Trim() == "")
+ // {
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
+ // objJsonResult.data = 1;
+ // return objJsonResult;
+ // }
+ // //oItem.HUSEORGID = Convert.ToInt32(msg_HUSEORGID); //缁勭粐id
+ // oItem.HShortNumber = sShortNumber;//鐭唬鐮�
+ // oItem.HEndFlag = true;//鏈骇鏍囧織
+ // oItem.HLevel = 1; //绛夌骇 DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim())
+ // oBill.oModel = oItem;
+ // }
+ // //淇濆瓨
+ // //淇濆瓨瀹屾瘯鍚庡鐞�
+ // bool bResult;
+ // if (oBill.oModel.HItemID == 0)
+ // {
+ // bResult = oBill.AddNew();
+ // }
+ // else
+ // {
+ // bResult = oBill.ModifyByID(oBill.oModel.HItemID);
+ // }
+ // if (bResult)
+ // {
+ // objJsonResult.code = "1";
+ // 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
#region 涓氬姟鍛� 鍒犻櫎
[Route("Gy_Operator/Delete")]
@@ -343,6 +502,75 @@
}
#endregion
+ #region 涓氬姟鍛� 浼垹闄�
+ [Route("Gy_Operator/Delete2")]
+ [HttpGet]
+ public object Delete2(string HItemID, string user)
+ {
+ DataSet ds;
+ try
+ {
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ //鍒犻櫎鏉冮檺
+ //if (!DBUtility.ClsPub.Security_Log("Gy_TaxRate_Drop", 1, false, user))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鏃犲垹闄ゆ潈闄�";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+ if (string.IsNullOrWhiteSpace(HItemID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HItemID涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ oCN.BeginTran();//寮�濮嬩簨鍔�
+ ds = oCN.RunProcReturn("select * from Gy_Operator where HItemID=" + HItemID, "Gy_Operator");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+ }
+ var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]);
+ if (HStopflag)
+ {
+ oCN.RollBack();//鍥炴粴浜嬪姟
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏁版嵁宸茬鐢ㄦ棤娉曞垹闄わ紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍥犱负灏嗘暟鎹鐢ㄥ悗灏嗘棤娉曞垹闄わ紝鎵�浠ヨ繖閲屽皢浣跨敤鏍囪鏇存柊涓� 1 浠h〃涓轰吉鍒犻櫎鐘舵�侊紝
+ //鐢ㄦ埛鍦ㄨ繘琛屼繚瀛樻搷浣滄椂锛屽皢浣跨敤鏍囪涓� 1 鐨勬暟鎹湡鍒犻櫎锛�
+ //濡傝嫢鐢ㄦ埛鍦ㄧ紪杈�/鏂板椤甸潰杩樹负杩涜淇濆瓨鎿嶄綔灏卞埛鏂伴〉闈紝浣跨敤鏍囪灏嗚鎭㈠涓�0
+ oCN.RunProc("update Gy_Operator set HIsPseDel = 1 where HItemID = " + HItemID);
+ oCN.Commit();//鎻愪氦浜嬪姟
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "* 鏁版嵁鍒犻櫎鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
#region 涓氬姟鍛� 閲戣澏鍚屾
[Route("Gy_Operator/SaveGy_OperatorListApi")]
[HttpPost]
@@ -351,23 +579,41 @@
try
{
var _value = msg["model"].ToString();
+ var operatorInfoModel = msg["model"]["HOperatorInfoEntry"].ToString();
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
ListModels oListModels = new ListModels();
List<Model.ClsGy_Operator_Model> lsmain = new List<Model.ClsGy_Operator_Model>();
lsmain = oListModels.getObjectByJson_Gy_Operator(_value);
string sql = string.Empty;
+
+ List<Model.ClsGy_Operator_Model> operatorInfos = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_Operator_Model>>(operatorInfoModel);
//淇濆瓨
oCN.BeginTran();
- sql = $"delete Gy_Operator where HItemID = {lsmain[0].HItemID}";
- oCN.RunProc(sql);
+ //sql = $"delete Gy_Operator where HItemID = {lsmain[0].HItemID}";
+ //oCN.RunProc(sql);
+ //sql = "set identity_insert Gy_Operator on";
+ //oCN.RunProc(sql);
+ //oCN.RunProc($@"insert into Gy_Operator(HItemID,HNumber,HName,HHelpCode,HShortNumber,HParentID
+ // ,HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HUSEORGID,HOperatorId,HOperatorType,HSEQ,HStaffId,HIsUse)
+ // values({lsmain[0].HItemID},'{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HHelpCode}','{lsmain[0].HShortNumber}',
+ // {lsmain[0].HParentID},{lsmain[0].HLevel},{Convert.ToString(lsmain[0].HEndFlag ? 1 : 0)},{Convert.ToString(lsmain[0].HStopflag ? 1 : 0) },
+ // '{lsmain[0].HRemark}','{lsmain[0].HUseFlag}',{lsmain[0].HUSEORGID},{lsmain[0].HOperatorId},'{lsmain[0].HOperatorType}',
+ // {lsmain[0].HSEQ},{lsmain[0].HStaffId},{lsmain[0].HIsUse})", ref DBUtility.ClsPub.sExeReturnInfo);
sql = "set identity_insert Gy_Operator on";
oCN.RunProc(sql);
- oCN.RunProc($@"insert into Gy_Operator(HItemID,HNumber,HName,HHelpCode,HShortNumber,HParentID
- ,HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HUSEORGID,HOperatorId,HOperatorType,HSEQ,HStaffId,HIsUse)
- values({lsmain[0].HItemID},'{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HHelpCode}','{lsmain[0].HShortNumber}',
- {lsmain[0].HParentID},{lsmain[0].HLevel},{Convert.ToString(lsmain[0].HEndFlag ? 1 : 0)},{Convert.ToString(lsmain[0].HStopflag ? 1 : 0) },
- '{lsmain[0].HRemark}','{lsmain[0].HUseFlag}',{lsmain[0].HUSEORGID},{lsmain[0].HOperatorId},'{lsmain[0].HOperatorType}',
- {lsmain[0].HSEQ},{lsmain[0].HStaffId},{lsmain[0].HIsUse})", ref DBUtility.ClsPub.sExeReturnInfo);
+ foreach (var item in operatorInfos)
+ {
+ sql = $"delete Gy_Operator where HItemID = {item.HItemID}";
+ oCN.RunProc(sql);
+
+ sql = $@"insert into Gy_Operator(HItemID,HNumber,HName,HHelpCode,HShortNumber,HParentID
+ ,HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HUSEORGID,HOperatorId,HOperatorType,HSEQ,HStaffId,HIsUse)
+ values({item.HItemID},'{item.HNumber}','{item.HName}','{item.HHelpCode}','{item.HShortNumber}',
+ {item.HParentID},{item.HLevel},{Convert.ToString(item.HEndFlag ? 1 : 0)},{Convert.ToString(item.HStopflag ? 1 : 0) },
+ '{item.HRemark}','{item.HUseFlag}',{item.HUSEORGID},{item.HOperatorId},'{item.HOperatorType}',
+ {item.HSEQ},{item.HStaffId},{item.HIsUse})";
+ oCN.RunProc(sql);
+ }
//淇敼涓婄骇涓洪潪鏈骇浠g爜
sql = "set identity_insert Gy_Operator off";
oCN.RunProc(sql);
--
Gitblit v1.9.1