DAL/基础资料/公用基础资料/ClsGy_DisposeWay_Ctl.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
DAL/基础资料/公用基础资料/ClsGy_ScrapReason_Ctl.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Model/基础资料/基础资料/ClsGy_DisposeWay_Model.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Model/基础资料/基础资料/ClsGy_ScrapReason_Model.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Controllers/BLL/Xt_UserController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Controllers/基础资料/基础资料/Gy_DisposeWayController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Controllers/基础资料/基础资料/Gy_ScrapReasonController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/WebAPI.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
DAL/»ù´¡×ÊÁÏ/¹«Óûù´¡×ÊÁÏ/ClsGy_DisposeWay_Ctl.cs
@@ -12,7 +12,7 @@ public string HOldNumber; public Model.ClsGy_DisposeWay_Model oModel = new Model.ClsGy_DisposeWay_Model(); //æ°å¢ public override bool AddNew() public bool AddNew(ref string sReturn) { try @@ -20,9 +20,9 @@ oCn.BeginTran(); oCn.RunProc("Insert into " + MvarItemKey + " " + " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + ",HLevel,HEndFlag,HStopflag,HRemark) " + ",HLevel,HEndFlag,HStopflag,HRemark,HUSEORGID,HCREATEORGID,HMakeEmp,HMakeTime) " + " Values('" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() + "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "')", ref DBUtility.ClsPub.sExeReturnInfo); "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "'," + oModel.HUSEORGID + "," + oModel.HUSEORGID + ",'" + oModel.HMakeEmp + "',GETDATE()" + ")", ref DBUtility.ClsPub.sExeReturnInfo); //ä¿®æ¹ä¸çº§ä¸ºéæ«çº§ä»£ç oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo); oCn.Commit(); @@ -36,7 +36,7 @@ } //ä¿®æ¹ public override bool ModifyByID(Int64 sItemID) public bool ModifyByID(Int64 sItemID, ref string sReturn) { try { @@ -50,6 +50,8 @@ ",HParentID=" + oModel.HParentID.ToString() + ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) + ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",HModifyEmp='" + oModel.HModifyEmp + "'" + ",HModifyTime=GETDATE()" + ",HRemark= '" + oModel.HRemark + "' Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo); //ä¿®æ¹å项ç®ä»£ç oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); DAL/»ù´¡×ÊÁÏ/¹«Óûù´¡×ÊÁÏ/ClsGy_ScrapReason_Ctl.cs
@@ -12,19 +12,18 @@ public string HOldNumber; public Model.ClsGy_ScrapReason_Model oModel = new Model.ClsGy_ScrapReason_Model(); //æ°å¢ public override bool AddNew() public bool AddNew(ref string sReturn) { try { oCn.BeginTran(); oCn.RunProc("Insert into " + MvarItemKey + " " + " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + ",HDeptID,HDeptNumber,HProcID,HBarCode" + ",HLevel,HEndFlag,HStopflag,HRemark) " + ",HLevel,HEndFlag,HStopflag,HRemark,HUSEORGID,HCREATEORGID,HMakeEmp,HMakeTime) " + " Values('" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() + "," + oModel.HDeptID.ToString() + ",'" + oModel.HDeptNumber + "'," + oModel.HProcID.ToString() + ",'" + oModel.HBarCode + "'" + "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "')", ref DBUtility.ClsPub.sExeReturnInfo); "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "'," + oModel.HUSEORGID + "," + oModel.HUSEORGID + ",'" + oModel.HMakeEmp + "',GETDATE()" + ")", ref DBUtility.ClsPub.sExeReturnInfo); //ä¿®æ¹ä¸çº§ä¸ºéæ«çº§ä»£ç oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo); oCn.Commit(); @@ -38,7 +37,7 @@ } //ä¿®æ¹ public override bool ModifyByID(Int64 sItemID) public bool ModifyByID(Int64 sItemID, ref string sReturn) { try { @@ -46,7 +45,7 @@ oCn.RunProc("Update " + MvarItemKey + " set " + " HNumber='" + oModel.HNumber + "'" + ",HName='" + oModel.HName + "'" + ",HShortNumber='" + oModel.HShortNumber + "'" + ",HShortNumber='" + oModel.HNumber + "'" + ",HHelpCode='" + oModel.HHelpCode + "'" + ",HLevel=" + oModel.HLevel.ToString() + ",HDeptID=" + oModel.HDeptID.ToString() + @@ -55,6 +54,8 @@ ",HBarCode='" + oModel.HBarCode + "'" + ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) + ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",HModifyEmp='" + oModel.HModifyEmp + "'" + ",HModifyTime=GETDATE()" + ",HRemark= '" + oModel.HRemark + "' Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo); //ä¿®æ¹å项ç®ä»£ç oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_DisposeWay_Model.cs
@@ -8,5 +8,11 @@ { // public string HEnglishName;// varchar(50) è±æåç§° public Int64 HUSEORGID; public Int64 HCREATEORGID; public string HMakeEmp; public DateTime HMakeTime; public string HModifyEmp; public DateTime HModifyTime; } } Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_ScrapReason_Model.cs
@@ -11,5 +11,11 @@ public string HDeptNumber; public Int64 HProcID; public string HBarCode; public Int64 HUSEORGID; public Int64 HCREATEORGID; public string HMakeEmp; public DateTime HMakeTime; public string HModifyEmp; public DateTime HModifyTime; } } WebAPI/Controllers/BLL/Xt_UserController.cs
@@ -1236,6 +1236,69 @@ } #endregion #region ç¨æ·å ³èå·¥ä½ç»´æ¤å表 /// <summary> ///åæ°ï¼string sqlã ///è¿åå¼ï¼objectã /// </summary> [Route("Xt_User/UserByWorkStationRelationList")] [HttpGet] public object UserByWorkStationRelationList(string sWhere, string user) { try { List<object> columnNameList = new List<object>(); //æ¥çæé if (!DBUtility.ClsPub.Security_Log("Gy_UserWorkStationList_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ æ¥çæéï¼"; objJsonResult.data = null; return objJsonResult; } string sql = ""; if (sWhere == null || sWhere.Equals("")) { sql = "select * from h_v_Gy_UserByWorkStationRelationList_Query order by ç¨æ·ä»£ç asc,å·¥ä½ä»£ç asc"; ds = oCN.RunProcReturn(sql, "h_v_Gy_UserByWorkStationRelationList_Query"); } else { sql = "select * from h_v_Gy_UserByWorkStationRelationList_Query where 1=1 "; sql = sql + sWhere + " order by ç¨æ·ä»£ç asc,å·¥ä½ä»£ç asc"; ds = oCN.RunProcReturn(sql, "h_v_Gy_UserByWorkStationRelationList_Query"); } //æ·»å åå 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));//è·åå°DataColumnå对象çåå } 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_User/SaveUserByWorkStation")] [HttpPost] @@ -1276,6 +1339,105 @@ objJsonResult.count = 0; objJsonResult.Message = "ä¿å失败ï¼" + e.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region ç¨æ·å ³èå·¥ä½ç»´æ¤ ç¼è¾åå§å /// <summary> ///åæ°ï¼string sqlã ///è¿åå¼ï¼objectã /// </summary> [Route("Xt_User/UserByWorkStationRelationList_EditInit")] [HttpGet] public object UserByWorkStationRelationList_EditInit(int HItemID, string user) { try { List<object> columnNameList = new List<object>(); //æ¥çæé if (!DBUtility.ClsPub.Security_Log("Gy_UserWorkStationList_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ æ¥çæéï¼"; objJsonResult.data = null; return objJsonResult; } string sql = "select * from h_v_Gy_UserByWorkStationRelationList_Query where HItemID = " + HItemID; ds = oCN.RunProcReturn(sql, "h_v_Gy_UserByWorkStationRelationList_Query"); 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 ç¨æ·å ³èå·¥ä½ç»´æ¤ å é¤ /// <summary> ///åæ°ï¼string HInterIDã ///è¿åå¼ï¼objectã /// </summary> [Route("Xt_User/UserByWorkStationRelationList_Drop")] [HttpGet] public object UserByWorkStationRelationList_Drop(string HInterID, string user) { try { string s = ""; //æ¥çæé if (!DBUtility.ClsPub.Security_Log("Gy_UserWorkStationList_Drop", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ å 餿éï¼"; objJsonResult.data = null; return objJsonResult; } if (HInterID == null || HInterID.Equals("")) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "HInterIDä¸è½ä¸ºç©ºï¼"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); string sql = "delete from Gy_UserByWorkStationRelation where HItemID = " + HInterID; oCN.RunProc(sql); oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucessï¼"; objJsonResult.data = null; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exceptionï¼" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } @@ -2544,6 +2706,7 @@ } } #endregion #region ç¨æ·å ³è客æ·ç»´æ¤ å é¤ /// <summary> ///åæ°ï¼string HInterIDã WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_DisposeWayController.cs
New file @@ -0,0 +1,436 @@ using Model; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Pub_Class; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Web.Http; using System.Windows.Forms; using WebAPI.Models; namespace WebAPI.Controllers { public class Gy_DisposeWayController : ApiController { private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; /// <summary> /// è¿åå¤çæ¹æ¡å表 ///åæ°ï¼string sqlã ///è¿åå¼ï¼objectã /// </summary> [Route("Gy_DisposeWay/list")] [HttpGet] public object list(string sWhere, string user) { try { List<object> columnNameList = new List<object>(); //æ¥çæé if (!DBUtility.ClsPub.Security_Log("Gy_DisposeWay_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("select * from h_v_Gy_DisposeWayList order by HItemID ", "h_v_Gy_DisposeWayList"); } else { string sql1 = "select * from h_v_Gy_DisposeWayList where 1 = 1 "; string sql = sql1 + sWhere + " order by HItemID "; ds = oCN.RunProcReturn(sql, "h_v_Gy_DisposeWayList"); } if (ds.Tables[0].Rows.Count != 0 && ds != null) { //æ·»å åå 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));//è·åå°DataColumnå对象çåå } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucessï¼"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ²¡ææ¥è¯¢å°æ°æ®ï¼"; 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; } } /// <summary> /// ä¿åæé® ///åæ°ï¼string sqlã ///è¿åå¼ï¼objectã /// </summary> [Route("Gy_DisposeWay/ModifyByID")] [HttpPost] public object ModifyByID([FromBody] JObject oMain) { try { DAL.ClsGy_DisposeWay_Ctl oBill = new DAL.ClsGy_DisposeWay_Ctl(); var _value = oMain["oMain"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string user = sArray[1].ToString();//ç¨æ·å //夿æ¯å¦æç¼è¾æé if (!DBUtility.ClsPub.Security_Log("Gy_DisposeWay_Edit", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ æéç¼è¾!"; objJsonResult.data = null; return objJsonResult; } //string msg3 = sArray[1].ToString(); //string msg4 = sArray[2].ToString(); //string msg5 = sArray[3].ToString(); //ååºåå msg2 = "[" + msg2.ToString() + "]"; List<Model.ClsGy_DisposeWay_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_DisposeWay_Model>>(msg2); long HItemID = list[0].HItemID; foreach (Model.ClsGy_DisposeWay_Model oItem in list) { oBill.oModel = oItem; } //ä¿å bool bResult; //ä¿å宿¯åå¤ç if (HItemID == 0) { bResult = oBill.AddNew( ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyByID(HItemID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; 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) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exceptionï¼" + e.Message; objJsonResult.data = null; return objJsonResult; } } /// <summary> /// å¤çæ¹æ¡å表å é¤åè½ /// </summary> /// <returns></returns> [Route("DeltetGy_DisposeWay")] [HttpGet] public object DeltetGy_DisposeWay(string HItemID, string user) { DataSet ds; DataSet ds1; try { //å 餿é if (!DBUtility.ClsPub.Security_Log("Gy_DisposeWay_Delete", 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 Gy_DisposeWay where HItemID=" + HItemID, "Gy_DisposeWay"); if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ²¡ææ°æ®ï¼æ æ³å é¤ï¼"; objJsonResult.data = null; return objJsonResult; ; } string HUseFlag = Convert.ToString(ds.Tables[0].Rows[0]["HUseFlag"]); if (HUseFlag == "已使ç¨") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ¤é¡¹ç®å·²ä½¿ç¨ï¼ä¸è½å é¤ï¼"; objJsonResult.data = null; return objJsonResult; } oCN.RunProc("delete from Gy_DisposeWay 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; } } #region å¤çæ¹æ¡å®¡æ ¸ãåå®¡æ ¸ /// <summary> /// /// </summary> /// <param name="HInterID">åæ®ID</param> /// <param name="IsAudit">å®¡æ ¸(0),åå®¡æ ¸(1)</param> /// <param name="CurUserName">å®¡æ ¸äºº</param> /// <returns></returns> [Route("Gy_DisposeWay/AuditGy_DisposeWay")] [HttpGet] public object AuditGy_DisposeWay(int HInterID, int IsAudit, string CurUserName) { try { //å®¡æ ¸æé if (!DBUtility.ClsPub.Security_Log_second("Gy_DisposeWay_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "å®¡æ ¸å¤±è´¥ï¼æ æéï¼"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_DisposeWay where HItemID=" + HInterID, "Gy_DisposeWay"); 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 Gy_DisposeWay 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 Gy_DisposeWay 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("Gy_DisposeWay/StopGy_DisposeWay")] [HttpGet] public object StopGy_DisposeWay(int HInterID, int IsStop, string CurUserName) { try { //å®¡æ ¸æé if (!DBUtility.ClsPub.Security_Log_second("Gy_DisposeWay_Stop", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "ç¦ç¨å¤±è´¥ï¼æ æéï¼"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_DisposeWay where HItemID=" + HInterID, "Gy_DisposeWay"); 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 Gy_DisposeWay 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 Gy_DisposeWay 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 } } WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_ScrapReasonController.cs
New file @@ -0,0 +1,437 @@ using Model; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Pub_Class; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Web.Http; using System.Windows.Forms; using WebAPI.Models; namespace WebAPI.Controllers { public class Gy_ScrapReasonController : ApiController { private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; /// <summary> /// è¿åæ¥åºåå å表 ///åæ°ï¼string sqlã ///è¿åå¼ï¼objectã /// </summary> [Route("Gy_ScrapReason/list")] [HttpGet] public object list(string sWhere, string user) { try { List<object> columnNameList = new List<object>(); //æ¥çæé if (!DBUtility.ClsPub.Security_Log("Gy_ScrapReason_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("select * from h_v_Gy_ScrapReasonList order by HItemID ", "h_v_Gy_ScrapReasonList"); } else { string sql1 = "select * from h_v_Gy_ScrapReasonList where 1 = 1 "; string sql = sql1 + sWhere + " order by HItemID "; ds = oCN.RunProcReturn(sql, "h_v_Gy_ScrapReasonList"); } if (ds.Tables[0].Rows.Count != 0 && ds != null) { //æ·»å åå 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));//è·åå°DataColumnå对象çåå } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucessï¼"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ²¡ææ¥è¯¢å°æ°æ®ï¼"; 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; } } /// <summary> /// ä¿åæé® ///åæ°ï¼string sqlã ///è¿åå¼ï¼objectã /// </summary> [Route("Gy_ScrapReason/ModifyByID")] [HttpPost] public object ModifyByID([FromBody] JObject oMain) { try { DAL.ClsGy_ScrapReason_Ctl oBill = new DAL.ClsGy_ScrapReason_Ctl(); DAL.ClsGy_ScrapReason_View oBill_View = new DAL.ClsGy_ScrapReason_View(); var _value = oMain["oMain"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); string user = sArray[1].ToString();//ç¨æ·å //夿æ¯å¦æç¼è¾æé if (!DBUtility.ClsPub.Security_Log("Gy_ScrapReason_Edit", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ æéç¼è¾!"; objJsonResult.data = null; return objJsonResult; } //string msg3 = sArray[1].ToString(); //string msg4 = sArray[2].ToString(); //string msg5 = sArray[3].ToString(); //ååºåå msg2 = "[" + msg2.ToString() + "]"; List<Model.ClsGy_ScrapReason_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_ScrapReason_Model>>(msg2); long HItemID = list[0].HItemID; foreach (Model.ClsGy_ScrapReason_Model oItem in list) { oBill.oModel = oItem; } //ä¿å bool bResult; //ä¿å宿¯åå¤ç if (HItemID == 0) { bResult = oBill.AddNew( ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyByID(HItemID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; 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) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exceptionï¼" + e.Message; objJsonResult.data = null; return objJsonResult; } } /// <summary> /// æ¥åºåå å表å é¤åè½ /// </summary> /// <returns></returns> [Route("DeltetGy_ScrapReason")] [HttpGet] public object DeltetGy_ScrapReason(string HItemID, string user) { DataSet ds; DataSet ds1; try { //å 餿é if (!DBUtility.ClsPub.Security_Log("Gy_ScrapReason_Delete", 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 Gy_ScrapReason where HItemID=" + HItemID, "Gy_ScrapReason"); if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ²¡ææ°æ®ï¼æ æ³å é¤ï¼"; objJsonResult.data = null; return objJsonResult; ; } string HUseFlag = Convert.ToString(ds.Tables[0].Rows[0]["HUseFlag"]); if (HUseFlag == "已使ç¨") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ¤é¡¹ç®å·²ä½¿ç¨ï¼ä¸è½å é¤ï¼"; objJsonResult.data = null; return objJsonResult; } oCN.RunProc("delete from Gy_ScrapReason 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; } } #region æ¥åºåå å®¡æ ¸ãåå®¡æ ¸ /// <summary> /// /// </summary> /// <param name="HInterID">åæ®ID</param> /// <param name="IsAudit">å®¡æ ¸(0),åå®¡æ ¸(1)</param> /// <param name="CurUserName">å®¡æ ¸äºº</param> /// <returns></returns> [Route("Gy_ScrapReason/AuditGy_ScrapReason")] [HttpGet] public object AuditGy_ScrapReason(int HInterID, int IsAudit, string CurUserName) { try { //å®¡æ ¸æé if (!DBUtility.ClsPub.Security_Log_second("Gy_ScrapReason_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "å®¡æ ¸å¤±è´¥ï¼æ æéï¼"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_ScrapReason where HItemID=" + HInterID, "Gy_ScrapReason"); 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 Gy_ScrapReason 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 Gy_ScrapReason 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("Gy_ScrapReason/StopGy_ScrapReason")] [HttpGet] public object StopGy_ScrapReason(int HInterID, int IsStop, string CurUserName) { try { //å®¡æ ¸æé if (!DBUtility.ClsPub.Security_Log_second("Gy_ScrapReason_Stop", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "ç¦ç¨å¤±è´¥ï¼æ æéï¼"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_ScrapReason where HItemID=" + HInterID, "Gy_ScrapReason"); 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 Gy_ScrapReason 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 Gy_ScrapReason 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 } } WebAPI/WebAPI.csproj
@@ -509,6 +509,8 @@ <Compile Include="Controllers\åºç¡èµæ\åºç¡èµæ\Gy_MouldStatusController.cs" /> <Compile Include="Controllers\åºç¡èµæ\åºç¡èµæ\Gy_OperatorController.cs" /> <Compile Include="Controllers\åºç¡èµæ\åºç¡èµæ\Gy_PaymentConditionListBillController.cs" /> <Compile Include="Controllers\åºç¡èµæ\åºç¡èµæ\Gy_DisposeWayController.cs" /> <Compile Include="Controllers\åºç¡èµæ\åºç¡èµæ\Gy_ScrapReasonController.cs" /> <Compile Include="Controllers\åºç¡èµæ\åºç¡èµæ\Gy_TemporaryAreaController.cs" /> <Compile Include="Controllers\åºç¡èµæ\åºç¡èµæ\Gy_RateTypeController.cs" /> <Compile Include="Controllers\åºç¡èµæ\åºç¡èµæ\Gy_RecConditionBillController.cs" />