1
王 垚
2022-12-12 7d40b174741ff3ee372d46a03b111cddf4546739
1
6个文件已添加
8个文件已修改
1407 ■■■■■ 已修改文件
DAL/基础资料/其他基础资料/ClsGy_MatePriceSup_Ctl.cs 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/Model.csproj 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/其他基础资料/ClsGy_MatePriceSup_Model.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_TaxMIXMain_Model.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_TaxMIXSub_Model.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/系统公用/ClsXt_BillType_Model.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BLL/Xt_BillTypeController.cs 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_CustLocationController.cs 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_MatePriceSupController.cs 332 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_SettleStyleController.cs 393 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_StockCheckItemBillController.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_TaxMIXController.cs 404 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/»ù´¡×ÊÁÏ/ÆäËû»ù´¡×ÊÁÏ/ClsGy_MatePriceSup_Ctl.cs
@@ -11,6 +11,7 @@
        //原代码 ç”¨äºŽ æ›¿æ¢å­é¡¹ç›®
        public string HOldNumber;
        public List<Model.ClsGy_MatePriceSup_Model> DetailColl = new List<Model.ClsGy_MatePriceSup_Model>();
        public Model.ClsGy_MatePriceSup_Model oModel = new Model.ClsGy_MatePriceSup_Model();
@@ -58,17 +59,26 @@
            try
            {
                oCn.BeginTran();
                //插入子表
                foreach (Model.ClsGy_MatePriceSup_Model oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Gy_MatePriceSup " +
                        " (HInterID,HEntryID,HMaterID,HRelationID" +
                //插入表
                //foreach (Model.ClsGy_MatePriceSup_Model oSub in DetailColl)
                //{
                //    oCn.RunProc("Insert into Gy_MatePriceSup " +
                //        " (HInterID,HEntryID,HMaterID,HRelationID" +
                //        ",HUnitID,HBeginQty,HEndQty,HCurID,HType" +
                //        ",HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate)" +
                //        " values(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HRelationID.ToString() +
                //        "," + oSub.HUnitID.ToString() + "," + oSub.HBeginQty.ToString() + "," + oSub.HEndQty.ToString() + "," + oSub.HCurID.ToString() + ",'" + oSub.HType + "'" +
                //        "," + oSub.HPrice.ToString() + ",'" + "GETDATE()" + "','" + "GETDATE()" + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "') ");
                //}
                oCn.RunProc("Insert into " + MvarItemKey + " " +
                    " (HInterID,HEntryID,HMaterID,HRelationID" +
                        ",HUnitID,HBeginQty,HEndQty,HCurID,HType" +
                        ",HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate)" +
                        " values(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HRelationID.ToString() +
                        "," + oSub.HUnitID.ToString() + "," + oSub.HBeginQty.ToString() + "," + oSub.HEndQty.ToString() + "," + oSub.HCurID.ToString() + ",'" + oSub.HType + "'" +
                        "," + oSub.HPrice.ToString() + ",'" + oSub.HBeginDate + "','" + oSub.HEndDate + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "') ");
                }
                        ",HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate) " +
                        " values(" + oModel.HInterID.ToString() + "," + oModel.HEntryID.ToString() + "," + oModel.HMaterID.ToString() + "," + oModel.HRelationID.ToString() +
                        "," + oModel.HUnitID.ToString() + "," + oModel.HBeginQty.ToString() + "," + oModel.HEndQty.ToString() + "," + oModel.HCurID.ToString() + ",'" + oModel.HType + "'" +
                        "," + oModel.HPrice.ToString() + ",'" + oModel.HBeginDate + "','" + oModel.HEndDate + "'," + oModel.HUsed + ",'" + oModel.HRemark + "','" + oModel.HMaker + "','" + oModel.HMakeDate + "') ");
                //修改上级为非末级代码
                //oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.Commit();
                return true;
            }
