From e5fc3795c5ece0b59881cecf680a9dff1f368a9d Mon Sep 17 00:00:00 2001 From: jingh <jingh@LAPTOP-I53VDLOO> Date: 星期二, 09 十一月 2021 22:09:01 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/PublicPageMethodController.cs | 483 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 463 insertions(+), 20 deletions(-) diff --git a/WebAPI/Controllers/PublicPageMethodController.cs b/WebAPI/Controllers/PublicPageMethodController.cs index 410fe8d..26339ef 100644 --- a/WebAPI/Controllers/PublicPageMethodController.cs +++ b/WebAPI/Controllers/PublicPageMethodController.cs @@ -1,10 +1,12 @@ -锘縰sing System; +锘縰sing DBUtility; +using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; +using System.Web.UI.WebControls; using WebAPI.Models; namespace WebAPI.Controllers @@ -122,9 +124,9 @@ #endregion - #region 閫夋嫨鐢ㄦ埛鍩虹璧勬枡 + #region 閫夋嫨鑱屽憳鍩虹璧勬枡 - #region 鏉′欢鏌ヨ鐢ㄦ埛鍒楄〃 + #region 鏉′欢鏌ヨ鑱屽憳鍒楄〃 [Route("PublicPageMethod/UserList")] [HttpGet] public object UserList(string sWhere) @@ -161,7 +163,7 @@ } #endregion - #region 鏍规嵁鏍戝瀷id鏌ユ壘鐢ㄦ埛鍒楄〃 + #region 鏍规嵁鏍戝瀷id鏌ユ壘鑱屽憳鍒楄〃 [Route("Gy_MaintenanceMode/UserCX")] [HttpGet] public object UserCX(long HInterID) @@ -198,7 +200,7 @@ } #endregion - #region 鏍戝瀷鍒楄〃鐢ㄦ埛鍒楄〃鏁版嵁 + #region 鏍戝瀷鍒楄〃鑱屽憳鍒楄〃鏁版嵁 [Route("Gy_MaintenanceMode/UserLoadTree")] [HttpGet] public object UserLoadTree(string sWhere) @@ -542,6 +544,219 @@ #endregion #endregion + + + #region 閫夋嫨璁㈠崟绛夌骇鍩虹璧勬枡 + + #region 鏉′欢鏌ヨ璁㈠崟绛夌骇 + [Route("PublicPageMethod/OrderLevList")] + [HttpGet] + public object OrderLevList(string sWhere) + { + try + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Gy_OrderLev " + sWhere + " Order by HItemID ", "Gy_OrderLev"); + 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 = "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 鏍规嵁鏍戝瀷id鏌ユ壘璁㈠崟绛夌骇 + [Route("Gy_MaintenanceMode/OrderLevCX")] + [HttpGet] + public object OrderLevCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.Gy_OrderLev WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.Gy_OrderLev AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "Gy_OrderLev"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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_MaintenanceMode/OrderLevLoadTree")] + [HttpGet] + public object OrderLevLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from Gy_OrderLev " + sWhere + "", "Gy_OrderLev"); + 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 = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + + #region 閫夋嫨璁㈠崟鍙嶉鐘舵�佸熀纭�璧勬枡 + + #region 鏉′欢鏌ヨ璁㈠崟鍙嶉鐘舵�� + [Route("PublicPageMethod/OrderBackInfoList")] + [HttpGet] + public object OrderBackInfoList(string sWhere) + { + try + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Gy_OrderBackInfo " + sWhere + " Order by HItemID ", "Gy_OrderBackInfo"); + 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 = "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 鏍规嵁鏍戝瀷id鏌ユ壘璁㈠崟鍙嶉鐘舵�� + [Route("Gy_MaintenanceMode/OrderBackInfoCX")] + [HttpGet] + public object OrderBackInfoCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.Gy_OrderBackInfo WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.Gy_OrderBackInfo AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "Gy_OrderBackInfo"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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_MaintenanceMode/OrderBackInfoLoadTree")] + [HttpGet] + public object OrderBackInfoLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from Gy_OrderBackInfo " + sWhere + "", "Gy_OrderBackInfo"); + 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 = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + #region 閫夋嫨鎴愬搧妯″叿鍩虹璧勬枡 @@ -895,22 +1110,22 @@ try { ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Gy_Supplier "+sWhere+" Order by HItemID", "Gy_Supplier"); - if (ds == null || ds.Tables[0].Rows.Count == 0) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "false锛�"; - objJsonResult.data = null; - return objJsonResult; - } - else - { + //if (ds == null || ds.Tables[0].Rows.Count == 0) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "false锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + //else + //{ objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess锛�"; objJsonResult.data = ds.Tables[0]; return objJsonResult; - } + //} } catch (Exception e) { @@ -1229,13 +1444,13 @@ { if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Gy_EquipMent where HStopflag=0 Order by HItemID", "Gy_EquipMent"); + ds = oCN.RunProcReturn("Select HInterID,HEquipFileNumber,HName from Gy_EquipFileBillMain Order by HInterID", "Gy_EquipFileBillMain"); } else { - string sql1 = "Select HItemID,HParentID,HNumber,HName from Gy_EquipMent where 1 = 1 "; + string sql1 = "Select HInterID,HEquipFileNumber,HName from Gy_EquipFileBillMain where 1 = 1 "; string sql = sql1 + sWhere; - ds = oCN.RunProcReturn(sql, "Gy_EquipMent"); + ds = oCN.RunProcReturn(sql, "HEquipFileNumber"); } if (ds == null || ds.Tables[0].Rows.Count == 0) { @@ -2992,6 +3207,234 @@ #endregion + #region 閫夋嫨鐧诲綍缁勭粐鍩虹璧勬枡 - } + #region 鏉′欢鏌ヨ缁勭粐鍒楄〃 + [Route("PublicPageMethod/OrganizationsList")] + [HttpGet] + public object OrganizationsList(string sWhere) + { + try + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Xt_ORGANIZATIONS " + sWhere + " Order by HItemID ", "Xt_ORGANIZATIONS"); + 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 = "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 鏍规嵁鏍戝瀷id鏌ユ壘缁勭粐鍒楄〃 + [Route("Gy_MaintenanceMode/OrganizationsCX")] + [HttpGet] + public object OrganizationsCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (select * from Gy_CusType Xt_ORGANIZATIONS HitemID=" + HInterID + " UNION ALL select s.* from Xt_ORGANIZATIONS AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "Xt_ORGANIZATIONS"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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_MaintenanceMode/OrganizationsLoadTree")] + [HttpGet] + public object OrganizationsLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from Xt_ORGANIZATIONS " + sWhere + "", "Xt_ORGANIZATIONS"); + 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 = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨鐢ㄦ埛鍩虹璧勬枡 + + #region 鏉′欢鏌ヨ鐢ㄦ埛鍒楄〃 + [Route("PublicPageMethod/PeopleList")] + [HttpGet] + public object PeopleList(string sWhere) + { + try + { + + ds = oCN.RunProcReturn("Select czybm HNumber,czymc HName from h_v_Gy_UserList " + sWhere + " Order by czybm ", "h_v_Gy_UserList"); + 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 = "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 + + #endregion + + #region 鐢ㄦ埛鍏宠仈鏉冮檺 + + #region 鏉′欢鏌ヨ鏉冮檺鍒楄〃 + [Route("PublicPageMethod/PowerList")] + [HttpGet] + public object PowerList(string czybm,string sGnbm) + { + try + { + string sName = ""; + if (sGnbm != "" && sGnbm != null) + { + sName = sGnbm.Substring(1, sGnbm.Length - 1); + if (sName == "鏉冮檺绠$悊-鐢ㄦ埛") + { + sName = ""; + } + } + + ds = oCN.RunProcReturn("select * from Gy_Czygl where czybm='" + czybm + "'", "Gy_Czygl"); + string AuthorityID = ClsPub.isStrNull(ds.Tables[0].Rows[0]["AuthorityID"]); + ds = oCN.RunProcReturn("SELECT id hid,case when id<=" + AuthorityID.Length + " then case when SUBSTRING('" + AuthorityID + "',id,1)=1 then 1 else 0 end else 0 end 鏄惁鏉冮檺,gnms 鍔熻兘璇存槑,gnbm hgnbm FROM xt_xtgnb where useflag=1 and sjgnbm='" + sName + "' and rightflag=1 order by gnbm", "xt_xtgnb"); + 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 = "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_MaintenanceMode/PowerLoadTree")] + [HttpGet] + public object PowerLoadTree() + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + string sql = string.Format(@"select 'T鏉冮檺绠$悊-鐢ㄦ埛' id,'' HNumber,'鏉冮檺绠$悊--鐢ㄦ埛' title,'' ParentID, 'true' spread + union all + Select 'T'+gnbm id,gnsy HNumber,gnmc as title,case when sjgnbm<>null then sjgnbm else 'T鏉冮檺绠$悊-鐢ㄦ埛' end ParentID, 'true' spread + from Xt_Xtgnb where useflag=1 and rightflag=1 and (gnbm NOT LIKE '99%') and sjgnbm='' and mjbz=0 "); + ds = oCN.RunProcReturn(sql, "Xt_Xtgnb"); + 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 = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + } } -- Gitblit v1.9.1