From ccfc7f25cbb5e78d335b44648a9964426a38a17f Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期四, 15 十二月 2022 09:54:05 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- Model/基础资料/其他基础资料/ClsGy_MatePriceSup_Model.cs | 2 DAL/基础资料/公用基础资料/ClsGy_Operator_Ctl.cs | 97 + WebAPI/Controllers/基础资料/基础资料/Gy_MatePriceSupController.cs | 332 +++++ DAL/基础资料/公用基础资料/ClsGy_Staff_Ctl.cs | 99 + WebAPI/Controllers/基础资料/基础资料/Gy_OperatorController.cs | 393 ++++++ Model/基础资料/基础资料/ClsGy_Property_Model.cs | 5 WebAPI/Controllers/BLL/Xt_BillTypeController.cs | 44 WebAPI/Controllers/基础资料/基础资料/Gy_StaffController.cs | 395 ++++++ Model/Model.csproj | 6 Model/系统公用/ClsXt_BillType_Model.cs | 18 Model/基础资料/基础资料/ClsGy_Work_Model.cs | 16 WebAPI/Controllers/BaseSet/Gy_PropertyController.cs | 324 +++++ WebAPI/Controllers/BaseSet/Gy_EmployeeController.cs | 58 BaseSet/公用资料/其他基础资料/Gy_MatePriceSup.cs | 2 DAL/基础资料/其他基础资料/ClsGy_MatePriceSup_Ctl.cs | 62 WebAPI/Controllers/基础资料/基础资料/Gy_WorkController.cs | 392 ++++++ WebAPI/Controllers/基础资料/基础资料/Gy_TaxMIXController.cs | 416 ++++++ WebAPI/Models/基础资料/Warehouse.cs | 1 DAL/基础资料/公用基础资料/ClsGy_Property_Ctl.cs | 4 WebAPI/Controllers/BaseSet/Gy_UnitController.cs | 4 Model/基础资料/基础资料/ClsGy_TaxMIXMain_Model.cs | 21 Model/基础资料/基础资料/ClsGy_TaxMIXSub_Model.cs | 16 Model/基础资料/基础资料/ClsGy_Operator_Model.cs | 19 Model/基础资料/基础资料/ClsGy_Unit_Model.cs | 1 WebAPI/Controllers/基础资料/基础资料/Gy_CustLocationController.cs | 50 WebAPI/Models/基础资料/Gy_StockPlace.cs | 34 Model/基础资料/基础资料/ClsGy_Staff_Model.cs | 20 DAL/基础资料/公用基础资料/ClsGy_Work_Ctl.cs | 98 + WebAPI/Controllers/基础资料/基础资料/Gy_SettleStyleController.cs | 393 ++++++ WebAPI/ListModels.cs | 96 + DAL/DAL.csproj | 3 WebAPI/Controllers/BaseSet/Gy_ICBomBillController.cs | 84 + Model/基础资料/基础资料/ClsGy_Employee_Model.cs | 2 WebAPI/WebAPI.csproj | 14 WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs | 27 35 files changed, 3,462 insertions(+), 86 deletions(-) diff --git "a/BaseSet/\345\205\254\347\224\250\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MatePriceSup.cs" "b/BaseSet/\345\205\254\347\224\250\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MatePriceSup.cs" index 37a7e56..6516ad6 100644 --- "a/BaseSet/\345\205\254\347\224\250\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MatePriceSup.cs" +++ "b/BaseSet/\345\205\254\347\224\250\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MatePriceSup.cs" @@ -553,7 +553,7 @@ oSub.HPrice = ClsPub.isDoule(grdMain.Rows[i].Cells[HPriceCol].Value); oSub.HBeginDate = ClsPub.isDate(grdMain.Rows[i].Cells[HBeginDateCol].Value); oSub.HEndDate = ClsPub.isDate(grdMain.Rows[i].Cells[HEndDateCol].Value); - oSub.HUsed = true; + oSub.HUsed = 1; oSub.HMaker = ClsPub.CurUserName; oSub.HMakeDate = DBUtility.ClsPub.isDate(ClsPub.GetServerDate(-1)); BillNew.DetailColl.Add(oSub); diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj index 3d8474e..a011b5f 100644 --- a/DAL/DAL.csproj +++ b/DAL/DAL.csproj @@ -85,7 +85,9 @@ <Compile Include="浠撳簱绠$悊\鏉$爜绠$悊\ClsGy_BarCodeBill_ChaiMa.cs" /> <Compile Include="鍩虹璧勬枡\InterFace鍩虹璧勬枡\ClsIF_ORGANIZATIONS_View.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_CustLocation_Ctl.cs" /> + <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_Operator_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_RateType_Ctl.cs" /> + <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_Staff_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_TaxRate_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_RecCondition_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_FactoryDayOff_Ctl.cs" /> @@ -94,6 +96,7 @@ <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_PaymentCondition_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_SupplierContact_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_StockStatus_Ctl.cs" /> + <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_Work_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_MateMould_Ctl.cs" /> <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_QCCheckProject_View.cs" /> <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_StdWorkTimes_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_Operator_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_Operator_Ctl.cs" new file mode 100644 index 0000000..6e2329f --- /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_Operator_Ctl.cs" @@ -0,0 +1,97 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace DAL +{ + public class ClsGy_Operator_Ctl : DBUtility.ClsGy_Base_Ctl + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + //鍘熶唬鐮� 鐢ㄤ簬 鏇挎崲瀛愰」鐩� + public string HOldNumber; + public Model.ClsGy_Operator_Model oModel = new Model.ClsGy_Operator_Model(); + //鏂板 + public override bool AddNew() + { + + try + { + oCn.BeginTran(); + oCn.RunProc("Insert into " + MvarItemKey + " " + + " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + + ",HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HUSEORGID" + + ",HOperatorId,HOperatorType,HSEQ,HStaffId,HIsUse) " + + " 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.HUseFlag + "'," + oModel.HUSEORGID + "," + oModel.HOperatorId + + ",'" + oModel.HOperatorType + "'," + oModel.HSEQ + "," + oModel.HStaffId + "," + oModel.HIsUse + ")", 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 + "'" + + ",HHelpCode='" + oModel.HHelpCode + "'" + + ",HLevel=" + oModel.HLevel.ToString() + + ",HParentID=" + oModel.HParentID.ToString() + + ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) + + ",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_Operator_Ctl() + { + MvarItemKey = "Gy_Operator"; + MvarReportTitle = "涓氬姟鍛樿缃�"; + oModel = new Model.ClsGy_Operator_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_Property_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_Property_Ctl.cs" index 261e10f..77f8c31 100644 --- "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_Property_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_Property_Ctl.cs" @@ -20,9 +20,9 @@ oCn.BeginTran(); oCn.RunProc("Insert into " + MvarItemKey + " " + " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + - ",HLevel,HEndFlag,HStopflag,HRemark,HPropertyTypeID) " + + ",HLevel,HEndFlag,HStopflag,HRemark,HPropertyTypeID,HUSEORGID,HCREATEORGID) " + " 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.HPropertyTypeID.ToString() + ")", ref DBUtility.ClsPub.sExeReturnInfo); + "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "'," + oModel.HPropertyTypeID.ToString() + "," + 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(); 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_Staff_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_Staff_Ctl.cs" new file mode 100644 index 0000000..895d1f7 --- /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_Staff_Ctl.cs" @@ -0,0 +1,99 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace DAL +{ + public class ClsGy_Staff_Ctl : DBUtility.ClsGy_Base_Ctl + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + //鍘熶唬鐮� 鐢ㄤ簬 鏇挎崲瀛愰」鐩� + public string HOldNumber; + public Model.ClsGy_Staff_Model oModel = new Model.ClsGy_Staff_Model(); + //鏂板 + public override bool AddNew() + { + + try + { + oCn.BeginTran(); + oCn.RunProc("Insert into " + MvarItemKey + " " + + " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + + ",HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HUSEORGID" + + ",HCREATEORGID,HPERSONID,HPOSTID,HFIRSTCARDID,HDEPTID,HSTAFFNUMBER) " + + " 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.HUseFlag + "'," + oModel.HUSEORGID + "," + oModel.HCREATEORGID + + "," + oModel.HPERSONID + "," + oModel.HPOSTID + "," + oModel.HFIRSTCARDID + "," + oModel.HDEPTID + + ",'" + oModel.HSTAFFNUMBER + "')", 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 + "'" + + ",HHelpCode='" + oModel.HHelpCode + "'" + + ",HLevel=" + oModel.HLevel.ToString() + + ",HParentID=" + oModel.HParentID.ToString() + + ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) + + ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) + + ",HRemark= '" + oModel.HRemark + "'" + + ",HDEPTID=" + oModel.HDEPTID + " 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_Staff_Ctl() + { + MvarItemKey = "Gy_Staff"; + MvarReportTitle = "鍛樺伐璁剧疆"; + oModel = new Model.ClsGy_Staff_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_Work_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_Work_Ctl.cs" new file mode 100644 index 0000000..9bab672 --- /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_Work_Ctl.cs" @@ -0,0 +1,98 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace DAL +{ + public class ClsGy_Work_Ctl : DBUtility.ClsGy_Base_Ctl + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + //鍘熶唬鐮� 鐢ㄤ簬 鏇挎崲瀛愰」鐩� + public string HOldNumber; + public Model.ClsGy_Work_Model oModel = new Model.ClsGy_Work_Model(); + //鏂板 + public override bool AddNew() + { + + try + { + oCn.BeginTran(); + oCn.RunProc("Insert into " + MvarItemKey + " " + + " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + + ",HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HUSEORGID" + + ",HCREATEORGID,HWORKCENTERID) " + + " 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.HUseFlag + "'," + oModel.HUSEORGID + "," + oModel.HCREATEORGID + + "," + oModel.HWORKCENTERID + ")", 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 + "'" + + ",HHelpCode='" + oModel.HHelpCode + "'" + + ",HLevel=" + oModel.HLevel.ToString() + + ",HParentID=" + oModel.HParentID.ToString() + + ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) + + ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) + + ",HRemark= '" + oModel.HRemark + "'" + + ",HWORKCENTERID=" + oModel.HWORKCENTERID + " 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_Work_Ctl() + { + MvarItemKey = "Gy_Work"; + MvarReportTitle = "浣滀笟璁剧疆"; + oModel = new Model.ClsGy_Work_Model(); + } + } +} diff --git "a/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MatePriceSup_Ctl.cs" "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MatePriceSup_Ctl.cs" index 8ac0595..32c854b 100644 --- "a/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MatePriceSup_Ctl.cs" +++ "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MatePriceSup_Ctl.cs" @@ -11,6 +11,7 @@ //鍘熶唬鐮� 鐢ㄤ簬 鏇挎崲瀛愰」鐩� public string HOldNumber; public List<Model.ClsGy_MatePriceSup_Model> DetailColl = new List<Model.ClsGy_MatePriceSup_Model>(); + public Model.ClsGy_MatePriceSup_Model oModel = new Model.ClsGy_MatePriceSup_Model(); @@ -58,17 +59,26 @@ try { oCn.BeginTran(); - //鎻掑叆瀛愯〃 - foreach (Model.ClsGy_MatePriceSup_Model oSub in DetailColl) - { - oCn.RunProc("Insert into Gy_MatePriceSup " + - " (HInterID,HEntryID,HMaterID,HRelationID" + + //鎻掑叆琛� + //foreach (Model.ClsGy_MatePriceSup_Model oSub in DetailColl) + //{ + // oCn.RunProc("Insert into Gy_MatePriceSup " + + // " (HInterID,HEntryID,HMaterID,HRelationID" + + // ",HUnitID,HBeginQty,HEndQty,HCurID,HType" + + // ",HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate)" + + // " values(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HRelationID.ToString() + + // "," + oSub.HUnitID.ToString() + "," + oSub.HBeginQty.ToString() + "," + oSub.HEndQty.ToString() + "," + oSub.HCurID.ToString() + ",'" + oSub.HType + "'" + + // "," + oSub.HPrice.ToString() + ",'" + "GETDATE()" + "','" + "GETDATE()" + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "') "); + //} + oCn.RunProc("Insert into " + MvarItemKey + " " + + " (HInterID,HEntryID,HMaterID,HRelationID" + ",HUnitID,HBeginQty,HEndQty,HCurID,HType" + - ",HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate)" + - " values(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HRelationID.ToString() + - "," + oSub.HUnitID.ToString() + "," + oSub.HBeginQty.ToString() + "," + oSub.HEndQty.ToString() + "," + oSub.HCurID.ToString() + ",'" + oSub.HType + "'" + - "," + oSub.HPrice.ToString() + ",'" + oSub.HBeginDate + "','" + oSub.HEndDate + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "') "); - } + ",HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate) " + + " values(" + oModel.HInterID.ToString() + "," + oModel.HEntryID.ToString() + "," + oModel.HMaterID.ToString() + "," + oModel.HRelationID.ToString() + + "," + oModel.HUnitID.ToString() + "," + oModel.HBeginQty.ToString() + "," + oModel.HEndQty.ToString() + "," + oModel.HCurID.ToString() + ",'" + oModel.HType + "'" + + "," + oModel.HPrice.ToString() + ",'" + oModel.HBeginDate + "','" + oModel.HEndDate + "'," + oModel.HUsed + ",'" + oModel.HRemark + "','" + oModel.HMaker + "','" + oModel.HMakeDate + "') "); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + //oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo); oCn.Commit(); return true; } @@ -85,18 +95,25 @@ try { oCn.BeginTran(); - DeleteByID(sItemID); //鍒犻櫎璁板綍 - //鎻掑叆琛� - foreach (Model.ClsGy_MatePriceSup_Model oSub in DetailColl) - { - oCn.RunProc("Insert into Gy_MatePriceSup " + - " (HInterID,HEntryID,HMaterID,HRelationID" + - ",HUnitID,HBeginQty,HEndQty,HCurID,HType" + - ",HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate)" + - " values(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HRelationID.ToString() + - "," + oSub.HUnitID.ToString() + "," + oSub.HBeginQty.ToString() + "," + oSub.HEndQty.ToString() + "," + oSub.HCurID.ToString() + ",'" + oSub.HType + "'" + - "," + oSub.HPrice.ToString() + ",'" + oSub.HBeginDate + "','" + oSub.HEndDate + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "') "); - } + oCn.RunProc("Update " + MvarItemKey + " set " + + " HPrice='" + oModel.HPrice + "'" + + ",HRemark='" + oModel.HRemark + "'" + + ",HMaterID=" + oModel.HMaterID.ToString() + + ",HUnitID=" + oModel.HUnitID.ToString() + + ",HCurID=" + oModel.HCurID.ToString() + + " Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo); + //DeleteByID(sItemID); //鍒犻櫎璁板綍 + ////鎻掑叆琛� + //foreach (Model.ClsGy_MatePriceSup_Model oSub in DetailColl) + //{ + // oCn.RunProc("Insert into Gy_MatePriceSup " + + // " (HInterID,HEntryID,HMaterID,HRelationID" + + // ",HUnitID,HBeginQty,HEndQty,HCurID,HType" + + // ",HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate)" + + // " values(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HRelationID.ToString() + + // "," + oSub.HUnitID.ToString() + "," + oSub.HBeginQty.ToString() + "," + oSub.HEndQty.ToString() + "," + oSub.HCurID.ToString() + ",'" + oSub.HType + "'" + + // "," + oSub.HPrice.ToString() + ",'" + oSub.HBeginDate + "','" + oSub.HEndDate + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "') "); + //} oCn.Commit(); return true; } @@ -190,6 +207,7 @@ { MvarItemKey = "Gy_MatePriceSup"; MvarReportTitle = "閲囪喘浠锋牸璧勬枡璁剧疆"; + oModel = new Model.ClsGy_MatePriceSup_Model(); } } } diff --git a/Model/Model.csproj b/Model/Model.csproj index 55b9794..364ced3 100644 --- a/Model/Model.csproj +++ b/Model/Model.csproj @@ -325,7 +325,11 @@ <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_CareFor_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_CheckToolsType_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_CustLocation_Model.cs" /> + <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_Operator_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_RateType_Model.cs" /> + <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_Staff_Model.cs" /> + <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_TaxMIXMain_Model.cs" /> + <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_TaxMIXSub_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_TaxRate_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_PaymentCondition_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_Company_Model.cs" /> @@ -399,6 +403,7 @@ <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_BarCodeCheckType_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_Item30JiTai_Model.cs" /> <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_User_Model.cs" /> + <Compile Include="鍩虹璧勬枡\鍩虹璧勬枡\ClsGy_Work_Model.cs" /> <Compile Include="宸ヤ綅鐪嬫澘\ClsGy_SOPBillMain.cs" /> <Compile Include="宸ヤ綅鐪嬫澘\ClsGy_SOPBillSub.cs" /> <Compile Include="宸ヨ祫绠$悊\ClsHR_EmpDimissionBillMain.cs" /> @@ -584,6 +589,7 @@ <Compile Include="绯荤粺鍏敤\ClsOA_EmpMessageBillModSub.cs" /> <Compile Include="绯荤粺鍏敤\ClsOA_FieldToChangeMain.cs" /> <Compile Include="绯荤粺鍏敤\ClsOA_FieldToChangeSub.cs" /> + <Compile Include="绯荤粺鍏敤\ClsXt_BillType_Model.cs" /> <Compile Include="绯荤粺鍏敤\ClsXt_ModuleParameterMain.cs" /> <Compile Include="绯荤粺鍏敤\ClsXt_ModuleParameterSub.cs" /> <Compile Include="琛屾斂绠$悊\ClsOF_DormCheckBookBillMain.cs" /> diff --git "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MatePriceSup_Model.cs" "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MatePriceSup_Model.cs" index 2f59f77..2f53708 100644 --- "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MatePriceSup_Model.cs" +++ "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MatePriceSup_Model.cs" @@ -16,7 +16,7 @@ public DateTime HMakeDate;// datetime public string HChecker;// varchar(50) --审核人(列表可批量审核) public DateTime HCheckDate;// datetime - public bool HUsed;// bit //使用标记 + public long HUsed;// bit //使用标记 //-------------------------------------------- public long HMaterID;// int --物料内码 public long HRelationID;// int --关联内码(供应商,客户,供应商大类,客户大类,等等) 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_Employee_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_Employee_Model.cs" index 35c4fd6..340f1f3 100644 --- "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_Employee_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_Employee_Model.cs" @@ -99,5 +99,7 @@ public string HAddress ; //家庭地址 varchar(300) public Int64 HProcID; //int 所作工序(关联出生产资源) public string HBarCode; + + public long HUSEORGID; } } 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_Operator_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_Operator_Model.cs" new file mode 100644 index 0000000..a6ec2fe --- /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_Operator_Model.cs" @@ -0,0 +1,19 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Model +{ + public class ClsGy_Operator_Model : DBUtility.ClsGy_Base_Model + { + public string HHelpCode;//鍔╄鐮� + public string HUseFlag; //浣跨敤鐘舵�侊紙鏈娴嬶紝鏈娇鐢紝宸蹭娇鐢級 + public Int64 HUSEORGID;//涓氬姟缁勭粐 + public Int64 HOperatorId;//涓氬姟鍛樺唴鐮� + public string HOperatorType;//涓氬姟鍛樼被鍨� + public Int64 HSEQ;//搴忓彿 + public Int64 HStaffId;//鑱屽憳 + public Int64 HIsUse;//鍚敤 + } +} 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_Property_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_Property_Model.cs" index 9514bbb..ec04e8d 100644 --- "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_Property_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_Property_Model.cs" @@ -9,5 +9,10 @@ // public Int64 HPropertyTypeID;// int 所属类别 public string HBarCode; + public Int64 HERPItemID; + public string HMakeTime; + + public Int64 HUSEORGID;//使用组织 + public Int64 HCREATEORGID;//创建组织 } } 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_Staff_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_Staff_Model.cs" new file mode 100644 index 0000000..38e7217 --- /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_Staff_Model.cs" @@ -0,0 +1,20 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Model +{ + public class ClsGy_Staff_Model : DBUtility.ClsGy_Base_Model + { + + public Int64 HUSEORGID; //浣跨敤缁勭粐锛圶t_ORGANIZATIONS锛� + public Int64 HCREATEORGID; //鍒涘缓缁勭粐锛圶t_ORGANIZATIONS锛� + public Int64 HPERSONID; //浜哄憳鍐呯爜 + public Int64 HPOSTID; //宀椾綅鍐呯爜 + public Int64 HFIRSTCARDID; //涓昏瘉浠跺唴鐮� + public Int64 HDEPTID; //閮ㄩ棬鍐呯爜 + public string HSTAFFNUMBER; //鍛樺伐缂栧彿 + + } +} 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_TaxMIXMain_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_TaxMIXMain_Model.cs" new file mode 100644 index 0000000..8cc2a7a --- /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_TaxMIXMain_Model.cs" @@ -0,0 +1,21 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Model +{ + public class ClsGy_TaxMIXMain_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_TaxMIXSub_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_TaxMIXSub_Model.cs" new file mode 100644 index 0000000..f6454ab --- /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_TaxMIXSub_Model.cs" @@ -0,0 +1,16 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Model +{ + public class ClsGy_TaxMIXSub_Model : DBUtility.ClsGy_Base_Model + { + public Int64 HItemID; //涓婚敭 int + public string HTAXBENCHMARK; + public Int64 FTAXRATEID; + public double FTAXBENCHMARKCORRVALUE; + public Int64 HTAXMIXID; + } +} 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_Unit_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_Unit_Model.cs" index ca71b4e..7772327 100644 --- "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_Unit_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_Unit_Model.cs" @@ -11,5 +11,6 @@ public bool HStandard;// '默认 public string HBarCode; public int HUSEORGID; + public int HCREATEORGID; } } 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_Work_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_Work_Model.cs" new file mode 100644 index 0000000..9d6f07e --- /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_Work_Model.cs" @@ -0,0 +1,16 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Model +{ + public class ClsGy_Work_Model : DBUtility.ClsGy_Base_Model + { + + public Int64 HUSEORGID; //浣跨敤缁勭粐锛圶t_ORGANIZATIONS锛� + public Int64 HCREATEORGID;//鍒涘缓缁勭粐锛圶t_ORGANIZATIONS锛� + public Int64 HWORKCENTERID;//宸ヤ綔涓績 + + } +} diff --git "a/Model/\347\263\273\347\273\237\345\205\254\347\224\250/ClsXt_BillType_Model.cs" "b/Model/\347\263\273\347\273\237\345\205\254\347\224\250/ClsXt_BillType_Model.cs" new file mode 100644 index 0000000..c5e7656 --- /dev/null +++ "b/Model/\347\263\273\347\273\237\345\205\254\347\224\250/ClsXt_BillType_Model.cs" @@ -0,0 +1,18 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Model +{ + public class ClsXt_BillType_Model : DBUtility.ClsGy_Base_Model + { + public string HTemplate; //妯″潡鍚� + public string HHeadTable; //鏁版嵁搴撲富琛� + public string HEntryTable; //鏁版嵁搴撳瓙琛� + public string HViewName; + public string HRightName; + + public string HBilltypeID; + } +} diff --git a/WebAPI/Controllers/BLL/Xt_BillTypeController.cs b/WebAPI/Controllers/BLL/Xt_BillTypeController.cs index 00d594e..c8947ff 100644 --- a/WebAPI/Controllers/BLL/Xt_BillTypeController.cs +++ b/WebAPI/Controllers/BLL/Xt_BillTypeController.cs @@ -268,7 +268,49 @@ } } + #region 鍗曟嵁绫诲瀷 閲戣澏鍚屾 + [Route("Xt_BillType/SaveXt_BillTypeListApi")] + [HttpPost] + public object SaveXt_BillTypeListApi([FromBody] JObject msg) + { + try + { + var _value = msg["model"].ToString(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + ListModels oListModels = new ListModels(); + List<Model.ClsXt_BillType_Model> lsmain = new List<Model.ClsXt_BillType_Model>(); + lsmain = oListModels.getObjectByJson_Xt_BillType(_value); + string sql = string.Empty; + //淇濆瓨 + oCN.BeginTran(); + sql = $"delete Xt_BillType where HItemID = {lsmain[0].HItemID}"; + oCN.RunProc(sql); + //sql = "set identity_insert Xt_BillType on"; + //oCN.RunProc(sql); - // + oCN.RunProc($@"insert into Xt_BillType(HBilltypeID,HNumber,HName,HTemplate,HHeadTable,HEntryTable,HViewName,HRightName) + values('{lsmain[0].HBilltypeID}','{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HTemplate}','{lsmain[0].HHeadTable}','{lsmain[0].HEntryTable}','{lsmain[0].HViewName}','{lsmain[0].HRightName}' )", ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + sql = "set identity_insert Xt_BillType off"; + oCN.RunProc(sql); + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + #endregion + } } \ No newline at end of file diff --git a/WebAPI/Controllers/BaseSet/Gy_EmployeeController.cs b/WebAPI/Controllers/BaseSet/Gy_EmployeeController.cs index f993172..23aa552 100644 --- a/WebAPI/Controllers/BaseSet/Gy_EmployeeController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_EmployeeController.cs @@ -891,7 +891,65 @@ } } + #region 鑱屽憳 閲戣澏鍚屾 + [Route("Gy_Employee/SaveGy_EmployeeListApi")] + [HttpPost] + public object SaveGy_EmployeeListApi([FromBody] JObject msg) + { + try + { + var _value = msg["model"].ToString(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + ListModels oListModels = new ListModels(); + List<Model.ClsGy_Employee_Model> lsmain = new List<Model.ClsGy_Employee_Model>(); + lsmain = oListModels.getObjectByJson_Gy_Employee(_value); + string sql = string.Empty; + //淇濆瓨 + oCN.BeginTran(); + sql = $"delete Gy_Employee where HItemID = {lsmain[0].HItemID}"; + oCN.RunProc(sql); + sql = "set identity_insert Gy_Employee on"; + oCN.RunProc(sql); + oCN.RunProc($@"insert into Gy_Employee(HItemID,HNumber, HName, HShortNumber, HEmpRate, HExamRate + ,HLevel,HParentID,HEndflag,HHighestPay,HOverPayRate + ,HStopflag,HRemark,HHelpCode,HInsuranceSubsidy + ,HBirthday,HGradDate,HInsuranceDate,HContractBDate,HContractEDate + ,HJobCardEDate,HCheckCardEDate,HStayCardEDate,HHealthCardEDate + ,HAge,HSalaryLev,HContractYear,HInsuranceStatus,HSignStatus + ,HSex,HMarr,HBlighty,HNation,HBlightyType + ,HGovStatus,HBloodType,HStature,HAvoird,HKnowLev + ,HProTitleID,HGradSchool,HEngLev,HCompLev,HSpec + ,HEmail,HNowAdd,HHomeAdd,HIDCard,HLinkPhone,HMobilePhone,HFax + ,HOldCompany,HInsuranceNo,HJobCardNo,HArchivesNo,HWorkType,HDimissionReason + ,HDimissionDate,HInComDate,HSignDate,HRelDate + ,HPostID,HDormID,HDutyID,HLeftMoneyRate + ,HEmpType,HPayType,HOverType,HNoBrushFlag,HShiftFlag,HStopwagesFlag + ,HPostalCode,HBank,HBasePay,HExamLevPostMoney,HBSTDeptID + ,HOtherDeduct3,HInsurance,HMedicare,HDrydock + ,HBankAccount,HGroupID,HDeptID,HWorkTypeID,HCTPrjID,HUSEORGID,HAddress) + values({lsmain[0].HItemID},'{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HShortNumber}',{lsmain[0].HEmpRate},{lsmain[0].HExamRate},{lsmain[0].HLevel},{lsmain[0].HParentID},{Convert.ToString(lsmain[0].HEndFlag ? 1 : 0)},{lsmain[0].HHighestPay},{lsmain[0].HOverPayRate},{Convert.ToString(lsmain[0].HStopflag ? 1 : 0) },'{lsmain[0].HRemark}','{lsmain[0].HHelpCode}',{lsmain[0].HInsuranceSubsidy},'{lsmain[0].HBirthDay}','{lsmain[0].HGradDate}','{lsmain[0].HInsuranceDate}','{lsmain[0].HContractBDate}','{lsmain[0].HContractEDate}','{lsmain[0].HJobCardEDate}','{lsmain[0].HCheckCardEDate}','{lsmain[0].HStayCardEDate}','{lsmain[0].HHealthCardEDate}',{lsmain[0].HAge},'{lsmain[0].HSalaryLev}',{lsmain[0].HContractYear},{lsmain[0].HInsuranceStatus},{lsmain[0].HSignStatus},'{lsmain[0].HSex}','{lsmain[0].HMarr}','{lsmain[0].HBlighty}','{lsmain[0].HNation}','{lsmain[0].HBlightyType}','{lsmain[0].HGovStatus}','{lsmain[0].HBloodType}','{lsmain[0].HStature}','{lsmain[0].HAvoird}','{lsmain[0].HKnowLev}','{lsmain[0].HProTitleID}','{lsmain[0].HGradSchool}','{lsmain[0].HEngLev}','{lsmain[0].HCompLev}','{lsmain[0].HSpec}','{lsmain[0].HEmail}','{lsmain[0].HNowAdd}','{lsmain[0].HHomeAdd}','{lsmain[0].HIDCard}','{lsmain[0].HLinkPhone}','{lsmain[0].HMobilePhone}','{lsmain[0].HFax}','{lsmain[0].HOldCompany}','{lsmain[0].HInsuranceNo}','{lsmain[0].HJobCardNo}','{lsmain[0].HArchivesNo}','{lsmain[0].HWorkType}','{lsmain[0].HDimissionReason}','{lsmain[0].HDimissionDate}','{lsmain[0].HInComDate}','{lsmain[0].HSignDate}','{lsmain[0].HRelDate}',{lsmain[0].HPostID},{lsmain[0].HDormID},{lsmain[0].HDutyID},{lsmain[0].HLeftMoneyRate},'{lsmain[0].HEmpType}','{lsmain[0].HPayType}','{lsmain[0].HOverType}',{lsmain[0].HNoBrushFlag},{lsmain[0].HShiftFlag},{lsmain[0].HStopwagesFlag},'{lsmain[0].HPostalCode}','{lsmain[0].HBank}',{lsmain[0].HBasePay},{lsmain[0].HExamLevPostMoney},{lsmain[0].HBSTDeptID},{lsmain[0].HOtherDeduct3},{lsmain[0].HInsurance},{lsmain[0].HMedicare},{lsmain[0].HDrydock},'{lsmain[0].HBankAccount}',{lsmain[0].HGroupID},{lsmain[0].HDeptID},{lsmain[0].HWorkTypeID},{lsmain[0].HCTPrjID},{lsmain[0].HUSEORGID},'{lsmain[0].HAddress}')", ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + sql = "set identity_insert Gy_Employee off"; + oCN.RunProc(sql); + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + #endregion } } \ No newline at end of file diff --git a/WebAPI/Controllers/BaseSet/Gy_ICBomBillController.cs b/WebAPI/Controllers/BaseSet/Gy_ICBomBillController.cs new file mode 100644 index 0000000..a70b248 --- /dev/null +++ b/WebAPI/Controllers/BaseSet/Gy_ICBomBillController.cs @@ -0,0 +1,84 @@ +锘縰sing Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Pub_Class; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Web.Http; +using WebAPI.Models; +namespace WebAPI.Controllers +{ + public class Gy_ICBomBillController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + [Route("Gy_ICBomBill/Gy_ICBomBillaveApi")] + [HttpPost] + public object Gy_ICBomBillaveApi([FromBody] JObject oMain) + { + try + { + var model = oMain["model"].ToString(); + var subModel = oMain["model"]["HENTRY"].ToString(); + //鍙嶅簭鍒楀寲 + model = "[" + model + "]"; + List<Model.ClsGy_ICBomBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_ICBomBillMain>>(model); + List<Model.ClsGy_ICBomBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_ICBomBillSub>>(subModel); + string sql = string.Empty; + oCN.BeginTran(); + sql = $"delete Gy_ICBomBillMain where HinterID = {mainList[0].HInterID}"; + oCN.RunProc(sql); + sql = $"delete Gy_ICBomBillSub where HinterID = {mainList[0].HInterID}"; + oCN.RunProc(sql); + oCN.RunProc("Insert Into Gy_ICBomBillMain " + + "(HBillType,HInterID,HBillNo,HDate" + + ",HYear,HPeriod,HRemark,HMaker,HMakeDate,HMaterTypeID,HStatus" + + ",HMaterID,HParentID,HVersion,HPicNo,HPropertyID" + + ",HUnitID,HQty,HProdRate,HJump" + + ") " + + " values('" + mainList[0].HBillType + "'," + mainList[0].HInterID.ToString() + ",'" + mainList[0].HBillNo + "','" + mainList[0].HDate + "'" + + "," + mainList[0].HYear.ToString() + "," + mainList[0].HPeriod.ToString() + ",'" + mainList[0].HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate(),'" + mainList[0].HMaterTypeID.ToString() + "','" + mainList[0].HStatus + + "','" + mainList[0].HMaterID.ToString() + "'," + mainList[0].HParentID.ToString() + ",'" + mainList[0].HVersion + "','" + mainList[0].HPicNo + "'," + mainList[0].HPropertyID.ToString() + + "," + mainList[0].HUnitID.ToString() + "," + mainList[0].HQty.ToString() + "," + mainList[0].HProdRate.ToString() + ",'" + mainList[0].HJump + "'" + + ") "); + //鎻掑叆瀛愯〃 + foreach (Model.ClsGy_ICBomBillSub oSub in subList) + { + oCN.RunProc("Insert into Gy_ICBomBillSub " + + " (HInterID,HEntryID,HMaterID,HRemark2" + + ",HQty,HUnitID,HRemark3,HRelQty,HWasteRate" + + ",HProcID,HWhID,HRemark4,HChildType," + + "HCloseMan,HCloseType,HRemark," + + "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ") values(" + + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + ",'" + oSub.HRemark2 + "'" + + "," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HRemark3 + "'," + oSub.HRelQty.ToString() + "," + oSub.HWasteRate.ToString() + + "," + oSub.HProcID.ToString() + "," + oSub.HWhID.ToString() + ",'" + oSub.HRemark4 + "','" + oSub.HChildType.ToString() + "'" + + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + ") "); + } + 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 = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/BaseSet/Gy_PropertyController.cs b/WebAPI/Controllers/BaseSet/Gy_PropertyController.cs index dc4674d..9da9f99 100644 --- a/WebAPI/Controllers/BaseSet/Gy_PropertyController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_PropertyController.cs @@ -26,7 +26,7 @@ /// </summary> [Route("Gy_Property/list")] [HttpGet] - public object list(string sWhere,string user) + public object list(string sWhere,string user, string Organization) { try { @@ -87,8 +87,328 @@ } } + #region 杈呭姪灞炴�� 缂栬緫 + [Route("Gy_Property/PropertyEdit")] + [HttpPost] + public object PropertyEdit([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_Property_Ctl oBill = new DAL.ClsGy_Property_Ctl(); + List<Model.ClsGy_Property_Model> lsmain = new List<Model.ClsGy_Property_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_Property(msg1); + foreach (Model.ClsGy_Property_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_Property where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_Property"); + 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_Property/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_Property where HItemID=" + HItemID, "Gy_Property"); + 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_Property 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_Property/SaveGy_PropertyListApi")] + //[HttpPost] + //public object SaveGy_PropertyListApi([FromBody] JObject msg) + //{ + // try + // { + // var _value = msg["model"].ToString(); + // SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + // ListModels oListModels = new ListModels(); + // List<Model.ClsGy_Property_Model> lsmain = new List<Model.ClsGy_Property_Model>(); + // lsmain = oListModels.getObjectByJson_Gy_Property(_value); + // string sql = string.Empty; + // //淇濆瓨 + // oCN.BeginTran(); + // sql = $"delete Gy_Property where HItemID = {lsmain[0].HItemID}"; + // oCN.RunProc(sql); + // sql = "set identity_insert Gy_Property on"; + // oCN.RunProc(sql); + + // oCN.RunProc($@"insert into Gy_Property(HItemID,HNumber,HName,HHelpCode,HShortNumber,HParentID + // ,HLevel,HEndFlag,HStopflag,HRemark,HPropertyTypeID,HUseFlag,HERPItemID,HMakeTime) + // values({lsmain[0].HItemID},'{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HHelpCode}','{lsmain[0].HShortNumber}',{lsmain[0].HParentID},{lsmain[0].HLevel} + // ,{Convert.ToString(lsmain[0].HEndFlag ? 1 : 0)},{Convert.ToString(lsmain[0].HStopflag ? 1 : 0) },'{lsmain[0].HRemark}',{lsmain[0].HPropertyTypeID},'{lsmain[0].HUseFlag}',{lsmain[0].HERPItemID},'{lsmain[0].HMakeTime}')", ref DBUtility.ClsPub.sExeReturnInfo); + // //淇敼涓婄骇涓洪潪鏈骇浠g爜 + // sql = "set identity_insert Gy_Property off"; + // oCN.RunProc(sql); + // oCN.Commit(); + + // objJsonResult.code = "1"; + // objJsonResult.count = 1; + // objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + // objJsonResult.data = 1; + // return objJsonResult; + // } + // catch (Exception e) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + // objJsonResult.data = 1; + // return objJsonResult; + // } + //} + //#endregion } } \ No newline at end of file diff --git a/WebAPI/Controllers/BaseSet/Gy_UnitController.cs b/WebAPI/Controllers/BaseSet/Gy_UnitController.cs index dba24d0..801f5dc 100644 --- a/WebAPI/Controllers/BaseSet/Gy_UnitController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_UnitController.cs @@ -335,10 +335,10 @@ oCN.RunProc(sql); oCN.RunProc("Insert into Gy_Unit" + " (HItemID,HNumber,HName,HHelpCode,HShortNumber,HParentID" + - ",HLevel,HEndFlag,HStopflag,HRemark,HRate,HStandard,HUSEORGID) " + + ",HLevel,HEndFlag,HStopflag,HRemark,HRate,HStandard,HUSEORGID,HCREATEORGID) " + " Values('" + lsmain[0].HItemID + "','" + lsmain[0].HNumber + "','" + lsmain[0].HName + "','" + lsmain[0].HHelpCode + "','" + lsmain[0].HShortNumber + "'," + lsmain[0].HParentID.ToString() + "," + lsmain[0].HLevel.ToString() + "," + Convert.ToString(lsmain[0].HEndFlag ? 1 : 0) + "," + Convert.ToString(lsmain[0].HStopflag ? 1 : 0) + ",'" + lsmain[0].HRemark + - "'," + lsmain[0].HRate.ToString() + "," + DBUtility.ClsPub.BoolToString(lsmain[0].HStandard) + "," + lsmain[0].HUSEORGID + ")", ref DBUtility.ClsPub.sExeReturnInfo); + "'," + lsmain[0].HRate.ToString() + "," + DBUtility.ClsPub.BoolToString(lsmain[0].HStandard) + "," + lsmain[0].HUSEORGID + "," + lsmain[0].HCREATEORGID + ")", ref DBUtility.ClsPub.sExeReturnInfo); //淇敼涓婄骇涓洪潪鏈骇浠g爜 sql = "set identity_insert Gy_Unit off"; oCN.RunProc(sql); diff --git a/WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs b/WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs index 4cfa986..9003f13 100644 --- a/WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs @@ -407,11 +407,13 @@ { try { - var _value = msg["model"].ToString(); + var model = msg["model"].ToString(); + var stockplaceModel = msg["model"]["HStockplaceEntry"].ToString(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); //鍙嶅簭鍒楀寲 - _value = "[" + _value.ToString() + "]"; - List<Warehouse> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Warehouse>>(_value); + model = "[" + model.ToString() + "]"; + List<Warehouse> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Warehouse>>(model);//浠撳簱 + List<Gy_StockPlace> stockplaceList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_StockPlace>>(stockplaceModel);//浠撲綅 string sql = string.Empty; //DataTable dt = DataHelper.ListToDataTable<Warehouse>(list); //oCN.SqlBulkCopyByDatatable("Gy_Warehouse", dt); @@ -423,11 +425,25 @@ oCN.RunProc(sql); oCN.RunProc("Insert into Gy_Warehouse " + " (HItemID,HNumber,HName,HHelpCode,HShortNumber,HParentID" + - ",HLevel,HEndFlag,HStopflag,HRemark,HEmpID,HAddress,HPhone,HUSEORGID) " + + ",HLevel,HEndFlag,HStopflag,HRemark,HEmpID,HAddress,HPhone,HUSEORGID,HCREATEORGID) " + " Values('" + list[0].HItemID + "','" + list[0].HNumber + "','" +list[0].HName + "','" + list[0].HHelpCode + "','" + list[0].HShortNumber + "'," + list[0].HParentID.ToString() + - "," + list[0].HLevel.ToString() + "," + Convert.ToString(list[0].HEndFlag ? 1 : 0) + "," + Convert.ToString(list[0].HStopFlag ? 1 : 0) + ",'" + list[0].HRemark + "'," + list[0].HEmpID.ToString() + ",'" + list[0].HAddress + "','" + list[0].HPhone + "','" + list[0].HUSEORGID + "')", ref DBUtility.ClsPub.sExeReturnInfo); + "," + list[0].HLevel.ToString() + "," + Convert.ToString(list[0].HEndFlag ? 1 : 0) + "," + Convert.ToString(list[0].HStopFlag ? 1 : 0) + ",'" + list[0].HRemark + "'," + list[0].HEmpID.ToString() + ",'" + list[0].HAddress + "','" + list[0].HPhone + "','" + list[0].HUSEORGID + "','" + list[0].HCREATEORGID + "')", ref DBUtility.ClsPub.sExeReturnInfo); //淇敼涓婄骇涓洪潪鏈骇浠g爜 sql = "set identity_insert Gy_Warehouse off"; + oCN.RunProc(sql); + sql = $"delete gy_stockplace where HSPGroupID in ({list[0].HItemID})"; + oCN.RunProc(sql); + sql = "set identity_insert gy_stockplace on"; + oCN.RunProc(sql); + foreach (var item in stockplaceList) + { + oCN.RunProc("Insert into gy_stockplace " + + " (HItemID,HNumber,HName,HHelpCode,HShortNumber,HParentID" + + ",HLevel,HEndFlag,HStopflag,HRemark,HUSEORGID,HCREATEORGID,HSPGroupID,HSPType,HSrcSPType,HDesSPType) " + + " Values('" + item.HItemID + "','" + item.HNumber + "','" + item.HName + "','" + item.HHelpCode + "','" + item.HShortNumber + "'," + item.HParentID.ToString() + + "," + item.HLevel.ToString() + "," + Convert.ToString(item.HEndFlag ? 1 : 0) + "," + Convert.ToString(item.HStopFlag ? 1 : 0) + ",'" + item.HRemark + "','" + item.HUSEORGID + "','" + item.HCREATEORGID + "','" + item.HSPGroupID + "','" + item.HSPType + "','" + item.HSrcSPType + "','" + item.HDesSPType + "')", ref DBUtility.ClsPub.sExeReturnInfo); + } + sql = "set identity_insert gy_stockplace off"; oCN.RunProc(sql); oCN.Commit(); @@ -439,6 +455,7 @@ } catch (Exception e) { + oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); 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" index 60b9271..12c083a 100644 --- "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" @@ -342,55 +342,5 @@ } } #endregion - - #region 浜よ揣鍦扮偣 閲戣澏鍚屾 - [Route("Gy_CustLocation/SaveGy_CustLocationListApi")] - [HttpPost] - public object SaveGy_CustLocationListApi([FromBody] JObject msg) - { - try - { - var _value = msg["model"].ToString(); - SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); - ListModels oListModels = new ListModels(); - List<Model.ClsGy_CustLocation_Model> lsmain = new List<Model.ClsGy_CustLocation_Model>(); - lsmain = oListModels.getObjectByJson_Gy_CustLocation(_value); - string sql = string.Empty; - //淇濆瓨 - oCN.BeginTran(); - sql = $"delete Gy_CustLocation where HItemID = {lsmain[0].HItemID}"; - oCN.RunProc(sql); - sql = "set identity_insert Gy_CustLocation on"; - oCN.RunProc(sql); - - oCN.RunProc($@"insert into Gy_CustLocation(HItemID,HNumber,HName ,HShortNumber,HParentID ,HLevel - ,HEndFla,HStopflag,HRemark ,HHelpCode ,HUseFlag - ,HMakeTime ,HMakeEmp ,HCheckEmp ,HCheckTime ,HModifyEmp - ,HModifyTime ,HStopEmp ,HStopTime ,HUSEORGID,HCREATEORGID) - values({lsmain[0].HItemID},'{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HShortNumber}',{lsmain[0].HParentID},{lsmain[0].HLevel} - ,{Convert.ToString(lsmain[0].HEndFlag ? 1 : 0)},{Convert.ToString(lsmain[0].HStopflag ? 1 : 0) },'{lsmain[0].HRemark}','{lsmain[0].HHelpCode}','{lsmain[0].HUseFlag}' - ,'{lsmain[0].HMakeTime}','{lsmain[0].HMakeEmp}','{lsmain[0].HCheckEmp}','{lsmain[0].HCheckTime}','{lsmain[0].HModifyEmp}' - ,'{lsmain[0].HModifyTime}','{lsmain[0].HStopEmp}',null,{lsmain[0].HUSEORGID},{lsmain[0].HCREATEORGID})", ref DBUtility.ClsPub.sExeReturnInfo); - //淇敼涓婄骇涓洪潪鏈骇浠g爜 - sql = "set identity_insert Gy_CustLocation off"; - oCN.RunProc(sql); - oCN.Commit(); - - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; - objJsonResult.data = 1; - return objJsonResult; - } - catch (Exception e) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); - objJsonResult.data = 1; - 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_MatePriceSupController.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_MatePriceSupController.cs" new file mode 100644 index 0000000..c2dd857 --- /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_MatePriceSupController.cs" @@ -0,0 +1,332 @@ +锘縰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_MatePriceSupController : ApiController + { + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + #region 閲囪喘浠锋牸 鍒楄〃 + [Route("Gy_MatePriceSup/MatePriceSupList")] + [HttpGet] + public object MatePriceSupList(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_MatePriceSupList where 1 = 1 "); + + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_Gy_MatePriceSupList"); + + //娣诲姞鍒楀悕 + 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_MatePriceSup/MatePriceSupEdit")] + [HttpPost] + public object MatePriceSupEdit([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_MatePriceSup_Ctl oBill = new DAL.ClsGy_MatePriceSup_Ctl(); + List<Model.ClsGy_MatePriceSup_Model> lsmain = new List<Model.ClsGy_MatePriceSup_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MatePriceSup(msg1); + foreach (Model.ClsGy_MatePriceSup_Model oItem in lsmain) + { + //鏂板鏃跺垽鏂� + #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 + //oItem.HUSEORGID = Convert.ToInt32(msg_HUSEORGID); //缁勭粐id + 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_MatePriceSup/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_MatePriceSup where HItemID=" + HItemID, "Gy_MatePriceSup"); + 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_MatePriceSup 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_MatePriceSup/SaveGy_MatePriceSupListApi")] + [HttpPost] + public object SaveGy_MatePriceSupListApi([FromBody] JObject msg) + { + try + { + var _value = msg["model"].ToString(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + ListModels oListModels = new ListModels(); + List<Model.ClsGy_MatePriceSup_Model> lsmain = new List<Model.ClsGy_MatePriceSup_Model>(); + lsmain = oListModels.getObjectByJson_Gy_MatePriceSup(_value); + string sql = string.Empty; + //淇濆瓨 + oCN.BeginTran(); + sql = $"delete Gy_MatePriceSup where HItemID = {lsmain[0].HItemID}"; + oCN.RunProc(sql); + sql = "set identity_insert Gy_MatePriceSup on"; + oCN.RunProc(sql); + + oCN.RunProc($@"insert into Gy_MatePriceSup(HItemID,HInterID,HEntryID,HMaterID,HRelationID,HUnitID,HBeginQty,HEndQty,HCurID,HType + ,HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate) + values({lsmain[0].HItemID},{lsmain[0].HInterID},{lsmain[0].HEntryID},{lsmain[0].HMaterID},{lsmain[0].HRelationID},{lsmain[0].HUnitID},{lsmain[0].HBeginQty},{lsmain[0].HEndQty},{lsmain[0].HCurID},'{lsmain[0].HType}',{lsmain[0].HPrice},'{lsmain[0].HBeginDate}','{lsmain[0].HEndDate}','{lsmain[0].HUsed}','{lsmain[0].HRemark}','{lsmain[0].HMaker}','{lsmain[0].HMakeDate}')", ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + sql = "set identity_insert Gy_MatePriceSup off"; + oCN.RunProc(sql); + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + 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_OperatorController.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_OperatorController.cs" new file mode 100644 index 0000000..739f98a --- /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_OperatorController.cs" @@ -0,0 +1,393 @@ +锘縰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_OperatorController : ApiController + { + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + #region 涓氬姟鍛� 鍒楄〃 + [Route("Gy_Operator/OperatorList")] + [HttpGet] + public object OperatorList(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_OperatorList where 1 = 1 "); + + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_Gy_OperatorList"); + + //娣诲姞鍒楀悕 + 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_Operator/OperatorEdit")] + [HttpPost] + public object OperatorEdit([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_Operator_Ctl oBill = new DAL.ClsGy_Operator_Ctl(); + List<Model.ClsGy_Operator_Model> lsmain = new List<Model.ClsGy_Operator_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_Operator(msg1); + foreach (Model.ClsGy_Operator_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_Operator where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_Operator"); + 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_Operator/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_Operator where HItemID=" + HItemID, "Gy_Operator"); + 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_Operator 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_Operator/SaveGy_OperatorListApi")] + [HttpPost] + public object SaveGy_OperatorListApi([FromBody] JObject msg) + { + try + { + var _value = msg["model"].ToString(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + ListModels oListModels = new ListModels(); + List<Model.ClsGy_Operator_Model> lsmain = new List<Model.ClsGy_Operator_Model>(); + lsmain = oListModels.getObjectByJson_Gy_Operator(_value); + string sql = string.Empty; + //淇濆瓨 + oCN.BeginTran(); + sql = $"delete Gy_Operator where HItemID = {lsmain[0].HItemID}"; + oCN.RunProc(sql); + sql = "set identity_insert Gy_Operator on"; + oCN.RunProc(sql); + oCN.RunProc($@"insert into Gy_Operator(HItemID,HNumber,HName,HHelpCode,HShortNumber,HParentID + ,HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HUSEORGID,HOperatorId,HOperatorType,HSEQ,HStaffId,HIsUse) + values({lsmain[0].HItemID},'{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HHelpCode}','{lsmain[0].HShortNumber}', + {lsmain[0].HParentID},{lsmain[0].HLevel},{Convert.ToString(lsmain[0].HEndFlag ? 1 : 0)},{Convert.ToString(lsmain[0].HStopflag ? 1 : 0) }, + '{lsmain[0].HRemark}','{lsmain[0].HUseFlag}',{lsmain[0].HUSEORGID},{lsmain[0].HOperatorId},'{lsmain[0].HOperatorType}', + {lsmain[0].HSEQ},{lsmain[0].HStaffId},{lsmain[0].HIsUse})", ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + sql = "set identity_insert Gy_Operator off"; + oCN.RunProc(sql); + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + 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_SettleStyleController.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_SettleStyleController.cs" new file mode 100644 index 0000000..8d79356 --- /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_SettleStyleController.cs" @@ -0,0 +1,393 @@ +锘縰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_SettleStyleController : ApiController + { + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + #region 缁撶畻鏂瑰紡 鍒楄〃 + [Route("Gy_SettleStyle/SettleStyleList")] + [HttpGet] + public object SettleStyleList(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_SettleStyleList where 1 = 1 "); + + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_Gy_SettleStyleList"); + + //娣诲姞鍒楀悕 + 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_SettleStyle/SettleStyleEdit")] + [HttpPost] + public object SettleStyleEdit([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_SettleStyle_Ctl oBill = new DAL.ClsGy_SettleStyle_Ctl(); + List<Model.ClsGy_SettleStyle_Model> lsmain = new List<Model.ClsGy_SettleStyle_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_SettleStyle(msg1); + foreach (Model.ClsGy_SettleStyle_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_SettleStyle where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_SettleStyle"); + 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_SettleStyle/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_SettleStyle where HItemID=" + HItemID, "Gy_SettleStyle"); + 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_SettleStyle 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_SettleStyle/SaveGy_SettleStyleListApi")] + [HttpPost] + public object SaveGy_SettleStyleListApi([FromBody] JObject msg) + { + try + { + var _value = msg["model"].ToString(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + ListModels oListModels = new ListModels(); + List<Model.ClsGy_SettleStyle_Model> lsmain = new List<Model.ClsGy_SettleStyle_Model>(); + lsmain = oListModels.getObjectByJson_Gy_SettleStyle(_value); + string sql = string.Empty; + //淇濆瓨 + oCN.BeginTran(); + sql = $"delete Gy_SettleStyle where HItemID = {lsmain[0].HItemID}"; + oCN.RunProc(sql); + sql = "set identity_insert Gy_SettleStyle on"; + oCN.RunProc(sql); + + oCN.RunProc($@"insert into Gy_SettleStyle(HItemID,HNumber,HName,HHelpCode,HShortNumber,HParentID + ,HLevel,HEndFlag,HStopflag,HRemark) + values({lsmain[0].HItemID},'{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HHelpCode}','{lsmain[0].HShortNumber}',{lsmain[0].HParentID},{lsmain[0].HLevel} + ,{Convert.ToString(lsmain[0].HEndFlag ? 1 : 0)},{Convert.ToString(lsmain[0].HStopflag ? 1 : 0) },'{lsmain[0].HRemark}')", ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + sql = "set identity_insert Gy_SettleStyle off"; + oCN.RunProc(sql); + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + 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_StaffController.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_StaffController.cs" new file mode 100644 index 0000000..1475243 --- /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_StaffController.cs" @@ -0,0 +1,395 @@ +锘縰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_StaffController : ApiController + { + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + #region 鍛樺伐 鍒楄〃 + [Route("Gy_Staff/StaffList")] + [HttpGet] + public object StaffList(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_StaffList where 1 = 1 "); + + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_Gy_StaffList"); + + //娣诲姞鍒楀悕 + 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_Staff/StaffEdit")] + [HttpPost] + public object StaffEdit([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_Staff_Ctl oBill = new DAL.ClsGy_Staff_Ctl(); + List<Model.ClsGy_Staff_Model> lsmain = new List<Model.ClsGy_Staff_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_Staff(msg1); + foreach (Model.ClsGy_Staff_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_Staff where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_Staff"); + 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_Staff/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_Staff where HItemID=" + HItemID, "Gy_Staff"); + 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_Staff 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_Staff/SaveGy_StaffListApi")] + [HttpPost] + public object SaveGy_StaffListApi([FromBody] JObject msg) + { + try + { + var _value = msg["model"].ToString(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + ListModels oListModels = new ListModels(); + List<Model.ClsGy_Staff_Model> lsmain = new List<Model.ClsGy_Staff_Model>(); + lsmain = oListModels.getObjectByJson_Gy_Staff(_value); + string sql = string.Empty; + //淇濆瓨 + oCN.BeginTran(); + sql = $"delete Gy_Staff where HItemID = {lsmain[0].HItemID}"; + oCN.RunProc(sql); + sql = "set identity_insert Gy_Staff on"; + oCN.RunProc(sql); + oCN.RunProc($@"insert into Gy_Staff(HItemID,HNumber,HName,HHelpCode,HShortNumber,HParentID + ,HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HUSEORGID + ,HCREATEORGID,HPERSONID,HPOSTID,HFIRSTCARDID,HDEPTID,HSTAFFNUMBER) + values({lsmain[0].HItemID},'{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HHelpCode}','{lsmain[0].HShortNumber}', + {lsmain[0].HParentID},{lsmain[0].HLevel},{Convert.ToString(lsmain[0].HEndFlag ? 1 : 0)},{Convert.ToString(lsmain[0].HStopflag ? 1 : 0) }, + '{lsmain[0].HRemark}','{lsmain[0].HUseFlag}',{lsmain[0].HUSEORGID},{lsmain[0].HCREATEORGID},{lsmain[0].HPERSONID}, + {lsmain[0].HPOSTID},{lsmain[0].HFIRSTCARDID},{lsmain[0].HDEPTID},'{lsmain[0].HSTAFFNUMBER}')", ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + sql = "set identity_insert Gy_Staff off"; + oCN.RunProc(sql); + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + 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_TaxMIXController.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_TaxMIXController.cs" new file mode 100644 index 0000000..5873a83 --- /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_TaxMIXController.cs" @@ -0,0 +1,416 @@ +锘縰sing Model; +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_TaxMIXController : ApiController + { + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + //#region 绋庣巼缁勫悎 鍒楄〃 + //[Route("Gy_TaxMIX/TaxMIXList")] + //[HttpGet] + //public object TaxMIXList(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_TaxMIXList where 浣跨敤缁勭粐='" + Organization + "'"); + + // string sql = sql1 + sWhere; + // ds = oCN.RunProcReturn(sql, "h_v_Gy_TaxMIXList"); + + // //娣诲姞鍒楀悕 + // 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_TaxMIX/TaxMIXEdit")] + //[HttpPost] + //public object TaxMIXEdit([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_TaxMIX_Ctl oBill = new DAL.ClsGy_TaxMIX_Ctl(); + // List<Model.ClsGy_TaxMIX_Model> lsmain = new List<Model.ClsGy_TaxMIX_Model>(); + // msg1 = msg1.Replace("\\", ""); + // msg1 = msg1.Replace("\n", ""); //\n + // lsmain = oListModels.getObjectByJson_Gy_TaxMIX(msg1); + // foreach (Model.ClsGy_TaxMIX_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_TaxMIX where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_TaxMIX"); + // 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_TaxMIX/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_TaxMIX where HItemID=" + HItemID, "Gy_TaxMIX"); + // 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_TaxMIX 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_TaxMIXMain/SaveGy_TaxMIXMainListApi")] + [HttpPost] + public object SaveGy_TaxMIXListApi([FromBody] JObject sMainSub) + { + try + { + var model = sMainSub["model"].ToString(); + var entry = sMainSub["model"]["HENTRY"].ToString(); + + model = "[" + model.ToString() + "]"; + List<ClsGy_TaxMIXMain_Model> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsGy_TaxMIXMain_Model>>(model); + List<ClsGy_TaxMIXSub_Model> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsGy_TaxMIXSub_Model>>(entry); + string sql = string.Empty; + oCN.BeginTran(); + sql = $"delete Gy_TaxMIXMain where HItemID = {mainList[0].HItemID}"; + oCN.RunProc(sql); + sql = $"delete Gy_TaxMIXSub where HItemID = {mainList[0].HItemID}"; + oCN.RunProc(sql); + + sql = "set identity_insert Gy_TaxMIXMain on"; + oCN.RunProc(sql); + //涓昏〃 + oCN.RunProc($@"insert into Gy_TaxMIXMain(HItemID,HNumber,HName ,HShortNumber,HParentID ,HLevel + ,HEndFlag,HStopflag,HRemark ,HHelpCode ,HUseFlag + ,HMakeTime ,HMakeEmp ,HCheckEmp ,HCheckTime ,HModifyEmp + ,HModifyTime ,HStopEmp ,HStopTime ,HUSEORGID,HCREATEORGID) + values({mainList[0].HItemID},'{mainList[0].HNumber}','{mainList[0].HName}','{mainList[0].HShortNumber}',{mainList[0].HParentID},{mainList[0].HLevel} + ,{Convert.ToString(mainList[0].HEndFlag ? 1 : 0)},{Convert.ToString(mainList[0].HStopflag ? 1 : 0) },'{mainList[0].HRemark}','{mainList[0].HHelpCode}','{mainList[0].HUseFlag}' + ,'{mainList[0].HMakeTime}','{mainList[0].HMakeEmp}','{mainList[0].HCheckEmp}','{mainList[0].HCheckTime}','{mainList[0].HModifyEmp}' + ,'{mainList[0].HModifyTime}','{mainList[0].HStopEmp}',null,{mainList[0].HUSEORGID},{mainList[0].HCREATEORGID})", ref DBUtility.ClsPub.sExeReturnInfo); + + sql = "set identity_insert Gy_TaxMIXMain off"; + oCN.RunProc(sql); + + sql = "set identity_insert Gy_TaxMIXSub on"; + oCN.RunProc(sql); + //淇濆瓨涓昏〃 + foreach (var oSub in subList) + { + oCN.RunProc($@"Insert into Gy_TaxMIXSub + (HItemID,HTAXMIXID,HTAXBENCHMARK,FTAXRATEID) + values({oSub.HItemID},{oSub.HTAXMIXID},'{oSub.HTAXBENCHMARK}' + ,{oSub.FTAXRATEID})"); + } + + sql = "set identity_insert Gy_TaxMIXSub off"; + oCN.RunProc(sql); + + 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 + } +} \ 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_WorkController.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_WorkController.cs" new file mode 100644 index 0000000..9434442 --- /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_WorkController.cs" @@ -0,0 +1,392 @@ +锘縰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_WorkController : ApiController + { + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + #region 浣滀笟 鍒楄〃 + [Route("Gy_Work/WorkList")] + [HttpGet] + public object WorkList(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_WorkList where 1 = 1 "); + + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_Gy_WorkList"); + + //娣诲姞鍒楀悕 + 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_Work/WorkEdit")] + [HttpPost] + public object WorkEdit([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_Work_Ctl oBill = new DAL.ClsGy_Work_Ctl(); + List<Model.ClsGy_Work_Model> lsmain = new List<Model.ClsGy_Work_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_Work(msg1); + foreach (Model.ClsGy_Work_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_Work where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_Work"); + 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_Work/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_Work where HItemID=" + HItemID, "Gy_Work"); + 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_Work 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_Work/SaveGy_WorkListApi")] + [HttpPost] + public object SaveGy_WorkListApi([FromBody] JObject msg) + { + try + { + var _value = msg["model"].ToString(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + ListModels oListModels = new ListModels(); + List<Model.ClsGy_Work_Model> lsmain = new List<Model.ClsGy_Work_Model>(); + lsmain = oListModels.getObjectByJson_Gy_Work(_value); + string sql = string.Empty; + //淇濆瓨 + oCN.BeginTran(); + sql = $"delete Gy_Work where HItemID = {lsmain[0].HItemID}"; + oCN.RunProc(sql); + sql = "set identity_insert Gy_Work on"; + oCN.RunProc(sql); + oCN.RunProc($@"insert into Gy_Work(HItemID,HNumber,HName,HHelpCode,HShortNumber,HParentID, + HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HUSEORGID,HCREATEORGID,HWORKCENTERID) + values({lsmain[0].HItemID},'{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HHelpCode}','{lsmain[0].HShortNumber}', + {lsmain[0].HParentID},{lsmain[0].HLevel},{Convert.ToString(lsmain[0].HEndFlag ? 1 : 0)},{Convert.ToString(lsmain[0].HStopflag ? 1 : 0) }, + '{lsmain[0].HRemark}','{lsmain[0].HUseFlag}',{lsmain[0].HUSEORGID},{lsmain[0].HCREATEORGID},{lsmain[0].HWORKCENTERID})", ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + sql = "set identity_insert Gy_Work off"; + oCN.RunProc(sql); + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + #endregion + } +} \ No newline at end of file diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs index ad55bde..f9efcec 100644 --- a/WebAPI/ListModels.cs +++ b/WebAPI/ListModels.cs @@ -909,6 +909,102 @@ } /// <summary> + /// 澶勭悊缁撶畻鏂瑰紡琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsGy_SettleStyle_Model> getObjectByJson_Gy_SettleStyle(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsGy_SettleStyle_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_SettleStyle_Model>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊杈呭姪灞炴�ц〃鐨刯son + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsGy_Property_Model> getObjectByJson_Gy_Property(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsGy_Property_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_Property_Model>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊涓氬姟鍛樿〃鐨刯son + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsGy_Operator_Model> getObjectByJson_Gy_Operator(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsGy_Operator_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_Operator_Model>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊浣滀笟琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsGy_Work_Model> getObjectByJson_Gy_Work(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsGy_Work_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_Work_Model>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鍛樺伐琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsGy_Staff_Model> getObjectByJson_Gy_Staff(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsGy_Staff_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_Staff_Model>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊绋庣巼缁勫悎琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsGy_TaxMIXMain_Model> getObjectByJson_Gy_TaxMIXMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsGy_TaxMIXMain_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_TaxMIXMain_Model>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊閲囪喘浠锋牸琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsGy_MatePriceSup_Model> getObjectByJson_Gy_MatePriceSup(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsGy_MatePriceSup_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_MatePriceSup_Model>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鍗曟嵁绫诲瀷琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsXt_BillType_Model> getObjectByJson_Xt_BillType(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsXt_BillType_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsXt_BillType_Model>>(jsonString); + return list; + } + + /// <summary> /// 澶勭悊鏀舵鏉′欢琛ㄧ殑json /// </summary> /// <param name="jsonString"></param> diff --git "a/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StockPlace.cs" "b/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StockPlace.cs" new file mode 100644 index 0000000..e6ec201 --- /dev/null +++ "b/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StockPlace.cs" @@ -0,0 +1,34 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebAPI.Models +{ + public class Gy_StockPlace + { + public bool HEndFlag { get; set; } + public string HHelpCode { get; set; } + public long HItemID { get; set; } + public long HLevel { get; set; } + public string HName { get; set; } + public string HNumber { get; set; } + public long HParentID { get; set; } + public string HRemark { get; set; } + public string HShortNumber { get; set; } + public bool HStopFlag { get; set; } + public string HUseFlag { get; set; } + public Int64 HEmpID { get; set; } + public string HAddress { get; set; } + public string HPhone { get; set; } + public Int64 HSPGroupID { get; set; } + public string HBarCode { get; set; } + public Int64 HUSEORGID { get; set; } + public Int64 HCREATEORGID { get; set; } + public string HMaker { get; set; } + public string HUpDater { get; set; } + public string HSPType { get; set; } + public string HSrcSPType { get; set; } + public string HDesSPType { get; set; } + } +} \ No newline at end of file diff --git "a/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Warehouse.cs" "b/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Warehouse.cs" index f0af683..dc7fb1c 100644 --- "a/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Warehouse.cs" +++ "b/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Warehouse.cs" @@ -24,6 +24,7 @@ public Int64 HSPGroupID { get; set; } public string HBarCode { get; set; } public Int64 HUSEORGID { get; set; } + public Int64 HCREATEORGID { get; set; } public string HMaker { get; set; } public string HUpDater { get; set; } diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj index e8bc19a..7ea71e5 100644 --- a/WebAPI/WebAPI.csproj +++ b/WebAPI/WebAPI.csproj @@ -325,6 +325,7 @@ <Compile Include="App_Start\WebApiConfig.cs" /> <Compile Include="Controllers\BaseSet\Gy_BarCodeBillController.cs" /> <Compile Include="Controllers\BaseSet\Gy_ConkTypeController.cs" /> + <Compile Include="Controllers\BaseSet\Gy_ICBomBillController.cs" /> <Compile Include="Controllers\BaseSet\Gy_WorkDayController.cs" /> <Compile Include="Controllers\BaseSet\Gy_PackTypeController.cs" /> <Compile Include="Controllers\BaseSet\Gy_RoutingGroupController.cs" /> @@ -447,16 +448,22 @@ <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_COMMONCONTACTBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_CustLocationController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_DutyBillController.cs" /> + <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_MatePriceSupController.cs" /> + <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_OperatorController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_PaymentConditionListBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_RateTypeController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_RecConditionBillController.cs" /> + <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_SettleStyleController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_SOPBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_SOPBillEditController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_SOPBillListController.cs" /> + <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_StaffController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_StockCheckItemBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_StockStatusBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_SupplierContactBillController.cs" /> + <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_TaxMIXController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_TaxRateBillController.cs" /> + <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_WorkController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_WorkStationBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Xt_CheckFlowBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Xt_CheckItemBillController.cs" /> @@ -629,6 +636,7 @@ <Compile Include="Models\鍩虹璧勬枡\ConkType.cs" /> <Compile Include="Models\鍩虹璧勬枡\Gy_ClassTimePrj.cs" /> <Compile Include="Models\鍩虹璧勬枡\Gy_Duty.cs" /> + <Compile Include="Models\鍩虹璧勬枡\Gy_StockPlace.cs" /> <Compile Include="Models\鍩虹璧勬枡\WorkDay.cs" /> <Compile Include="Models\鍩虹璧勬枡\PackType.cs" /> <Compile Include="Models\鍩虹璧勬枡\WorkStation.cs" /> @@ -892,16 +900,22 @@ <Folder Include="Views\Gy_EquipType\" /> <Folder Include="Views\Gy_ICBomBill\" /> <Folder Include="Views\Gy_MateMould\" /> + <Folder Include="Views\Gy_MatePriceSup\" /> + <Folder Include="Views\Gy_Operator\" /> <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_SettleStyle\" /> <Folder Include="Views\Gy_SOPBill\" /> + <Folder Include="Views\Gy_Staff\" /> <Folder Include="Views\Gy_StockStatusBill\" /> <Folder Include="Views\Gy_SupplierContactBill\" /> + <Folder Include="Views\Gy_TaxMIXMain\" /> <Folder Include="Views\Gy_TaxRateBill\" /> <Folder Include="Views\Gy_WorkStation\" /> + <Folder Include="Views\Gy_Work\" /> <Folder Include="Views\JIT_DayPlanPlatFormBill\" /> <Folder Include="Views\JIT_DayPlanPlatFormImport\" /> <Folder Include="Views\JIT_ICMOSortBillList\" /> -- Gitblit v1.9.1