From b66de96d1568a88095fb462852c694974d6a4cd2 Mon Sep 17 00:00:00 2001 From: duhe <226547893@qq.com> Date: 星期二, 12 三月 2024 10:08:18 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/基础资料/基础资料/Gy_CardTypeController.cs | 274 +++++++++++++++++++ DAL/基础资料/公用基础资料/ClsGy_CardType_Ctl.cs | 96 ++++++ DAL/基础资料/公用基础资料/ClsGy_CardAddress_Ctl.cs | 96 ++++++ WebAPI/Controllers/基础资料/基础资料/Gy_CardAddressController.cs | 274 +++++++++++++++++++ DAL/DAL.csproj | 2 Model/基础资料/基础资料/ClsGy_CardAddress_Model.cs | 22 + Model/基础资料/基础资料/ClsGy_CardType_Model.cs | 22 + Model/Model.csproj | 2 WebAPI/Controllers/WebAPIController.cs | 2 WebAPI/WebAPI.csproj | 2 10 files changed, 791 insertions(+), 1 deletions(-) diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj index fbebf4a..a90c461 100644 --- a/DAL/DAL.csproj +++ b/DAL/DAL.csproj @@ -97,8 +97,10 @@ <Compile Include="浠撳簱绠$悊\鏉$爜绠$悊\ClsKF_BarCodeStatusChangeBill.cs" /> <Compile Include="鍩虹璧勬枡\InterFace鍩虹璧勬枡\ClsIF_ORGANIZATIONS_View.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_BadType_Ctl.cs" /> + <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_CardAddress_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_CustLocation_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_EquipStatus_Ctl.cs" /> + <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_CardType_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_MouldStatus_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_Operator_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_RateType_Ctl.cs" /> diff --git "a/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CardAddress_Ctl.cs" "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CardAddress_Ctl.cs" new file mode 100644 index 0000000..31dbf14 --- /dev/null +++ "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CardAddress_Ctl.cs" @@ -0,0 +1,96 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace DAL +{ + public class ClsGy_CardAddress_Ctl : DBUtility.ClsGy_Base_Ctl + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + //鍘熶唬鐮� 鐢ㄤ簬 鏇挎崲瀛愰」鐩� + public string HOldNumber; + public Model.ClsGy_CardAddress_Model oModel = new Model.ClsGy_CardAddress_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,HAllAddress ) " + + " 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 + "','" + oModel.HAllAddress + "'" + ")", ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + 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 + "'" + + ",HAllAddress='" + oModel.HAllAddress + "'" + + ",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); + } + } + //鏍规嵁浠g爜鍒ゆ柇淇℃伅 + 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_CardAddress_Ctl() + { + MvarItemKey = "Gy_CardAddress"; + MvarReportTitle = "璧勪骇浣嶇疆"; + oModel = new Model.ClsGy_CardAddress_Model(); + } + } +} diff --git "a/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CardType_Ctl.cs" "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CardType_Ctl.cs" new file mode 100644 index 0000000..6958250 --- /dev/null +++ "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CardType_Ctl.cs" @@ -0,0 +1,96 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace DAL +{ + public class ClsGy_CardType_Ctl : DBUtility.ClsGy_Base_Ctl + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + //鍘熶唬鐮� 鐢ㄤ簬 鏇挎崲瀛愰」鐩� + public string HOldNumber; + public Model.ClsGy_CardType_Model oModel = new Model.ClsGy_CardType_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,HUnitID) " + + " 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 + "'," + oModel.HUnitID + ")", ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + 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 + "'" + + ",HUnitID='" + oModel.HUnitID + "'" + + ",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); + } + } + //鏍规嵁浠g爜鍒ゆ柇淇℃伅 + 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_CardType_Ctl() + { + MvarItemKey = "Gy_CardType"; + MvarReportTitle = "璧勪骇绫诲埆"; + oModel = new Model.ClsGy_CardType_Model(); + } + } +} diff --git a/Model/Model.csproj b/Model/Model.csproj index 9cbaf81..7d5f886 100644 --- a/Model/Model.csproj +++ b/Model/Model.csproj @@ -340,6 +340,8 @@ <SubType>Code</SubType> </Compile> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_BadResult_Model.cs" /> + <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_CardAddress_Model.cs" /> + <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_CardType_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_StockCheckItem_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_InspectInstruMent_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_InspectBasis_Model.cs" /> diff --git "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CardAddress_Model.cs" "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CardAddress_Model.cs" new file mode 100644 index 0000000..4b89b87 --- /dev/null +++ "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CardAddress_Model.cs" @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; +//using System.Drawing; + +namespace Model +{ + public class ClsGy_CardAddress_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; } + public string HAllAddress{ get; set; } + } +} diff --git "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CardType_Model.cs" "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CardType_Model.cs" new file mode 100644 index 0000000..00bd6f0 --- /dev/null +++ "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_CardType_Model.cs" @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; +//using System.Drawing; + +namespace Model +{ + public class ClsGy_CardType_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; } + public Int64 HUnitID { get; set; } + } +} diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs index a7b07b5..d6ccfb0 100644 --- a/WebAPI/Controllers/WebAPIController.cs +++ b/WebAPI/Controllers/WebAPIController.cs @@ -10135,7 +10135,7 @@ HView = "h_v_Sb_EquipMaintainBillList"; break; case "WX": - HView = "h_v_Sb_EquipRepairCheckBillList"; + HView = "h_v_Sb_EquipRepairWorkBillList"; break; case "GZ": HView = "h_v_Sb_EquipConkBookBillList"; 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_CardAddressController.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_CardAddressController.cs" new file mode 100644 index 0000000..8a68760 --- /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_CardAddressController.cs" @@ -0,0 +1,274 @@ +锘縰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 Gy_CardAddressController : 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; + + #region 璧勪骇浣嶇疆鍒楄〃鏌ヨ + [Route("Gy_CardAddress/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_CardAddress_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_CardAddressList where 浣跨敤缁勭粐='" + Organization + "'"); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn(sql1 + sWhere + " order by hmainid desc", "h_v_Gy_CardAddressList"); + } + else + { + string sql = sql1 + sWhere + "order by hmainid desc"; + ds = oCN.RunProcReturn(sql, "h_v_Gy_CardAddressList"); + } + + //娣诲姞鍒楀悕 + 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("Gy_CardAddress/SaveGy_CardAddress")] + [HttpPost] + public object SaveGy_CardAddress([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_CardAddress_Edit", 1, false, msg2)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + try + { + DAL.ClsGy_CardAddress_Ctl oBill = new DAL.ClsGy_CardAddress_Ctl(); + List<Model.ClsGy_CardAddress_Model> lsmain = new List<Model.ClsGy_CardAddress_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + msg1 = "[" + msg1 + "]"; + lsmain = JsonConvert.DeserializeObject<List<Model.ClsGy_CardAddress_Model>>(msg1); + foreach (Model.ClsGy_CardAddress_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_CardAddress where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CardAddress"); + + 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_CardAddress")] + [HttpGet] + public object DeltetGy_CardAddress(string HItemID, string user) + { + DataSet ds; + DataSet ds1; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_CardAddress_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_CardAddress where HItemID=" + HItemID, "Gy_CardAddress"); + 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_CardAddress Where HParentID='" + HItemID + "'", "Gy_CardAddress"); + 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_CardAddress 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/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_CardTypeController.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_CardTypeController.cs" new file mode 100644 index 0000000..48457a5 --- /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_CardTypeController.cs" @@ -0,0 +1,274 @@ +锘縰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 Gy_CardTypeController : 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; + + #region 璧勪骇绫诲埆鍒楄〃鏌ヨ + [Route("Gy_CardType/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_CardType_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_CardTypeList where 浣跨敤缁勭粐='" + Organization + "'"); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn(sql1 + sWhere + " order by hmainid desc", "h_v_Gy_CardTypeList"); + } + else + { + string sql = sql1 + sWhere + "order by hmainid desc"; + ds = oCN.RunProcReturn(sql, "h_v_Gy_CardTypeList"); + } + + //娣诲姞鍒楀悕 + 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("Gy_CardType/SaveGy_CardType")] + [HttpPost] + public object SaveGy_MaterType([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_CardType_Edit", 1, false, msg2)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + try + { + DAL.ClsGy_CardType_Ctl oBill = new DAL.ClsGy_CardType_Ctl(); + List<Model.ClsGy_CardType_Model> lsmain = new List<Model.ClsGy_CardType_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + msg1 = "[" + msg1 + "]"; + lsmain = JsonConvert.DeserializeObject<List<Model.ClsGy_CardType_Model>>(msg1); + foreach (Model.ClsGy_CardType_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_CardType where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CardType"); + + 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_CardType")] + [HttpGet] + public object DeltetGy_CardType(string HItemID, string user) + { + DataSet ds; + DataSet ds1; + try + { + //鍒犻櫎鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_CardType_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_CardType where HItemID=" + HItemID, "Gy_CardType"); + 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_CardType Where HParentID='" + HItemID + "'", "Gy_CardType"); + 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_CardType 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/WebAPI.csproj b/WebAPI/WebAPI.csproj index 35fe3ac..80b547d 100644 --- a/WebAPI/WebAPI.csproj +++ b/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_CardAddressController.cs" /> + <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_CardTypeController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_COMMONCONTACTBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_CustLocationController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_DutyBillController.cs" /> -- Gitblit v1.9.1