From 52b059d17a5fdd30bf50ca354239cc7c8537cd35 Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期一, 05 十二月 2022 10:29:21 +0800 Subject: [PATCH] 基础表 --- WebAPI/ListModels.cs | 24 + Model/基础资料/基础资料/ClsGy_CustLocation_Model.cs | 20 + DAL/DAL.csproj | 2 WebAPI/Controllers/基础资料/基础资料/Gy_RateTypeController.cs | 346 ++++++++++++++++++++ DAL/基础资料/公用基础资料/ClsGy_CustLocation_Ctl.cs | 103 ++++++ DAL/基础资料/公用基础资料/ClsGy_RateType_Ctl.cs | 103 ++++++ Model/Model.csproj | 2 WebAPI/WebAPI.csproj | 4 Model/基础资料/基础资料/ClsGy_RateType_Model.cs | 20 + WebAPI/Controllers/基础资料/基础资料/Gy_CustLocationController.cs | 346 ++++++++++++++++++++ 10 files changed, 970 insertions(+), 0 deletions(-) diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj index 3ef8b22..3d8474e 100644 --- a/DAL/DAL.csproj +++ b/DAL/DAL.csproj @@ -84,6 +84,8 @@ <Compile Include="浜轰簨绠$悊\ClsHR_EmpUpChangeBill.cs" /> <Compile Include="浠撳簱绠$悊\鏉$爜绠$悊\ClsGy_BarCodeBill_ChaiMa.cs" /> <Compile Include="鍩虹璧勬枡\InterFace鍩虹璧勬枡\ClsIF_ORGANIZATIONS_View.cs" /> + <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_CustLocation_Ctl.cs" /> + <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_RateType_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_TaxRate_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_RecCondition_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_FactoryDayOff_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_CustLocation_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_CustLocation_Ctl.cs" new file mode 100644 index 0000000..148470c --- /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_CustLocation_Ctl.cs" @@ -0,0 +1,103 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace DAL +{ + public class ClsGy_CustLocation_Ctl : DBUtility.ClsGy_Base_Ctl + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + //鍘熶唬鐮� 鐢ㄤ簬 鏇挎崲瀛愰」鐩� + public string HOldNumber; + public Model.ClsGy_CustLocation_Model oModel = new Model.ClsGy_CustLocation_Model(); + //鏂板 + public override bool AddNew() + { + + try + { + oCn.BeginTran(); + oCn.RunProc($@"insert into Gy_CustLocation(HNumber,HName,HShortNumber,HParentID ,HLevel + ,HEndFlag ,HStopflag ,HRemark ,HHelpCode ,HUseFlag + ,HMakeTime ,HMakeEmp ,HCheckEmp ,HCheckTime ,HModifyEmp + ,HModifyTime ,HStopEmp ,HStopTime ,HUSEORGID,HCREATEORGID) + values('{oModel.HNumber}','{oModel.HName}','{oModel.HShortNumber}',{oModel.HParentID},{oModel.HLevel} + ,{(oModel.HEndFlag == true ? 1 : 0)},{(oModel.HStopflag == true ? 1 : 0)},'{oModel.HRemark}','{oModel.HHelpCode}','{oModel.HUseFlag}' + ,GETDATE(),'{oModel.HMakeEmp}','','','' + ,'','','',{oModel.HUSEORGID},{oModel.HCREATEORGID})" + , 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 + "'" + + ",HShortNumber='" + oModel.HShortNumber + "'" + + ",HParentID=" + oModel.HParentID.ToString() + + ",HLevel=" + oModel.HLevel.ToString() + + ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) + + ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) + + ",HRemark= '" + oModel.HRemark + "'" + + ",HHelpCode='" + oModel.HHelpCode + "'" + + ",HModifyEmp ='" + oModel.HMakeEmp + "'" + + ",HModifyTime =getdate()" + + " Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼瀛愰」鐩唬鐮� + //oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", 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_CustLocation_Ctl() + { + MvarItemKey = "Gy_CustLocation"; + MvarReportTitle = "姹囩巼"; + oModel = new Model.ClsGy_CustLocation_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_RateType_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_RateType_Ctl.cs" new file mode 100644 index 0000000..287a640 --- /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_RateType_Ctl.cs" @@ -0,0 +1,103 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace DAL +{ + public class ClsGy_RateType_Ctl : DBUtility.ClsGy_Base_Ctl + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + //鍘熶唬鐮� 鐢ㄤ簬 鏇挎崲瀛愰」鐩� + public string HOldNumber; + public Model.ClsGy_RateType_Model oModel = new Model.ClsGy_RateType_Model(); + //鏂板 + public override bool AddNew() + { + + try + { + oCn.BeginTran(); + oCn.RunProc($@"insert into Gy_RateType(HNumber,HName,HShortNumber ,HParentID ,HLevel + ,HEndFlag ,HStopflag ,HRemark ,HHelpCode ,HUseFlag + ,HMakeTime ,HMakeEmp ,HCheckEmp ,HCheckTime ,HModifyEmp + ,HModifyTime ,HStopEmp ,HStopTime ,HUSEORGID,HCREATEORGID) + values('{oModel.HNumber}','{oModel.HName}','{oModel.HShortNumber}',{oModel.HParentID},{oModel.HLevel} + ,{(oModel.HEndFlag == true ? 1 : 0)},{(oModel.HStopflag == true ? 1 : 0)},'{oModel.HRemark}','{oModel.HHelpCode}','{oModel.HUseFlag}' + ,GETDATE(),'{oModel.HMakeEmp}','','','' + ,'','','',{oModel.HUSEORGID},{oModel.HCREATEORGID})" + , 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 + "'" + + ",HShortNumber='" + oModel.HShortNumber + "'" + + ",HParentID=" + oModel.HParentID.ToString() + + ",HLevel=" + oModel.HLevel.ToString() + + ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) + + ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) + + ",HRemark= '" + oModel.HRemark + "'" + + ",HHelpCode='" + oModel.HHelpCode + "'" + + ",HModifyEmp ='" + oModel.HMakeEmp + "'" + + ",HModifyTime =getdate()" + + " Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼瀛愰」鐩唬鐮� + //oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", 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_RateType_Ctl() + { + MvarItemKey = "Gy_RateType"; + MvarReportTitle = "姹囩巼"; + oModel = new Model.ClsGy_RateType_Model(); + } + } +} diff --git a/Model/Model.csproj b/Model/Model.csproj index 0b380f5..55b9794 100644 --- a/Model/Model.csproj +++ b/Model/Model.csproj @@ -324,6 +324,8 @@ <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_Carbook_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_CareFor_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_CheckToolsType_Model.cs" /> + <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_CustLocation_Model.cs" /> + <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_RateType_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_TaxRate_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_PaymentCondition_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_Company_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_CustLocation_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_CustLocation_Model.cs" new file mode 100644 index 0000000..0b53f6b --- /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_CustLocation_Model.cs" @@ -0,0 +1,20 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Model +{ + public class ClsGy_CustLocation_Model : DBUtility.ClsGy_Base_Model + { + public DateTime HMakeTime { get; set; } + public DateTime HCheckTime { get; set; } + public DateTime HModifyTime { get; set; } + public DateTime HStopTime { get; set; } + public string HMakeEmp { get; set; } + public string HCheckEmp { get; set; } + public string HModifyEmp { get; set; } + public string HStopEmp { get; set; } + public int HUSEORGID { get; set; } + public int HCREATEORGID { 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_RateType_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_RateType_Model.cs" new file mode 100644 index 0000000..51b9d7e --- /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_RateType_Model.cs" @@ -0,0 +1,20 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Model +{ + public class ClsGy_RateType_Model : DBUtility.ClsGy_Base_Model + { + public DateTime HMakeTime { get; set; } + public DateTime HCheckTime { get; set; } + public DateTime HModifyTime { get; set; } + public DateTime HStopTime { get; set; } + public string HMakeEmp { get; set; } + public string HCheckEmp { get; set; } + public string HModifyEmp { get; set; } + public string HStopEmp { get; set; } + public int HUSEORGID { get; set; } + public int HCREATEORGID { get; set; } + } +} 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_CustLocationController.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_CustLocationController.cs" new file mode 100644 index 0000000..12c083a --- /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_CustLocationController.cs" @@ -0,0 +1,346 @@ +锘縰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_CustLocationController : ApiController + { + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + #region 浜よ揣鍦扮偣 鍒楄〃 + [Route("Gy_CustLocation/CustLocationList")] + [HttpGet] + public object CustLocationList(string sWhere, string user, string Organization) + { + try + { + List<object> columnNameList = new List<object>(); + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_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_CustLocationList where 浣跨敤缁勭粐='" + Organization + "'"); + + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_Gy_CustLocationList"); + + //娣诲姞鍒楀悕 + 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.list = columnNameList; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 浜よ揣鍦扮偣 缂栬緫 + [Route("Gy_CustLocation/CustLocationEdit")] + [HttpPost] + public object CustLocationEdit([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(); + Int64 HItemID = 0; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Edit", 1, false, msg2)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + //鑾峰彇鏈�澶D鍊艰祴鍊� + //DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_TaxRate ", "Gy_TaxRate"); + //if (Maxds != null || Maxds.Tables[0].Rows.Count > 0) + //{ + // //HItemID= Maxds.Tables[0].Rows[0]["HItemID"] + // var maxid = Convert.ToInt32((Maxds.Tables[0].Rows[0]["HItemID"].ToString()==""?0: Maxds.Tables[0].Rows[0]["HItemID"])); + // maxid += 1; + // HItemID = maxid; + //} + ListModels oListModels = new ListModels(); + + try + { + DAL.ClsGy_CustLocation_Ctl oBill = new DAL.ClsGy_CustLocation_Ctl(); + List<Model.ClsGy_CustLocation_Model> lsmain = new List<Model.ClsGy_CustLocation_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_CustLocation(msg1); + foreach (Model.ClsGy_CustLocation_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; + } + + //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮� + ds = oCN.RunProcReturn("select * from Gy_CustLocation where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CustLocation"); + if (oItem.HItemID == 0) + { + if (ds.Tables[0].Rows.Count > 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + if (ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HItemID"].ToString() != oItem.HItemID.ToString()) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + + + //鏂板鏃跺垽鏂� + #region 鐖剁骇鏍¢獙鏂规硶锛坅pi璋冪敤鍏堟敞閲婃帀锛岋級 + /* + if (oItem.HItemID == 0) + { + if (ds == null || ds.Tables[0].Rows.Count > 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + else//缂栬緫鏃跺垽鏂� + { + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + */ + #endregion + //寰楀埌鐭唬鐮� + string sShortNumber; + sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); + if (sShortNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + //oItem.HUSEORGID = Convert.ToInt32(msg_HUSEORGID); //缁勭粐id + oItem.HShortNumber = sShortNumber;//鐭唬鐮� + oItem.HEndFlag = true;//鏈骇鏍囧織 + oItem.HLevel = 1; //绛夌骇 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 = "淇濆瓨鎴愬姛锛�"; + //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) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + #endregion + + #region 浜よ揣鍦扮偣 鍒犻櫎 + [Route("Gy_CustLocation/Delete")] + [HttpGet] + public object Delete(string HItemID, string user) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + //鍒犻櫎鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Gy_TaxRate_Drop", 1, false, user)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + 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_CustLocation where HItemID=" + HItemID, "Gy_CustLocation"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); + if (HStopflag) + { + oCN.RollBack();//鍥炴粴浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏁版嵁宸茬鐢ㄦ棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.RunProc("delete from Gy_CustLocation 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 + } +} \ No newline at end of file diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_RateTypeController.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_RateTypeController.cs" new file mode 100644 index 0000000..e461863 --- /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_RateTypeController.cs" @@ -0,0 +1,346 @@ +锘縰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_RateTypeController : ApiController + { + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + #region 姹囩巼 鍒楄〃 + [Route("Gy_RateType/RateTypeList")] + [HttpGet] + public object RateTypeList(string sWhere, string user, string Organization) + { + try + { + List<object> columnNameList = new List<object>(); + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_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_RateTypeList where 浣跨敤缁勭粐='" + Organization + "'"); + + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_Gy_RateTypeList"); + + //娣诲姞鍒楀悕 + 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.list = columnNameList; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 姹囩巼 缂栬緫 + [Route("Gy_RateType/RateTypeEdit")] + [HttpPost] + public object RateTypeEdit([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(); + Int64 HItemID = 0; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Edit", 1, false, msg2)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + //鑾峰彇鏈�澶D鍊艰祴鍊� + //DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_TaxRate ", "Gy_TaxRate"); + //if (Maxds != null || Maxds.Tables[0].Rows.Count > 0) + //{ + // //HItemID= Maxds.Tables[0].Rows[0]["HItemID"] + // var maxid = Convert.ToInt32((Maxds.Tables[0].Rows[0]["HItemID"].ToString()==""?0: Maxds.Tables[0].Rows[0]["HItemID"])); + // maxid += 1; + // HItemID = maxid; + //} + ListModels oListModels = new ListModels(); + + try + { + DAL.ClsGy_RateType_Ctl oBill = new DAL.ClsGy_RateType_Ctl(); + List<Model.ClsGy_RateType_Model> lsmain = new List<Model.ClsGy_RateType_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_RateType(msg1); + foreach (Model.ClsGy_RateType_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; + } + + //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮� + ds = oCN.RunProcReturn("select * from Gy_RateType where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_RateType"); + if (oItem.HItemID == 0) + { + if (ds.Tables[0].Rows.Count > 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + if (ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HItemID"].ToString() != oItem.HItemID.ToString()) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + + + //鏂板鏃跺垽鏂� + #region 鐖剁骇鏍¢獙鏂规硶锛坅pi璋冪敤鍏堟敞閲婃帀锛岋級 + /* + if (oItem.HItemID == 0) + { + if (ds == null || ds.Tables[0].Rows.Count > 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + else//缂栬緫鏃跺垽鏂� + { + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + */ + #endregion + //寰楀埌鐭唬鐮� + string sShortNumber; + sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); + if (sShortNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + //oItem.HUSEORGID = Convert.ToInt32(msg_HUSEORGID); //缁勭粐id + oItem.HShortNumber = sShortNumber;//鐭唬鐮� + oItem.HEndFlag = true;//鏈骇鏍囧織 + oItem.HLevel = 1; //绛夌骇 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 = "淇濆瓨鎴愬姛锛�"; + //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) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + #endregion + + #region 姹囩巼 鍒犻櫎 + [Route("Gy_RateType/Delete")] + [HttpGet] + public object Delete(string HItemID, string user) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + //鍒犻櫎鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Gy_TaxRate_Drop", 1, false, user)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + 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_RateType where HItemID=" + HItemID, "Gy_RateType"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); + if (HStopflag) + { + oCN.RollBack();//鍥炴粴浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏁版嵁宸茬鐢ㄦ棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.RunProc("delete from Gy_RateType 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 + } +} \ No newline at end of file diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs index 8f87506..ad55bde 100644 --- a/WebAPI/ListModels.cs +++ b/WebAPI/ListModels.cs @@ -885,6 +885,30 @@ } /// <summary> + /// 澶勭悊姹囩巼琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsGy_RateType_Model> getObjectByJson_Gy_RateType(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsGy_RateType_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_RateType_Model>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊浜よ揣鍦扮偣琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsGy_CustLocation_Model> getObjectByJson_Gy_CustLocation(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsGy_CustLocation_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_CustLocation_Model>>(jsonString); + return list; + } + + /// <summary> /// 澶勭悊鏀舵鏉′欢琛ㄧ殑json /// </summary> /// <param name="jsonString"></param> diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj index 6f7c654..79619d3 100644 --- a/WebAPI/WebAPI.csproj +++ b/WebAPI/WebAPI.csproj @@ -444,8 +444,10 @@ <Compile Include="Controllers\浠撳瓨绠$悊\楠屾敹鍏ュ簱\Kf_StepFoldinBillController.cs" /> <Compile Include="Controllers\鍗氭棩鑷姩鎵爜绾縗ScanlineAPIController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_COMMONCONTACTBillController.cs" /> + <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_CustLocationController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_DutyBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_PaymentConditionListBillController.cs" /> + <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_RateTypeController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_RecConditionBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_SOPBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_SOPBillEditController.cs" /> @@ -884,12 +886,14 @@ <Folder Include="Views\Cj_SendGoodsBill\" /> <Folder Include="Views\Gy_COMMONCONTACTBill\" /> <Folder Include="Views\Gy_ConkType\" /> + <Folder Include="Views\Gy_CustLocation\" /> <Folder Include="Views\Gy_DutyBill\" /> <Folder Include="Views\Gy_EquipType\" /> <Folder Include="Views\Gy_ICBomBill\" /> <Folder Include="Views\Gy_MateMould\" /> <Folder Include="Views\Gy_PackType\" /> <Folder Include="Views\Gy_PaymentConditionListBill\" /> + <Folder Include="Views\Gy_RateType\" /> <Folder Include="Views\Gy_RecConditionBill\" /> <Folder Include="Views\Gy_RoutingGroup\" /> <Folder Include="Views\Gy_SOPBill\" /> -- Gitblit v1.9.1