From 6ab91376db824bac727946324f184d6076fa5acd Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期五, 11 十一月 2022 11:13:11 +0800 Subject: [PATCH] 审批项目 组织架构 审核用户权限设置 审核流程单 --- WebAPI/Controllers/基础资料/基础资料/Xt_CheckFlowBillController.cs | 399 +++++++++++++++++++++ WebAPI/Models/Xt_CheckFlowSub.cs | 19 + WebAPI/Controllers/基础资料/基础资料/Gy_DutyBillController.cs | 375 +++++++++++++++++++ WebAPI/ListModels.cs | 12 WebAPI/Models/Xt_CheckFlowMain.cs | 17 WebAPI/Controllers/基础资料/基础资料/Xt_CheckItemBillController.cs | 262 +++++++++++++ WebAPI/Models/Xt_CheckItem.cs | 16 WebAPI/Models/基础资料/Gy_Duty.cs | 22 + WebAPI/WebAPI.csproj | 10 9 files changed, 1,132 insertions(+), 0 deletions(-) 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_DutyBillController.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_DutyBillController.cs" new file mode 100644 index 0000000..1fe868f --- /dev/null +++ "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_DutyBillController.cs" @@ -0,0 +1,375 @@ +锘縰sing Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using WebAPI.Models.鍩虹璧勬枡; +using WebAPI.Models; + +namespace WebAPI.Controllers.鍩虹璧勬枡.鍩虹璧勬枡 +{ + public class Gy_DutyBillController : ApiController + { + private json objJsonResult = new json(); + public DataSet ds = new DataSet(); + public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + #region 缁勭粐鏋舵瀯璁剧疆 鏍戝舰鍥� + public class TreeModel + { + public string id { get; set; } + public string title { get; set; } + public List<TreeModel> children = new List<TreeModel>(); + } + [Route("Gy_DutyBill/Gy_DutyBillTreeList")] + [HttpGet] + public object Gy_DutyBillTreeList() + { + try + { + string sql1 = string.Format("select hitemid,hnumber,hname from Gy_Duty order by hnumber"); + + ds = oCN.RunProcReturn(sql1, "Gy_Duty"); + + 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["hnumber"].ToString().Split('.'); + if (strLen.Length == 1) + { + TreeModel tree = new TreeModel(); + tree.id = row["hnumber"].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]["hnumber"].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 + + #region 缁勭粐鏋舵瀯璁剧疆 鍒楄〃 + [Route("Gy_DutyBill/Gy_DutyBillList")] + [HttpGet] + public object Gy_DutyBillList(string sWhere) + { + try + { + string sql1 = string.Format(@"select * from h_v_Gy_DutyList where 1=1 "); + + ds = oCN.RunProcReturn(sql1+ sWhere+ " order by 缁勭粐鏋舵瀯浠g爜", "h_v_Gy_DutyList"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 缁勭粐鏋舵瀯璁剧疆 淇濆瓨 + [Route("Gy_DutyBill/Gy_DutyBillEdit")] + [HttpPost] + public object Xt_CheckFlowBillEdit([FromBody] JObject msg) + { + 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 msg4 = sArray[2].ToString(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + try + { + Gy_Duty Duty = JsonConvert.DeserializeObject<Gy_Duty>(msg1); + + + //鑾峰彇涓婄骇鐨勪唬鐮� + var topHNum = DBUtility.ClsPub.GetParentCode(Duty.HNumber); + + if (topHNum == "") + { + Duty.HParentID = 0; + } + else + { + ds = oCN.RunProcReturn("select * from Gy_Duty where HStopflag=0 and HNumber='" + topHNum + "' or HNumber='" + Duty.HNumber + "' ", "Gy_Duty"); + if (ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "涓婄骇浠g爜涓嶅瓨鍦ㄦ垨琚鐢紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (msg4 == "1") { + if (ds.Tables[0].Rows.Count == 2) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜閲嶅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + + Duty.HParentID = int.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString()); + } + + if (Duty.HItemID != 0) + { + ds = oCN.RunProcReturn("select * from Gy_Duty where HItemID='" + Duty.HItemID + "' ", "Gy_Duty"); + var newHNum = Duty.HNumber.Split('.'); + var oldHNum = ds.Tables[0].Rows[0]["HNumber"].ToString().Split('.'); + + if (newHNum.Length > oldHNum.Length && Duty.HItemID == Duty.HParentID) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏂颁唬鐮佷笉鑳芥槸鑷繁鐨勪笅绾х殑瀛愰」鐩紒"; + objJsonResult.data = null; + return objJsonResult; + } + + ds = oCN.RunProcReturn("select * from Gy_Duty where HParentID='" + Duty.HItemID + "' ", "Gy_Duty"); + + if (ds.Tables[0].Rows.Count>0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇ラ」鐩笅闈㈡湁瀛愰」鐩�,涓嶈兘淇敼锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + + Duty.HEndFlag = 1; + Duty.HShortNumber = DBUtility.ClsPub.GetShortNumber(Duty.HNumber); + Duty.HLevel = DBUtility.ClsPub.GetLevel(Duty.HNumber); + + if (Duty.HShortNumber == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鐭唬鐮佷负绌猴紒"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.BeginTran(); + + if (msg4 == "1") + { + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + oCN.RunProc("Insert into Gy_Duty " + + " (HNumber,HName,HHelpCode,HShortNumber,HParentID,HUserGroupID" + + ",HLevel,HEndFlag,HStopflag,HRemark) " + + " Values('" + Duty.HNumber + "','" + Duty.HName + "','" + Duty.HHelpCode + "','" + Duty.HShortNumber + "'," + Duty.HParentID.ToString() + "," + Duty.HUserGroupID.ToString() + + "," + Duty.HLevel.ToString() + "," + Duty.HEndFlag + "," + Convert.ToString(Duty.HStopflag ? 1 : 0) + ",'" + Duty.HRemark + "')", ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + oCN.RunProc("Update Gy_Duty set " + + " HNumber='" + Duty.HNumber + "'" + + ",HName='" + Duty.HName + "'" + + ",HShortNumber='" + Duty.HShortNumber + "'" + + ",HHelpCode='" + Duty.HHelpCode + "'" + + ",HLevel=" + Duty.HLevel.ToString() + + ",HParentID=" + Duty.HParentID.ToString() + + ",HUserGroupID=" + Duty.HUserGroupID.ToString() + + ",HEndflag=" + Duty.HEndFlag + + ",HStopflag=" + Convert.ToString(Duty.HStopflag ? 1 : 0) + + ",HRemark= '" + Duty.HRemark + "' Where HItemID=" + Duty.HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + } + + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + oCN.RunProc("Update Gy_Duty set HEndflag=0 where HItemID=" + Duty.HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + oCN.Commit(); + + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + + #endregion + + #region 缁勭粐鏋舵瀯璁剧疆 鍒犻櫎 + [Route("Gy_DutyBill/Gy_DutyBillDel")] + [HttpGet] + public object Gy_DutyBillDel(string HItemID, string user) + { + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (string.IsNullOrWhiteSpace(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HItemID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ds = oCN.RunProcReturn("select * from Gy_Duty where HParentID='" + HItemID + "' ", "Gy_Duty"); + + if (ds.Tables[0].Rows.Count > 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇ラ」鐩笅闈㈡湁瀛愰」鐩�,涓嶈兘鍒犻櫎锛�,璇峰厛鍒犻櫎瀛愰」鐩�!"; + objJsonResult.data = null; + return objJsonResult; + } + + ds = oCN.RunProcReturn("select * from Gy_Duty where HItemID='" + HItemID + "' ", "Gy_Duty"); + + oCN.BeginTran();//寮�濮嬩簨鍔� + + //鍒犻櫎鏁版嵁 + oCN.RunProc("Delete from Gy_Duty where HItemID='" + HItemID + "'"); + //淇敼涓婄骇涓烘湯绾� + oCN.RunProc("Update Gy_Duty set HEndflag=1 where HItemID=" + ds.Tables[0].Rows[0]["HParentID"].ToString()); + + 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 = "鍒犻櫎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 缁勭粐鏋舵瀯璁剧疆 妫�娴� + [Route("Gy_DutyBill/Gy_DutyBillTest")] + [HttpGet] + public object Gy_DutyBillTest(string HItemID, string user) + { + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (string.IsNullOrWhiteSpace(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HItemID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.BeginTran();//寮�濮嬩簨鍔� + + //妫�娴嬫暟鎹� + oCN.RunProc("exec h_p_Gy_Duty " + HItemID ); + + 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 = "澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + } +} \ No newline at end of file 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/Xt_CheckFlowBillController.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/Xt_CheckFlowBillController.cs" new file mode 100644 index 0000000..b22ae29 --- /dev/null +++ "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/Xt_CheckFlowBillController.cs" @@ -0,0 +1,399 @@ +锘縰sing Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using WebAPI.Models; + +namespace WebAPI.Controllers.鍩虹璧勬枡.鍩虹璧勬枡 +{ + public class Xt_CheckFlowBillController : ApiController + { + private json objJsonResult = new json(); + public DataSet ds = new DataSet(); + public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + #region 瀹℃牳娴佺▼鍗曞垪琛� + [Route("Xt_CheckFlowBill/Xt_CheckFlowBillList")] + [HttpGet] + public object Xt_CheckFlowBillList(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + //鏌ヨ鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Xt_CheckFlow_Query", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + string sql1 = string.Format(@"select * from h_v_Xt_CheckFlowList where 1=1 "); + + ds = oCN.RunProcReturn(sql1 + sWhere+ " order by 娴佺▼鍚嶇О", "h_v_Xt_CheckFlowList"); + + //娣诲姞鍒楀悕 + 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 = 1; + 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 瀹℃牳娴佺▼鍗� 淇濆瓨 + [Route("Xt_CheckFlowBill/Xt_CheckFlowBillEdit")] + [HttpPost] + public object Xt_CheckFlowBillEdit([FromBody] JObject msg) + { + 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(); + msg3 = sArray[2].ToString(); + string msg4 = sArray[3].ToString(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Xt_CheckFlow_Edit", 1, false, msg4)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + try + { + Models.Xt_CheckFlowMain main = JsonConvert.DeserializeObject<Xt_CheckFlowMain>(msg1); + List<Models.Xt_CheckFlowSub> lsmain = new List<Models.Xt_CheckFlowSub>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain =JsonConvert.DeserializeObject<List<Xt_CheckFlowSub>>(msg2); + foreach (Xt_CheckFlowSub oItem in lsmain) + { + if (oItem.HCheckItemID == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佸鎵归」鐩唬鐮佷笉鑳戒负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (oItem.HFlowNo == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹祦绋嬪彿涓嶈兘涓虹┖锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + ds = oCN.RunProcReturn("select * from h_v_Xt_CheckFlowList where Hmainid= " + main.HInterID, "h_v_Xt_CheckFlowList"); + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + oCN.BeginTran(); + if (msg3 == "1" && ds.Tables[0].Rows.Count == 0) + { + oCN.RunProc("Insert Into Xt_CheckFlowMain " + + "(HBillTypeID,HInterID,HDeptID" + + ",HRemark,HStandard,HName" + ") " + + " values('" + main.HBillTypeID.ToString() + "'," + main.HInterID.ToString() + "," + main.HDeptID.ToString() + + ",'" + main.HRemark + "'," + Convert.ToString(main.HStandard ? 1 : 0) + ",'" + main.HName.ToString() + "') "); + + int i = 0; + foreach (Xt_CheckFlowSub oSub in lsmain) + { + i++; + bool bResult = false; + + oCN.RunProc("Insert into Xt_CheckFlowSub " + + " (HInterID,HEntryID,HCheckMan" + + ",HFlowNo,HJumpFlag,HMakerSelf,HCheckItemID" + + " )values(" + + main.HInterID.ToString() + "," + i + ",'" + oSub.HCheckMan + "'" + + "," + oSub.HFlowNo + "," + Convert.ToString(oSub.HJumpFlag ? 1 : 0) + "," + Convert.ToString(oSub.HMakerSelf ? 1 : 0) + "," + oSub.HCheckItemID + ") "); + + bResult = true; + + + if (!bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = 1; + return objJsonResult; + } + + } + } + + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + + #endregion + + #region 瀹℃牳娴佺▼鍗� 鍒犻櫎 + [Route("Xt_CheckFlowBill/Xt_CheckFlowBillDelete")] + [HttpGet] + public object Xt_CheckFlowBillDelete(string HItemID, string user) + { + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Xt_CheckFlow_Drop", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犲垹闄ゆ潈闄�"; + objJsonResult.data = null; + return objJsonResult; + } + + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (string.IsNullOrWhiteSpace(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HItemID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran();//寮�濮嬩簨鍔� + + //鍒犻櫎瀛愯〃 + oCN.RunProc("Delete From Xt_CheckFlowSub where HInterID=" + HItemID); + + //鍒犻櫎涓昏〃 + oCN.RunProc("Delete From Xt_CheckFlowMain where HInterID=" + HItemID); + + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 1; + 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 瀹℃壒鐢ㄦ埛鏉冮檺璁剧疆 + [Route("Xt_CheckFlowBill/Xt_CheckUserRight")] + [HttpGet] + public object Xt_CheckUserRight() + { + try + { + string sql1 = string.Format(@"select * from Gy_Czygl "); + + ds = oCN.RunProcReturn(sql1, "Gy_Czygl"); + + string TreeStr = "[{\"title\": \"瀹℃壒鐢ㄦ埛鏉冮檺璁剧疆\", \"id\": \"1\" ,\"spread\": \"true\",\"children\":["; + + foreach (DataRow item in ds.Tables[0].Rows) + { + TreeStr+= "{ \"title\": \"" + item["Czymc"].ToString() + "\",\"id\": \"" + item["Czybm"].ToString() + "\"},"; + } + TreeStr = TreeStr.Substring(0, TreeStr.Length - 1); + TreeStr += "]}]"; + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = JsonConvert.DeserializeObject(TreeStr); + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 瀹℃壒鐢ㄦ埛鏉冮檺璁剧疆 鍙� + [Route("Xt_CheckFlowBill/Xt_CheckUserRightListMain")] + [HttpGet] + public object Xt_CheckUserRightListMain(string sWhere) + { + try + { + string sql1 = string.Format(@"select *,row_number()over(ORDER BY HInterID ) num from h_v_Xt_CheckUserRightMain where 1=1 "); + + ds = oCN.RunProcReturn(sql1+sWhere, "h_v_Xt_CheckUserRightMain"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 瀹℃壒鐢ㄦ埛鏉冮檺璁剧疆 宸� + [Route("Xt_CheckFlowBill/Xt_CheckUserRightListMainSource")] + [HttpGet] + public object Xt_CheckUserRightListMainSource(string sWhere) + { + try + { + string sql1 = string.Format(@"select *,row_number()over(ORDER BY HInterID ) num from h_v_Xt_CheckUserRightSource where 1=1 "); + + ds = oCN.RunProcReturn(sql1 + sWhere, "h_v_Xt_CheckUserRightSource"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + 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 Xt_CheckUserRightsub + { + public int hcheckitemid; + } + [Route("Xt_CheckFlowBill/Xt_CheckUserRightEdit")] + [HttpPost] + public object Xt_CheckUserRightEdit([FromBody] JObject msg) + { + 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(); + msg3 = sArray[2].ToString(); + string msg4 = sArray[3].ToString(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Xt_CheckFlow_Edit", 1, false, msg4)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + try + { + List<Xt_CheckUserRightsub> lsmain = new List<Xt_CheckUserRightsub>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = JsonConvert.DeserializeObject<List<Xt_CheckUserRightsub>>(msg1); + + oCN.BeginTran(); + //鍒犻櫎鍘熻褰� + oCN.RunProc("Delete From Xt_CheckUserRight where HUserID='" + msg2 + "'and HCheckFlowInterID=" + msg3 + ""); + var HCheckItemID=0; + //鏂板璁板綍 + for (int i = 0; i <= lsmain.Count - 1; i++) + { + if (HCheckItemID != lsmain[i].hcheckitemid) + { + oCN.RunProc("insert into Xt_CheckUserRight(HUserID,HCheckFlowInterID,HCheckItemID) values('" + msg2 + "'," + msg3 + "," + lsmain[i].hcheckitemid + ") "); + HCheckItemID = lsmain[i].hcheckitemid; + } + + } + + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + + #endregion + + } +} \ No newline at end of file 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/Xt_CheckItemBillController.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/Xt_CheckItemBillController.cs" new file mode 100644 index 0000000..8588b9d --- /dev/null +++ "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/Xt_CheckItemBillController.cs" @@ -0,0 +1,262 @@ +锘縰sing Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using WebAPI.Models; + +namespace WebAPI.Controllers.鍩虹璧勬枡.鍩虹璧勬枡 +{ + public class Xt_CheckItemBillController : ApiController + { + private json objJsonResult = new json(); + public DataSet ds = new DataSet(); + public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + #region 瀹℃牳椤圭洰鍒楄〃 + [Route("Xt_CheckItemBill/Xt_CheckItemList")] + [HttpGet] + public object Xt_CheckItemList(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + //鏌ヨ鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Xt_CheckItem_Query", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + string sql1 = string.Format(@"select * from h_v_Xt_CheckItemList where 1=1 "); + + ds = oCN.RunProcReturn(sql1 + sWhere + " order by 瀹℃壒椤圭洰浠g爜 ", "h_v_Xt_CheckItemList"); + + //娣诲姞鍒楀悕 + 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 = 1; + 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 瀹℃牳椤圭洰淇濆瓨 + [Route("Xt_CheckItemBill/Xt_CheckItemEdit")] + [HttpPost] + public object Xt_CheckItemEdit([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(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Xt_CheckItem_Edit", 1, false, msg2)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + ListModels oListModels = new ListModels(); + try + { + List<Models.Xt_CheckItem> lsmain = new List<Models.Xt_CheckItem>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Xt_CheckItem(msg1); + foreach (Xt_CheckItem 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 Xt_CheckItem where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Xt_CheckItem"); + //鏂板鏃跺垽鏂� + if (oItem.HItemID == 0) + { + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + oCN.BeginTran(); + foreach (Xt_CheckItem oItem in lsmain) + { + bool bResult = false; + if (oItem.HItemID == 0) + { + + oCN.RunProc("Insert into Xt_CheckItem " + + " (HNumber,HName" + + ",HStopflag,HRemark) " + + " Values('" + oItem.HNumber + "','" + oItem.HName + + "'," + Convert.ToString(oItem.HStopFlag ? 1 : 0) + ",'" + oItem.HRemark + "')"); + + bResult = true; + } + else + { + oCN.RunProc("Update Xt_CheckItem set " + + " HNumber='" + oItem.HNumber + "'" + + ",HName='" + oItem.HName + "'" + + ",HStopflag=" + Convert.ToString(oItem.HStopFlag ? 1 : 0) + + ",HRemark= '" + oItem.HRemark + "' Where HItemID=" + oItem.HItemID); + bResult = true; + } + + if (!bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = 1; + return objJsonResult; + } + + } + + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + + #endregion + + #region 瀹℃牳椤圭洰鍒犻櫎 + [Route("Xt_CheckItemBill/Xt_CheckItemBillDelete")] + [HttpGet] + public object Xt_CheckItemBillDelete(string HItemID, string user) + { + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Xt_CheckItem_Drop", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犲垹闄ゆ潈闄�"; + objJsonResult.data = null; + return objJsonResult; + } + + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + 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 Xt_CheckItem where HItemID=" + HItemID, "Xt_CheckItem"); + 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; + } + + oCN.RunProc("update Xt_CheckItem set HStopflag=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 + } +} diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs index 2733854..983a9c2 100644 --- a/WebAPI/ListModels.cs +++ b/WebAPI/ListModels.cs @@ -838,6 +838,18 @@ } /// <summary> + /// 澶勭悊鏂板瀹℃牳椤圭洰鐨刯son + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Models.Xt_CheckItem> getObjectByJson_Xt_CheckItem(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.Xt_CheckItem> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.Xt_CheckItem>>(jsonString); + return list; + } + + /// <summary> /// 澶勭悊鏂板璁惧缁翠慨涓昏〃鐨刯son /// </summary> /// <param name="jsonString"></param> diff --git a/WebAPI/Models/Xt_CheckFlowMain.cs b/WebAPI/Models/Xt_CheckFlowMain.cs new file mode 100644 index 0000000..63c076f --- /dev/null +++ b/WebAPI/Models/Xt_CheckFlowMain.cs @@ -0,0 +1,17 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebAPI.Models +{ + public class Xt_CheckFlowMain + { + public Int64 HInterID; + public string HName; + public string HBillTypeID; + public Int64 HDeptID; + public bool HStandard; + public string HRemark; + } +} \ No newline at end of file diff --git a/WebAPI/Models/Xt_CheckFlowSub.cs b/WebAPI/Models/Xt_CheckFlowSub.cs new file mode 100644 index 0000000..7bfcf0c --- /dev/null +++ b/WebAPI/Models/Xt_CheckFlowSub.cs @@ -0,0 +1,19 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebAPI.Models +{ + public class Xt_CheckFlowSub + { + public Int64 HInterID; + public Int64 HEntryID; + public int HSno; + public string HFlowNo; + public long HCheckItemID; + public bool HJumpFlag; + public bool HMakerSelf; + public string HCheckMan; + } +} \ No newline at end of file diff --git a/WebAPI/Models/Xt_CheckItem.cs b/WebAPI/Models/Xt_CheckItem.cs new file mode 100644 index 0000000..33155d0 --- /dev/null +++ b/WebAPI/Models/Xt_CheckItem.cs @@ -0,0 +1,16 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebAPI.Models +{ + public class Xt_CheckItem + { + public int HItemID; + public string HNumber; + public string HName; + public string HRemark; + public bool HStopFlag; + } +} \ No newline at end of file diff --git "a/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Duty.cs" "b/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Duty.cs" new file mode 100644 index 0000000..9988568 --- /dev/null +++ "b/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Duty.cs" @@ -0,0 +1,22 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebAPI.Models.鍩虹璧勬枡 +{ + public class Gy_Duty + { + public int HItemID; + public int HParentID; + public int HLevel; + public string HNumber { get; set; } + public string HName { get; set; } + public string HUserGroupID { get; set; } + public string HRemark { get; set; } + public string HShortNumber { get; set; } + public string HHelpCode { get; set; } + public bool HStopflag; + public int HEndFlag; + } +} \ No newline at end of file diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj index 0b7af7f..3d12a98 100644 --- a/WebAPI/WebAPI.csproj +++ b/WebAPI/WebAPI.csproj @@ -439,10 +439,13 @@ <Compile Include="Controllers\浠撳瓨绠$悊\棰嗘枡鍙戣揣\Kf_StepFoldOutBillController.cs" /> <Compile Include="Controllers\浠撳瓨绠$悊\楠屾敹鍏ュ簱\Kf_StepFoldinBillController.cs" /> <Compile Include="Controllers\鍗氭棩鑷姩鎵爜绾縗ScanlineAPIController.cs" /> + <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_DutyBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_SOPBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_SOPBillListController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_StockCheckItemBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_WorkStationBillController.cs" /> + <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Xt_CheckFlowBillController.cs" /> + <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Xt_CheckItemBillController.cs" /> <Compile Include="Controllers\宸ヨ祫绠$悊\Pay_MonthlySalaryReportController.cs" /> <Compile Include="Controllers\宸ヨ祫绠$悊\Pay_PieceRateWageReportController.cs" /> <Compile Include="Controllers\宸ヨ祫绠$悊\Gy_ClassTimePrjBillController.cs" /> @@ -602,10 +605,14 @@ <Compile Include="Models\TechnologyParameter.cs" /> <Compile Include="Models\TechnologyParameterUnit.cs" /> <Compile Include="Models\TechParamByProc.cs" /> + <Compile Include="Models\Xt_CheckFlowMain.cs" /> + <Compile Include="Models\Xt_CheckFlowSub.cs" /> + <Compile Include="Models\Xt_CheckItem.cs" /> <Compile Include="Models\鍏跺畠\ReciveBill_FastModel.cs" /> <Compile Include="Models\鍔ㄦ�佸垪\OptionListModel.cs" /> <Compile Include="Models\鍩虹璧勬枡\ConkType.cs" /> <Compile Include="Models\鍩虹璧勬枡\Gy_ClassTimePrj.cs" /> + <Compile Include="Models\鍩虹璧勬枡\Gy_Duty.cs" /> <Compile Include="Models\鍩虹璧勬枡\PackType.cs" /> <Compile Include="Models\鍩虹璧勬枡\WorkStation.cs" /> <Compile Include="Models\宸ヨ祫绠$悊\ClsGy_ClassTimePrj_Model.cs" /> @@ -862,6 +869,7 @@ <Folder Include="Views\Cj_ComplementGoodsBill\" /> <Folder Include="Views\Cj_SendGoodsBill\" /> <Folder Include="Views\Gy_ConkType\" /> + <Folder Include="Views\Gy_DutyBill\" /> <Folder Include="Views\Gy_EquipType\" /> <Folder Include="Views\Gy_ICBomBill\" /> <Folder Include="Views\Gy_MateMould\" /> @@ -896,6 +904,8 @@ <Folder Include="Views\Sc_WorkBillAutoSortBillMain\" /> <Folder Include="Views\Sc_WorkBillSortBill\" /> <Folder Include="Views\Sc_WorkDemandPlanBill\" /> + <Folder Include="Views\Xt_CheckFlowBill\" /> + <Folder Include="Views\Xt_CheckItem\" /> <Folder Include="Views\Xt_grdAlignment_WMES\" /> </ItemGroup> <ItemGroup> -- Gitblit v1.9.1