@@ -85,18 +95,25 @@
            try
            {
                oCn.BeginTran();
                DeleteByID(sItemID);        //删除记录
                //插入表
                foreach (Model.ClsGy_MatePriceSup_Model oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Gy_MatePriceSup " +
                        " (HInterID,HEntryID,HMaterID,HRelationID" +
                        ",HUnitID,HBeginQty,HEndQty,HCurID,HType" +
                        ",HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate)" +
                        " values(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HRelationID.ToString() +
                        "," + oSub.HUnitID.ToString() + "," + oSub.HBeginQty.ToString() + "," + oSub.HEndQty.ToString() + "," + oSub.HCurID.ToString() + ",'" + oSub.HType + "'" +
                        "," + oSub.HPrice.ToString() + ",'" + oSub.HBeginDate + "','" + oSub.HEndDate + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "') ");
                }
                oCn.RunProc("Update " + MvarItemKey + " set " +
                   " HPrice='" + oModel.HPrice + "'" +
                   ",HRemark='" + oModel.HRemark + "'" +
                   ",HMaterID=" + oModel.HMaterID.ToString() +
                   ",HUnitID=" + oModel.HUnitID.ToString() +
                   ",HCurID=" + oModel.HCurID.ToString() +
                 " Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //DeleteByID(sItemID);        //删除记录
                ////插入表
                //foreach (Model.ClsGy_MatePriceSup_Model oSub in DetailColl)
                //{
                //    oCn.RunProc("Insert into Gy_MatePriceSup " +
                //        " (HInterID,HEntryID,HMaterID,HRelationID" +
                //        ",HUnitID,HBeginQty,HEndQty,HCurID,HType" +
                //        ",HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate)" +
                //        " values(" + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HRelationID.ToString() +
                //        "," + oSub.HUnitID.ToString() + "," + oSub.HBeginQty.ToString() + "," + oSub.HEndQty.ToString() + "," + oSub.HCurID.ToString() + ",'" + oSub.HType + "'" +
                //        "," + oSub.HPrice.ToString() + ",'" + oSub.HBeginDate + "','" + oSub.HEndDate + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "') ");
                //}
                oCn.Commit();
                return true;
            }
@@ -190,6 +207,7 @@
        {
            MvarItemKey = "Gy_MatePriceSup";
            MvarReportTitle = "采购价格资料设置";
            oModel = new Model.ClsGy_MatePriceSup_Model();
        }
    }
}
Model/Model.csproj
@@ -326,6 +326,8 @@
    <Compile Include="基础资料\基础资料\ClsGy_CheckToolsType_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_CustLocation_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_RateType_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_TaxMIXMain_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_TaxMIXSub_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_TaxRate_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_PaymentCondition_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_Company_Model.cs" />
@@ -584,6 +586,7 @@
    <Compile Include="系统公用\ClsOA_EmpMessageBillModSub.cs" />
    <Compile Include="系统公用\ClsOA_FieldToChangeMain.cs" />
    <Compile Include="系统公用\ClsOA_FieldToChangeSub.cs" />
    <Compile Include="系统公用\ClsXt_BillType_Model.cs" />
    <Compile Include="系统公用\ClsXt_ModuleParameterMain.cs" />
    <Compile Include="系统公用\ClsXt_ModuleParameterSub.cs" />
    <Compile Include="行政管理\ClsOF_DormCheckBookBillMain.cs" />
