ch
2022-12-04 a71373599d6bddfcf3a65a288be80cbf2b1f9e30
Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
12个文件已修改
20个文件已添加
4301 ■■■■■ 已修改文件
DAL/DAL.csproj 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/基础资料/公用基础资料/ClsGy_COMMONCONTACT_Ctl.cs 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/基础资料/公用基础资料/ClsGy_PaymentCondition_Ctl.cs 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/基础资料/公用基础资料/ClsGy_RecCondition_Ctl.cs 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/基础资料/公用基础资料/ClsGy_StockStatus_Ctl.cs 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/基础资料/公用基础资料/ClsGy_SupplierContact_Ctl.cs 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/基础资料/公用基础资料/ClsGy_TaxRate_Ctl.cs 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/Model.csproj 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_COMMONCONTACT_Model.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_PaymentCondition_Model.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_RecCondition_Model.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_StockStatus_Model.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_SupplierContact_Model.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_TaxRate_Model.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/ClsSc_PPBomBillMain.cs 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/ClsSc_PPBomBillSub.cs 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/采购管理/ClsCg_POInStockBillMain.cs 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/采购管理/ClsCg_POInStockBillSub.cs 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/采购管理/ClsCg_POOrderBillMain.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/采购管理/ClsCg_POOrderBillSub.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs 424 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs 319 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SCGL/Sc_PPBomBillController.cs 331 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/WebAPIController.cs 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_COMMONCONTACTBillController.cs 346 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_PaymentConditionListBillController.cs 345 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_RecConditionBillController.cs 346 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_StockStatusBillController.cs 346 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_SupplierContactBillController.cs 346 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_TaxRateBillController.cs 346 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/DAL.csproj
@@ -84,8 +84,14 @@
    <Compile Include="人事管理\ClsHR_EmpUpChangeBill.cs" />
    <Compile Include="仓库管理\条码管理\ClsGy_BarCodeBill_ChaiMa.cs" />
    <Compile Include="基础资料\InterFace基础资料\ClsIF_ORGANIZATIONS_View.cs" />
    <Compile Include="基础资料\公用基础资料\ClsGy_TaxRate_Ctl.cs" />
    <Compile Include="基础资料\公用基础资料\ClsGy_RecCondition_Ctl.cs" />
    <Compile Include="基础资料\公用基础资料\ClsGy_FactoryDayOff_Ctl.cs" />
    <Compile Include="基础资料\公用基础资料\ClsGy_FactoryDayOff_View.cs" />
    <Compile Include="基础资料\公用基础资料\ClsGy_COMMONCONTACT_Ctl.cs" />
    <Compile Include="基础资料\公用基础资料\ClsGy_PaymentCondition_Ctl.cs" />
    <Compile Include="基础资料\公用基础资料\ClsGy_SupplierContact_Ctl.cs" />
    <Compile Include="基础资料\公用基础资料\ClsGy_StockStatus_Ctl.cs" />
    <Compile Include="基础资料\其他基础资料\ClsGy_MateMould_Ctl.cs" />
    <Compile Include="基础资料\其他基础资料\ClsGy_QCCheckProject_View.cs" />
    <Compile Include="基础资料\其他基础资料\ClsGy_StdWorkTimes_Ctl.cs" />
DAL/»ù´¡×ÊÁÏ/¹«Óûù´¡×ÊÁÏ/ClsGy_COMMONCONTACT_Ctl.cs
New file
@@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public class ClsGy_COMMONCONTACT_Ctl : DBUtility.ClsGy_Base_Ctl
    {
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        //原代码 ç”¨äºŽ æ›¿æ¢å­é¡¹ç›®
        public string HOldNumber;
        public Model.ClsGy_COMMONCONTACT_Model oModel = new Model.ClsGy_COMMONCONTACT_Model();
        //新增
        public override bool AddNew()
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc($@"insert into Gy_COMMONCONTACT(HNumber,HName ,HShortNumber  ,HParentID ,HLevel
                                ,HEndFlag  ,HStopflag  ,HRemark ,HHelpCode ,HUseFlag
                                 ,HMakeTime ,HMakeEmp ,HCheckEmp ,HCheckTime ,HModifyEmp
                                 ,HModifyTime ,HStopEmp ,HStopTime ,HUSEORGID,HCREATEORGID)
                                values('{oModel.HNumber}','{oModel.HName}','{oModel.HShortNumber}',{oModel.HParentID},{oModel.HLevel}
                                ,{(oModel.HEndFlag==true?1:0)},{(oModel.HStopflag == true ? 1:0)},'{oModel.HRemark}','{oModel.HHelpCode}','{oModel.HUseFlag}'
                                ,GETDATE(),'{oModel.HMakeEmp}','','',''
                                ,'','','',{oModel.HUSEORGID},{oModel.HCREATEORGID})"
                                , ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //修改
        public override bool ModifyByID(Int64 sItemID)
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc("Update " + MvarItemKey + " set " +
                    " HNumber='" + oModel.HNumber + "'" +
                    ",HName='" + oModel.HName + "'" +
                    ",HShortNumber='" + oModel.HShortNumber + "'" +
                    ",HParentID=" + oModel.HParentID.ToString() +
                    ",HLevel=" + oModel.HLevel.ToString() +
                    ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) +
                    ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) +
                    ",HRemark= '" + oModel.HRemark + "'" +
                    ",HHelpCode='" + oModel.HHelpCode + "'" +
                     ",HModifyEmp ='" + oModel.HMakeEmp + "'" +
                      ",HModifyTime   =getdate()" +
                  " Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //修改子项目代码
                //oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                //将上级 ä¸ºéžæœ«çº§
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //根据代码判断信息
        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_COMMONCONTACT_Ctl()
        {
            MvarItemKey = "Gy_COMMONCONTACT";
            MvarReportTitle = "收货方联系人";
            oModel = new Model.ClsGy_COMMONCONTACT_Model();
        }
    }
}
DAL/»ù´¡×ÊÁÏ/¹«Óûù´¡×ÊÁÏ/ClsGy_PaymentCondition_Ctl.cs
New file
@@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public class ClsGy_PaymentCondition_Ctl:DBUtility.ClsGy_Base_Ctl
    {
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        //原代码 ç”¨äºŽ æ›¿æ¢å­é¡¹ç›®
        public string HOldNumber;
        public Model.ClsGy_PaymentCondition_Model oModel = new Model.ClsGy_PaymentCondition_Model();
        //新增
        public override bool AddNew()
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc($@"insert into Gy_PaymentCondition(HNumber,HName ,HShortNumber  ,HParentID ,HLevel
                                ,HEndFlag  ,HStopflag  ,HRemark ,HHelpCode ,HUseFlag
                                 ,HMakeTime ,HMakeEmp ,HCheckEmp ,HCheckTime ,HModifyEmp
                                 ,HModifyTime ,HStopEmp ,HStopTime ,HUSEORGID,HCREATEORGID)
                                values('{oModel.HNumber}','{oModel.HName}','{oModel.HShortNumber}',{oModel.HParentID},{oModel.HLevel}
                                ,{(oModel.HEndFlag==true?1:0)},{(oModel.HStopflag == true ? 1:0)},'{oModel.HRemark}','{oModel.HHelpCode}','{oModel.HUseFlag}'
                                ,GETDATE(),'{oModel.HMakeEmp}','','',''
                                ,'','','',{oModel.HUSEORGID},{oModel.HCREATEORGID})"
                                , ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //修改
        public override bool ModifyByID(Int64 sItemID)
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc("Update " + MvarItemKey + " set " +
                    " HNumber='" + oModel.HNumber + "'" +
                    ",HName='" + oModel.HName + "'" +
                    ",HShortNumber='" + oModel.HShortNumber + "'" +
                    ",HParentID=" + oModel.HParentID.ToString() +
                    ",HLevel=" + oModel.HLevel.ToString() +
                    ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) +
                    ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) +
                    ",HRemark= '" + oModel.HRemark + "'" +
                    ",HHelpCode='" + oModel.HHelpCode + "'" +
                     ",HModifyEmp ='" + oModel.HMakeEmp + "'" +
                      ",HModifyTime   =getdate()" +
                  " Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //修改子项目代码
                //oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                //将上级 ä¸ºéžæœ«çº§
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //根据代码判断信息
        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_PaymentCondition_Ctl()
        {
            MvarItemKey = "Gy_PaymentCondition";
            MvarReportTitle = "付款条件";
            oModel = new Model.ClsGy_PaymentCondition_Model();
        }
    }
}
DAL/»ù´¡×ÊÁÏ/¹«Óûù´¡×ÊÁÏ/ClsGy_RecCondition_Ctl.cs
New file
@@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public class ClsGy_RecCondition_Ctl : DBUtility.ClsGy_Base_Ctl
    {
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        //原代码 ç”¨äºŽ æ›¿æ¢å­é¡¹ç›®
        public string HOldNumber;
        public Model.ClsGy_RecCondition_Model oModel = new Model.ClsGy_RecCondition_Model();
        //新增
        public override bool AddNew()
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc($@"insert into Gy_RecCondition(HNumber,HName ,HShortNumber  ,HParentID ,HLevel
                                ,HEndFlag  ,HStopflag  ,HRemark ,HHelpCode ,HUseFlag
                                 ,HMakeTime ,HMakeEmp ,HCheckEmp ,HCheckTime ,HModifyEmp
                                 ,HModifyTime ,HStopEmp ,HStopTime ,HUSEORGID,HCREATEORGID)
                                values('{oModel.HNumber}','{oModel.HName}','{oModel.HShortNumber}',{oModel.HParentID},{oModel.HLevel}
                                ,{(oModel.HEndFlag==true?1:0)},{(oModel.HStopflag == true ? 1:0)},'{oModel.HRemark}','{oModel.HHelpCode}','{oModel.HUseFlag}'
                                ,GETDATE(),'{oModel.HMakeEmp}','','',''
                                ,'','','',{oModel.HUSEORGID},{oModel.HCREATEORGID})"
                                , ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //修改
        public override bool ModifyByID(Int64 sItemID)
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc("Update " + MvarItemKey + " set " +
                    " HNumber='" + oModel.HNumber + "'" +
                    ",HName='" + oModel.HName + "'" +
                    ",HShortNumber='" + oModel.HShortNumber + "'" +
                    ",HParentID=" + oModel.HParentID.ToString() +
                    ",HLevel=" + oModel.HLevel.ToString() +
                    ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) +
                    ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) +
                    ",HRemark= '" + oModel.HRemark + "'" +
                    ",HHelpCode='" + oModel.HHelpCode + "'" +
                     ",HModifyEmp ='" + oModel.HMakeEmp + "'" +
                      ",HModifyTime   =getdate()" +
                  " Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //修改子项目代码
                //oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                //将上级 ä¸ºéžæœ«çº§
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //根据代码判断信息
        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_RecCondition_Ctl()
        {
            MvarItemKey = "Gy_RecCondition";
            MvarReportTitle = "收款条件";
            oModel = new Model.ClsGy_RecCondition_Model();
        }
    }
}
DAL/»ù´¡×ÊÁÏ/¹«Óûù´¡×ÊÁÏ/ClsGy_StockStatus_Ctl.cs
New file
@@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public class ClsGy_StockStatus_Ctl:DBUtility.ClsGy_Base_Ctl
    {
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        //原代码 ç”¨äºŽ æ›¿æ¢å­é¡¹ç›®
        public string HOldNumber;
        public Model.ClsGy_StockStatus_Model oModel = new Model.ClsGy_StockStatus_Model();
        //新增
        public override bool AddNew()
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc($@"insert into Gy_StockStatus(HNumber,HName ,HShortNumber  ,HParentID ,HLevel
                                ,HEndFlag  ,HStopflag  ,HRemark ,HHelpCode ,HUseFlag
                                 ,HMakeTime ,HMakeEmp ,HCheckEmp ,HCheckTime ,HModifyEmp
                                 ,HModifyTime ,HStopEmp ,HStopTime ,HUSEORGID,HCREATEORGID)
                                values('{oModel.HNumber}','{oModel.HName}','{oModel.HShortNumber}',{oModel.HParentID},{oModel.HLevel}
                                ,{(oModel.HEndFlag==true?1:0)},{(oModel.HStopflag == true ? 1:0)},'{oModel.HRemark}','{oModel.HHelpCode}','{oModel.HUseFlag}'
                                ,GETDATE(),'{oModel.HMakeEmp}','','',''
                                ,'','','',{oModel.HUSEORGID},{oModel.HCREATEORGID})"
                                , ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //修改
        public override bool ModifyByID(Int64 sItemID)
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc("Update " + MvarItemKey + " set " +
                    " HNumber='" + oModel.HNumber + "'" +
                    ",HName='" + oModel.HName + "'" +
                    ",HShortNumber='" + oModel.HShortNumber + "'" +
                    ",HParentID=" + oModel.HParentID.ToString() +
                    ",HLevel=" + oModel.HLevel.ToString() +
                    ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) +
                    ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) +
                    ",HRemark= '" + oModel.HRemark + "'" +
                    ",HHelpCode='" + oModel.HHelpCode + "'" +
                     ",HModifyEmp ='" + oModel.HMakeEmp + "'" +
                      ",HModifyTime   =getdate()" +
                  " Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //修改子项目代码
                //oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                //将上级 ä¸ºéžæœ«çº§
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //根据代码判断信息
        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_StockStatus_Ctl()
        {
            MvarItemKey = "Gy_StockStatus";
            MvarReportTitle = "库存状态";
            oModel = new Model.ClsGy_StockStatus_Model();
        }
    }
}
DAL/»ù´¡×ÊÁÏ/¹«Óûù´¡×ÊÁÏ/ClsGy_SupplierContact_Ctl.cs
New file
@@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public class ClsGy_SupplierContact_Ctl:DBUtility.ClsGy_Base_Ctl
    {
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        //原代码 ç”¨äºŽ æ›¿æ¢å­é¡¹ç›®
        public string HOldNumber;
        public Model.ClsGy_SupplierContact_Model oModel = new Model.ClsGy_SupplierContact_Model();
        //新增
        public override bool AddNew()
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc($@"insert into Gy_SupplierContact(HNumber,HName ,HShortNumber  ,HParentID ,HLevel
                                ,HEndFlag  ,HStopflag  ,HRemark ,HHelpCode ,HUseFlag
                                 ,HMakeTime ,HMakeEmp ,HCheckEmp ,HCheckTime ,HModifyEmp
                                 ,HModifyTime ,HStopEmp ,HStopTime ,HUSEORGID,HCREATEORGID)
                                values('{oModel.HNumber}','{oModel.HName}','{oModel.HShortNumber}',{oModel.HParentID},{oModel.HLevel}
                                ,{(oModel.HEndFlag==true?1:0)},{(oModel.HStopflag == true ? 1:0)},'{oModel.HRemark}','{oModel.HHelpCode}','{oModel.HUseFlag}'
                                ,GETDATE(),'{oModel.HMakeEmp}','','',''
                                ,'','','',{oModel.HUSEORGID},{oModel.HCREATEORGID})"
                                , ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //修改
        public override bool ModifyByID(Int64 sItemID)
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc("Update " + MvarItemKey + " set " +
                    " HNumber='" + oModel.HNumber + "'" +
                    ",HName='" + oModel.HName + "'" +
                    ",HShortNumber='" + oModel.HShortNumber + "'" +
                    ",HParentID=" + oModel.HParentID.ToString() +
                    ",HLevel=" + oModel.HLevel.ToString() +
                    ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) +
                    ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) +
                    ",HRemark= '" + oModel.HRemark + "'" +
                    ",HHelpCode='" + oModel.HHelpCode + "'" +
                     ",HModifyEmp ='" + oModel.HMakeEmp + "'" +
                      ",HModifyTime   =getdate()" +
                  " Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //修改子项目代码
                //oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                //将上级 ä¸ºéžæœ«çº§
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //根据代码判断信息
        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_SupplierContact_Ctl()
        {
            MvarItemKey = "Gy_SupplierContact";
            MvarReportTitle = "供货方联系人";
            oModel = new Model.ClsGy_SupplierContact_Model();
        }
    }
}
DAL/»ù´¡×ÊÁÏ/¹«Óûù´¡×ÊÁÏ/ClsGy_TaxRate_Ctl.cs
New file
@@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public class ClsGy_TaxRate_Ctl:DBUtility.ClsGy_Base_Ctl
    {
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        //原代码 ç”¨äºŽ æ›¿æ¢å­é¡¹ç›®
        public string HOldNumber;
        public Model.ClsGy_TaxRate_Model oModel = new Model.ClsGy_TaxRate_Model();
        //新增
        public override bool AddNew()
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc($@"insert into Gy_TaxRate(HNumber,HName ,HTaxRate,HShortNumber  ,HParentID ,HLevel
                                ,HEndFlag  ,HStopflag  ,HRemark ,HHelpCode ,HUseFlag
                                 ,HMakeTime ,HMakeEmp ,HCheckEmp ,HCheckTime ,HModifyEmp
                                 ,HModifyTime ,HStopEmp ,HStopTime ,HUSEORGID,HCREATEORGID)
                                values('{oModel.HNumber}','{oModel.HName}',{oModel.HTaxRate},'{oModel.HShortNumber}',{oModel.HParentID},{oModel.HLevel}
                                ,{(oModel.HEndFlag==true?1:0)},{(oModel.HStopflag == true ? 1:0)},'{oModel.HRemark}','{oModel.HHelpCode}','{oModel.HUseFlag}'
                                ,GETDATE(),'{oModel.HMakeEmp}','','',''
                                ,'','','',{oModel.HUSEORGID},{oModel.HCREATEORGID})"
                                , ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                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 + "'" +
                     ",HTaxRate='" + oModel.HTaxRate + "'" +
                    ",HShortNumber='" + oModel.HShortNumber + "'" +
                    ",HParentID=" + oModel.HParentID.ToString() +
                    ",HLevel=" + oModel.HLevel.ToString() +
                    ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) +
                    ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) +
                    ",HRemark= '" + oModel.HRemark + "'" +
                    ",HHelpCode='" + oModel.HHelpCode + "'" +
                     ",HModifyEmp ='" + oModel.HMakeEmp + "'" +
                      ",HModifyTime   =getdate()" +
                  " Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //修改子项目代码
                //oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                //将上级 ä¸ºéžæœ«çº§
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //根据代码判断信息
        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_TaxRate_Ctl()
        {
            MvarItemKey = "Gy_TaxRate";
            MvarReportTitle = "税率";
            oModel = new Model.ClsGy_TaxRate_Model();
        }
    }
}
Model/Model.csproj
@@ -324,6 +324,8 @@
    <Compile Include="基础资料\基础资料\ClsGy_Carbook_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_CareFor_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_CheckToolsType_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_TaxRate_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_PaymentCondition_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_Company_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_ConveyComp_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_ConveyType_Model.cs" />
