DAL/DAL.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
DAL/基础资料/公用基础资料/ClsGy_CardChangeType_Ctl.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
DAL/基础资料/公用基础资料/ClsGy_CardStatus_Ctl.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Model/Model.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Model/基础资料/基础资料/ClsGy_CardChangeType_Model.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Model/基础资料/基础资料/ClsGy_CardStatus_Model.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Controllers/基础资料/基础资料/Gy_CardAddressController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Controllers/基础资料/基础资料/Gy_CardChangeTypeController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Controllers/基础资料/基础资料/Gy_CardStatusController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Controllers/基础资料/基础资料/Gy_CardTypeController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/WebAPI.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
DAL/DAL.csproj
@@ -97,6 +97,8 @@ <Compile Include="ä»åºç®¡ç\æ¡ç 管ç\ClsKF_BarCodeStatusChangeBill.cs" /> <Compile Include="åºç¡èµæ\InterFaceåºç¡èµæ\ClsIF_ORGANIZATIONS_View.cs" /> <Compile Include="åºç¡èµæ\å ¬ç¨åºç¡èµæ\ClsGy_BadType_Ctl.cs" /> <Compile Include="åºç¡èµæ\å ¬ç¨åºç¡èµæ\ClsGy_CardChangeType_Ctl.cs" /> <Compile Include="åºç¡èµæ\å ¬ç¨åºç¡èµæ\ClsGy_CardStatus_Ctl.cs" /> <Compile Include="åºç¡èµæ\å ¬ç¨åºç¡èµæ\ClsGy_CardAddress_Ctl.cs" /> <Compile Include="åºç¡èµæ\å ¬ç¨åºç¡èµæ\ClsGy_CustLocation_Ctl.cs" /> <Compile Include="åºç¡èµæ\å ¬ç¨åºç¡èµæ\ClsGy_EquipStatus_Ctl.cs" /> DAL/»ù´¡×ÊÁÏ/¹«Óûù´¡×ÊÁÏ/ClsGy_CardChangeType_Ctl.cs
New file @@ -0,0 +1,95 @@ using System; using System.Collections.Generic; using System.Text; using System.Data; namespace DAL { public class ClsGy_CardChangeType_Ctl : DBUtility.ClsGy_Base_Ctl { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //å代ç ç¨äº æ¿æ¢åé¡¹ç® public string HOldNumber; public Model.ClsGy_CardChangeType_Model oModel = new Model.ClsGy_CardChangeType_Model(); //æ°å¢ public override bool AddNew() { try { oCn.BeginTran(); oCn.RunProc("Insert into " + MvarItemKey + " " + " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + ",HLevel,HEndFlag,HStopflag,HRemark,HMakeEmp,HMakeTime,HUSEORGID,HCREATEORGID,HUseFlag) " + " 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 + "','"+ oModel.HMakeEmp.ToString() + "',getdate()," + oModel.HUSEORGID + "," + oModel.HCREATEORGID + ",'"+ oModel.HUseFlag + "'" + ")", ref DBUtility.ClsPub.sExeReturnInfo); //ä¿®æ¹ä¸çº§ä¸ºéæ«çº§ä»£ç oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo); oCn.Commit(); return true; } catch (Exception e) { oCn.RollBack(); throw (e); } } //ä¿®æ¹ public override bool ModifyByID(Int64 sItemID) { try { oCn.BeginTran(); oCn.RunProc("Update " + MvarItemKey + " set " + " HNumber='" + oModel.HNumber + "'" + ",HName='" + oModel.HName + "'" + ",HHelpCode='" + oModel.HHelpCode + "'" + ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) + ",HModifyEmp='" + oModel.HMakeEmp.ToString() + "'" + ",HModifyTime= getdate()" + ",HUSEORGID=" + oModel.HUSEORGID + ",HUseFlag='" + oModel.HUseFlag + "'" + ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",HRemark= '" + oModel.HRemark + "' Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo); //å°ä¸çº§ ä¸ºéæ«çº§ oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo); // oCn.Commit(); return true; } catch (Exception e) { oCn.RollBack(); throw (e); } } //æ ¹æ®ä»£ç å¤æä¿¡æ¯ public override bool HavParentCode(string sCode, Int64 sItemID) { DataSet DS; try { DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HStopflag=0 and HNumber='" + sCode + "' and HItemID<>" + sItemID, MvarItemKey, ref Pub_Class.ClsPub.sExeReturnInfo); if (DS.Tables[0].Rows.Count == 0) return false; else { oModel.HItemID = Convert.ToInt64(DS.Tables[0].Rows[0]["HItemID"]); return true; } } catch (Exception e) { throw (e); } } //æé 彿° public ClsGy_CardChangeType_Ctl() { MvarItemKey = "Gy_CardChangeType"; MvarReportTitle = "å卿¹å¼"; oModel = new Model.ClsGy_CardChangeType_Model(); } } } DAL/»ù´¡×ÊÁÏ/¹«Óûù´¡×ÊÁÏ/ClsGy_CardStatus_Ctl.cs
New file @@ -0,0 +1,95 @@ using System; using System.Collections.Generic; using System.Text; using System.Data; namespace DAL { public class ClsGy_CardStatus_Ctl : DBUtility.ClsGy_Base_Ctl { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //å代ç ç¨äº æ¿æ¢åé¡¹ç® public string HOldNumber; public Model.ClsGy_CardStatus_Model oModel = new Model.ClsGy_CardStatus_Model(); //æ°å¢ public override bool AddNew() { try { oCn.BeginTran(); oCn.RunProc("Insert into " + MvarItemKey + " " + " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + ",HLevel,HEndFlag,HStopflag,HRemark,HMakeEmp,HMakeTime,HUSEORGID,HCREATEORGID,HUseFlag) " + " 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 + "','"+ oModel.HMakeEmp.ToString() + "',getdate()," + oModel.HUSEORGID + "," + oModel.HCREATEORGID + ",'"+ oModel.HUseFlag + "'" + ")", ref DBUtility.ClsPub.sExeReturnInfo); //ä¿®æ¹ä¸çº§ä¸ºéæ«çº§ä»£ç oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo); oCn.Commit(); return true; } catch (Exception e) { oCn.RollBack(); throw (e); } } //ä¿®æ¹ public override bool ModifyByID(Int64 sItemID) { try { oCn.BeginTran(); oCn.RunProc("Update " + MvarItemKey + " set " + " HNumber='" + oModel.HNumber + "'" + ",HName='" + oModel.HName + "'" + ",HHelpCode='" + oModel.HHelpCode + "'" + ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) + ",HModifyEmp='" + oModel.HMakeEmp.ToString() + "'" + ",HModifyTime= getdate()" + ",HUSEORGID=" + oModel.HUSEORGID + ",HUseFlag='" + oModel.HUseFlag + "'" + ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",HRemark= '" + oModel.HRemark + "' Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo); //å°ä¸çº§ ä¸ºéæ«çº§ oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo); // oCn.Commit(); return true; } catch (Exception e) { oCn.RollBack(); throw (e); } } //æ ¹æ®ä»£ç å¤æä¿¡æ¯ public override bool HavParentCode(string sCode, Int64 sItemID) { DataSet DS; try { DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HStopflag=0 and HNumber='" + sCode + "' and HItemID<>" + sItemID, MvarItemKey, ref Pub_Class.ClsPub.sExeReturnInfo); if (DS.Tables[0].Rows.Count == 0) return false; else { oModel.HItemID = Convert.ToInt64(DS.Tables[0].Rows[0]["HItemID"]); return true; } } catch (Exception e) { throw (e); } } //æé 彿° public ClsGy_CardStatus_Ctl() { MvarItemKey = "Gy_CardStatus"; MvarReportTitle = "èµäº§ç¶æ"; oModel = new Model.ClsGy_CardStatus_Model(); } } } Model/Model.csproj
@@ -340,6 +340,8 @@ <SubType>Code</SubType> </Compile> <Compile Include="åºç¡èµæ\åºç¡èµæ\ClsGy_BadResult_Model.cs" /> <Compile Include="åºç¡èµæ\åºç¡èµæ\ClsGy_CardChangeType_Model.cs" /> <Compile Include="åºç¡èµæ\åºç¡èµæ\ClsGy_CardStatus_Model.cs" /> <Compile Include="åºç¡èµæ\åºç¡èµæ\ClsGy_CardAddress_Model.cs" /> <Compile Include="åºç¡èµæ\åºç¡èµæ\ClsGy_CardType_Model.cs" /> <Compile Include="åºç¡èµæ\åºç¡èµæ\ClsGy_StockCheckItem_Model.cs" /> Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_CardChangeType_Model.cs
New file @@ -0,0 +1,21 @@ using System; using System.Collections.Generic; using System.Text; //using System.Drawing; namespace Model { public class ClsGy_CardChangeType_Model : DBUtility.ClsGy_Base_Model { public long HUSEORGID { get; set; } public long HCREATEORGID { get; set; } public string HMakeEmp { get; set; } public DateTime HMakeTime { get; set; } public string HCheckEmp { get; set; } public DateTime HCheckTime { get; set; } public string HModifyEmp { get; set; } public DateTime HModifyTime { get; set; } public string HStopEmp { get; set; } public DateTime HStopTime { get; set; } } } Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_CardStatus_Model.cs
New file @@ -0,0 +1,21 @@ using System; using System.Collections.Generic; using System.Text; //using System.Drawing; namespace Model { public class ClsGy_CardStatus_Model : DBUtility.ClsGy_Base_Model { public long HUSEORGID { get; set; } public long HCREATEORGID { get; set; } public string HMakeEmp { get; set; } public DateTime HMakeTime { get; set; } public string HCheckEmp { get; set; } public DateTime HCheckTime { get; set; } public string HModifyEmp { get; set; } public DateTime HModifyTime { get; set; } public string HStopEmp { get; set; } public DateTime HStopTime { get; set; } } } WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_CardAddressController.cs
@@ -1,4 +1,5 @@ using Newtonsoft.Json; using DBUtility; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -19,6 +20,7 @@ private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; public DAL.ClsGy_CardAddress_Ctl BillOld = new DAL.ClsGy_CardAddress_Ctl(); #region èµäº§ä½ç½®å表æ¥è¯¢ [Route("Gy_CardAddress/list")] @@ -270,5 +272,207 @@ } } #endregion #region èµäº§ä½ç½® å®¡æ ¸ [Route("Gy_CardAddress/AuditGy_CardAddress")] [HttpGet] public object AuditGy_CardAddress(string HInterID, int Type, string user) { try { //夿æ¯å¦æå®¡æ ¸æé if (!DBUtility.ClsPub.Security_Log("Gy_CardAddress_Check", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ æéå®¡æ ¸!"; objJsonResult.data = null; return objJsonResult; } if (string.IsNullOrWhiteSpace(HInterID)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "HInterID为空ï¼"; objJsonResult.data = null; return objJsonResult; } ClsPub.CurUserName = user; oCN.BeginTran();//å¼å§äºå¡ //Type 1 å®¡æ ¸ 2 åå®¡æ ¸ if (Type == 1) { //夿忮æ¯å¦å·²ç»å®¡æ ¸ DataSet ds; string sql = "select * from Gy_CardAddress where HItemID = " + HInterID; ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); if (ds.Tables[0].Rows[0]["HCheckEmp"] != null && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "åæ®å·²å®¡æ ¸!ä¸è½åæ¬¡å®¡æ ¸ï¼"; objJsonResult.data = null; return objJsonResult; } //å®¡æ ¸åæ® if (!BillOld.AuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { //夿忮æ¯å¦å·²ç»åå®¡æ ¸ DataSet ds; string sql = "select * from Gy_CardAddress where HItemID = " + HInterID; ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["HCheckEmp"] == null || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "åæ®æªå®¡æ ¸!ä¸éè¦åå®¡æ ¸!"; objJsonResult.data = null; return objJsonResult; } //åå®¡æ ¸åæ® if (!BillOld.DeAuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "åå®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } } 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_CardAddress/StopGy_CardAddress")] [HttpGet] public object StopGy_CardAddress(int HInterID, int IsStop, string CurUserName) { try { //å®¡æ ¸æé if (!DBUtility.ClsPub.Security_Log_second("Gy_CardAddress_Stop", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "ç¦ç¨å¤±è´¥ï¼æ æéï¼"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_CardAddress where HItemID=" + HInterID, "Gy_CardAddress"); 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) //ç¦ç¨å¤æ { //ç¦ç¨åæ® if (!BillOld.StopByHItemID(HInterID, CurUserName, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //åç¦ç¨å¤æ { //åç¦ç¨åæ® if (!BillOld.AbandonStopByHItemID(HInterID, CurUserName, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } 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 } } WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_CardChangeTypeController.cs
New file @@ -0,0 +1,478 @@ using DBUtility; using 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 Gy_CardChangeTypeController : ApiController { //è·åç³»ç»åæ° Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); public DBUtility.ClsPub.Enum_BillStatus BillStatus; private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; public DAL.ClsGy_CardChangeType_Ctl BillOld = new DAL.ClsGy_CardChangeType_Ctl(); #region å卿¹å¼å表æ¥è¯¢ [Route("Gy_CardChangeType/list")] [HttpGet] public object list(string sWhere, string user, string Organization) { try { List<object> columnNameList = new List<object>(); //ç¼è¾æé if (!DBUtility.ClsPub.Security_Log_second("Gy_CardChangeType_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_Gy_CardChangeTypeList where 使ç¨ç»ç»='" + Organization + "'"); if (sWhere == null || sWhere.Equals("")) { ds = oCN.RunProcReturn(sql1 + sWhere + " order by hmainid desc", "h_v_Gy_CardChangeTypeList"); } else { string sql = sql1 + sWhere + "order by hmainid desc"; ds = oCN.RunProcReturn(sql, "h_v_Gy_CardChangeTypeList"); } //æ·»å åå 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("Gy_CardChangeType/SaveGy_CardChangeType")] [HttpPost] public object SaveGy_CardChangeType([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();//ç»ç» SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); //ç¼è¾æé if (!DBUtility.ClsPub.Security_Log_second("Gy_CardChangeType_Edit", 1, false, msg2)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ ä¿åæéï¼"; objJsonResult.data = null; return objJsonResult; } try { DAL.ClsGy_CardChangeType_Ctl oBill = new DAL.ClsGy_CardChangeType_Ctl(); List<Model.ClsGy_CardChangeType_Model> lsmain = new List<Model.ClsGy_CardChangeType_Model>(); msg1 = msg1.Replace("\\", ""); msg1 = msg1.Replace("\n", ""); //\n msg1 = "[" + msg1 + "]"; lsmain = JsonConvert.DeserializeObject<List<Model.ClsGy_CardChangeType_Model>>(msg1); foreach (Model.ClsGy_CardChangeType_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; } if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim())) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "ä¿å失败ï¼ä»£ç ä¸ä¸è½åºç°è¿ç»â.âå¹¶ä¸é¦ä½æ«ä½ä¸è½ä¸ºâ.âï¼"; objJsonResult.data = 1; return objJsonResult; } //æ¥è¯¢æ°æ®ä¸æ¯å¦åå¨éå¤ä»£ç ds = oCN.RunProcReturn("select * from Gy_CardChangeType where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CardChangeType"); if (ds.Tables[0].Rows.Count > 0) { if (oItem.HItemID == 0 || (ds.Tables[0].Rows[0]["HItemID"].ToString() != oItem.HItemID.ToString() && oItem.HItemID != 0)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "ä¿å失败ï¼ä»£ç éå¤ï¼"; objJsonResult.data = 1; return objJsonResult; } } oItem.HCREATEORGID = Convert.ToInt32(msg_HUSEORGID); //ç»ç»id oItem.HMakeEmp = msg2; oItem.HEndFlag = true;//æ«çº§æ å¿ oItem.HLevel = 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 = "ä¿åæåï¼"; 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("DeltetGy_CardChangeType")] [HttpGet] public object DeltetGy_CardChangeType(string HItemID, string user) { DataSet ds; DataSet ds1; try { //å 餿é if (!DBUtility.ClsPub.Security_Log("Gy_CardChangeType_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_CardChangeType where HItemID=" + HItemID, "Gy_CardChangeType"); if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ²¡ææ°æ®ï¼æ æ³å é¤ï¼"; objJsonResult.data = null; return objJsonResult; ; } ds1 = oCN.RunProcReturn("Select HItemID from Gy_CardChangeType Where HParentID='" + HItemID + "'", "Gy_CardChangeType"); if (ds1.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_CardChangeType 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_CardChangeType/AuditGy_CardChangeType")] [HttpGet] public object AuditGy_CardChangeType(string HInterID, int Type, string user) { try { //夿æ¯å¦æå®¡æ ¸æé if (!DBUtility.ClsPub.Security_Log("Gy_CardChangeType_Check", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ æéå®¡æ ¸!"; objJsonResult.data = null; return objJsonResult; } if (string.IsNullOrWhiteSpace(HInterID)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "HInterID为空ï¼"; objJsonResult.data = null; return objJsonResult; } ClsPub.CurUserName = user; oCN.BeginTran();//å¼å§äºå¡ //Type 1 å®¡æ ¸ 2 åå®¡æ ¸ if (Type == 1) { //夿忮æ¯å¦å·²ç»å®¡æ ¸ DataSet ds; string sql = "select * from Gy_CardChangeType where HItemID = " + HInterID; ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); if (ds.Tables[0].Rows[0]["HCheckEmp"] != null && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "åæ®å·²å®¡æ ¸!ä¸è½åæ¬¡å®¡æ ¸ï¼"; objJsonResult.data = null; return objJsonResult; } //å®¡æ ¸åæ® if (!BillOld.AuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { //夿忮æ¯å¦å·²ç»åå®¡æ ¸ DataSet ds; string sql = "select * from Gy_CardChangeType where HItemID = " + HInterID; ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["HCheckEmp"] == null || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "åæ®æªå®¡æ ¸!ä¸éè¦åå®¡æ ¸!"; objJsonResult.data = null; return objJsonResult; } //åå®¡æ ¸åæ® if (!BillOld.DeAuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "åå®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } } 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_CardChangeType/StopGy_CardChangeType")] [HttpGet] public object StopGy_CardChangeType(int HInterID, int IsStop, string CurUserName) { try { //å®¡æ ¸æé if (!DBUtility.ClsPub.Security_Log_second("Gy_CardChangeType_Stop", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "ç¦ç¨å¤±è´¥ï¼æ æéï¼"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_CardChangeType where HItemID=" + HInterID, "Gy_CardChangeType"); 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) //ç¦ç¨å¤æ { //ç¦ç¨åæ® if (!BillOld.StopByHItemID(HInterID, CurUserName, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //åç¦ç¨å¤æ { //åç¦ç¨åæ® if (!BillOld.AbandonStopByHItemID(HInterID, CurUserName, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } 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 } } WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_CardStatusController.cs
New file @@ -0,0 +1,478 @@ using DBUtility; using 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 Gy_CardStatusController : ApiController { //è·åç³»ç»åæ° Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); public DBUtility.ClsPub.Enum_BillStatus BillStatus; private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; public DAL.ClsGy_CardStatus_Ctl BillOld = new DAL.ClsGy_CardStatus_Ctl(); #region èµäº§ç¶æå表æ¥è¯¢ [Route("Gy_CardStatus/list")] [HttpGet] public object list(string sWhere, string user, string Organization) { try { List<object> columnNameList = new List<object>(); //ç¼è¾æé if (!DBUtility.ClsPub.Security_Log_second("Gy_CardStatus_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_Gy_CardStatusList where 使ç¨ç»ç»='" + Organization + "'"); if (sWhere == null || sWhere.Equals("")) { ds = oCN.RunProcReturn(sql1 + sWhere + " order by hmainid desc", "h_v_Gy_CardStatusList"); } else { string sql = sql1 + sWhere + "order by hmainid desc"; ds = oCN.RunProcReturn(sql, "h_v_Gy_CardStatusList"); } //æ·»å åå 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("Gy_CardStatus/SaveGy_CardStatus")] [HttpPost] public object SaveGy_CardStatus([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();//ç»ç» SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); //ç¼è¾æé if (!DBUtility.ClsPub.Security_Log_second("Gy_CardStatus_Edit", 1, false, msg2)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ ä¿åæéï¼"; objJsonResult.data = null; return objJsonResult; } try { DAL.ClsGy_CardStatus_Ctl oBill = new DAL.ClsGy_CardStatus_Ctl(); List<Model.ClsGy_CardStatus_Model> lsmain = new List<Model.ClsGy_CardStatus_Model>(); msg1 = msg1.Replace("\\", ""); msg1 = msg1.Replace("\n", ""); //\n msg1 = "[" + msg1 + "]"; lsmain = JsonConvert.DeserializeObject<List<Model.ClsGy_CardStatus_Model>>(msg1); foreach (Model.ClsGy_CardStatus_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; } if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim())) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "ä¿å失败ï¼ä»£ç ä¸ä¸è½åºç°è¿ç»â.âå¹¶ä¸é¦ä½æ«ä½ä¸è½ä¸ºâ.âï¼"; objJsonResult.data = 1; return objJsonResult; } //æ¥è¯¢æ°æ®ä¸æ¯å¦åå¨éå¤ä»£ç ds = oCN.RunProcReturn("select * from Gy_CardStatus where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CardStatus"); if (ds.Tables[0].Rows.Count > 0) { if (oItem.HItemID == 0 || (ds.Tables[0].Rows[0]["HItemID"].ToString() != oItem.HItemID.ToString() && oItem.HItemID != 0)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "ä¿å失败ï¼ä»£ç éå¤ï¼"; objJsonResult.data = 1; return objJsonResult; } } oItem.HCREATEORGID = Convert.ToInt32(msg_HUSEORGID); //ç»ç»id oItem.HMakeEmp = msg2; oItem.HEndFlag = true;//æ«çº§æ å¿ oItem.HLevel = 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 = "ä¿åæåï¼"; 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("DeltetGy_CardStatus")] [HttpGet] public object DeltetGy_CardStatus(string HItemID, string user) { DataSet ds; DataSet ds1; try { //å 餿é if (!DBUtility.ClsPub.Security_Log("Gy_CardStatus_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_CardStatus where HItemID=" + HItemID, "Gy_CardStatus"); if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ²¡ææ°æ®ï¼æ æ³å é¤ï¼"; objJsonResult.data = null; return objJsonResult; ; } ds1 = oCN.RunProcReturn("Select HItemID from Gy_CardStatus Where HParentID='" + HItemID + "'", "Gy_CardStatus"); if (ds1.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_CardStatus 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_CardStatus/AuditGy_CardStatus")] [HttpGet] public object AuditGy_CardStatus(string HInterID, int Type, string user) { try { //夿æ¯å¦æå®¡æ ¸æé if (!DBUtility.ClsPub.Security_Log("Gy_CardStatus_Check", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ æéå®¡æ ¸!"; objJsonResult.data = null; return objJsonResult; } if (string.IsNullOrWhiteSpace(HInterID)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "HInterID为空ï¼"; objJsonResult.data = null; return objJsonResult; } ClsPub.CurUserName = user; oCN.BeginTran();//å¼å§äºå¡ //Type 1 å®¡æ ¸ 2 åå®¡æ ¸ if (Type == 1) { //夿忮æ¯å¦å·²ç»å®¡æ ¸ DataSet ds; string sql = "select * from Gy_CardStatus where HItemID = " + HInterID; ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); if (ds.Tables[0].Rows[0]["HCheckEmp"] != null && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "åæ®å·²å®¡æ ¸!ä¸è½åæ¬¡å®¡æ ¸ï¼"; objJsonResult.data = null; return objJsonResult; } //å®¡æ ¸åæ® if (!BillOld.AuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { //夿忮æ¯å¦å·²ç»åå®¡æ ¸ DataSet ds; string sql = "select * from Gy_CardStatus where HItemID = " + HInterID; ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["HCheckEmp"] == null || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "åæ®æªå®¡æ ¸!ä¸éè¦åå®¡æ ¸!"; objJsonResult.data = null; return objJsonResult; } //åå®¡æ ¸åæ® if (!BillOld.DeAuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "åå®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } } 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_CardStatus/StopGy_CardStatus")] [HttpGet] public object StopGy_CardStatus(int HInterID, int IsStop, string CurUserName) { try { //å®¡æ ¸æé if (!DBUtility.ClsPub.Security_Log_second("Gy_CardStatus_Stop", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "ç¦ç¨å¤±è´¥ï¼æ æéï¼"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_CardStatus where HItemID=" + HInterID, "Gy_CardStatus"); 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) //ç¦ç¨å¤æ { //ç¦ç¨åæ® if (!BillOld.StopByHItemID(HInterID, CurUserName, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //åç¦ç¨å¤æ { //åç¦ç¨åæ® if (!BillOld.AbandonStopByHItemID(HInterID, CurUserName, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } 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 } } WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_CardTypeController.cs
@@ -1,4 +1,5 @@ using Newtonsoft.Json; using DBUtility; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -19,6 +20,7 @@ private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; public DAL.ClsGy_CardType_Ctl BillOld = new DAL.ClsGy_CardType_Ctl(); #region èµäº§ç±»å«å表æ¥è¯¢ [Route("Gy_CardType/list")] @@ -270,5 +272,207 @@ } } #endregion #region èµäº§ç±»å« å®¡æ ¸ [Route("Gy_CardType/AuditGy_CardType")] [HttpGet] public object AuditGy_CardType(string HInterID, int Type, string user) { try { //夿æ¯å¦æå®¡æ ¸æé if (!DBUtility.ClsPub.Security_Log("Gy_CardType_Check", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ æéå®¡æ ¸!"; objJsonResult.data = null; return objJsonResult; } if (string.IsNullOrWhiteSpace(HInterID)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "HInterID为空ï¼"; objJsonResult.data = null; return objJsonResult; } ClsPub.CurUserName = user; oCN.BeginTran();//å¼å§äºå¡ //Type 1 å®¡æ ¸ 2 åå®¡æ ¸ if (Type == 1) { //夿忮æ¯å¦å·²ç»å®¡æ ¸ DataSet ds; string sql = "select * from Gy_CardType where HItemID = " + HInterID; ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); if (ds.Tables[0].Rows[0]["HCheckEmp"] != null && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "åæ®å·²å®¡æ ¸!ä¸è½åæ¬¡å®¡æ ¸ï¼"; objJsonResult.data = null; return objJsonResult; } //å®¡æ ¸åæ® if (!BillOld.AuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { //夿忮æ¯å¦å·²ç»åå®¡æ ¸ DataSet ds; string sql = "select * from Gy_CardType where HItemID = " + HInterID; ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["HCheckEmp"] == null || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "åæ®æªå®¡æ ¸!ä¸éè¦åå®¡æ ¸!"; objJsonResult.data = null; return objJsonResult; } //åå®¡æ ¸åæ® if (!BillOld.DeAuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "åå®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } } 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_CardType/StopGy_CardType")] [HttpGet] public object StopGy_CardType(int HInterID, int IsStop, string CurUserName) { try { //å®¡æ ¸æé if (!DBUtility.ClsPub.Security_Log_second("Gy_CardType_Stop", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "ç¦ç¨å¤±è´¥ï¼æ æéï¼"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_CardType where HItemID=" + HInterID, "Gy_CardType"); 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) //ç¦ç¨å¤æ { //ç¦ç¨åæ® if (!BillOld.StopByHItemID(HInterID, CurUserName, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //åç¦ç¨å¤æ { //åç¦ç¨åæ® if (!BillOld.AbandonStopByHItemID(HInterID, CurUserName, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } 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 } } WebAPI/WebAPI.csproj
@@ -508,6 +508,8 @@ <Compile Include="Controllers\å质管ç\å·¡æ£å\QC_PatrolProcCheckBillController.cs" /> <Compile Include="Controllers\å质管ç\å·¥åºæ£éªå\MES_ProcessCheckBill_PDAController.cs" /> <Compile Include="Controllers\å质管ç\è´¨éæ¥è¡¨\QC_QualityReportsController.cs" /> <Compile Include="Controllers\åºç¡èµæ\åºç¡èµæ\Gy_CardChangeTypeController.cs" /> <Compile Include="Controllers\åºç¡èµæ\åºç¡èµæ\Gy_CardStatusController.cs" /> <Compile Include="Controllers\åºç¡èµæ\åºç¡èµæ\Gy_CardAddressController.cs" /> <Compile Include="Controllers\åºç¡èµæ\åºç¡èµæ\Gy_CardTypeController.cs" /> <Compile Include="Controllers\åºç¡èµæ\åºç¡èµæ\Gy_COMMONCONTACTBillController.cs" />