Model/»ù´¡×ÊÁÏ/ÆäËû»ù´¡×ÊÁÏ/ClsGy_MatePriceSup_Model.cs
@@ -16,7 +16,7 @@
        public DateTime HMakeDate;//    datetime
        public string HChecker;//    varchar(50)            --审核人(列表可批量审核)
        public DateTime HCheckDate;//    datetime
        public bool HUsed;//        bit                //使用标记
        public long HUsed;//        bit                //使用标记
        //--------------------------------------------
        public long HMaterID;//    int            --物料内码
        public long HRelationID;//    int            --关联内码(供应商,客户,供应商大类,客户大类,等等)
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_TaxMIXMain_Model.cs
New file
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Model
{
    public class ClsGy_TaxMIXMain_Model : DBUtility.ClsGy_Base_Model
    {
        public DateTime HMakeTime { get; set; }
        public DateTime HCheckTime { get; set; }
        public DateTime HModifyTime { get; set; }
        public DateTime HStopTime { get; set; }
        public string HMakeEmp { get; set; }
        public string HCheckEmp { get; set; }
        public string HModifyEmp { get; set; }
        public string HStopEmp { get; set; }
        public int HUSEORGID { get; set; }
        public int HCREATEORGID { get; set; }
    }
}
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_TaxMIXSub_Model.cs
New file
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Model
{
    public class ClsGy_TaxMIXSub_Model : DBUtility.ClsGy_Base_Model
    {
        public Int64 HItemID;                   //主键 int
        public string HTAXBENCHMARK;
        public Int64 FTAXRATEID;
        public double FTAXBENCHMARKCORRVALUE;
        public Int64 HTAXMIXID;
    }
}
Model/ϵͳ¹«ÓÃ/ClsXt_BillType_Model.cs
New file
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Model
{
    public class ClsXt_BillType_Model : DBUtility.ClsGy_Base_Model
    {
        public string HTemplate;  //模块名
        public string HHeadTable; //数据库主表
        public string HEntryTable; //数据库子表
        public string HViewName;
        public string HRightName;
        public string HBilltypeID;
    }
}
WebAPI/Controllers/BLL/Xt_BillTypeController.cs
@@ -268,7 +268,49 @@
            }
        }
        #region å•据类型 é‡‘蝶同步
        [Route("Xt_BillType/SaveXt_BillTypeListApi")]
        [HttpPost]
        public object SaveXt_BillTypeListApi([FromBody] JObject msg)
        {
            try
            {
                var _value = msg["model"].ToString();
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ListModels oListModels = new ListModels();
                List<Model.ClsXt_BillType_Model> lsmain = new List<Model.ClsXt_BillType_Model>();
                lsmain = oListModels.getObjectByJson_Xt_BillType(_value);
                string sql = string.Empty;
                //保存
                oCN.BeginTran();
                sql = $"delete Xt_BillType where HItemID = {lsmain[0].HItemID}";
                oCN.RunProc(sql);
                //sql = "set identity_insert Xt_BillType on";
                //oCN.RunProc(sql);
        //
                oCN.RunProc($@"insert into Xt_BillType(HBilltypeID,HNumber,HName,HTemplate,HHeadTable,HEntryTable,HViewName,HRightName)
                  values('{lsmain[0].HBilltypeID}','{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HTemplate}','{lsmain[0].HHeadTable}','{lsmain[0].HEntryTable}','{lsmain[0].HViewName}','{lsmain[0].HRightName}' )", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                sql = "set identity_insert Xt_BillType off";
                oCN.RunProc(sql);
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "保存成功!";
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_CustLocationController.cs
@@ -342,55 +342,5 @@
            }
        }
        #endregion
        #region äº¤è´§åœ°ç‚¹ é‡‘蝶同步
        [Route("Gy_CustLocation/SaveGy_CustLocationListApi")]
        [HttpPost]
        public object SaveGy_CustLocationListApi([FromBody] JObject msg)
        {
            try
            {
                var _value = msg["model"].ToString();
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ListModels oListModels = new ListModels();
                List<Model.ClsGy_CustLocation_Model> lsmain = new List<Model.ClsGy_CustLocation_Model>();
                lsmain = oListModels.getObjectByJson_Gy_CustLocation(_value);
                string sql = string.Empty;
                //保存
                oCN.BeginTran();
                sql = $"delete Gy_CustLocation where HItemID = {lsmain[0].HItemID}";
                oCN.RunProc(sql);
                sql = "set identity_insert Gy_CustLocation on";
                oCN.RunProc(sql);
                oCN.RunProc($@"insert into Gy_CustLocation(HItemID,HNumber,HName ,HShortNumber,HParentID ,HLevel
                                ,HEndFla,HStopflag,HRemark ,HHelpCode ,HUseFlag
                                 ,HMakeTime ,HMakeEmp ,HCheckEmp ,HCheckTime ,HModifyEmp
                                 ,HModifyTime ,HStopEmp ,HStopTime ,HUSEORGID,HCREATEORGID)
                  values({lsmain[0].HItemID},'{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HShortNumber}',{lsmain[0].HParentID},{lsmain[0].HLevel}
           ,{Convert.ToString(lsmain[0].HEndFlag ? 1 : 0)},{Convert.ToString(lsmain[0].HStopflag ? 1 : 0) },'{lsmain[0].HRemark}','{lsmain[0].HHelpCode}','{lsmain[0].HUseFlag}'
            ,'{lsmain[0].HMakeTime}','{lsmain[0].HMakeEmp}','{lsmain[0].HCheckEmp}','{lsmain[0].HCheckTime}','{lsmain[0].HModifyEmp}'
            ,'{lsmain[0].HModifyTime}','{lsmain[0].HStopEmp}',null,{lsmain[0].HUSEORGID},{lsmain[0].HCREATEORGID})", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                sql = "set identity_insert Gy_CustLocation off";
                oCN.RunProc(sql);
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "保存成功!";
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_MatePriceSupController.cs
New file
@@ -0,0 +1,332 @@
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_MatePriceSupController : ApiController
    {
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        #region  é‡‡è´­ä»·æ ¼ åˆ—表
        [Route("Gy_MatePriceSup/MatePriceSupList")]
        [HttpGet]
        public object MatePriceSupList(string sWhere, string user, string Organization)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Query", 1, false, user))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "无查看权限!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                string sql1 = string.Format(@"select * from h_v_Gy_MatePriceSupList where 1 = 1 ");
                string sql = sql1 + sWhere;
                ds = oCN.RunProcReturn(sql, "h_v_Gy_MatePriceSupList");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到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_MatePriceSup/MatePriceSupEdit")]
        [HttpPost]
        public object MatePriceSupEdit([FromBody] JObject msg)
        {
            DataSet ds;
            var _value = msg["msg"].ToString();
            string msg3 = _value.ToString();
            string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg1 = sArray[0].ToString();
            string msg2 = sArray[1].ToString();
            //string msg_HUSEORGID = sArray[2].ToString();
            Int64 HItemID = 0;
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            //编辑权限
            //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Edit", 1, false, msg2))
            //{
            //    objJsonResult.code = "0";
            //    objJsonResult.count = 0;
            //    objJsonResult.Message = "无保存权限!";
            //    objJsonResult.data = null;
            //    return objJsonResult;
            //}
            //获取最大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_MatePriceSup_Ctl oBill = new DAL.ClsGy_MatePriceSup_Ctl();
                List<Model.ClsGy_MatePriceSup_Model> lsmain = new List<Model.ClsGy_MatePriceSup_Model>();
                msg1 = msg1.Replace("\\", "");
                msg1 = msg1.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Gy_MatePriceSup(msg1);
                foreach (Model.ClsGy_MatePriceSup_Model oItem in lsmain)
                {
                    //新增时判断
                    #region çˆ¶çº§æ ¡éªŒæ–¹æ³•(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
                    //oItem.HUSEORGID = Convert.ToInt32(msg_HUSEORGID); //组织id
                    oBill.oModel = oItem;
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (oBill.oModel.HItemID == 0)
                {
                    bResult = oBill.AddNew();
                }
                else
                {
                    bResult = oBill.ModifyByID(oBill.oModel.HItemID);
                }
                if (bResult)
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #endregion
        #region  é‡‡è´­ä»·æ ¼ åˆ é™¤
        [Route("Gy_MatePriceSup/Delete")]
        [HttpGet]
        public object Delete(string HItemID, string user)
        {
            DataSet ds;
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                //删除权限
                //if (!DBUtility.ClsPub.Security_Log("Gy_TaxRate_Drop", 1, false, user))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "无删除权限";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                if (string.IsNullOrWhiteSpace(HItemID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HItemID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();//开始事务
                ds = oCN.RunProcReturn("select * from Gy_MatePriceSup where HItemID=" + HItemID, "Gy_MatePriceSup");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有数据,无法删除!";
                    objJsonResult.data = null;
                    return objJsonResult; ;
                }
                //var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]);
                //if (HStopflag)
                //{
                //    oCN.RollBack();//回滚事务
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "数据已禁用无法删除!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                oCN.RunProc("delete from Gy_MatePriceSup where HItemID=" + HItemID);
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "* æ•°æ®åˆ é™¤æˆåŠŸï¼";
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "删除失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region é‡‡è´­ä»·æ ¼ é‡‘蝶同步
        [Route("Gy_MatePriceSup/SaveGy_MatePriceSupListApi")]
        [HttpPost]
        public object SaveGy_MatePriceSupListApi([FromBody] JObject msg)
        {
            try
            {
                var _value = msg["model"].ToString();
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ListModels oListModels = new ListModels();
                List<Model.ClsGy_MatePriceSup_Model> lsmain = new List<Model.ClsGy_MatePriceSup_Model>();
                lsmain = oListModels.getObjectByJson_Gy_MatePriceSup(_value);
                string sql = string.Empty;
                //保存
                oCN.BeginTran();
                sql = $"delete Gy_MatePriceSup where HItemID = {lsmain[0].HItemID}";
                oCN.RunProc(sql);
                sql = "set identity_insert Gy_MatePriceSup on";
                oCN.RunProc(sql);
                oCN.RunProc($@"insert into Gy_MatePriceSup(HItemID,HInterID,HEntryID,HMaterID,HRelationID,HUnitID,HBeginQty,HEndQty,HCurID,HType
                        ,HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate)
                  values({lsmain[0].HItemID},{lsmain[0].HInterID},{lsmain[0].HEntryID},{lsmain[0].HMaterID},{lsmain[0].HRelationID},{lsmain[0].HUnitID},{lsmain[0].HBeginQty},{lsmain[0].HEndQty},{lsmain[0].HCurID},'{lsmain[0].HType}',{lsmain[0].HPrice},'{lsmain[0].HBeginDate}','{lsmain[0].HEndDate}','{lsmain[0].HUsed}','{lsmain[0].HRemark}','{lsmain[0].HMaker}','{lsmain[0].HMakeDate}')", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                sql = "set identity_insert Gy_MatePriceSup off";
                oCN.RunProc(sql);
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "保存成功!";
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_SettleStyleController.cs
New file
@@ -0,0 +1,393 @@
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_SettleStyleController : ApiController
    {
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        #region  ç»“算方式 åˆ—表
        [Route("Gy_SettleStyle/SettleStyleList")]
        [HttpGet]
        public object SettleStyleList(string sWhere, string user, string Organization)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Query", 1, false, user))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "无查看权限!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                string sql1 = string.Format(@"select * from h_v_Gy_SettleStyleList where 1 = 1 ");
                string sql = sql1 + sWhere;
                ds = oCN.RunProcReturn(sql, "h_v_Gy_SettleStyleList");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到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_SettleStyle/SettleStyleEdit")]
        [HttpPost]
        public object SettleStyleEdit([FromBody] JObject msg)
        {
            DataSet ds;
            var _value = msg["msg"].ToString();
            string msg3 = _value.ToString();
            string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg1 = sArray[0].ToString();
            string msg2 = sArray[1].ToString();
            //string msg_HUSEORGID = sArray[2].ToString();
            Int64 HItemID = 0;
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            //编辑权限
            //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Edit", 1, false, msg2))
            //{
            //    objJsonResult.code = "0";
            //    objJsonResult.count = 0;
            //    objJsonResult.Message = "无保存权限!";
            //    objJsonResult.data = null;
            //    return objJsonResult;
            //}
            //获取最大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_SettleStyle_Ctl oBill = new DAL.ClsGy_SettleStyle_Ctl();
                List<Model.ClsGy_SettleStyle_Model> lsmain = new List<Model.ClsGy_SettleStyle_Model>();
                msg1 = msg1.Replace("\\", "");
                msg1 = msg1.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Gy_SettleStyle(msg1);
                foreach (Model.ClsGy_SettleStyle_Model oItem in lsmain)
                {
                    if (oItem.HNumber.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码不能为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (oItem.HName.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!名称不能为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //查询数据中是否存在重复代码
                    ds = oCN.RunProcReturn("select * from  Gy_SettleStyle where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_SettleStyle");
                    if (oItem.HItemID == 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "保存失败!代码重复!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    else
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            if (ds.Tables[0].Rows[0]["HItemID"].ToString() != oItem.HItemID.ToString())
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "保存失败!代码重复!";
                                objJsonResult.data = null;
                                return objJsonResult;
                            }
                        }
                    }
                    //新增时判断
                    #region çˆ¶çº§æ ¡éªŒæ–¹æ³•(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_SettleStyle/Delete")]
        [HttpGet]
        public object Delete(string HItemID, string user)
        {
            DataSet ds;
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                //删除权限
                //if (!DBUtility.ClsPub.Security_Log("Gy_TaxRate_Drop", 1, false, user))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "无删除权限";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                if (string.IsNullOrWhiteSpace(HItemID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HItemID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();//开始事务
                ds = oCN.RunProcReturn("select * from Gy_SettleStyle where HItemID=" + HItemID, "Gy_SettleStyle");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有数据,无法删除!";
                    objJsonResult.data = null;
                    return objJsonResult; ;
                }
                var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]);
                if (HStopflag)
                {
                    oCN.RollBack();//回滚事务
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "数据已禁用无法删除!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.RunProc("delete from Gy_SettleStyle where HItemID=" + HItemID);
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "* æ•°æ®åˆ é™¤æˆåŠŸï¼";
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "删除失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ç»“算方式 é‡‘蝶同步
        [Route("Gy_SettleStyle/SaveGy_SettleStyleListApi")]
        [HttpPost]
        public object SaveGy_SettleStyleListApi([FromBody] JObject msg)
        {
            try
            {
                var _value = msg["model"].ToString();
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ListModels oListModels = new ListModels();
                List<Model.ClsGy_SettleStyle_Model> lsmain = new List<Model.ClsGy_SettleStyle_Model>();
                lsmain = oListModels.getObjectByJson_Gy_SettleStyle(_value);
                string sql = string.Empty;
                //保存
                oCN.BeginTran();
                sql = $"delete Gy_SettleStyle where HItemID = {lsmain[0].HItemID}";
                oCN.RunProc(sql);
                sql = "set identity_insert Gy_SettleStyle on";
                oCN.RunProc(sql);
                oCN.RunProc($@"insert into Gy_SettleStyle(HItemID,HNumber,HName,HHelpCode,HShortNumber,HParentID
                    ,HLevel,HEndFlag,HStopflag,HRemark)
                  values({lsmain[0].HItemID},'{lsmain[0].HNumber}','{lsmain[0].HName}','{lsmain[0].HHelpCode}','{lsmain[0].HShortNumber}',{lsmain[0].HParentID},{lsmain[0].HLevel}
           ,{Convert.ToString(lsmain[0].HEndFlag ? 1 : 0)},{Convert.ToString(lsmain[0].HStopflag ? 1 : 0) },'{lsmain[0].HRemark}')", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                sql = "set identity_insert Gy_SettleStyle off";
                oCN.RunProc(sql);
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "保存成功!";
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_StockCheckItemBillController.cs
@@ -472,7 +472,7 @@
                string userID = sArray[2].ToString();//userID
                string sName = sArray[3].ToString();//盘点方案
                //查询盘点方案创建日期
                DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName=" + sName, "Gy_StockCheckItem");
                DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName='" + sName+"'", "Gy_StockCheckItem");
                string HDate = dd.Tables[0].Rows[0]["HMakeTime"].ToString();
                //转化格式
@@ -561,7 +561,7 @@
                string userID = sArray[2].ToString();//userID
                string sName = sArray[3].ToString();//盘点方案
                //查询盘点方案创建日期
                DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName=" + sName, "Gy_StockCheckItem");
                DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName='" + sName + "'", "Gy_StockCheckItem");
                string HDate = dd.Tables[0].Rows[0]["HMakeTime"].ToString();
                //转化格式
@@ -764,7 +764,7 @@
                string userID = sArray[2].ToString();//userID
                string sName = sArray[3].ToString();//盘点方案
                //查询盘点方案创建日期
                DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName=" + sName, "Gy_StockCheckItem");
                DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName='" + sName + "'", "Gy_StockCheckItem");
                string HDate = dd.Tables[0].Rows[0]["HMakeTime"].ToString();
                //转化格式
@@ -852,7 +852,7 @@
                string userID = sArray[2].ToString();//userID
                string sName = sArray[3].ToString();//盘点方案
                //查询盘点方案创建日期
                DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName=" + sName, "Gy_StockCheckItem");
                DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName='" + sName + "'", "Gy_StockCheckItem");
                string HDate = dd.Tables[0].Rows[0]["HMakeTime"].ToString();
                //转化格式
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_TaxMIXController.cs
New file
@@ -0,0 +1,404 @@
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebAPI.Models;
namespace WebAPI.Controllers.基础资料.基础资料
{
    public class Gy_TaxMIXController : ApiController
    {
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        //#region  ç¨ŽçŽ‡ç»„åˆ åˆ—表
        //[Route("Gy_TaxMIX/TaxMIXList")]
        //[HttpGet]
        //public object TaxMIXList(string sWhere, string user, string Organization)
        //{
        //    try
        //    {
        //        List<object> columnNameList = new List<object>();
        //        //编辑权限
        //        //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Query", 1, false, user))
        //        //{
        //        //    objJsonResult.code = "0";
        //        //    objJsonResult.count = 0;
        //        //    objJsonResult.Message = "无查看权限!";
        //        //    objJsonResult.data = null;
        //        //    return objJsonResult;
        //        //}
        //        string sql1 = string.Format(@"select * from h_v_Gy_TaxMIXList where ä½¿ç”¨ç»„织='" + Organization + "'");
        //        string sql = sql1 + sWhere;
        //        ds = oCN.RunProcReturn(sql, "h_v_Gy_TaxMIXList");
        //        //添加列名
        //        foreach (DataColumn col in ds.Tables[0].Columns)
        //        {
        //            Type dataType = col.DataType;
        //            string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
        //            columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到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_TaxMIX/TaxMIXEdit")]
        //[HttpPost]
        //public object TaxMIXEdit([FromBody] JObject msg)
        //{
        //    DataSet ds;
        //    var _value = msg["msg"].ToString();
        //    string msg3 = _value.ToString();
        //    string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
        //    string msg1 = sArray[0].ToString();
        //    string msg2 = sArray[1].ToString();
        //    //string msg_HUSEORGID = sArray[2].ToString();
        //    Int64 HItemID = 0;
        //    SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        //    //编辑权限
        //    //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Edit", 1, false, msg2))
        //    //{
        //    //    objJsonResult.code = "0";
        //    //    objJsonResult.count = 0;
        //    //    objJsonResult.Message = "无保存权限!";
        //    //    objJsonResult.data = null;
        //    //    return objJsonResult;
        //    //}
        //    //获取最大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_TaxMIX_Ctl oBill = new DAL.ClsGy_TaxMIX_Ctl();
        //        List<Model.ClsGy_TaxMIX_Model> lsmain = new List<Model.ClsGy_TaxMIX_Model>();
        //        msg1 = msg1.Replace("\\", "");
        //        msg1 = msg1.Replace("\n", "");  //\n
        //        lsmain = oListModels.getObjectByJson_Gy_TaxMIX(msg1);
        //        foreach (Model.ClsGy_TaxMIX_Model oItem in lsmain)
        //        {
        //            if (oItem.HNumber.Trim() == "")
        //            {
        //                objJsonResult.code = "0";
        //                objJsonResult.count = 0;
        //                objJsonResult.Message = "保存失败!代码不能为空!";
        //                objJsonResult.data = 1;
        //                return objJsonResult;
        //            }
        //            if (oItem.HName.Trim() == "")
        //            {
        //                objJsonResult.code = "0";
        //                objJsonResult.count = 0;
        //                objJsonResult.Message = "保存失败!名称不能为空!";
        //                objJsonResult.data = 1;
        //                return objJsonResult;
        //            }
        //            //查询数据中是否存在重复代码
        //            ds = oCN.RunProcReturn("select * from  Gy_TaxMIX where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_TaxMIX");
        //            if (oItem.HItemID == 0)
        //            {
        //                if (ds.Tables[0].Rows.Count > 0)
        //                {
        //                    objJsonResult.code = "0";
        //                    objJsonResult.count = 0;
        //                    objJsonResult.Message = "保存失败!代码重复!";
        //                    objJsonResult.data = null;
        //                    return objJsonResult;
        //                }
        //            }
        //            else
        //            {
        //                if (ds.Tables[0].Rows.Count > 0)
        //                {
        //                    if (ds.Tables[0].Rows[0]["HItemID"].ToString() != oItem.HItemID.ToString())
        //                    {
        //                        objJsonResult.code = "0";
        //                        objJsonResult.count = 0;
        //                        objJsonResult.Message = "保存失败!代码重复!";
        //                        objJsonResult.data = null;
        //                        return objJsonResult;
        //                    }
        //                }
        //            }
        //            //新增时判断
        //            #region çˆ¶çº§æ ¡éªŒæ–¹æ³•(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_TaxMIX/Delete")]
        //[HttpGet]
        //public object Delete(string HItemID, string user)
        //{
        //    DataSet ds;
        //    try
        //    {
        //        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        //        //删除权限
        //        //if (!DBUtility.ClsPub.Security_Log("Gy_TaxRate_Drop", 1, false, user))
        //        //{
        //        //    objJsonResult.code = "0";
        //        //    objJsonResult.count = 0;
        //        //    objJsonResult.Message = "无删除权限";
        //        //    objJsonResult.data = null;
        //        //    return objJsonResult;
        //        //}
        //        if (string.IsNullOrWhiteSpace(HItemID))
        //        {
        //            objJsonResult.code = "0";
        //            objJsonResult.count = 0;
        //            objJsonResult.Message = "HItemID为空!";
        //            objJsonResult.data = null;
        //            return objJsonResult;
        //        }
        //        oCN.BeginTran();//开始事务
        //        ds = oCN.RunProcReturn("select * from Gy_TaxMIX where HItemID=" + HItemID, "Gy_TaxMIX");
        //        if (ds == null || ds.Tables[0].Rows.Count == 0)
        //        {
        //            objJsonResult.code = "0";
        //            objJsonResult.count = 0;
        //            objJsonResult.Message = "没有数据,无法删除!";
        //            objJsonResult.data = null;
        //            return objJsonResult; ;
        //        }
        //        var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]);
        //        if (HStopflag)
        //        {
        //            oCN.RollBack();//回滚事务
        //            objJsonResult.code = "0";
        //            objJsonResult.count = 0;
        //            objJsonResult.Message = "数据已禁用无法删除!";
        //            objJsonResult.data = null;
        //            return objJsonResult;
        //        }
        //        oCN.RunProc("delete from Gy_TaxMIX where HItemID=" + HItemID);
        //        oCN.Commit();//提交事务
        //        objJsonResult.code = "0";
        //        objJsonResult.count = 1;
        //        objJsonResult.Message = "* æ•°æ®åˆ é™¤æˆåŠŸï¼";
        //        objJsonResult.data = null;
        //        return objJsonResult; ;
        //    }
        //    catch (Exception e)
        //    {
        //        objJsonResult.code = "0";
        //        objJsonResult.count = 0;
        //        objJsonResult.Message = "删除失败!" + e.ToString();
        //        objJsonResult.data = null;
        //        return objJsonResult;
        //    }
        //}
        //#endregion
        #region ç¨ŽçŽ‡ç»„åˆ é‡‘蝶同步
        [Route("Gy_TaxMIXMain/SaveGy_TaxMIXMainListApi")]
        [HttpPost]
        public object SaveGy_TaxMIXListApi([FromBody] JObject sMainSub)
        {
            try
            {
                var model = sMainSub["model"].ToString();
                var entry = sMainSub["model"]["HENTRY"].ToString();
                model = "[" + model.ToString() + "]";
                List<ClsGy_TaxMIXMain_Model> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsGy_TaxMIXMain_Model>>(model);
                List<ClsGy_TaxMIXSub_Model> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsGy_TaxMIXSub_Model>>(entry);
                string sql = string.Empty;
                oCN.BeginTran();
                sql = $"delete Gy_TaxMIXMain where HItemID = {mainList[0].HItemID}";
                oCN.RunProc(sql);
                sql = $"delete Gy_TaxMIXSub where HItemID = {mainList[0].HItemID}";
                oCN.RunProc(sql);
                //主表
                oCN.RunProc($@"insert into Gy_TaxMIXMain(HItemID,HNumber,HName ,HShortNumber,HParentID ,HLevel
                                ,HEndFlag,HStopflag,HRemark ,HHelpCode ,HUseFlag
                                 ,HMakeTime ,HMakeEmp ,HCheckEmp ,HCheckTime ,HModifyEmp
                                 ,HModifyTime ,HStopEmp ,HStopTime ,HUSEORGID,HCREATEORGID)
                  values({mainList[0].HItemID},'{mainList[0].HNumber}','{mainList[0].HName}','{mainList[0].HShortNumber}',{mainList[0].HParentID},{mainList[0].HLevel}
                   ,{Convert.ToString(mainList[0].HEndFlag ? 1 : 0)},{Convert.ToString(mainList[0].HStopflag ? 1 : 0) },'{mainList[0].HRemark}','{mainList[0].HHelpCode}','{mainList[0].HUseFlag}'
                    ,'{mainList[0].HMakeTime}','{mainList[0].HMakeEmp}','{mainList[0].HCheckEmp}','{mainList[0].HCheckTime}','{mainList[0].HModifyEmp}'
                    ,'{mainList[0].HModifyTime}','{mainList[0].HStopEmp}',null,{mainList[0].HUSEORGID},{mainList[0].HCREATEORGID})", ref DBUtility.ClsPub.sExeReturnInfo);
                //保存主表
                foreach (var oSub in subList)
                {
                    oCN.RunProc($@"Insert into Gy_TaxMIXSub
                (HItemID,FTAXMIXID,HTAXBENCHMARK,FTAXRATEID
                ,FTAXBENCHMARKCORRVALUE)
                 values({oSub.HItemID},{oSub.HTAXMIXID},{oSub.HTAXBENCHMARK}
                ,{oSub.FTAXRATEID},{oSub.FTAXBENCHMARKCORRVALUE})");
                }
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "单据保存成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/ListModels.cs
@@ -909,6 +909,54 @@
        }
        /// <summary>
        /// å¤„理结算方式表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsGy_SettleStyle_Model> getObjectByJson_Gy_SettleStyle(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_SettleStyle_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_SettleStyle_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理税率组合表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsGy_TaxMIXMain_Model> getObjectByJson_Gy_TaxMIXMain(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_TaxMIXMain_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_TaxMIXMain_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理采购价格表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsGy_MatePriceSup_Model> getObjectByJson_Gy_MatePriceSup(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_MatePriceSup_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_MatePriceSup_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理单据类型表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsXt_BillType_Model> getObjectByJson_Xt_BillType(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsXt_BillType_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsXt_BillType_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理收款条件表的json
        /// </summary>
        /// <param name="jsonString"></param>
WebAPI/WebAPI.csproj
@@ -448,15 +448,18 @@
    <Compile Include="Controllers\基础资料\基础资料\Gy_COMMONCONTACTBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_CustLocationController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_DutyBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_MatePriceSupController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_PaymentConditionListBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_RateTypeController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_RecConditionBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_SettleStyleController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_SOPBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_SOPBillEditController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_SOPBillListController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_StockCheckItemBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_StockStatusBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_SupplierContactBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_TaxMIXController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_TaxRateBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_WorkStationBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Xt_CheckFlowBillController.cs" />
@@ -894,14 +897,17 @@
    <Folder Include="Views\Gy_EquipType\" />
    <Folder Include="Views\Gy_ICBomBill\" />
    <Folder Include="Views\Gy_MateMould\" />
    <Folder Include="Views\Gy_MatePriceSup\" />
    <Folder Include="Views\Gy_PackType\" />
    <Folder Include="Views\Gy_PaymentConditionListBill\" />
    <Folder Include="Views\Gy_RateType\" />
    <Folder Include="Views\Gy_RecConditionBill\" />
    <Folder Include="Views\Gy_RoutingGroup\" />
    <Folder Include="Views\Gy_SettleStyle\" />
    <Folder Include="Views\Gy_SOPBill\" />
    <Folder Include="Views\Gy_StockStatusBill\" />
    <Folder Include="Views\Gy_SupplierContactBill\" />
    <Folder Include="Views\Gy_TaxMIXMain\" />
    <Folder Include="Views\Gy_TaxRateBill\" />
    <Folder Include="Views\Gy_WorkStation\" />
    <Folder Include="Views\JIT_DayPlanPlatFormBill\" />