@@ -352,6 +354,10 @@
    <Compile Include="基础资料\基础资料\ClsGy_Logo_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_MainMaterial_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_Market_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_COMMONCONTACT_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_RecCondition_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_SupplierContact_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_StockStatus_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_MaterType_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_MouldFileMain.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_MouldFileSub.cs" />
@@ -432,6 +438,8 @@
    <Compile Include="生产管理\ClsSc_ChangeNoteBillSub.cs" />
    <Compile Include="生产管理\ClsSc_MateWasterRequestBillMain.cs" />
    <Compile Include="生产管理\ClsSc_MateWasterRequestBillSub.cs" />
    <Compile Include="生产管理\ClsSc_PPBomBillMain.cs" />
    <Compile Include="生产管理\ClsSc_PPBomBillSub.cs" />
    <Compile Include="生产管理\ClsSc_WIPStockChangeBillMain.cs" />
    <Compile Include="生产管理\ClsSc_WIPStockChangeBillSub.cs" />
    <Compile Include="生产管理\ClsSc_WIPStockCheckBillMain.cs" />
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_COMMONCONTACT_Model.cs
New file
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsGy_COMMONCONTACT_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; }
    }
}
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_PaymentCondition_Model.cs
New file
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsGy_PaymentCondition_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; }
    }
}
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_RecCondition_Model.cs
New file
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsGy_RecCondition_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; }
    }
}
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_StockStatus_Model.cs
New file
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsGy_StockStatus_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; }
    }
}
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_SupplierContact_Model.cs
New file
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsGy_SupplierContact_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; }
    }
}
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_TaxRate_Model.cs
New file
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsGy_TaxRate_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; }
        public decimal HTaxRate { get; set; }
    }
}
Model/Éú²ú¹ÜÀí/ClsSc_PPBomBillMain.cs
New file
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Model.生产管理
{
    public class ClsSc_PPBomBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public string HBillNo;     //单据号
        public Int64 HMaterID;  //物料
        public Int64 HUnitID;  //计量单位
        public Int64 HDeptID;    //部门
        public DateTime HDate;  //日期
        public double HQty;  //数量
        public string HRemark;   //备注
        public Int64 HYear;
        public Int64 HPeriod;
        public string HBillType; // å•据类型
        public string HBillSubType; // å­ç±»åž‹
        public Int64 HInterID;
        public Int64 HBillStatus;        //单据状态
        public Int64 HCheckItemNextID;  //待审核项目(默认值 0)    ç•Œé¢ä¸Šä¸éœ€è¦æ˜¾ç¤º
        public Int64 HCheckFlowID;  //审批流(默认值 0)  ç•Œé¢ä¸Šä¸éœ€è¦æ˜¾ç¤º
        public string HBacker; //退回人  ï¼ˆé»˜è®¤ä¸º'')
        public string HBackDate;  //退回日期 ï¼ˆå…è®¸NULL)
        public string HChecker;   //审核人 ï¼ˆé»˜è®¤ä¸º'')
        public string HCheckDate;          //审核日期 ï¼ˆå…è®¸NULL)
        public string HMaker;          //制单人
        public string HMakeDate;             //制单日期
        public string HUpDater;                 //修改人 ï¼ˆé»˜è®¤ä¸º'')
        public string HUpDateDate;         //修改日期 ï¼ˆå…è®¸NULL)
        public string HCloseMan;          //关闭人 ï¼ˆé»˜è®¤ä¸º'')
        public string HCloseDate;         //关闭日期 ï¼ˆå…è®¸NULL)
        public Int64 HCloseType;           //关闭类型   ï¼ˆé»˜è®¤ä¸º0)
        public string HDeleteMan;           //作废人 ï¼ˆé»˜è®¤ä¸º'')
        public string HDeleteDate;           //作废日期 ï¼ˆå…è®¸NULL)
        public Int64 HICMOInterID;  //生产订单内码
        public Int64 HCheckItemNowID;      //当前审核项目(默认值 0)        ç•Œé¢ä¸Šä¸éœ€è¦æ˜¾ç¤º
        public Int64 HSeOrderInterID;  //销售订单内码
        public Int64 HSeOrderEntryID;  //销售订单子内码
        public string HSeOrderBillNo;  //销售订单号
        public string HType; // ç±»åž‹(可能是 å§”外和生产)
        public Int64 HSeOrderEntrySEQ;  //销售订单行号
        public Int64 HICMOEntrySEQ;  //生产订单行号
        public string HREQSRC;   //需求来源
        public Int64 HICMOEntryID;
        public Int64 HPRDORGID;
        public Int64 HENTRUSTORGID;
        public Int64 HPARENTOWNERID;
        public string HPARENTOWNERTYPEID;
        public Int64 HERPInterID;
        public string HERPBillType;
    }
}
Model/Éú²ú¹ÜÀí/ClsSc_PPBomBillSub.cs
New file
@@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Model.生产管理
{
    public class ClsSc_PPBomBillSub : DBUtility.ClsXt_BaseBillSub
    {
        public Int64 HMaterID;    //物料ID
        public string HMaterNumber; //
        public Int64 HUnitID;    //单位ID
        public string HUnitNumber; //
        public Int64 HWHID;  //仓库
        public Int64 HSPID;  //仓位
        public Int64 HBASEUNITID; //基本计量单位,
        public double HQty;  //数量
        public string HRemark;            //备注
        public Int64 HQtyMust; //应发数量
        public double HNumerator;  //分子
        public double HDenominator;  //分母
        public double HQtyScrap;  //损耗率
        public DateTime HSendDate;  //发料日期
        public Int64 HBomInterID; //BOM
        public Int64 HProcID;      //工序内码
        public Int64 HKeyMaterID_Line;  //关键件绑定标记
        public Int64 HKeyMaterID_InStock;     //关键件入库标记
        public Int64 HKeyMaterID_Ready;  //关键件齐套标记
        public Int64 HICMOInterID;   //任务单ID
        public string HICMOBillNo;  //任务单号
        public string HSeOrderBillNo;  //(销售订单号)
        public Int64 HSeOrderInterID;    //(销售订单主内码)
        public Int64 HSeOrderEntryID;     //(销售订单子内码)
        public Int64 HChangeTimes;         //变更次数
        public Int64 HProcessID; //作业,
        public Int64 HICMOENTRYSEQ;//生产订单行号,
        public Int64 HICMOEntryID;//生产订单子内码
        public string HPROJECTNO;  //项目编号,
        public Int64 HOPERID;//金蝶工序,
        public Int64 HSEQ;//行号,
        public Int64 HSTOCKSTATUSID; //库存状态,
        public Int64 HLOT; //批次内码,
        public Int64 HOPTQUEUE;//工序序列,
        public Int64 HRESERVETYPE;//预留类型,
        public double HSelPickedQty; //领料选单数量,
        public double HSELPRCDRETURNQTY;  //退料选单数量,
        public Int64 HInterID;
        public Int64 HEntryID;
        public string HCloseMan; //行关闭(默认为'')
        public DateTime HEntryCloseDate;    //行关闭(默认为'')
        public Int64 HCloseType; //关闭类型(默认为0)
        public Int64 HSourceInterID;     //源单ID
        public Int64 HSourceEntryID; //源单子ID
        public string HSourceBillNo; //源单单号
        public string HSourceBillType; //源单类型
        public double HRelationQty;     //关联数量
        public double HRelationMoney; //关联金额
        public Int64 HCHILDSUPPLYORGID;
        public Int64 HSUPPLYORGID;
        public Int64 HENTRUSTPICKORGID;
        public Int64 HSRCTRANSORGID;
        public Int64 HGROUPBYOWNERID;
        public Int64 HOWNERID;
        public Int64 HAuxPropID;
        public Int64 HERPInterID;
        public Int64 HERPEntryID;
        public double HMoveStockQty;
        public double HBackRelationQty;
        public string HOWNERTYPEID;
        public string HBatchNO;
        public string HMTONo;
    }
}
Model/²É¹º¹ÜÀí/ClsCg_POInStockBillMain.cs
@@ -16,5 +16,40 @@
        public Int64 HDeptID;//     int                 --部门    (Gy_Employee)
        public string HExplanation;//  varchar(200)             --ÕªÒª 
        public string HInnerBillNo;//  varchar(50)             --内部单据号
        public Int64 HInterID;
        public Int64 HYear;
        public Int64 HPeriod;
        public string HBillType;
        public string HBillSubType;
        public DateTime HDate;
        public string HBillNo;
        public Int64 HBillStatus;
        public string HRemark;
        public string HMaker;
        public string HMakeDate;
        public string HChecker;
        public string HCheckDate;
        public string HOWNERTYPEID;
        public Int64 HOWNERID;
        public Int64 HERPInterID;
        public string HERPBillType;
        public Int64 HPURCHASEORGID;
        public Int64 HSTOCKORGID;
        public Int64 HREQUIREORGID;
        public Int64 HSTOCKGROUPID;
        public string HSENDBILLNO;
        public string HLADBILLNO;
        public Int64 HPURDEPTID;
        public Int64 HPURGROUPID;
        public Int64 HSUPPLYID;
        public Int64 HSETTLEID;
        public Int64 HCHARGEID;
        public string HBUSINESSTYPE;
        public string HSUPPLYADDRESS;
        public Int64 HCORRESPONDORGID;
        public Int64 HPROVIDERCONTACTID;
    }
}
Model/²É¹º¹ÜÀí/ClsCg_POInStockBillSub.cs
@@ -22,5 +22,58 @@
        public Int64 HPOOrderInterID;//
        public Int64 HPOOrderEntryID;//
        public string HPOOrderBillNo;//
        public Int64 HSecUnitID;// è¾…助单位
        public Int64 HInterID;
        public Int64 HEntryID;
        public Int64 HSPID;
        public Int64 HSourceInterID;
        public Int64 HSourceEntryID;
        public string HSourceBillNo;
        public Int64 HAuxPropID;
        public string HBatchNO;
        public string HMTONo;
        public string HPlanMode;
        public Int64 HERPInterID;
        public Int64 HERPEntryID;
        public double HRelationQty;
        public Int64 HGiveAwayFlag;
        public double HReceiveQty;
        public Int64 HSEQ;
        public string HPRODUCEDATE;
        public string HEXPIRYDATE;
        public string HSUPPLYLOT;
        public string HREQTRACENO;
        public Int64 HBOMID;
        public Int64 HSTOCKUNITID;
        public Int64 HBASEUNITID;
        public Int64 HSTOCKSTATUSID;
        public string HKEEPERTYPEID;
        public string HPROJECTNO;
        public string HGIVEAWAY;
        public string HCHECKINCOMING;
        public string HDISCOUNTRATE;
        public double HPRICECOEFFICIENT;
        public Int64 HPRICEUNITID;
        public Int64 HPRICELISTENTRY;
        public double HSAMPLEDAMAGEQTY;
        public double HSAMPLEDAMAGEBASEQTY;
        public Int64 HPAYORGID;
        public Int64 HSETTLEORGID;
        public Int64 HSETTLECURRID;
        public Int64 HSETTLEMODEID;
        public Int64 HEXCHANGETYPEID;
        public double HEXCHANGERATE;
        public Int64 HPAYCONDITONID;
        public Int64 HLOCALCURRID;
        public Int64 HISINCLUDEDTAX;
        public Int64 HISPRICEEXCLUDETAX;
        public Int64 HTAXRATEID;
        public double HCOSTPERCENT;
        public double HCOSTAMOUNT;
        public Int64 HVAT;
        public Int64 HSELLERWITHHOLDING;
        public Int64 HBUYERWITHHOLDING;
    }
}
Model/²É¹º¹ÜÀí/ClsCg_POOrderBillMain.cs
@@ -17,6 +17,25 @@
        public Int64 HDeptID;//     int                 --部门    (Gy_Employee)
        public string HExplanation;//  varchar(200)             --ÕªÒª 
        public string HInnerBillNo;//  varchar(50)             --内部单据号
        public DateTime HSSDate;
        public DateTime HSSDate;   //结算日期
        public string HRemark;     //备注
        public Int64 HInterID;
        public Int64 HYear;
        public Int64 HPeriod;
        public string HBillType;
        public string HBillSubType;
        public DateTime HDate;
        public string HBillNo;
        public Int64 HBillStatus;
        public string HChecker;
        public string HCheckDate;
        public string HMaker;
        public string HMakeDate;
        public Int64 HERPInterID;
        public string HERPBillType;
        public Int64 HPURCHASEORGID;
    }
}
Model/²É¹º¹ÜÀí/ClsCg_POOrderBillSub.cs
@@ -30,5 +30,20 @@
        public string HSourceInterID;
        public string HSourceEntryID;
        public string HSourceQty;
        public Int64 HInterID;
        public Int64 HEntryID;
        public string HSourceBillNo;
        public string HSourceBillType;
        public double HRelationQty;
        public double HBackRelationQty;
        public Int64 HPropertyID;
        public string HBatChNo;
        public Int64 HAuxPropID;
        public string HMTONo;
        public Int64 HERPInterID;
        public Int64 HERPEntryID;
    }
}
WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
@@ -118,134 +119,7 @@
                return objJsonResult;
            }
        }
        /// <summary>
        /// ä¿å­˜æŒ‰é’®
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Cg_POInStockBill/ModifyByID")]
        [HttpPost]
        public object ModifyByID([FromBody] JObject oMain)
        {
            try
            {
                DAL.ClsGy_Warehouse_Ctl oDept = new DAL.ClsGy_Warehouse_Ctl();
                DAL.ClsGy_Warehouse_View oDeptHlp = new DAL.ClsGy_Warehouse_View();
                var _value = oMain["oMain"].ToString();
                string msg1 = _value.ToString();
                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                string msg2 = sArray[0].ToString();
                //string msg3 = sArray[1].ToString();
                //string msg4 = sArray[2].ToString();
                //string msg5 = sArray[3].ToString();
                //反序列化
                msg2 = "[" + msg2.ToString() + "]";
                List<Warehouse> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Warehouse>>(msg2);
                long HItemID = list[0].HItemID;
                string HNumber = list[0].HNumber;
                string HName = list[0].HName;
                string HHelpCode = list[0].HHelpCode;
                string HShortNumber = list[0].HShortNumber;
                long HParentID = list[0].HParentID;
                long HLevel = list[0].HLevel;
                bool HEndFlag = list[0].HEndFlag;
                bool HStopflag = list[0].HStopflag;
                string HRemark = list[0].HRemark;
                string HBarCode = list[0].HBarCode;
                long HEmpID = list[0].HEmpID;
                string HAddress = list[0].HAddress;
                string HPhone = list[0].HPhone;
                long HUSEORGID = list[0].HUSEORGID;
                string HUpDater = list[0].HUpDater;
                ////判断权限
                //if (!ClsPub.Security_Log(msg5, 1, false, msg4))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "没有找到该功能模块!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                //if (!DBUtility.ClsPub.AllowNumber(HNumber))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "代码中不能出现连续‘.’并且首位末位不能为‘.’!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                //if (oDept.HavSameNumber(HItemID, HNumber))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "代码重复!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                //保存
                //保存完毕后处理
                if (HItemID == 0)
                {
                    oCN.BeginTran();
                    oCN.RunProc("Insert into Gy_Warehouse  " +
                        " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                        ",HLevel,HEndFlag,HStopflag,HRemark,HEmpID,HAddress,HPhone,HUSEORGID) " +
                        " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID.ToString() +
                        "," + HLevel.ToString() + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "'," + HEmpID.ToString() + ",'" + HAddress + "','" + HPhone + "','" + HUSEORGID + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                    //修改上级为非末级代码
                    oCN.RunProc("Update Gy_Warehouse set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                    oCN.Commit();
                }
                else
                {
                    //若MAINDI重复则重新获取
                    oCN.BeginTran();
                    //主表
                    oCN.RunProc("Update Gy_Warehouse set " +
                        " HNumber='" + HNumber + "'" +
                        ",HName='" + HName + "'" +
                        ",HShortNumber='" + HShortNumber + "'" +
                        ",HHelpCode='" + HHelpCode + "'" +
                        ",HLevel=" + HLevel.ToString() +
                        ",HParentID=" + HParentID.ToString() +
                        ",HEndflag=" + Convert.ToString(HEndFlag ? 1 : 0) +
                        ",HStopflag=" + Convert.ToString(HStopflag ? 1 : 0) +
                        ",HEmpID=" + HEmpID.ToString() +
                        ",HAddress='" + HAddress + "'" +
                        ",HPhone='" + HPhone + "'" +
                        ",HUSEORGID='" + HUSEORGID + "'" +
                        ",HUpdater='" + HUpDater + "'" +
                        ",HUpdateDate= getdate()" +
                        ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                    //修改子项目代码
                    //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_Warehouse,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                    //将上级 ä¸ºéžæœ«çº§
                    oCN.RunProc("Update Gy_Warehouse set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                    //
                    oCN.Commit();
                }
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "保存成功!";
                //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        ///删除功能
        /// </summary>
@@ -381,6 +255,296 @@
            return objJsonResult;
        }
        //
        #region æ”¶æ–™é€šçŸ¥å• ä¿å­˜/编辑功能
        [Route("Cg_POInStockBill/POInStockBillEdit")]
        [HttpPost]
        public object POInStockBillEdit([FromBody] JObject sMainSub)
        {
            try
            {
                var _value = sMainSub["sMainSub"].ToString();
                string msg1 = _value.ToString();
                oCN.BeginTran();
                //保存主表
                objJsonResult = AddBillMain(msg1);
                if (objJsonResult.code == "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = objJsonResult.Message;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "单据保存成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        public json AddBillMain(string msg1)
        {
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString(); //主表数据
            string msg3 = sArray[1].ToString(); //子表数据
            int OperationType = int.Parse(sArray[2].ToString()); // æ•°æ®ç±»åž‹ 1添加 3修改
            string user = sArray[3].ToString();
            string msg_allVal = sArray[4].ToString(); //主表+子表所有数据
            try
            {
                msg2 = "[" + msg2.ToString() + "]";
                List<ClsCg_POInStockBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBillMain>>(msg2);
                long HInterID = mainList[0].HInterID;//递入type得到的单据ID
                string HBillNo = mainList[0].HBillNo;//递入type得到的单据号
                long HPRDORGID = mainList[0].HPRDORGID;//组织
                DateTime HDate = mainList[0].HDate;//日期
                string HRemark = mainList[0].HRemark;//备注
                long HSupID = mainList[0].HSupID;//供应商
                long HEmpID = mainList[0].HEmpID;//业务员
                long HDeptID = mainList[0].HDeptID;//部门
                long HCurID = mainList[0].HCurID;//币别
                Single HExRate = mainList[0].HExRate;//汇率
                long HManagerID = mainList[0].HManagerID;//主管
                long HWHID = mainList[0].HWHID;//仓库
                string HMaker = user;//制单人
                string HAddress = mainList[0].HAddress;//地址
                string HExplanation = mainList[0].HExplanation;//摘要
                string HInnerBillNo = mainList[0].HInnerBillNo;//内部单据号
                List<ClsCg_POInStockBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBillMain>>(msg2);
                DateTime dt = DateTime.Now;
                long HYear = mainList2[0].HYear == null ? 0 : mainList2[0].HYear;
                long HPeriod = mainList2[0].HPeriod == null ? 0 : mainList2[0].HPeriod;
                string HBillType = mainList2[0].HBillType == null ? "''" : mainList2[0].HBillType;
                string HBillSubType = mainList2[0].HBillSubType == null ? "''" : mainList2[0].HBillSubType;
                long HBillStatus = mainList2[0].HBillStatus == null ? 0 : mainList2[0].HBillStatus;
                string HMakeDate = mainList2[0].HMakeDate == null ? "''" : mainList2[0].HMakeDate;
                string HChecker = mainList2[0].HChecker == null ? "''" : mainList2[0].HChecker;
                string HCheckDate = mainList2[0].HCheckDate == null ? "''" : mainList2[0].HCheckDate;
                string HOWNERTYPEID = mainList2[0].HOWNERTYPEID == null ? "''" : mainList2[0].HOWNERTYPEID;
                long HOWNERID = mainList2[0].HOWNERID == null ? 0 : mainList2[0].HOWNERID;
                long HERPInterID = mainList2[0].HERPInterID == null ? 0 : mainList2[0].HERPInterID;
                string HERPBillType = mainList2[0].HERPBillType == null ? "''" : mainList2[0].HERPBillType;
                long HPURCHASEORGID = mainList2[0].HPURCHASEORGID == null ? 0 : mainList2[0].HPURCHASEORGID;
                long HSTOCKORGID = mainList2[0].HSTOCKORGID == null ? 0 : mainList2[0].HSTOCKORGID;
                long HREQUIREORGID = mainList2[0].HREQUIREORGID == null ? 0 : mainList2[0].HREQUIREORGID;
                long HSTOCKGROUPID = mainList2[0].HSTOCKGROUPID == null ? 0 : mainList2[0].HSTOCKGROUPID;
                string HSENDBILLNO = mainList2[0].HSENDBILLNO == null ? "''" : mainList2[0].HSENDBILLNO;
                string HLADBILLNO = mainList2[0].HLADBILLNO == null ? "''" : mainList2[0].HLADBILLNO;
                long HPURDEPTID = mainList2[0].HPURDEPTID == null ? 0 : mainList2[0].HPURDEPTID;
                long HPURGROUPID = mainList2[0].HPURGROUPID == null ? 0 : mainList2[0].HPURGROUPID;
                long HSUPPLYID = mainList2[0].HSUPPLYID == null ? 0 : mainList2[0].HSUPPLYID;
                long HSETTLEID = mainList2[0].HSETTLEID == null ? 0 : mainList2[0].HSETTLEID;
                long HCHARGEID = mainList2[0].HCHARGEID == null ? 0 : mainList2[0].HCHARGEID;
                string HBUSINESSTYPE = mainList2[0].HBUSINESSTYPE == null ? "''" : mainList2[0].HBUSINESSTYPE;
                string HSUPPLYADDRESS = mainList2[0].HSUPPLYADDRESS == null ? "''" : mainList2[0].HSUPPLYADDRESS;
                long HCORRESPONDORGID = mainList2[0].HCORRESPONDORGID == null ? 0 : mainList2[0].HCORRESPONDORGID;
                long HPROVIDERCONTACTID = mainList2[0].HPROVIDERCONTACTID == null ? 0 : mainList2[0].HPROVIDERCONTACTID;
                ds = oCN.RunProcReturn("select * from h_v_IF_POInStockBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_IF_POOrderBillList");
                if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//新增
                {
                    //主表
                    oCN.RunProc(@"Insert Into Cg_POInStockBillMain
                        (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate
                        ,HBillNo,HBillStatus,HSupID,HManagerID,HEmpID,HDeptID,HRemark
                        ,HMaker,HMakeDate,HChecker,HCheckDate,HOWNERTYPEID,HOWNERID
                        ,HERPInterID,HERPBillType,HPURCHASEORGID,HSTOCKORGID,HREQUIREORGID
                        ,HSTOCKGROUPID,HSENDBILLNO,HLADBILLNO,HPURDEPTID,HPURGROUPID,HSUPPLYID
                        ,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HSUPPLYADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID,HCurID,HExRate,HAddress,HWHID)
                        values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1103 + "','" +
                    HBillSubType + "','" + HDate + "','" + HBillNo + "'," + HBillStatus + "," + HSupID +
                    "," + HManagerID + "," + HEmpID + "," + HDeptID + ",'" + HRemark + "','" + HMaker +
                    "','" + HMakeDate + "','" + HChecker + "','" + HCheckDate + "','" + HOWNERTYPEID + "'," + HOWNERID + "," + HERPInterID + ",'" + HERPBillType + "'," + HPURCHASEORGID + "," + HSTOCKORGID + "," + HREQUIREORGID + "," +
                    HSTOCKGROUPID + ",'" + HSENDBILLNO + "','" + HLADBILLNO + "'," + HPURDEPTID + "," + HPURGROUPID + "," + HSUPPLYID + "," +
                    HSETTLEID + "," + HCHARGEID + ",'" + HBUSINESSTYPE + "','" + HSUPPLYADDRESS + "'," + HCORRESPONDORGID + "," + HPROVIDERCONTACTID + "," + HCurID + "," + HExRate + ",'" + HAddress + "'," + HWHID + ")");
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    oCN.RunProc("update Cg_POInStockBillMain  set " +
                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" +
                                 ",HSupID=" + HSupID + ",HCurID=" + HCurID
                                 + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID
                                 + ",HAddress='" + HAddress + " where HInterID=" + HInterID);
                    //删除子表
                    oCN.RunProc("delete from Cg_POInStockBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddBillSub(msg3, HInterID, OperationType);
                if (objJsonResult.code == "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = objJsonResult.Message;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = null;
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        public json AddBillSub(string msg3, long HInterID, int OperationType)
        {
            List<ClsCg_POInStockBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBillSub>>(msg3);
            List<ClsCg_POInStockBillSub> DetailColl2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBillSub>>(msg3);
            long HSPID = DetailColl2[0].HSPID == null ? 0 : DetailColl2[0].HSPID;
            long HSourceInterID = DetailColl2[0].HSourceInterID == null ? 0 : DetailColl2[0].HSourceInterID;
            long HSourceEntryID = DetailColl2[0].HSourceEntryID == null ? 0 : DetailColl2[0].HSourceEntryID;
            string HSourceBillNo = DetailColl2[0].HSourceBillNo == null ? "''" : DetailColl2[0].HSourceBillNo;
            string HSourceBillType = DetailColl2[0].HSourceBillType == null ? "''" : DetailColl2[0].HSourceBillType;
            long HAuxPropID = DetailColl2[0].HAuxPropID == null ? 0 : DetailColl2[0].HAuxPropID;
            string HBatchNO = DetailColl2[0].HBatchNO == null ? "''" : DetailColl2[0].HBatchNO;
            string HMTONo = DetailColl2[0].HMTONo == null ? "''" : DetailColl2[0].HMTONo;
            string HPlanMode = DetailColl2[0].HPlanMode == null ? "''" : DetailColl2[0].HPlanMode;
            long HERPInterID = DetailColl2[0].HERPInterID == null ? 0 : DetailColl2[0].HERPInterID;
            long HERPEntryID = DetailColl2[0].HERPEntryID == null ? 0 : DetailColl2[0].HERPEntryID;
            double HRelationQty = DetailColl2[0].HRelationQty == null ? 0 : DetailColl2[0].HRelationQty;
            long HGiveAwayFlag = DetailColl2[0].HGiveAwayFlag == null ? 0 : DetailColl2[0].HGiveAwayFlag;
            double HReceiveQty = DetailColl2[0].HReceiveQty == null ? 0 : DetailColl2[0].HReceiveQty;
            long HSEQ = DetailColl2[0].HSEQ == null ? 0 : DetailColl2[0].HSEQ;
            string HPRODUCEDATE = DetailColl2[0].HPRODUCEDATE == null ? "''" : DetailColl2[0].HPRODUCEDATE;
            string HEXPIRYDATE = DetailColl2[0].HEXPIRYDATE == null ? "''" : DetailColl2[0].HEXPIRYDATE;
            string HSUPPLYLOT = DetailColl2[0].HSUPPLYLOT == null ? "''" : DetailColl2[0].HSUPPLYLOT;
            string HREQTRACENO = DetailColl2[0].HREQTRACENO == null ? "''" : DetailColl2[0].HREQTRACENO;
            long HBOMID = DetailColl2[0].HBOMID == null ? 0 : DetailColl2[0].HBOMID;
            long HSTOCKUNITID = DetailColl2[0].HSTOCKUNITID == null ? 0 : DetailColl2[0].HSTOCKUNITID;
            long HBASEUNITID = DetailColl2[0].HBASEUNITID == null ? 0 : DetailColl2[0].HBASEUNITID;
            long HSTOCKSTATUSID = DetailColl2[0].HSTOCKSTATUSID == null ? 0 : DetailColl2[0].HSTOCKSTATUSID;
            string HKEEPERTYPEID = DetailColl2[0].HKEEPERTYPEID == null ? "''" : DetailColl2[0].HKEEPERTYPEID;
            string HPROJECTNO = DetailColl2[0].HPROJECTNO == null ? "''" : DetailColl2[0].HPROJECTNO;
            string HGIVEAWAY = DetailColl2[0].HGIVEAWAY == null ? "''" : DetailColl2[0].HGIVEAWAY;
            string HCHECKINCOMING = DetailColl2[0].HCHECKINCOMING == null ? "''" : DetailColl2[0].HCHECKINCOMING;
            string HDISCOUNTRATE = DetailColl2[0].HDISCOUNTRATE == null ? "''" : DetailColl2[0].HDISCOUNTRATE;
            double HPRICECOEFFICIENT = DetailColl2[0].HPRICECOEFFICIENT == null ? 0 : DetailColl2[0].HPRICECOEFFICIENT;
            long HPRICEUNITID = DetailColl2[0].HPRICEUNITID == null ? 0 : DetailColl2[0].HPRICEUNITID;
            long HPRICELISTENTRY = DetailColl2[0].HPRICELISTENTRY == null ? 0 : DetailColl2[0].HPRICELISTENTRY;
            double HSAMPLEDAMAGEQTY = DetailColl2[0].HSAMPLEDAMAGEQTY == null ? 0 : DetailColl2[0].HSAMPLEDAMAGEQTY;
            double HSAMPLEDAMAGEBASEQTY = DetailColl2[0].HSAMPLEDAMAGEBASEQTY == null ? 0 : DetailColl2[0].HSAMPLEDAMAGEBASEQTY;
            long HPAYORGID = DetailColl2[0].HPAYORGID == null ? 0 : DetailColl2[0].HPAYORGID;
            long HSETTLEORGID = DetailColl2[0].HSETTLEORGID == null ? 0 : DetailColl2[0].HSETTLEORGID;
            long HSETTLECURRID = DetailColl2[0].HSETTLECURRID == null ? 0 : DetailColl2[0].HSETTLECURRID;
            long HSETTLEMODEID = DetailColl2[0].HSETTLEMODEID == null ? 0 : DetailColl2[0].HSETTLEMODEID;
            long HEXCHANGETYPEID = DetailColl2[0].HEXCHANGETYPEID == null ? 0 : DetailColl2[0].HEXCHANGETYPEID;
            long HPAYCONDITONID = DetailColl2[0].HPAYCONDITONID == null ? 0 : DetailColl2[0].HPAYCONDITONID;
            long HLOCALCURRID = DetailColl2[0].HLOCALCURRID == null ? 0 : DetailColl2[0].HLOCALCURRID;
            long HISINCLUDEDTAX = DetailColl2[0].HISINCLUDEDTAX == null ? 0 : DetailColl2[0].HISINCLUDEDTAX;
            long HISPRICEEXCLUDETAX = DetailColl2[0].HISPRICEEXCLUDETAX == null ? 0 : DetailColl2[0].HISPRICEEXCLUDETAX;
            long HTAXRATEID = DetailColl2[0].HTAXRATEID == null ? 0 : DetailColl2[0].HTAXRATEID;
            double HCOSTPERCENT = DetailColl2[0].HCOSTPERCENT == null ? 0 : DetailColl2[0].HCOSTPERCENT;
            double HCOSTAMOUNT = DetailColl2[0].HCOSTAMOUNT == null ? 0 : DetailColl2[0].HCOSTAMOUNT;
            long HVAT = DetailColl2[0].HVAT == null ? 0 : DetailColl2[0].HVAT;
            long HSELLERWITHHOLDING = DetailColl2[0].HSELLERWITHHOLDING == null ? 0 : DetailColl2[0].HSELLERWITHHOLDING;
            long HBUYERWITHHOLDING = DetailColl2[0].HBUYERWITHHOLDING == null ? 0 : DetailColl2[0].HBUYERWITHHOLDING;
            string HRemark = DetailColl2[0].HRemark == null ? "''" : DetailColl2[0].HRemark;
            string HPOOrderBillNo = DetailColl2[0].HPOOrderBillNo == null ? "''" : DetailColl2[0].HPOOrderBillNo;
            int i = 0;
            foreach (ClsCg_POInStockBillSub oSub in DetailColl)
            {
                i++;
                if (oSub.HQty <= 0 || oSub.HQty == null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "第" + i + "行,数量不能为0或者小于0";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (oSub.HMaterID == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "第" + i + "行,物料不能为空";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //if (oSub.HSourceID == 0)
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "第" + i + "行,生产资源不能为空";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                if (oSub.HUnitID == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "第" + i + "行,计量单位不能为空";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DataSet Cs;
                Int64 NewHEntryID = 1;
                Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Cg_POInStockBillSub", "Cg_POInStockBillSub");
                if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0)
                {
                    NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
                    NewHEntryID += 1;
                }
                oCN.RunProc($@"Insert into Cg_POInStockBillSub
                (HInterID,HEntryID,HMaterID,HUnitID,HQty,HPrice
                ,HMoney,HWHID,HSPID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HPOOrderInterID
                ,HPOOrderEntryID,HPOORderBillNo,HAuxPropID,HBatchNO,HMTONo,HPlanMode,HERPInterID,HERPEntryID
                ,HRelationQty,HGiveAwayFlag,HReceiveQty,HSEQ,HPRODUCEDATE,HEXPIRYDATE,HSUPPLYLOT,HREQTRACENO,HBOMID,HSTOCKUNITID
                ,HBASEUNITID,HSTOCKSTATUSID,HKEEPERTYPEID,HPROJECTNO,HGIVEAWAY,HCHECKINCOMING,HTAXPRICE,HDISCOUNTRATE
                ,HPRICECOEFFICIENT,HPRICEUNITID,HPRICELISTENTRY,HSAMPLEDAMAGEQTY,HSAMPLEDAMAGEBASEQTY
                ,HPAYORGID,HSETTLEORGID,HSETTLECURRID,HSETTLEMODEID,HEXCHANGETYPEID,HPAYCONDITONID
                ,HEXCHANGERATE,HLOCALCURRID,HISINCLUDEDTAX,HISPRICEEXCLUDETAX
                ,HTAXRATEID,HCOSTPERCENT,HCOSTAMOUNT,HVAT,HSELLERWITHHOLDING,HBUYERWITHHOLDING,HSecUnitID)
                 values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{(oSub.HQty == null ? 0 : oSub.HQty)}
                ,{oSub.HPrice},{oSub.HMoney},{oSub.HWHID},{oSub.HSPID},'{HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},{HSourceBillNo},{HSourceBillType},{oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},{HPOOrderBillNo},{HAuxPropID},{HBatchNO},{HMTONo},{HPlanMode},{HERPInterID},{HERPEntryID},{HRelationQty},{HGiveAwayFlag},{HReceiveQty},{HSEQ},{HPRODUCEDATE},{HEXPIRYDATE},
                  {HSUPPLYLOT},{HREQTRACENO},{HBOMID},{HSTOCKUNITID},{HBASEUNITID},{HSTOCKSTATUSID},'{HKEEPERTYPEID}',{HPROJECTNO},{HGIVEAWAY},{HCHECKINCOMING},{oSub.HTaxPrice},{HDISCOUNTRATE},{HPRICECOEFFICIENT},{HPRICEUNITID},{HPRICELISTENTRY},{HSAMPLEDAMAGEQTY},{HSAMPLEDAMAGEBASEQTY},{HPAYORGID},{HSETTLEORGID},{HSETTLECURRID},{HSETTLEMODEID},{HEXCHANGETYPEID},{HPAYCONDITONID},{oSub.HEXCHANGERATE},{HLOCALCURRID},{HISINCLUDEDTAX},{HISPRICEEXCLUDETAX},{HTAXRATEID},{HCOSTPERCENT},{HCOSTAMOUNT},{HVAT},{HSELLERWITHHOLDING},{HBUYERWITHHOLDING},{oSub.HSecUnitID})");
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
    }
}
WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
@@ -659,7 +660,321 @@
            }
        }
        //
        #region é‡‡è´­è®¢å• ä¿å­˜/编辑功能
        [Route("Cg_POOrderBill/POOrderBillEdit")]
        [HttpPost]
        public object POOrderBillEdit([FromBody] JObject sMainSub)
        {
            try
            {
                var _value = sMainSub["sMainSub"].ToString();
                string msg1 = _value.ToString();
                oCN.BeginTran();
                //保存主表
                objJsonResult = AddBillMain(msg1);
                if (objJsonResult.code == "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = objJsonResult.Message;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "单据保存成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        public json AddBillMain(string msg1)
        {
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString(); //主表数据
            string msg3 = sArray[1].ToString(); //子表数据
            int OperationType = int.Parse(sArray[2].ToString()); // æ•°æ®ç±»åž‹ 1添加 3修改
            string user = sArray[3].ToString();
            string msg_allVal = sArray[4].ToString(); //主表+子表所有数据
            try
            {
                msg2 = "[" + msg2.ToString() + "]";
                List<ClsCg_POOrderBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POOrderBillMain>>(msg2);
                long HInterID = mainList[0].HInterID;//递入type得到的单据ID
                string HBillNo = mainList[0].HBillNo;//递入type得到的单据号
                long HPRDORGID = mainList[0].HPRDORGID;//组织
                DateTime HDate = mainList[0].HDate;//日期
                string HRemark = mainList[0].HRemark;//备注
                long HSupID = mainList[0].HSupID;//供应商
                long HEmpID = mainList[0].HEmpID;//业务员
                long HDeptID = mainList[0].HDeptID;//部门
                long HCurID = mainList[0].HCurID;//币别
                Single HExRate = mainList[0].HExRate;//汇率
                long HManagerID = mainList[0].HManagerID;//主管
                long HPSStyleID = mainList[0].HPSStyleID;//采购方式
                long HSSID = mainList[0].HSSID;//结算方式
                DateTime HSSDate = mainList[0].HSSDate;//结算日期
                string HMaker = user;//制单人
                string HAddress = mainList[0].HAddress;//地址
                string HExplanation = mainList[0].HExplanation;//摘要
                string HInnerBillNo = mainList[0].HInnerBillNo;//内部单据号
                List<ClsCg_POOrderBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POOrderBillMain>>(msg2);
                DateTime dt = DateTime.Now;
                long HYear = mainList2[0].HYear == null ? 0 : mainList2[0].HYear;
                long HPeriod = mainList2[0].HPeriod == null ? 0 : mainList2[0].HPeriod;
                string HBillType = mainList2[0].HBillType == null ? "''" : mainList2[0].HBillType;
                string HBillSubType = mainList2[0].HBillSubType == null ? "''" : mainList2[0].HBillSubType;
                long HBillStatus = mainList2[0].HBillStatus == null ? 0 : mainList2[0].HBillStatus;
                string HChecker = mainList2[0].HChecker == null ? "''" : mainList2[0].HChecker;
                string HCheckDate = mainList2[0].HCheckDate == null ? "''" : mainList2[0].HCheckDate;
                string HMakeDate = mainList2[0].HMakeDate == null ? "''" : mainList2[0].HMakeDate;
                long HERPInterID = mainList2[0].HERPInterID == null ? 0 : mainList2[0].HERPInterID;
                string HERPBillType = mainList2[0].HERPBillType == null ? "''" : mainList2[0].HERPBillType;
                long HPURCHASEORGID = mainList2[0].HPURCHASEORGID == null ? 0 : mainList2[0].HPURCHASEORGID;
                ds = oCN.RunProcReturn("select * from h_v_IF_POOrderBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_IF_POOrderBillList");
                if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//新增
                {
                    DataSet Ds;
                    Int64 NewHInterID = 1;
                    Ds = oCN.RunProcReturn("select MAX(HInterID)HInterID from Cg_POOrderBillMain", "Cg_POOrderBillMain");
                    if (Ds.Tables[0].Rows.Count != 0 && ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString()) != 0)
                    {
                        NewHInterID = ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString());
                        NewHInterID += 1;
                    }
                    //主表
                    oCN.RunProc(@"Insert Into Cg_POOrderBillMain
                        (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus
                        ,HAddress,HSSID,HSSDate,HPSStyleID,HSupID,HCurID
                        ,HExRate,HEmpID,HManagerID,HDeptID,HExplanation,HRemark,HInnerBillNo
                        ,HChecker,HCheckDate,HMaker,HMakeDate
                        ,HERPInterID,HERPBillType,HPURCHASEORGID)
                        values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1102 + "','" +
                    HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + HAddress +
                    "'," + HSSID + ",'" + HSSDate + "'," + HPSStyleID + "," + HSupID + "," + HCurID +
                    "," + HExRate + "," + HEmpID + "," + HManagerID + "," + HDeptID + ",'" + HExplanation + "','" + HRemark + "','" + HInnerBillNo + "','" + HChecker + "','" + HCheckDate + "','" + HMaker + "','" +
                    HMakeDate + "'," + HERPInterID + ",'" + HERPBillType + "'," + HPURCHASEORGID + ")");
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    oCN.RunProc("update Cg_POOrderBillMain  set " +
                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" +
                                 ",HSSID=" + HSSID + ",HPSStyleID=" + HPSStyleID + ",HSupID=" + HSupID + ",HCurID=" + HCurID
                                 + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID
                                 + ",HAddress='" + HAddress + "',HSSDate='" + HSSDate + "' where HInterID=" + HInterID);
                    //删除子表
                    oCN.RunProc("delete from Cg_POOrderBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddBillSub(msg3, HInterID, OperationType);
                if (objJsonResult.code == "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = objJsonResult.Message;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = null;
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        public json AddBillSub(string msg3, long HInterID, int OperationType)
        {
            List<ClsCg_POOrderBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POOrderBillSub>>(msg3);
            List<ClsCg_POOrderBillSub> DetailColl2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POOrderBillSub>>(msg3);
            string HSourceBillNo = DetailColl2[0].HSourceBillNo == null ? "''" : DetailColl2[0].HSourceBillNo;
            string HSourceBillType = DetailColl2[0].HSourceBillType == null ? "''" : DetailColl2[0].HSourceBillType;
            double HRelationQty = DetailColl2[0].HRelationQty == null ? 0 : DetailColl2[0].HRelationQty;
            double HBackRelationQty = DetailColl2[0].HBackRelationQty == null ? 0 : DetailColl2[0].HBackRelationQty;
            long HPropertyID = DetailColl2[0].HPropertyID == null ? 0 : DetailColl2[0].HPropertyID;
            string HBatChNo = DetailColl2[0].HBatChNo == null ? "''" : DetailColl2[0].HBatChNo;
            long HAuxPropID = DetailColl2[0].HAuxPropID == null ? 0 : DetailColl2[0].HAuxPropID;
            string HMTONo = DetailColl2[0].HMTONo == null ? "''" : DetailColl2[0].HMTONo;
            long HERPInterID = DetailColl2[0].HERPInterID == null ? 0 : DetailColl2[0].HERPInterID;
            long HERPEntryID = DetailColl2[0].HERPEntryID == null ? 0 : DetailColl2[0].HERPEntryID;
            string HSeOrderBillNo = DetailColl2[0].HSeOrderBillNo == null ? "''" : DetailColl2[0].HSeOrderBillNo;
            string HRemark = DetailColl2[0].HRemark == null ? "''" : DetailColl2[0].HRemark;
            string HSourceInterID = DetailColl2[0].HSourceInterID == null ? "''" : DetailColl2[0].HSourceInterID;
            string HSourceEntryID = DetailColl2[0].HSourceEntryID == null ? "''" : DetailColl2[0].HSourceEntryID;
            int i = 0;
            foreach (ClsCg_POOrderBillSub oSub in DetailColl)
            {
                i++;
                if (oSub.HQty <= 0 || oSub.HQty == null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "第" + i + "行,数量不能为0或者小于0";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (oSub.HMaterID == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "第" + i + "行,物料不能为空";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //if (oSub.HSourceID == 0)
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "第" + i + "行,生产资源不能为空";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                if (oSub.HUnitID == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "第" + i + "行,计量单位不能为空";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DataSet Cs;
                Int64 NewHEntryID = 1;
                Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Cg_POOrderBillSub", "Cg_POOrderBillSub");
                if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0)
                {
                    NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
                    NewHEntryID += 1;
                }
                oCN.RunProc($@"Insert into Cg_POOrderBillSub
                (HInterID,HEntryID,HMaterID,HUnitID,HQty,HPrice,HTaxPrice,HDiscountRate,HRelTaxPrice
                ,HMoney,HTaxRate,HTaxMoney,HLineTotal,HlineTotalBB,HDate,HInStockQty,HInvoiceQty,HSeOrderBillNo,HSeOrderInterID
                ,HSeOrderEntryID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo
                ,HSourceBillType,HRelationQty,HBackRelationQty,HPropertyID,HBatChNo,HAuxPropID,HMTONo
                ,HERPInterID,HERPEntryID)
                 values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{(oSub.HQty == null ? 0 : oSub.HQty)}
                ,{oSub.HPrice},{oSub.HTaxPrice},{oSub.HDiscountRate},{oSub.HRelTaxPrice},{oSub.HMoney},{oSub.HTaxRate},{oSub.HTaxMoney},{oSub.HlineTotal},{oSub.HlineTotalBB},'{oSub.HDate}',{oSub.HInStockQty},{oSub.HInvoiceQty},{HSeOrderBillNo},{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{HRemark}',{HSourceInterID},{HSourceEntryID},{HSourceBillNo},{HSourceBillType},{HRelationQty},{HBackRelationQty},{HPropertyID},{HBatChNo},
                  {HAuxPropID},{HMTONo},{HERPInterID},{HERPEntryID})");
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        /// <summary>
        ///删除功能
        /// </summary>
        /// <returns></returns>
        [Route("Cg_POOrderBill/DeltetCg_POOrderBill")]
        [HttpGet]
        public object DeltetCg_POOrderBill(string HInterID)
        {
            try
            {
                oCN.BeginTran();
                oCN.RunProc("Delete From Cg_POOrderBillMain where HInterID = " + HInterID);
                oCN.RunProc("Delete From Cg_POOrderBillSub where HInterID = " + HInterID);
                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.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// æ ¹æ®åŸºç¡€èµ„æ–™ID æŸ¥æ‰¾è®°å½•
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Cg_POOrderBill/cx")]
        [HttpGet]
        public object cx(long HInterID)
        {
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_IF_POOrderBillList where hmainid =" + HInterID, "h_v_IF_POOrderBillList");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "false!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    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;
            }
        }
    }
}
WebAPI/Controllers/SCGL/Sc_PPBomBillController.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq;
using Model.生产管理;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
@@ -240,5 +241,333 @@
            }
        }
        #endregion
        #region ç”Ÿäº§ç”¨æ–™å• ä¿å­˜/编辑功能
        [Route("Sc_PPBomBill/PPBomBillEdit")]
        [HttpPost]
        public object PPBomBillEdit([FromBody] JObject sMainSub)
        {
            try
            {
                var _value = sMainSub["sMainSub"].ToString();
                string msg1 = _value.ToString();
                oCN.BeginTran();
                //保存主表
                objJsonResult = AddBillMain(msg1);
                if (objJsonResult.code == "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = objJsonResult.Message;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "单据保存成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        public json AddBillMain(string msg1)
        {
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString(); //主表数据
            string msg3 = sArray[1].ToString(); //子表数据
            int OperationType = int.Parse(sArray[2].ToString()); // æ•°æ®ç±»åž‹ 1添加 3修改
            string user = sArray[3].ToString();
            string msg_allVal = sArray[4].ToString(); //主表+子表所有数据
            try
            {
                msg2 = "[" + msg2.ToString() + "]";
                List<ClsSc_PPBomBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_PPBomBillMain>>(msg2);
                string HBillNo = mainList[0].HBillNo;     //单据号
                long HMaterID = mainList[0].HMaterID;  //物料
                long HUnitID = mainList[0].HUnitID;  //计量单位
                long HDeptID = mainList[0].HDeptID;    //部门
                DateTime HDate = mainList[0].HDate;  //日期
                double HQty = mainList[0].HQty;  //数量
                string HRemark = mainList[0].HRemark;   //备注
                List<ClsSc_PPBomBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_PPBomBillMain>>(msg2);
                DateTime dt = DateTime.Now;
                long HYear = mainList2[0].HYear == null ? 0 : mainList2[0].HYear;
                long HPeriod = mainList2[0].HPeriod == null ? 0 : mainList2[0].HPeriod;
                string HBillType = mainList2[0].HBillType == null ? "''" : mainList2[0].HBillType; // å•据类型
                string HBillSubType = mainList2[0].HBillSubType == null ? "''" : mainList2[0].HBillSubType; // å­ç±»åž‹
                long HInterID = mainList2[0].HInterID == null ? 0 : mainList2[0].HInterID;
                long HBillStatus = mainList2[0].HBillStatus == null ? 0 : mainList2[0].HBillStatus;        //单据状态
                long HCheckItemNextID = mainList2[0].HCheckItemNextID == null ? 0 : mainList2[0].HCheckItemNextID;  //待审核项目(默认值 0)
                long HCheckFlowID = mainList2[0].HCheckFlowID == null ? 0 : mainList2[0].HCheckFlowID;  //审批流(默认值 0)  ç•Œé¢ä¸Šä¸éœ€è¦æ˜¾ç¤º
                string HBacker = mainList2[0].HBacker == null ? "''" : mainList2[0].HBacker; //退回人  ï¼ˆé»˜è®¤ä¸º'')
                string HBackDate = mainList2[0].HBackDate == null ? "''" : mainList2[0].HBackDate;  //退回日期 ï¼ˆå…è®¸NULL)
                string HChecker = mainList2[0].HChecker == null ? "''" : mainList2[0].HChecker;   //审核人 ï¼ˆé»˜è®¤ä¸º'')
                string HCheckDate = mainList2[0].HCheckDate == null ? "''" : mainList2[0].HCheckDate;          //审核日期 ï¼ˆå…è®¸NULL)
                string HMaker = mainList2[0].HMaker == null ? "''" : mainList2[0].HMaker;          //制单人
                string HMakeDate = mainList2[0].HMakeDate == null ? "''" : mainList2[0].HMakeDate;             //制单日期
                string HUpDater = mainList2[0].HUpDater == null ? "''" : mainList2[0].HUpDater;                 //修改人 ï¼ˆé»˜è®¤ä¸º'')
                string HUpDateDate = mainList2[0].HUpDateDate == null ? "''" : mainList2[0].HUpDateDate;         //修改日期 ï¼ˆå…è®¸NULL)
                string HCloseMan = mainList2[0].HCloseMan == null ? "''" : mainList2[0].HCloseMan;          //关闭人 ï¼ˆé»˜è®¤ä¸º'')
                string HCloseDate = mainList2[0].HCloseDate == null ? "''" : mainList2[0].HCloseDate;         //关闭日期 ï¼ˆå…è®¸NULL)
                long HCloseType = mainList2[0].HCloseType == null ? 0 : mainList2[0].HCloseType;           //关闭类型   ï¼ˆé»˜è®¤ä¸º0)
                string HDeleteMan = mainList2[0].HDeleteMan == null ? "''" : mainList2[0].HDeleteMan;           //作废人 ï¼ˆé»˜è®¤ä¸º'')
                string HDeleteDate = mainList2[0].HDeleteDate == null ? "''" : mainList2[0].HDeleteDate;           //作废日期 ï¼ˆå…è®¸NULL)
                long HICMOInterID = mainList2[0].HICMOInterID == null ? 0 : mainList2[0].HICMOInterID;  //生产订单内码
                long HCheckItemNowID = mainList2[0].HCheckItemNowID == null ? 0 : mainList2[0].HCheckItemNowID;      //当前审核项目(默认值 0)
                long HSeOrderInterID = mainList2[0].HSeOrderInterID == null ? 0 : mainList2[0].HSeOrderInterID;  //销售订单内码
                long HSeOrderEntryID = mainList2[0].HSeOrderEntryID == null ? 0 : mainList2[0].HSeOrderEntryID;  //销售订单子内码
                string HSeOrderBillNo = mainList2[0].HSeOrderBillNo == null ? "''" : mainList2[0].HSeOrderBillNo;  //销售订单号
                string HType = mainList2[0].HType == null ? "''" : mainList2[0].HType; // ç±»åž‹(可能是 å§”外和生产)
                long HSeOrderEntrySEQ = mainList2[0].HSeOrderEntrySEQ == null ? 0 : mainList2[0].HSeOrderEntrySEQ;  //销售订单行号
                long HICMOEntrySEQ = mainList2[0].HICMOEntrySEQ == null ? 0 : mainList2[0].HICMOEntrySEQ;  //生产订单行号
                string HREQSRC = mainList2[0].HREQSRC == null ? "''" : mainList2[0].HREQSRC;   //需求来源
                long HICMOEntryID = mainList2[0].HICMOEntryID == null ? 0 : mainList2[0].HICMOEntryID;
                long HPRDORGID = mainList2[0].HPRDORGID == null ? 0 : mainList2[0].HPRDORGID;
                long HENTRUSTORGID = mainList2[0].HENTRUSTORGID == null ? 0 : mainList2[0].HENTRUSTORGID;
                long HPARENTOWNERID = mainList2[0].HPARENTOWNERID == null ? 0 : mainList2[0].HPARENTOWNERID;
                string HPARENTOWNERTYPEID = mainList2[0].HPARENTOWNERTYPEID == null ? "''" : mainList2[0].HPARENTOWNERTYPEID;
                long HERPInterID = mainList2[0].HERPInterID == null ? 0 : mainList2[0].HERPInterID;
                string HERPBillType = mainList2[0].HERPBillType == null ? "''" : mainList2[0].HERPBillType;
                ds = oCN.RunProcReturn("select * from h_v_IF_PPBomBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_IF_PPBomBillList");
                if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//新增
                {
                    //主表
                    oCN.RunProc(@"Insert Into Sc_PPBomBillMain
                        (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus,HICMOInterID
                        ,HICMOEntryID,HMaterID,HUnitID,HQty,HDeptID,HMaker,HMakeDate,HChecker,HCheckDate
                        ,HSeOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HPRDORGID,HENTRUSTORGID,HPARENTOWNERID
                        ,HPARENTOWNERTYPEID,HERPInterID,HERPBillType,HSeOrderEntrySEQ,HICMOEntrySEQ)
                        values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 3720 + "','" +
                    HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "'," + HICMOInterID +
                    "," + HICMOEntryID + ",'" + HMaterID + "'," + HUnitID + "," + HQty + "," + HDeptID +
                    ",'" + HMaker + "','" + HMakeDate + "','" + HChecker + "','" + HCheckDate + "','" + HSeOrderBillNo + "'," + HSeOrderInterID + "," + HSeOrderEntryID + "," + HPRDORGID + "," + HENTRUSTORGID + "," + HPARENTOWNERID + "," +
                    HPARENTOWNERTYPEID + "," + HERPInterID + ",'" + HERPBillType + "'," + HSeOrderEntrySEQ + "," + HICMOEntrySEQ + ")");
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    oCN.RunProc("update Sc_PPBomBillMain  set " +
                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" +
                                ",HDeptID=" + HDeptID + " where HInterID=" + HInterID);
                    //删除子表
                    oCN.RunProc("delete from Sc_PPBomBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddBillSub(msg3, HInterID, OperationType);
                if (objJsonResult.code == "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = objJsonResult.Message;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = null;
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        public json AddBillSub(string msg3, long HInterID, int OperationType)
        {
            List<ClsSc_PPBomBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_PPBomBillSub>>(msg3);
            List<ClsSc_PPBomBillSub> DetailColl2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_PPBomBillSub>>(msg3);
            DateTime dt = DateTime.Now;
            long HQtyMust = DetailColl2[0].HQtyMust == null ? 0 : DetailColl2[0].HQtyMust; //应发数量
            double HNumerator = DetailColl2[0].HNumerator == null ? 0 : DetailColl2[0].HNumerator;  //分子
            double HDenominator = DetailColl2[0].HDenominator == null ? 0 : DetailColl2[0].HDenominator;  //分母
            double HQtyScrap = DetailColl2[0].HQtyScrap == null ? 0 : DetailColl2[0].HQtyScrap;  //损耗率
            DateTime HSendDate = DetailColl2[0].HSendDate == null ? dt : DetailColl2[0].HSendDate;  //发料日期
            long HBomInterID = DetailColl2[0].HBomInterID == null ? 0 : DetailColl2[0].HBomInterID; //BOM
            long HProcID = DetailColl2[0].HProcID == null ? 0 : DetailColl2[0].HProcID;      //工序内码
            long HKeyMaterID_Line = DetailColl2[0].HKeyMaterID_Line == null ? 0 : DetailColl2[0].HKeyMaterID_Line;  //关键件绑定标记
            long HKeyMaterID_InStock = DetailColl2[0].HKeyMaterID_InStock == null ? 0 : DetailColl2[0].HKeyMaterID_InStock;     //关键件入库标记
            long HKeyMaterID_Ready = DetailColl2[0].HKeyMaterID_Ready == null ? 0 : DetailColl2[0].HKeyMaterID_Ready;  //关键件齐套标记
            long HICMOInterID = DetailColl2[0].HICMOInterID == null ? 0 : DetailColl2[0].HICMOInterID;   //任务单ID
            string HICMOBillNo = DetailColl2[0].HICMOBillNo == null ? "''" : DetailColl2[0].HICMOBillNo;  //任务单号
            string HSeOrderBillNo = DetailColl2[0].HSeOrderBillNo == null ? "''" : DetailColl2[0].HSeOrderBillNo;  //(销售订单号)
            long HSeOrderInterID = DetailColl2[0].HSeOrderInterID == null ? 0 : DetailColl2[0].HSeOrderInterID;    //(销售订单主内码)
            long HSeOrderEntryID = DetailColl2[0].HSeOrderEntryID == null ? 0 : DetailColl2[0].HSeOrderEntryID;     //(销售订单子内码)
            long HChangeTimes = DetailColl2[0].HChangeTimes == null ? 0 : DetailColl2[0].HChangeTimes;         //变更次数
            long HProcessID = DetailColl2[0].HProcessID == null ? 0 : DetailColl2[0].HProcessID; //作业,
            long HICMOENTRYSEQ = DetailColl2[0].HICMOENTRYSEQ == null ? 0 : DetailColl2[0].HICMOENTRYSEQ;//生产订单行号,
            long HICMOEntryID = DetailColl2[0].HICMOEntryID == null ? 0 : DetailColl2[0].HICMOEntryID;//生产订单子内码
            string HPROJECTNO = DetailColl2[0].HPROJECTNO == null ? "''" : DetailColl2[0].HPROJECTNO;  //项目编号,
            long HOPERID = DetailColl2[0].HOPERID == null ? 0 : DetailColl2[0].HOPERID;//金蝶工序,
            long HSEQ = DetailColl2[0].HSEQ == null ? 0 : DetailColl2[0].HSEQ;//行号,
            long HSTOCKSTATUSID = DetailColl2[0].HSTOCKSTATUSID == null ? 0 : DetailColl2[0].HSTOCKSTATUSID; //库存状态,
            long HLOT = DetailColl2[0].HLOT == null ? 0 : DetailColl2[0].HLOT; //批次内码,
            long HOPTQUEUE = DetailColl2[0].HOPTQUEUE == null ? 0 : DetailColl2[0].HOPTQUEUE;//工序序列,
            long HRESERVETYPE = DetailColl2[0].HRESERVETYPE == null ? 0 : DetailColl2[0].HRESERVETYPE;//预留类型,
            double HSelPickedQty = DetailColl2[0].HSelPickedQty == null ? 0 : DetailColl2[0].HSelPickedQty; //领料选单数量,
            double HSELPRCDRETURNQTY = DetailColl2[0].HSELPRCDRETURNQTY == null ? 0 : DetailColl2[0].HSELPRCDRETURNQTY;  //退料选单数量,
            string HCloseMan = DetailColl2[0].HCloseMan == null ? "''" : DetailColl2[0].HCloseMan; //行关闭(默认为'')
            DateTime HEntryCloseDate = DetailColl2[0].HEntryCloseDate == null ? dt : DetailColl2[0].HEntryCloseDate;    //行关闭(默认为'')
            long HCloseType = DetailColl2[0].HCloseType == null ? 0 : DetailColl2[0].HCloseType; //关闭类型(默认为0)
            long HSourceInterID = DetailColl2[0].HSourceInterID == null ? 0 : DetailColl2[0].HSourceInterID;     //源单ID
            long HSourceEntryID = DetailColl2[0].HSourceEntryID == null ? 0 : DetailColl2[0].HSourceEntryID; //源单子ID
            string HSourceBillNo = DetailColl2[0].HSourceBillNo == null ? "''" : DetailColl2[0].HSourceBillNo; //源单单号
            string HSourceBillType = DetailColl2[0].HSourceBillType == null ? "''" : DetailColl2[0].HSourceBillType; //源单类型
            double HRelationQty = DetailColl2[0].HRelationQty == null ? 0 : DetailColl2[0].HRelationQty;     //关联数量
            double HRelationMoney = DetailColl2[0].HRelationMoney == null ? 0 : DetailColl2[0].HRelationMoney; //关联金额
            long HCHILDSUPPLYORGID = DetailColl2[0].HCHILDSUPPLYORGID == null ? 0 : DetailColl2[0].HCHILDSUPPLYORGID;
            long HSUPPLYORGID = DetailColl2[0].HSUPPLYORGID == null ? 0 : DetailColl2[0].HSUPPLYORGID;
            long HENTRUSTPICKORGID = DetailColl2[0].HENTRUSTPICKORGID == null ? 0 : DetailColl2[0].HENTRUSTPICKORGID;
            long HSRCTRANSORGID = DetailColl2[0].HSRCTRANSORGID == null ? 0 : DetailColl2[0].HSRCTRANSORGID;
            long HGROUPBYOWNERID = DetailColl2[0].HGROUPBYOWNERID == null ? 0 : DetailColl2[0].HGROUPBYOWNERID;
            long HOWNERID = DetailColl2[0].HOWNERID == null ? 0 : DetailColl2[0].HOWNERID;
            long HAuxPropID = DetailColl2[0].HAuxPropID == null ? 0 : DetailColl2[0].HAuxPropID;
            long HERPInterID = DetailColl2[0].HERPInterID == null ? 0 : DetailColl2[0].HERPInterID;
            long HERPEntryID = DetailColl2[0].HERPEntryID == null ? 0 : DetailColl2[0].HERPEntryID;
            double HMoveStockQty = DetailColl2[0].HMoveStockQty == null ? 0 : DetailColl2[0].HMoveStockQty;
            double HBackRelationQty = DetailColl2[0].HBackRelationQty == null ? 0 : DetailColl2[0].HBackRelationQty;
            string HOWNERTYPEID = DetailColl2[0].HOWNERTYPEID == null ? "''" : DetailColl2[0].HOWNERTYPEID;
            string HBatchNO = DetailColl2[0].HBatchNO == null ? "''" : DetailColl2[0].HBatchNO;
            string HMTONo = DetailColl2[0].HMTONo == null ? "''" : DetailColl2[0].HMTONo;
            string HRemark = DetailColl2[0].HRemark == null ? "''" : DetailColl2[0].HRemark;
            string HMaterNumber = DetailColl2[0].HMaterNumber == null ? "''" : DetailColl2[0].HMaterNumber;
            string HUnitNumber = DetailColl2[0].HUnitNumber == null ? "''" : DetailColl2[0].HUnitNumber;
            int i = 0;
            foreach (ClsSc_PPBomBillSub oSub in DetailColl)
            {
                i++;
                if (oSub.HQty <= 0 || oSub.HQty == null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "第" + i + "行,数量不能为0或者小于0";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (oSub.HMaterID == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "第" + i + "行,物料不能为空";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //if (oSub.HSourceID == 0)
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "第" + i + "行,生产资源不能为空";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                if (oSub.HUnitID == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "第" + i + "行,计量单位不能为空";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DataSet Cs;
                Int64 NewHEntryID = 1;
                Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Sc_PPBomBillSub", "Sc_PPBomBillSub");
                if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0)
                {
                    NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
                    NewHEntryID += 1;
                }
                oCN.RunProc($@"Insert into Sc_PPBomBillSub
                (HInterID,HEntryID,HMaterID,HMaterNumber,HUnitID,HUnitNumber,HSPID,HQty,HQtyMust,HWHID,HRemark
                ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HICMOInterID,HICMOEntryID,HICMOBillNo
                ,HCHILDSUPPLYORGID,HSUPPLYORGID,HENTRUSTPICKORGID,HSRCTRANSORGID,HGROUPBYOWNERID,HOWNERID,HOWNERTYPEID
                ,HRelationQty,HMoveStockQty,HAuxPropID,HBatchNO,HMTONo,HQtyScrap,HERPInterID,HERPEntryID
                ,HBackRelationQty,HNumerator,HDenominator,HBASEUNITID,HProcessID,HICMOENTRYSEQ,HPROJECTNO
                ,HOPERID,HSEQ,HSTOCKSTATUSID,HLOT,HOPTQUEUE,HRESERVETYPE,HSelPickedQty,HSELPRCDRETURNQTY)
                 values({HInterID},{NewHEntryID},{oSub.HMaterID},'{HMaterNumber}',{oSub.HUnitID},'{HUnitNumber}',{oSub.HSPID},{(oSub.HQty == null ? 0 : oSub.HQty)}
                ,{HQtyMust},{oSub.HWHID},'{HRemark}',{HSourceInterID},{HSourceEntryID},{HSourceBillNo},{HSourceBillType},{HICMOInterID},{HICMOEntryID},{HICMOBillNo},{HCHILDSUPPLYORGID},{HSUPPLYORGID},{HENTRUSTPICKORGID},{HSRCTRANSORGID},{HGROUPBYOWNERID},{HOWNERID},{HOWNERTYPEID},{HRelationQty},{HMoveStockQty},{HAuxPropID},{HBatchNO},{HMTONo},{HQtyScrap},{HERPInterID},
                  {HERPEntryID},{HBackRelationQty},{HNumerator},{HDenominator},{oSub.HBASEUNITID},{HProcessID},{HICMOENTRYSEQ},{HPROJECTNO},{HOPERID},{HSEQ},{HSTOCKSTATUSID},{HLOT},{HOPTQUEUE},{HRESERVETYPE},{HSelPickedQty},{HSELPRCDRETURNQTY})");
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        /// <summary>
        ///删除功能
        /// </summary>
        /// <returns></returns>
        [Route("Sc_PPBomBill/DeltetPPBomBillBill")]
        [HttpGet]
        public object DeltetSeOrderBill(string HInterID)
        {
            try
            {
                oCN.BeginTran();
                oCN.RunProc("Delete From Sc_PPBomBillMain where HInterID = " + HInterID);
                oCN.RunProc("Delete From Sc_PPBomBillSub where HInterID = " + HInterID);
                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.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
    }
}
WebAPI/Controllers/WebAPIController.cs
@@ -955,7 +955,7 @@
            //sWhere = " Where HStopFlag=0  and HEndFlag=1  and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
            if (Supplier != "")
            {
                sWhere = sWhere + " and ( HNumber like '%" + Supplier + "%' or HName like '%" + Supplier + "%' or HUSEORGID like '%" + Supplier + "%' ) ";
                sWhere = sWhere + " and ( HNumber like '%" + Supplier + "%' or HName like '%" + Supplier + "%' or HUSEORGID like '%" + HOrgID + "%' ) ";
            }
            try
            {
@@ -1453,6 +1453,60 @@
        }
        /// <summary>
        /// èŽ·å–é‡‡è´­æ–¹å¼åˆ—è¡¨
        /// </summary>
        /// <returns></returns>
        [Route("Web/GetPoStockStyleList_Json")]
        [HttpGet]
        public object GetPoStockStyleList_Json(string PoStockStyle)
        {
            if (PoStockStyle != "")
            {
                sWhere = sWhere + " and ( HNumber like '%" + PoStockStyle + "%' or HName like '%" + PoStockStyle + "%' ) ";
            }
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName  from Gy_PoStockStyle where HStopflag=0 Order by HItemID ", "Gy_PoStockStyle");
                }
                else
                {
                    string sql1 = "Select HItemID,HNumber ,HName  from Gy_PoStockStyle where HStopflag=0 and HEndFlag=1 ";
                    string sql = sql1 + sWhere;
                    ds = oCN.RunProcReturn(sql, "Gy_PoStockStyle");
                }
                if (ds == null || ds.Tables[0].Rows.Count <= 0)
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败" + DBUtility.ClsPub.sErrInfo;
                    objjson.data = null;
                    return objjson;
                }
                else
                {
                    objjson.code = "0";
                    objjson.count = 1;
                    objjson.Message = "获取成功!";
                    objjson.data = ds.Tables[0];
                    return objjson;
                }
            }
            catch (Exception ex)
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "获取失败" + ex.ToString();
                objjson.data = null;
                return objjson;
            }
        }
        /// <summary>
        /// èŽ·å–å®¢æˆ·åˆ—è¡¨
        /// </summary>
        /// <returns></returns>
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_COMMONCONTACTBillController.cs
New file
@@ -0,0 +1,346 @@
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_COMMONCONTACTBillController : ApiController
    {
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        #region  æ”¶è´§æ–¹è”系人 åˆ—表
        [Route("Gy_COMMONCONTACTBill/Gy_COMMONCONTACTList")]
        [HttpGet]
        public object Gy_COMMONCONTACTList(string sWhere, string user, string Organization)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_COMMONCONTACT_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_COMMONCONTACTList where ä½¿ç”¨ç»„织='" + Organization + "'");
                string sql = sql1 + sWhere;
                ds = oCN.RunProcReturn(sql, "h_v_Gy_COMMONCONTACTList");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.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_COMMONCONTACTBill/Gy_COMMONCONTACTEdit")]
        [HttpPost]
        public object Gy_COMMONCONTACTEdit([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_COMMONCONTACT_Edit", 1, false, msg2))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无保存权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            //获取最大ID值赋值
            //DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_COMMONCONTACT ", "Gy_COMMONCONTACT");
            //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_COMMONCONTACT_Ctl oBill = new DAL.ClsGy_COMMONCONTACT_Ctl();
                List<Model.ClsGy_COMMONCONTACT_Model> lsmain = new List<Model.ClsGy_COMMONCONTACT_Model>();
                msg1 = msg1.Replace("\\", "");
                msg1 = msg1.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Gy_COMMONCONTACT(msg1);
                foreach (Model.ClsGy_COMMONCONTACT_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_COMMONCONTACT where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_COMMONCONTACT");
                    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 çˆ¶çº§æ ¡éªŒæ–¹æ³•(api调用先注释掉,)
                    /*
                    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 = "保存失败!短代码为空!";
                        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_COMMONCONTACTBill/Delete")]
        [HttpGet]
        public object Delete(string HItemID, string user)
        {
            DataSet ds;
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                //删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_COMMONCONTACT_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_COMMONCONTACT where HItemID=" + HItemID, "Gy_COMMONCONTACT");
                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_COMMONCONTACT 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
    }
}
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_PaymentConditionListBillController.cs
New file
@@ -0,0 +1,345 @@
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_PaymentConditionListBillController : ApiController
    {
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        #region  ä»˜æ¬¾æ¡ä»¶ åˆ—表
        [Route("Gy_PaymentConditionBill/Gy_PaymentConditionList")]
        [HttpGet]
        public object Gy_PaymentConditionList(string sWhere, string user, string Organization)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_PaymentCondition_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_PaymentConditionList where ä½¿ç”¨ç»„织='" + Organization + "'");
                string sql = sql1 + sWhere;
                ds = oCN.RunProcReturn(sql, "h_v_Gy_PaymentConditionList");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.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_PaymentConditionBill/Gy_PaymentConditionEdit")]
        [HttpPost]
        public object Gy_PaymentConditionEdit([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_PaymentCondition_Edit", 1, false, msg2))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无保存权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            //获取最大ID值赋值
            //DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_PaymentCondition ", "Gy_PaymentCondition");
            //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_PaymentCondition_Ctl oBill = new DAL.ClsGy_PaymentCondition_Ctl();
                List<Model.ClsGy_PaymentCondition_Model> lsmain = new List<Model.ClsGy_PaymentCondition_Model>();
                msg1 = msg1.Replace("\\", "");
                msg1 = msg1.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Gy_PaymentCondition(msg1);
                foreach (Model.ClsGy_PaymentCondition_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_PaymentCondition where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PaymentCondition");
                    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 çˆ¶çº§æ ¡éªŒæ–¹æ³•(api调用先注释掉,)
                    /*
                    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 = "保存失败!短代码为空!";
                        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_PaymentConditionBill/Delete")]
        [HttpGet]
        public object Delete(string HItemID, string user)
        {
            DataSet ds;
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                //删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_PaymentCondition_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_PaymentCondition where HItemID=" + HItemID, "Gy_PaymentCondition");
                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_PaymentCondition 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
    }
}
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_RecConditionBillController.cs
New file
@@ -0,0 +1,346 @@
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_RecConditionBillController : ApiController
    {
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        #region  æ”¶æ¬¾æ¡ä»¶ åˆ—表
        [Route("Gy_RecConditionBill/Gy_RecConditionList")]
        [HttpGet]
        public object Gy_RecConditionList(string sWhere, string user, string Organization)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_RecCondition_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_RecConditionList where ä½¿ç”¨ç»„织='" + Organization + "'");
                string sql = sql1 + sWhere;
                ds = oCN.RunProcReturn(sql, "h_v_Gy_RecConditionList");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.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_RecConditionBill/Gy_RecConditionEdit")]
        [HttpPost]
        public object Gy_RecConditionEdit([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_RecCondition_Edit", 1, false, msg2))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无保存权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            //获取最大ID值赋值
            //DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_RecCondition ", "Gy_RecCondition");
            //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_RecCondition_Ctl oBill = new DAL.ClsGy_RecCondition_Ctl();
                List<Model.ClsGy_RecCondition_Model> lsmain = new List<Model.ClsGy_RecCondition_Model>();
                msg1 = msg1.Replace("\\", "");
                msg1 = msg1.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Gy_RecCondition(msg1);
                foreach (Model.ClsGy_RecCondition_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_RecCondition where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_RecCondition");
                    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 çˆ¶çº§æ ¡éªŒæ–¹æ³•(api调用先注释掉,)
                    /*
                    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 = "保存失败!短代码为空!";
                        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_RecConditionBill/Delete")]
        [HttpGet]
        public object Delete(string HItemID, string user)
        {
            DataSet ds;
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                //删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_RecCondition_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_RecCondition where HItemID=" + HItemID, "Gy_RecCondition");
                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_RecCondition 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
    }
}
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_StockStatusBillController.cs
New file
@@ -0,0 +1,346 @@
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_StockStatusBillController : ApiController
    {
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        #region åº“存状态 åˆ—表
        [Route("Gy_StockStatusBill/Gy_StockStatusList")]
        [HttpGet]
        public object Gy_StockStatusList(string sWhere, string user, string Organization)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_StockStatus_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_StockStatusList where ä½¿ç”¨ç»„织='" + Organization + "'");
                string sql = sql1 + sWhere;
                ds = oCN.RunProcReturn(sql, "h_v_Gy_StockStatusList");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.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_StockStatusBill/Gy_StockStatusEdit")]
        [HttpPost]
        public object Gy_StockStatusEdit([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_StockStatus_Edit", 1, false, msg2))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无保存权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            //获取最大ID值赋值
            //DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_StockStatus ", "Gy_StockStatus");
            //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_StockStatus_Ctl oBill = new DAL.ClsGy_StockStatus_Ctl();
                List<Model.ClsGy_StockStatus_Model> lsmain = new List<Model.ClsGy_StockStatus_Model>();
                msg1 = msg1.Replace("\\", "");
                msg1 = msg1.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Gy_StockStatus(msg1);
                foreach (Model.ClsGy_StockStatus_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_StockStatus where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_StockStatus");
                    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 çˆ¶çº§æ ¡éªŒæ–¹æ³•(api调用先注释掉,)
                    /*
                    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 = "保存失败!短代码为空!";
                        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_StockStatusBill/Delete")]
        [HttpGet]
        public object Delete(string HItemID, string user)
        {
            DataSet ds;
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                //删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_StockStatus_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_StockStatus where HItemID=" + HItemID, "Gy_StockStatus");
                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_StockStatus 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
    }
}
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_SupplierContactBillController.cs
New file
@@ -0,0 +1,346 @@
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_SupplierContactBillController : ApiController
    {
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        #region ä¾›è´§æ–¹è”系人 åˆ—表
        [Route("Gy_SupplierContactBill/Gy_SupplierContactList")]
        [HttpGet]
        public object Gy_SupplierContactList(string sWhere, string user, string Organization)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_SupplierContact_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_SupplierContactList where ä½¿ç”¨ç»„织='" + Organization + "'");
                string sql = sql1 + sWhere;
                ds = oCN.RunProcReturn(sql, "h_v_Gy_SupplierContactList");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.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_SupplierContactBill/Gy_SupplierContactEdit")]
        [HttpPost]
        public object Gy_SupplierContactEdit([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_SupplierContact_Edit", 1, false, msg2))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无保存权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            //获取最大ID值赋值
            //DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_SupplierContact ", "Gy_SupplierContact");
            //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_SupplierContact_Ctl oBill = new DAL.ClsGy_SupplierContact_Ctl();
                List<Model.ClsGy_SupplierContact_Model> lsmain = new List<Model.ClsGy_SupplierContact_Model>();
                msg1 = msg1.Replace("\\", "");
                msg1 = msg1.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Gy_SupplierContact(msg1);
                foreach (Model.ClsGy_SupplierContact_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_SupplierContact where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_SupplierContact");
                    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 çˆ¶çº§æ ¡éªŒæ–¹æ³•(api调用先注释掉,)
                    /*
                    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 = "保存失败!短代码为空!";
                        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_SupplierContactBill/Delete")]
        [HttpGet]
        public object Delete(string HItemID, string user)
        {
            DataSet ds;
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                //删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_SupplierContact_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_SupplierContact where HItemID=" + HItemID, "Gy_SupplierContact");
                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_SupplierContact 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
    }
}
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_TaxRateBillController.cs
New file
@@ -0,0 +1,346 @@
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_TaxRateBillController : ApiController
    {
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        #region  ä»˜æ¬¾æ¡ä»¶ åˆ—表
        [Route("Gy_TaxRateBill/Gy_TaxRateList")]
        [HttpGet]
        public object Gy_TaxRateList(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_TaxRateList where ä½¿ç”¨ç»„织='" + Organization + "'");
                string sql = sql1 + sWhere;
                ds = oCN.RunProcReturn(sql, "h_v_Gy_TaxRateList");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.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_TaxRateBill/Gy_TaxRateEdit")]
        [HttpPost]
        public object Gy_TaxRateEdit([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;
            }
            //获取最大ID值赋值
            //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_TaxRate_Ctl oBill = new DAL.ClsGy_TaxRate_Ctl();
                List<Model.ClsGy_TaxRate_Model> lsmain = new List<Model.ClsGy_TaxRate_Model>();
                msg1 = msg1.Replace("\\", "");
                msg1 = msg1.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Gy_TaxRate(msg1);
                foreach (Model.ClsGy_TaxRate_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_TaxRate where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_TaxRate");
                    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 çˆ¶çº§æ ¡éªŒæ–¹æ³•(api调用先注释掉,)
                    /*
                    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 = "保存失败!短代码为空!";
                        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_TaxRateBill/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_TaxRate where HItemID=" + HItemID, "Gy_TaxRate");
                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_TaxRate 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
    }
}
WebAPI/ListModels.cs
@@ -849,6 +849,78 @@
        }
        /// <summary>
        /// å¤„理库存状态表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsGy_StockStatus_Model> getObjectByJson_Gy_StockStatus(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_StockStatus_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_StockStatus_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理付款条件表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsGy_PaymentCondition_Model> getObjectByJson_Gy_PaymentCondition(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_PaymentCondition_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_PaymentCondition_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理税率表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsGy_TaxRate_Model> getObjectByJson_Gy_TaxRate(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_TaxRate_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_TaxRate_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理收款条件表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsGy_RecCondition_Model> getObjectByJson_Gy_RecCondition(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_RecCondition_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_RecCondition_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理供货方联系人表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsGy_SupplierContact_Model> getObjectByJson_Gy_SupplierContact(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_SupplierContact_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_SupplierContact_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理收货方联系人表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsGy_COMMONCONTACT_Model> getObjectByJson_Gy_COMMONCONTACT(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_COMMONCONTACT_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_COMMONCONTACT_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理新增审核项目的json
        /// </summary>
        /// <param name="jsonString"></param>
WebAPI/WebAPI.csproj
@@ -443,11 +443,17 @@
    <Compile Include="Controllers\仓存管理\领料发货\Kf_StepFoldOutBillController.cs" />
    <Compile Include="Controllers\仓存管理\验收入库\Kf_StepFoldinBillController.cs" />
    <Compile Include="Controllers\博日自动扫码线\ScanlineAPIController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_COMMONCONTACTBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_DutyBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_PaymentConditionListBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_RecConditionBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_SOPBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_SOPBillEditController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_SOPBillListController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_StockCheckItemBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_StockStatusBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_SupplierContactBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_TaxRateBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_WorkStationBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Xt_CheckFlowBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Xt_CheckItemBillController.cs" />
@@ -876,14 +882,20 @@
    <Folder Include="Views\Cj_CallGoodsBillMain\" />
    <Folder Include="Views\Cj_ComplementGoodsBill\" />
    <Folder Include="Views\Cj_SendGoodsBill\" />
    <Folder Include="Views\Gy_COMMONCONTACTBill\" />
    <Folder Include="Views\Gy_ConkType\" />
    <Folder Include="Views\Gy_DutyBill\" />
    <Folder Include="Views\Gy_EquipType\" />
    <Folder Include="Views\Gy_ICBomBill\" />
    <Folder Include="Views\Gy_MateMould\" />
    <Folder Include="Views\Gy_PackType\" />
    <Folder Include="Views\Gy_PaymentConditionListBill\" />
    <Folder Include="Views\Gy_RecConditionBill\" />
    <Folder Include="Views\Gy_RoutingGroup\" />
    <Folder Include="Views\Gy_SOPBill\" />
    <Folder Include="Views\Gy_StockStatusBill\" />
    <Folder Include="Views\Gy_SupplierContactBill\" />
    <Folder Include="Views\Gy_TaxRateBill\" />
    <Folder Include="Views\Gy_WorkStation\" />
    <Folder Include="Views\JIT_DayPlanPlatFormBill\" />
    <Folder Include="Views\JIT_DayPlanPlatFormImport\" />