仓库列表 增加 仓库类型字段
班次 ,,点检项目,维修项目,维修验收项目,设备档案,器具主档维护,检验项目分类,检验项目,检验值,检验仪器,异常反馈类型,工艺路线大类,维修验收项目分类,维修项目分类,保养项目分类 审核 反审核 禁用 反禁用 删除前 删除后 控制 增加页签 增加字段
增加点检项目分类字段
保养项目 维修项目 维修验收项目 增加树形图
1个文件已删除
36个文件已修改
8个文件已添加
9368 ■■■■■ 已修改文件
DAL/DAL.csproj 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/基础资料/公用基础资料/ClsGy_MaintainClass_Ctl.cs 161 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/基础资料/公用基础资料/ClsGy_RepairCheckClass_Ctl.cs 161 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/基础资料/公用基础资料/ClsGy_RepairClass_Ctl.cs 161 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/基础资料/其他基础资料/ClsGy_WorkShift_Ctl.cs 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LMES/DingDing_autoGetData.cs 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LMES/bin/Debug.rar 补丁 | 查看 | 原始文档 | blame | 历史
Model/Model.csproj 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_ErrMsgBackType_Model.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_InspectInstruMent_Model.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_InspectValue_Model .cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_MaintainClass_Model.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_RepairCheckClass_Model.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_RepairClass_Model.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_RoutingGroup_Model.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs 530 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BaseSet/Gy_CheckItemController.cs 829 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BaseSet/Gy_MaterialController.cs 334 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BaseSet/Gy_QCCheckClassController.cs 161 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BaseSet/Gy_RoutingGroupController.cs 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs 283 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/WebAPIController.cs 888 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_DotCheckBillController.cs 539 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_MaintainBillController.cs 630 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_RepairBillController.cs 530 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_RepairCheckBillController.cs 633 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_RepairCheckClassController.cs 2380 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/生产基础资料/Gy_ShiftsController.cs 420 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/数据同步/钉钉同步/DD_DataSynchronizationController.cs 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsGy_ErrMsgBackType_Ctl.cs 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsGy_InspectInstruMent_Ctl.cs 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsGy_InspectValue_Ctl.cs 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsGy_RoutingGroup_Ctl.cs 165 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/CheckItem.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsGy_DotCheck.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsGy_EquipFileMain.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsGy_Maintain.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsGy_Repair.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsGy_RepairCheck.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/Gy_Mould.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/基础资料/Warehouse.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/DAL.csproj
@@ -80,6 +80,9 @@
  <ItemGroup>
    <Compile Include="APS\ClsSc_WorkBillMonthSortBill.cs" />
    <Compile Include="APS\ClsSc_ICMOChangeBill.cs" />
    <Compile Include="基础资料\公用基础资料\ClsGy_MaintainClass_Ctl.cs" />
    <Compile Include="基础资料\公用基础资料\ClsGy_RepairClass_Ctl.cs" />
    <Compile Include="基础资料\公用基础资料\ClsGy_RepairCheckClass_Ctl.cs" />
    <Compile Include="生产管理\ClsSc_ShiftsBeginInfoBill.cs" />
    <Compile Include="ClsPay_AbsentBill.cs" />
    <Compile Include="ClsPay_EarlyLateErrBill.cs" />
DAL/»ù´¡×ÊÁÏ/¹«Óûù´¡×ÊÁÏ/ClsGy_MaintainClass_Ctl.cs
New file
@@ -0,0 +1,161 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public class ClsGy_MaintainClass_Ctl : DBUtility.ClsGy_Base_Ctl
    {
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        //原代码 ç”¨äºŽ æ›¿æ¢å­é¡¹ç›®
        public string HOldNumber;
        public Model.ClsGy_MaintainClass_Model oModel = new Model.ClsGy_MaintainClass_Model();
        //新增
        public bool AddNew(ref string sReturn)
        {
            //
            try
            {
                oCn.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_MaintainClass_BeforeSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_MaintainClass_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.RunProc("Insert into " + MvarItemKey + " " +
                    " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                    ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID) " +
                    " Values('" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() +
                    "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "','" + DateTime.Now + "','" + oModel.HUSEORGID + "','" + oModel.HUseFlag + "','" + oModel.HMakeEmp + "','" + oModel.HUSEORGID + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_MaintainClass_AfterSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_MaintainClass_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //=========================================================
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //修改
        public bool ModifyByID(Int64 sItemID, ref string sReturn)
        {
            try
            {
                oCn.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_MaintainClass_BeforeSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_MaintainClass_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.RunProc("Update " + MvarItemKey + " set " +
                    " HNumber='" + oModel.HNumber + "'" +
                    ",HName='" + oModel.HName + "'" +
                    ",HShortNumber='" + oModel.HShortNumber + "'" +
                    ",HHelpCode='" + oModel.HHelpCode + "'" +
                    ",HModifyTime='" + DateTime.Now + "'" +
                    ",HUSEORGID='" + oModel.HUSEORGID + "'" +
                    ",HModifyEmp ='" + oModel.HMakeEmp + "'" +
                    ",HUseFlag='" + oModel.HUseFlag + "'" +
                    ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) +
                    ",HRemark= '" + oModel.HRemark + "' 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);
                //
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_MaintainClass_AfterSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_MaintainClass_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //=========================================================
                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_MaintainClass_Ctl()
        {
            MvarItemKey = "Gy_MaintainClass";
            MvarReportTitle = "保养项目分类";
            oModel = new Model.ClsGy_MaintainClass_Model();
        }
    }
}
DAL/»ù´¡×ÊÁÏ/¹«Óûù´¡×ÊÁÏ/ClsGy_RepairCheckClass_Ctl.cs
New file
@@ -0,0 +1,161 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public class ClsGy_RepairCheckClass_Ctl : DBUtility.ClsGy_Base_Ctl
    {
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        //原代码 ç”¨äºŽ æ›¿æ¢å­é¡¹ç›®
        public string HOldNumber;
        public Model.ClsGy_RepairCheckClass_Model oModel = new Model.ClsGy_RepairCheckClass_Model();
        //新增
        public bool AddNew(ref string sReturn)
        {
            //
            try
            {
                oCn.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_RepairCheckClass_BeforeSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_RepairCheckClass_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.RunProc("Insert into " + MvarItemKey + " " +
                    " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                    ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID) " +
                    " Values('" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() +
                    "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "','" + DateTime.Now + "','" + oModel.HUSEORGID + "','" + oModel.HUseFlag + "','" + oModel.HMakeEmp + "','" + oModel.HUSEORGID + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_RepairCheckClass_AfterSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_RepairCheckClass_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //=========================================================
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //修改
        public bool ModifyByID(Int64 sItemID, ref string sReturn)
        {
            try
            {
                oCn.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_RepairCheckClass_BeforeSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_RepairCheckClass_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.RunProc("Update " + MvarItemKey + " set " +
                    " HNumber='" + oModel.HNumber + "'" +
                    ",HName='" + oModel.HName + "'" +
                    ",HShortNumber='" + oModel.HShortNumber + "'" +
                    ",HHelpCode='" + oModel.HHelpCode + "'" +
                    ",HModifyTime='" + DateTime.Now + "'" +
                    ",HUSEORGID='" + oModel.HUSEORGID + "'" +
                    ",HModifyEmp ='" + oModel.HMakeEmp + "'" +
                    ",HUseFlag='" + oModel.HUseFlag + "'" +
                    ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) +
                    ",HRemark= '" + oModel.HRemark + "' 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);
                //
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_RepairCheckClass_AfterSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_RepairCheckClass_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //=========================================================
                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_RepairCheckClass_Ctl()
        {
            MvarItemKey = "Gy_RepairCheckClass";
            MvarReportTitle = "维修验收项目分类";
            oModel = new Model.ClsGy_RepairCheckClass_Model();
        }
    }
}
DAL/»ù´¡×ÊÁÏ/¹«Óûù´¡×ÊÁÏ/ClsGy_RepairClass_Ctl.cs
New file
@@ -0,0 +1,161 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public class ClsGy_RepairClass_Ctl : DBUtility.ClsGy_Base_Ctl
    {
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        //原代码 ç”¨äºŽ æ›¿æ¢å­é¡¹ç›®
        public string HOldNumber;
        public Model.ClsGy_RepairClass_Model oModel = new Model.ClsGy_RepairClass_Model();
        //新增
        public bool AddNew(ref string sReturn)
        {
            //
            try
            {
                oCn.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_RepairClass_BeforeSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_RepairClass_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.RunProc("Insert into " + MvarItemKey + " " +
                    " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                    ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID) " +
                    " Values('" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() +
                    "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "','" + DateTime.Now + "','" + oModel.HUSEORGID + "','" + oModel.HUseFlag + "','" + oModel.HMakeEmp + "','" + oModel.HUSEORGID + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_RepairClass_AfterSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_RepairClass_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //=========================================================
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //修改
        public bool ModifyByID(Int64 sItemID, ref string sReturn)
        {
            try
            {
                oCn.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_RepairClass_BeforeSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_RepairClass_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.RunProc("Update " + MvarItemKey + " set " +
                    " HNumber='" + oModel.HNumber + "'" +
                    ",HName='" + oModel.HName + "'" +
                    ",HShortNumber='" + oModel.HShortNumber + "'" +
                    ",HHelpCode='" + oModel.HHelpCode + "'" +
                    ",HModifyTime='" + DateTime.Now + "'" +
                    ",HUSEORGID='" + oModel.HUSEORGID + "'" +
                    ",HModifyEmp ='" + oModel.HMakeEmp + "'" +
                    ",HUseFlag='" + oModel.HUseFlag + "'" +
                    ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) +
                    ",HRemark= '" + oModel.HRemark + "' 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);
                //
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_RepairClass_AfterSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_RepairClass_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //=========================================================
                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_RepairClass_Ctl()
        {
            MvarItemKey = "Gy_RepairClass";
            MvarReportTitle = "维修项目分类";
            oModel = new Model.ClsGy_RepairClass_Model();
        }
    }
}
DAL/»ù´¡×ÊÁÏ/ÆäËû»ù´¡×ÊÁÏ/ClsGy_WorkShift_Ctl.cs
@@ -77,18 +77,35 @@
        {
            try
            {
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_WorkShift_BeforeSaveCtrl " + omodel.HMakeEmp + ",'2'", "h_p_Gy_WorkShift_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                //
                oCn.BeginTran();
                //更新主表
                oCn.RunProc("UpDate Gy_WorkShift set  " +
                "HNumber='" + omodel.HNumber + "'" +
                ",HModifyEmp='" + DBUtility.ClsPub.CurUserName + "'" +
                ",HModifyTime=getdate()" +
                ",HName='" + omodel.HName + "'" +
                ",HNote='" + omodel.HNote + "'" +
                ",HDeptID=" + omodel.HDeptID.ToString() +
                ",HUSEORGID=" + omodel.HUSEORGID.ToString() +
                ",HWorkCenterID=" + omodel.HWorkCenterID.ToString() +
                ",HWorkTimes=" + omodel.HWorkTimes.ToString() +
                ",HStopflag='" + DBUtility.ClsPub.BoolToString(omodel.HStopflag) + "'" +
                ",HRemark='" + omodel.HRemark + "'" +
                ",HUseFlag='" + omodel.HUseFlag + "'" +
                ",HPlanShutdownTimes='" + omodel.HPlanShutdownTimes + "'" +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
@@ -105,6 +122,23 @@
                        + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HSno.ToString() +
                        ",'" + oSub.HStartDate.ToShortTimeString() + "','" + oSub.HEndDate.ToShortTimeString() + "'," + Convert.ToString(oSub.HOverDay ? 1 : 0) + ") ");
                }
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_WorkShift_AfterSaveCtrl " + omodel.HMakeEmp + ",'2'", "h_p_Gy_WorkShift_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //=========================================================
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
@@ -121,6 +155,20 @@
        {
            try
            {
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_WorkShift_BeforeSaveCtrl " + omodel.HMakeEmp+ ",'1'", "h_p_Gy_WorkShift_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                //得到mainid
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo);
                //若MAINDI重复则重新获取
@@ -130,11 +178,12 @@
                "(HInterID,HNumber,HName,HNote" +
                ",HDeptID,HWorkCenterID,HWorkTimes,HStopflag,HRemark" +
                ",HPlanShutdownTimes" +
                ",HMakeEmp,HMakeTime,HUSEORGID,HCreateORGID,HUseFlag" +
                ") " +
                " values(" + omodel.HInterID.ToString() + ",'" + omodel.HNumber + "','" + omodel.HName + "','" + omodel.HNote + "'" +
                "," + omodel.HDeptID.ToString() + "," + omodel.HWorkCenterID.ToString() + "," + omodel.HWorkTimes.ToString() + "," + Convert.ToString(omodel.HStopflag ? 1 : 0) + ",'" + omodel.HRemark + "'" +
                ","+ omodel.HPlanShutdownTimes.ToString() +
                ") ");
                ",'"+ omodel.HMakeEmp.ToString() + "',getdate(),"+ omodel.HUSEORGID.ToString() + "," + omodel.HCREATEORGID.ToString() + ",'"+ omodel.HUseFlag.ToString() + "') ");
                //插入子表
                foreach (Model.ClsGy_WorkShiftSub oSub in DetailColl)
                {
@@ -145,6 +194,23 @@
                        + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HSno.ToString() +
                        ",'" + oSub.HStartDate.ToShortTimeString() + "','" + oSub.HEndDate.ToShortTimeString() + "'," + Convert.ToString(oSub.HOverDay ? 1 : 0) + ") ");
                }
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_WorkShift_AfterSaveCtrl " + omodel.HMakeEmp + ",'1'", "h_p_Gy_WorkShift_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //=========================================================
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
LMES/DingDing_autoGetData.cs
@@ -37,40 +37,52 @@
            try
            {
                int num = 0;
                obj.getAccessToken();
                if (obj.getData_FenCengShenHeQianDaoBiao(ref msg) == false)
                {
                    return false;
                    //return false;
                    num = num + 1;
                }
                if (obj.getData_XianChangBianHuaDianPingShenDan(ref msg) == false)
                {
                    return false;
                    //return false;
                    num = num + 1;
                }
                if (obj.getData_FenCengShenHeGuanLi(ref msg) == false)
                {
                    return false;
                    //return false;
                    num = num + 1;
                }
                if (obj.getData_QRQCWenTiTiJiaoBiao(ref msg) == false)
                {
                    return false;
                    //return false;
                    num = num + 1;
                }
                //设备维修记录单
                if (obj.getData_EquipRepairWeiXiu(ref msg) == false)
                {
                    return false;
                    //return false;
                    num = num + 1;
                }
                //模具维修记录单 ä¿å…»è®°å½•单
                if (obj.getData_MouldFileWeiXiuBaoYang(ref msg) == false)
                {
                    return false;
                    //return false;
                    num = num + 1;
                }
                if (obj.getData_HuaMingCe(ref msg) == false)
                {
                    //return false;
                    num = num + 1;
                }
                if (num > 0)
                {
                    return false;
                }
LMES/bin/Debug.rar
Binary files differ
Model/Model.csproj
@@ -96,6 +96,9 @@
    <Compile Include="APS\ClsSc_WorkBillMonthSortBillSub.cs" />
    <Compile Include="APS\ClsSc_ICMOChangeBillMain.cs" />
    <Compile Include="APS\ClsSc_ICMOChangeBillSub.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_MaintainClass_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_RepairClass_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_RepairCheckClass_Model.cs" />
    <Compile Include="生产管理\ClsSc_ShiftsBeginInfoBillMain.cs" />
    <Compile Include="生产管理\ClsSc_ShiftsBeginInfoBillSub.cs" />
    <Compile Include="ClsHR_EmpFosterBillMain.cs" />
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_ErrMsgBackType_Model.cs
@@ -6,9 +6,9 @@
{
    public class ClsGy_ErrMsgBackType_Model : DBUtility.ClsGy_Base_Model
    {
        public DateTime HMakeTime;
        public DateTime? HMakeTime;
        public int HUSEORGID;
        public string HMakeEmp;
        public DateTime HModifyTime;
        public DateTime? HModifyTime;
    }
}
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_InspectInstruMent_Model.cs
@@ -7,10 +7,10 @@
    public class ClsGy_InspectInstruMent_Model : DBUtility.ClsGy_Base_Model
    {
        public DateTime HMakeTime;
        public DateTime? HMakeTime;
        public int HUSEORGID;
        public string HMakeEmp;
        public DateTime HModifyTime;
        public DateTime? HModifyTime;
        public int HERPItemID;
        public string HExpiryDay;
        public string HCalibrationStatus;
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_InspectValue_Model .cs
@@ -7,10 +7,10 @@
    public class ClsGy_InspectValue_Model : DBUtility.ClsGy_Base_Model
    {
        public DateTime HMakeTime;
        public DateTime? HMakeTime;
        public int HUSEORGID;
        public string HMakeEmp;
        public DateTime HModifyTime;
        public DateTime? HModifyTime;
        public int HERPItemID;
    }
}
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_MaintainClass_Model.cs
New file
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsGy_MaintainClass_Model : DBUtility.ClsGy_Base_Model
    {
        //
        public DateTime? HMakeTime;
        public int HUSEORGID;
        public string HMakeEmp;
        public DateTime? HModifyTime;
    }
}
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_RepairCheckClass_Model.cs
New file
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsGy_RepairCheckClass_Model : DBUtility.ClsGy_Base_Model
    {
        //
        public DateTime? HMakeTime;
        public int HUSEORGID;
        public string HMakeEmp;
        public DateTime? HModifyTime;
    }
}
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_RepairClass_Model.cs
New file
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsGy_RepairClass_Model : DBUtility.ClsGy_Base_Model
    {
        //
        public DateTime? HMakeTime;
        public int HUSEORGID;
        public string HMakeEmp;
        public DateTime? HModifyTime;
    }
}
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_RoutingGroup_Model.cs
@@ -6,6 +6,10 @@
{
    public class ClsGy_RoutingGroup_Model : DBUtility.ClsGy_Base_Model
    {
       //
        //
        public DateTime? HMakeTime;
        public int HUSEORGID;
        public string HMakeEmp;
        public DateTime? HModifyTime;
    }
}
WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
@@ -690,7 +690,52 @@
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_InspectValue set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -699,7 +744,51 @@
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_InspectValue set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_AfterUnCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -785,7 +874,51 @@
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_InspectValue set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -794,7 +927,51 @@
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_InspectValue set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectValue_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -1809,7 +1986,51 @@
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_InspectInstruMent set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -1818,7 +2039,51 @@
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_InspectInstruMent set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_AfterUnCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -1904,7 +2169,51 @@
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_InspectInstruMent set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -1913,7 +2222,51 @@
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_InspectInstruMent set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_InspectInstruMent_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -5344,7 +5697,51 @@
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_ErrMsgBackType set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -5353,7 +5750,51 @@
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_ErrMsgBackType set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_AfterUnCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -5439,7 +5880,51 @@
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_ErrMsgBackType set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -5448,8 +5933,53 @@
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_ErrMsgBackType set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_ErrMsgBackType_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
WebAPI/Controllers/BaseSet/Gy_CheckItemController.cs
@@ -182,26 +182,67 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //
                    if (oDept.DeleteByID(HItemID))
                    oCN.BeginTran();
                    //删除前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_QCCheckItem_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_QCCheckItem_BeforeDelCtrl");
                    if (ds == null)
                    {
                        //写入日志
                        ClsPub.Add_Log("", "删除项目,代码:" + oDeptHlp.omodel.HNumber + ",名称:" + oDeptHlp.omodel.HName, ClsPub.CurUserName);
                        //更新上级为 æœ«çº§
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "删除成功";
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    //
                    if (!oDept.DeleteByID(HItemID))
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //删除后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_QCCheckItem_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_QCCheckItem_AfterDelCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.Commit();
                }
                //ds = oCN.RunProcReturn("delete from Gy_Department where HItemID =  " + HItemID, "Gy_Department");
@@ -236,6 +277,7 @@
            {
                var _value = oMain["oMain"].ToString();
                string msg1 = _value.ToString();
                //反序列化
                msg1 = "[" + msg1.ToString() + "]";
@@ -255,7 +297,7 @@
                string HHelpCode = list[0].HHelpCode;
                string HRemark = list[0].HRemark;
                bool HStopflag = list[0].HStopflag;
                bool HUseFlag = list[0].HUseFlag;
                string HUseFlag = list[0].HUseFlag;
                long HQCCheckClassID = list[0].HQCCheckClassID;
                string HDefaultResult = list[0].HDefaultResult;
@@ -270,6 +312,9 @@
                long HInspectBasisID = list[0].HInspectBasisID;
                long HSampleSchemeID = list[0].HSampleSchemeID;
                long HISsystemSet = list[0].HISsystemSet;
                string HMakeEmp = list[0].HMakeEmp;
                long HUSEORGID = list[0].HUSEORGID;
                long HCREATEORGID = list[0].HCREATEORGID;
                if (!DBUtility.ClsPub.AllowNumber(HNumber))
                {
@@ -284,21 +329,70 @@
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_QCCheckItem_BeforeSaveCtrl " + HMakeEmp + ",'1'", "h_p_Gy_QCCheckItem_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("Insert Into Gy_QCCheckItem " +
                "(HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                ",HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HQCCheckClassID,HDefaultResult" +
                ",HAnalysisMethod,HDefectLevel,HUnitID,HDestructInspect,HKeyInspect,HQualityStdID" +
                ",HInspectMethodID,HInspectInstruMentID,HInspectBasisID,HSampleSchemeID,HISsystemSet) " +
                ",HInspectMethodID,HInspectInstruMentID,HInspectBasisID,HSampleSchemeID,HISsystemSet" +
                ",HMakeEmp,HMakeTime,HUSEORGID,HCREATEORGID) " +
                " values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "','" + HItemID + "'" +
                ",'"+ HLevel + "','0','" + Convert.ToString(HStopflag ? 1 : 0) + "','" + HRemark + "','未使用','"+ HQCCheckClassID + "','" + HDefaultResult +
                ",'"+ HLevel + "','0','" + Convert.ToString(HStopflag ? 1 : 0) + "','" + HRemark + "','"+ HUseFlag + "','"+ HQCCheckClassID + "','" + HDefaultResult +
                "','" + HAnalysisMethod + "','" + HDefectLevel + "'," + HUnitID + "," + HDestructInspect + "," + HKeyInspect + "," + HQualityStdID +
                "," + HInspectMethodID + "," + HInspectInstruMentID + "," + HInspectBasisID + "," + HSampleSchemeID + "," + HISsystemSet + ")");
                "," + HInspectMethodID + "," + HInspectInstruMentID + "," + HInspectBasisID + "," + HSampleSchemeID + "," + HISsystemSet + "" +
                ",'" + HMakeEmp + "',getdate()," + HUSEORGID + "," + HCREATEORGID + ")");
                //修改上级为非末级代码
                if (list[0].HItemID.ToString() != "")
                {
                    oCN.RunProc("Update Gy_QCCheckItem set HEndflag=0 where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                //保存后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_QCCheckItem_AfterSaveCtrl " + HMakeEmp + ",'1'", "h_p_Gy_QCCheckItem_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -365,7 +459,7 @@
                long  HQCCheckClassID = list[0].HQCCheckClassID;
                string HRemark = list[0].HRemark;
                bool HStopflag = list[0].HStopflag;
                bool HUseFlag = list[0].HUseFlag;
                string HUseFlag = list[0].HUseFlag;
                string HDefaultResult = list[0].HDefaultResult;
                long HUnitID = list[0].HUnitID;
@@ -379,6 +473,8 @@
                long HInspectBasisID = list[0].HInspectBasisID;
                long HSampleSchemeID = list[0].HSampleSchemeID;
                long HISsystemSet = list[0].HISsystemSet;
                string HModifyEmp = msg4;
                long HUSEORGID = list[0].HUSEORGID;
                if (!DBUtility.ClsPub.AllowNumber(HNumber))
                {
@@ -401,11 +497,37 @@
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_QCCheckItem_BeforeSaveCtrl " + HModifyEmp + ",'1'", "h_p_Gy_QCCheckItem_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("Update Gy_QCCheckItem set " +
                    " HNumber='" + HNumber + "'" +
                    ",HName='" + HName + "'" +
                    ",HShortNumber='" + HShortNumber + "'" +
                     ",HModifyEmp='" + HModifyEmp + "'" +
                    ",HModifyTime=getdate()" +
                     ",HUSEORGID='" + HUSEORGID + "'" +
                    ",HHelpCode='" + HHelpCode + "'" +
                    ",HParentID=" + HParentID +
                    ",HStopflag='" + HStopflag + "'" +
@@ -430,6 +552,30 @@
                //将上级 ä¸ºéžæœ«çº§
                oCN.RunProc("Update Gy_QCCheckItem set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //
                //保存后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_QCCheckItem_AfterSaveCtrl " + HModifyEmp + ",'1'", "h_p_Gy_QCCheckItem_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -443,6 +589,386 @@
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region æ£€éªŒé¡¹ç›®åˆ†ç±»å®¡æ ¸/反审核
        [Route("Gy_QCCheckClass/AuditGy_QCCheckClass")]
        [HttpGet]
        public object AuditGy_QCCheckClass(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有审核权限
                if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckClass_Check", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限审核!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DAL.ClsGy_QCCheckClass_Ctl oBill = new DAL.ClsGy_QCCheckClass_Ctl();
                ClsPub.CurUserName = user;
                oCN.BeginTran();//开始事务
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                {
                    //判断单据是否已经审核
                    DataSet ds;
                    string sql = "select * from  Gy_QCCheckClass  where HItemID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, oBill.MvarItemKey);
                    if (ds.Tables[0].Rows[0]["HCheckEmp"] != null && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已审核!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_QCCheckClass_BeforeCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_QCCheckClass_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    //审核单据
                    if (!oBill.AuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_QCCheckClass_AfterCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_QCCheckClass_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                }
                else
                {
                    //判断单据是否已经反审核
                    DataSet ds;
                    string sql = "select * from  Gy_QCCheckClass  where HItemID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, oBill.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"] == null || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核前控制=========================================
                        ds = oCN.RunProcReturn("Exec h_p_Gy_QCCheckClass_BeforeUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_QCCheckClass_BeforeUnCheckCtrl");
                        if (ds == null)
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核前判断失败!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //=========================================================
                        //反审核单据
                        if (!oBill.DeAuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "反审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核后控制=========================================
                        DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_QCCheckClass_AfterUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_QCCheckClass_AfterUnCheckCtrl");
                        if (ds2 == null)
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核后判断失败!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //=========================================================
                    }
                }
                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 æ£€éªŒé¡¹ç›®åˆ†ç±»ç¦ç”¨ã€åç¦ç”¨
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_QCCheckClass/StopGy_QCCheckClass")]
        [HttpGet]
        public object StopGy_QCCheckClass(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //禁用权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_QCCheckClass_Stop", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_QCCheckClass where HItemID=" + HInterID, "Gy_Material");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_QCCheckClass_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_QCCheckClass_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_QCCheckClass set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_QCCheckClass_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_QCCheckClass_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_QCCheckClass_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_QCCheckClass_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_QCCheckClass set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_QCCheckClass_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_QCCheckClass_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -583,6 +1109,29 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_QCCheckItem_BeforeCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_QCCheckItem_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    //审核单据
                    if (!BillOld.AuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
@@ -592,6 +1141,29 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_QCCheckItem_AfterCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_QCCheckItem_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                }
                else
@@ -610,6 +1182,29 @@
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核前控制=========================================
                        ds = oCN.RunProcReturn("Exec h_p_Gy_QCCheckItem_BeforeUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_QCCheckItem_BeforeUnCheckCtrl");
                        if (ds == null)
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核前判断失败!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //=========================================================
                        //反审核单据
                        if (!BillOld.DeAuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
@@ -619,6 +1214,28 @@
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核后控制=========================================
                        DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_QCCheckItem_AfterUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_QCCheckItem_AfterUnCheckCtrl");
                        if (ds2 == null)
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核后判断失败!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //=========================================================
                    }
                }
@@ -642,6 +1259,190 @@
        }
        #endregion
        #region æ£€éªŒé¡¹ç›®ç¦ç”¨ã€åç¦ç”¨
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_QCCheckItem/StopGy_QCCheckItem")]
        [HttpGet]
        public object StopGy_QCCheckItem(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //禁用权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_QCCheckItem_Stop", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_QCCheckItem where HItemID=" + HInterID, "Gy_Material");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_QCCheckItem_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_QCCheckItem_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_QCCheckItem set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_QCCheckItem_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_QCCheckItem_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_QCCheckItem_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_QCCheckItem_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_QCCheckItem set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_QCCheckItem_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_QCCheckItem_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region æ ¡éªŒé¡¹ç›®åˆ—表 æ–‡ä»¶ä¸Šä¼ 
        [Route("Gy_CheckItem/Gy_CheckItem_Excel")]
        [HttpPost]
WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
@@ -2096,6 +2096,8 @@
                int HNowWHID = mainList[0].HNowWHID;
                int HNowSPID = mainList[0].HNowSPID;
                string HMouldUseStatus = mainList[0].HMouldUseStatus;
                int HCREATEORGID = mainList[0].HCREATEORGID;
                int HUSEORGID = mainList[0].HUSEORGID;
                //保存前控制=========================================
                string HBillNote = "";
@@ -2131,7 +2133,7 @@
                ",HPrintQty,HMouldStatus,HWhID,HRoutingID,HCaveQty" +
                ",HBomID,HVersion,HSPGroupID,HSPID,HDesignLife,HNowSupID,HNowSupTypeID" +
                ",HUseLife,HLeaveLife,HProdQty,HProdWeight,HMouldOWNER,HSaveLife,HMouldDotCheckRuleInterID,HMouldMaintainRuleInterID,HBarCode,HMadeSupID" +
                ",HMouldClass,HNowWHID,HNowSPID,HInitLife,HMouldUseStatus) " +
                ",HMouldClass,HNowWHID,HNowSPID,HInitLife,HMouldUseStatus,HCREATEORGID,HUSEORGID) " +
                " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()" +
                ",'" + HMouldNo + "','" + HName + "','" + HModel + "','" + HModel2 + "','" + HDiameter + "'" +
@@ -2141,7 +2143,7 @@
                "," + HPrintQty + ",'" + HMouldStatus + "'," + HWHID + "," + HRoutingID + "," + HCaveQty +
                "," + HBOMID + ",'" + HVersion + "'," + HSPGroupID + "," + HSPID + ",'" + HDesignLife + "','" + HNowSupID + "','" + HNowSupTypeID + "'" +
                ",'" + HUseLife + "','" + HLeaveLife + "','" + HProdQty + "','" + HProdWeight + "','" + HMouldOWNER + "','" + HSaveLife + "','" + HMouldDotCheckRuleInterID + "','" + HMouldMaintainRuleInterID + "','" + HBarCode + "'," + HMadeSupID +
                ",'"+ HMouldClass + "'," + HNowWHID + "," + HNowSPID + ",'" + HInitLife + "','" + HMouldUseStatus + "') ");
                ",'"+ HMouldClass + "'," + HNowWHID + "," + HNowSPID + ",'" + HInitLife + "','" + HMouldUseStatus + "',"+ HCREATEORGID + ","+ HUSEORGID + ") ");
                //子表
                oCN.RunProc("Insert into Gy_MouldFileSub " +
@@ -2292,8 +2294,32 @@
                int HNowWHID = mainList[0].HNowWHID;
                int HNowSPID = mainList[0].HNowSPID;
                string HMouldUseStatus = mainList[0].HMouldUseStatus;
                int HUSEORGID = mainList[0].HUSEORGID;
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                string HBillNote = "";
                ds = oCN.RunProcReturn("Exec h_p_Gy_MouldFileMain_BeforeSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "','" + HBillNote + "',1 ", "h_p_Gy_MouldFileMain_BeforeSaveCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存失败!原因:保存前判断失败,请与网络管理人员联系";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("UpDate Gy_MouldFileMain set  " +
                " HBillNo='" + HBillNo + "'" +  //固定赋值===============
@@ -2314,6 +2340,7 @@
                ",HPICNo='" + HPICNo + "'" +
                ",HWorkMaterModel='" + HWorkMaterModel + "'" +
                ",HMaterID=" + HMaterID.ToString() +
                ",HUSEORGID=" + HUSEORGID.ToString() +
                ",HMaterNumber='" + HMaterNumber + "'" +
                ",HMouldClass='" + HMouldClass + "'" +
                ",HMouldType=" + HMouleTypeID.ToString() +
@@ -2360,6 +2387,29 @@
                oCN.RunProc("delete from Gy_MouldFileSub_MaintainRule where HInterID='" + HInterID + "'");
                oCN.RunProc("delete from Gy_MouldFileSub_DotCheckRule where HInterID='" + HInterID + "'");
                objJsonResult = AddBillSub(msg5, msg6, msg7, HInterID, HBillNo);
                //保存后控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_MouldFileMain_AfterSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "','" + HBillNote + "',1 ", "h_p_Gy_MouldFileMain_AfterSaveCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存失败!原因:保存前判断失败,请与网络管理人员联系";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
                    objJsonResult.data = null;
                    oCN.RollBack();
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
@@ -2546,8 +2596,56 @@
                }
                if (oBill.DeleteBill(hmainid, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    oCN.BeginTran();
                    //删除前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_MouldFile_BeforeDelCtrl " + hmainid + ",'" + User + "'", "h_p_Gy_MouldFile_BeforeDelCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("Delete From Gy_MouldFileSub_MaintainRule  where HInterID=" + hmainid);
                    oCN.RunProc("Delete From Gy_MouldFileSub_DotCheckRule  where HInterID=" + hmainid);
                    //删除后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_MouldFile_AfterDelCtrl " + hmainid + ",'" + User + "'", "h_p_Gy_MouldFile_AfterDelCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.Commit();
                    //写入日志
                    ClsPub.Add_Log("", "删除项目,代码:" + oBill.omodel.HMouldNo + ",名称:" + oBill.omodel.HName, ClsPub.CurUserName);
                    //更新上级为 æœ«çº§
@@ -2921,6 +3019,26 @@
                }
                if (IsAudit == 0) //审核提交
                {
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Sc_MouldStockBill_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Sc_MouldStockBill_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    //审核提交
                    if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
@@ -2938,9 +3056,50 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Sc_MouldStockBill_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Sc_MouldStockBill_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                }
                if (IsAudit == 1) //反审核提交
                {
                    //反审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Sc_MouldStockBill_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Sc_MouldStockBill_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    //反审核提交AbandonCheck
                    if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
@@ -2958,6 +3117,29 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //反审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Sc_MouldStockBill_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Sc_MouldStockBill_AfterUnCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                }
                return objJsonResult;
            }
@@ -2972,6 +3154,154 @@
        }
        #endregion
        #region æ¨¡å…·æ¡ˆå…³é—­/反关闭功能
        [Route("Gy_Mould/CloseGy_Mould")]
        [HttpGet]
        public object CloseGy_Mould(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_MouldFile_Close", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限关闭!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                DAL.ClsGy_MouldFile oBill = new DAL.ClsGy_MouldFile();
                oCN.BeginTran();//开始事务
                //Type 1 å…³é—­  2  åå…³é—­
                if (Type == 1)
                {
                    if (!oBill.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    if (!oBill.CancelClose(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                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_Mould/DeleteGy_Mould")]
        [HttpGet]
        public object DeleteGy_Mould(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_MouldFile_Drop", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限关闭!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DAL.ClsGy_MouldFile oBill = new DAL.ClsGy_MouldFile();
                ClsPub.CurUserName = user;
                oCN.BeginTran();//开始事务
                //Type 1 ä½œåºŸ  2  åä½œåºŸ
                if (Type == 1)
                {
                    if (!oBill.Cancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    if (!oBill.AbandonCancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                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_Mould/SaveBatchGen_MouldFile")]
        [HttpGet]
WebAPI/Controllers/BaseSet/Gy_QCCheckClassController.cs
@@ -182,9 +182,55 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    oCN.BeginTran();
                    //
                    //删除前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_QCCheckClass_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_QCCheckClass_BeforeDelCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    if (oDept.DeleteByID(HItemID))
                    {
                        //删除后控制=========================================
                        DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_QCCheckClass_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_QCCheckClass_AfterDelCtrl");
                        if (ds2 == null)
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "删除后判断失败!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //=========================================================
                        oCN.Commit();
                        //写入日志
                        ClsPub.Add_Log("", "删除项目,代码:" + oDeptHlp.omodel.HNumber + ",名称:" + oDeptHlp.omodel.HName, ClsPub.CurUserName);
                        //更新上级为 æœ«çº§
@@ -196,6 +242,7 @@
                    }
                    else
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败";
@@ -268,8 +315,11 @@
                string HHelpCode = list[0].HHelpCode;
                string HRemark = list[0].HRemark;
                bool HStopflag = list[0].HStopflag;
                bool HUseFlag = list[0].HUseFlag;
                string HUseFlag = list[0].HUseFlag;
                long HQCCheckClassID = list[0].HQCCheckClassID;
                string HMakeEmp = list[0].HMakeEmp;
                long HUSEORGID = list[0].HUSEORGID;
                long HCREATEORGID = list[0].HCREATEORGID;
                if (!DBUtility.ClsPub.AllowNumber(HNumber))
                {
@@ -282,17 +332,66 @@
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_QCCheckClass_BeforeSaveCtrl " + msg4 + ",'1'", "h_p_Gy_QCCheckClass_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("Insert Into Gy_QCCheckClass " +
                "(HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                ",HLevel,HEndFlag,HStopflag,HRemark,HUseFlag) " +
                ",HLevel,HEndFlag,HStopflag,HRemark" +
                 ",HMakeEmp,HMakeTime,HUSEORGID,HCREATEORGID,HUseFlag) " +
                " values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "','" + HItemID + "'" +
                ",'1',0,'" + Convert.ToString(HStopflag ? 1 : 0) + "','" + HRemark + "','未使用')");
                ",'1',0,'" + Convert.ToString(HStopflag ? 1 : 0) + "','" + HRemark + "'" +
                ",'" + HMakeEmp + "',getdate()," + HUSEORGID + "," + HCREATEORGID + ",'" + HUseFlag + "')");
                //修改上级为非末级代码
                if (list[0].HItemID.ToString() != "")
                {
                    oCN.RunProc("Update Gy_QCCheckClass set HEndflag=0 where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                //保存后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_QCCheckClass_AfterSaveCtrl " + msg4 + ",'1'", "h_p_Gy_QCCheckClass_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -348,7 +447,7 @@
                //反序列化
                msg2 = "[" + msg2.ToString() + "]";
                List<MaintenanceAcceptItem> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MaintenanceAcceptItem>>(msg2);
                List<CheckItem> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<CheckItem>>(msg2);
                long HItemID = int.Parse(msg3);
                string HNumber = list[0].HNumber;
@@ -357,8 +456,10 @@
                long HParentID = list[0].HParentID.ToString() == "" ? 0 : list[0].HParentID;
                string HHelpCode = list[0].HHelpCode;
                string HRemark = list[0].HRemark;
                string HStopflag = list[0].HStopflag;
                bool HStopflag = list[0].HStopflag;
                string HUseFlag = list[0].HUseFlag;
                string HModifyEmp = msg4;
                long HUSEORGID = list[0].HUSEORGID;
                if (!DBUtility.ClsPub.AllowNumber(HNumber))
                {
@@ -381,10 +482,36 @@
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_QCCheckClass_BeforeSaveCtrl " + msg4 + ",'1'", "h_p_Gy_QCCheckClass_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("Update Gy_QCCheckClass set " +
                    " HNumber='" + HNumber + "'" +
                    ",HName='" + HName + "'" +
                    ",HModifyEmp='" + HModifyEmp + "'" +
                    ",HModifyTime=getdate()" +
                     ",HUSEORGID='" + HUSEORGID + "'" +
                    ",HShortNumber='" + HShortNumber + "'" +
                    ",HHelpCode='" + HHelpCode + "'" +
                    ",HParentID=" + HParentID +
@@ -395,6 +522,30 @@
                //将上级 ä¸ºéžæœ«çº§
                oCN.RunProc("Update Gy_QCCheckClass set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //
                //保存后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_QCCheckClass_AfterSaveCtrl " + msg4 + ",'1'", "h_p_Gy_QCCheckClass_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
WebAPI/Controllers/BaseSet/Gy_RoutingGroupController.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SyntacticSugar.constant;
using System;
using System.Collections.Generic;
@@ -28,32 +29,32 @@
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from Gy_RoutingGroup where 1=1 order by HItemID ", "Gy_RoutingGroup");
                    ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingGroup where 1=1 order by HItemID ", "h_v_Gy_RoutingGroup");
                }
                else
                {
                    string sql = "select * from Gy_RoutingGroup where 1 = 1 " + sWhere+ " order by HItemID ";
                    ds = oCN.RunProcReturn(sql, "Gy_RoutingGroup");
                    string sql = "select * from h_v_Gy_RoutingGroup where 1 = 1 " + sWhere+ " order by HItemID ";
                    ds = oCN.RunProcReturn(sql, "h_v_Gy_RoutingGroup");
                }
                //添加列名
                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列对象的列名
                }
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
                //}
                //else
                //{
                //objJsonResult.code = "0";
                //objJsonResult.count = 0;
                //objJsonResult.Message = "无数据";
                //objJsonResult.data = null;
                //return objJsonResult;
                //}
            }
            catch (Exception e)
            {
WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs
@@ -329,6 +329,7 @@
                //long HCREATEORGID = list[0].HCREATEORGID;
                string HUpDater = list[0].HUpDater;
                long HSPFlag = list[0].HSPFlag;
                string HWarehouseType = list[0].HWarehouseType;
                //得到短代码
                string HShortNumber = DBUtility.ClsPub.GetShortNumber(HNumber);
                if (HShortNumber.Trim() == "")
@@ -392,9 +393,11 @@
                    oCN.BeginTran();
                    oCN.RunProc("Insert into Gy_Warehouse  " +
                        " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                        ",HLevel,HEndFlag,HStopflag,HRemark,HEmpID,HAddress,HPhone,HUSEORGID,HSPFlag,HCREATEORGID,HMaker,HMakeTime,HStockCtrlFlag) " +
                        ",HLevel,HEndFlag,HStopflag,HRemark,HEmpID,HAddress,HPhone,HUSEORGID,HSPFlag,HCREATEORGID,HMaker,HMakeTime,HStockCtrlFlag" +
                        ",HWarehouseType) " +
                        " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID.ToString() +
                        "," + HLevel.ToString() + "," + HEndFlag + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "'," + HEmpID.ToString() + ",'" + HAddress + "','" + HPhone + "','"+ HUSEORGID + "',"+ HSPFlag + ","+ HUSEORGID + ",'"+msg3+"',getdate(),"+ Convert.ToString(HStockCtrlFlag ? 1 : 0)+")", ref DBUtility.ClsPub.sExeReturnInfo);
                        "," + HLevel.ToString() + "," + HEndFlag + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "'," + HEmpID.ToString() + ",'" + HAddress + "','" + HPhone + "','"+ HUSEORGID + "',"+ HSPFlag + ","+ HUSEORGID + ",'"+msg3+"',getdate(),"+ Convert.ToString(HStockCtrlFlag ? 1 : 0)+"" +
                        ",'"+ HWarehouseType + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                    //修改上级为非末级代码
                    oCN.RunProc("Update Gy_Warehouse set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                    //启用仓位
@@ -422,6 +425,7 @@
                        ",HAddress='" + HAddress + "'" +
                        ",HPhone='" + HPhone + "'" +
                        ",HUSEORGID='" + HUSEORGID + "'" +
                        ",HWarehouseType='" + HWarehouseType + "'" +
                        ",HCREATEORGID='" + HUSEORGID + "'" +
                        ",HSPFlag='" + HSPFlag + "'" +
                        //",HSPGroupID='" + HSPGroupID + "'" +
WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
@@ -244,6 +244,21 @@
                        return objJsonResult;
                    }
                }
                else if (oSystemParameter.omodel.WMS_CampanyName == "添康科技")
                {
                    DataSet dss;
                    dss = oCN.RunProcReturn("select COUNT(*) as number from Sc_ProcessExchangeBillMain where HRoutingBillID = " + HInterID, "Gy_RoutingBillMain");
                    //判断是否可编辑
                    if (dss.Tables[0].Rows[0]["number"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "此单据已经被引用,不允许修改!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                }
                if (OperationType == 2)
                {
                    ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingBillList where  å•据号='" + HBillNo + "'", "h_v_Gy_RoutingBillList");
@@ -297,17 +312,6 @@
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据状态未在创建,不允许修改!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        dss = oCN.RunProcReturn("select COUNT(*) as number from Sc_ProcessExchangeBillMain where HRoutingBillID = " + HInterID, "Gy_RoutingBillMain");
                        //判断是否可编辑
                        if (dss.Tables[0].Rows[0]["number"].ToString() != "0")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据已经被引用,不允许修改!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
@@ -132,7 +132,7 @@
        [HttpGet]
        public object Delete_EquipFile(string HItemID, string user)
        {
            if (!DBUtility.ClsPub.Security_Log("Gy_EquipFile_Delete", 1, false, user))
            if (!DBUtility.ClsPub.Security_Log("Gy_EquipFileBill_Delete", 1, false, user))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
@@ -166,9 +166,57 @@
                    return objJsonResult;
                }
                //删除前控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_Maintain_BeforeDelCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.RunProc("Delete From Gy_EquipFileBillMain  where HInterID=" + lngBillKey);
                oCN.RunProc("Delete From Gy_EquipFileBillSub_MaintainRule  where HInterID=" + lngBillKey);
                oCN.RunProc("Delete From Gy_EquipFileBillSub_DotCheckRule  where HInterID=" + lngBillKey);
                //删除后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_Maintain_AfterDelCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -363,6 +411,8 @@
                int HEquipDotCheckRuleInterID = list[0].HEquipDotCheckRuleInterID;
                int HEquipMaintainRuleInterID = list[0].HEquipMaintainRuleInterID;
                int HSourceID = list[0].HSourceID;
                int HCREATEORGID = list[0].HCREATEORGID;
                int HUSEORGID = list[0].HUSEORGID;
                if (!DBUtility.ClsPub.AllowNumber(HEquipFileNumber))
                {
@@ -386,9 +436,10 @@
                oCN.BeginTran();
                //保存前控制=========================================
                string HBillNote = "";
                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBillMain_BeforeSaveCtrl " + HInterID.ToString() + ", '" + hbillno + "','" + HBillNote + "',1 ", "h_p_Gy_EquipFileBillMain_BeforeSaveCtrl");
                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_BeforeSaveCtrl " + HInterID.ToString() + ", '" + hbillno + "','" + HBillNote + "',1 ", "h_p_Gy_EquipFileBill_BeforeSaveCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存失败!原因:保存前判断失败,请与网络管理人员联系";
@@ -398,6 +449,7 @@
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
@@ -410,19 +462,20 @@
                   " (HInterID,hbillno,HEquipFileNumber,HEquipFileNo,HName,HModel,HModel2,HMaterID,HUnitID,HOutComDate" +
                   ",HOutComNo,HDeptID,HUseEmpID,HRepairEmpID,HAddress,HSetupDate,HStartupDate,HStatus," +
                    "HEquipFileTypeID,HProNum,HBarCode,HWorkArea,HLogo,HSellSupID,HMakeSupID,hbilltype,HDate,HYear,HMaker,HMakeDate,HEquipMaintainRuleInterID,HEquipDotCheckRuleInterID," +
                    "HSourceID,HMainSourceFlag,HMacAddress,HMainSourceID,HIPAddress,HLinkNETMode,HCollectMode,HCollectClass) " +
                    "HSourceID,HMainSourceFlag,HMacAddress,HMainSourceID,HIPAddress,HLinkNETMode,HCollectMode,HCollectClass,HCREATEORGID,HUSEORGID) " +
                   " Values("+ HInterID+",'" + hbillno + "','" + HEquipFileNumber + "','" + HEquipFileNo + "','" + HName + "','" + HModel + "','" + HModel2 + "'," + HMaterID + "," + HUnitID +
                   ",'" + HOutComDate + "','" + HOutComNo + "'," + HDeptID + "," + HUseEmpID + "," + HRepairEmpID + ",'" + HAddress +
                   "','" + HSetupDate + "','" + HStartupDate + "','" + HStatus + "'," + HEquipFileTypeID + ",'" + HProNum +
                   "','" + HBarCode + "','" + HWorkArea + "','" + HLogo + "'," + HSellSupID + "," + HMakeSupID + ",'3308','" + HDate + "','" + HYear + "','" + HMaker + "',GETDATE(),'" + HEquipMaintainRuleInterID + "','" + HEquipDotCheckRuleInterID +"'" +
                   "," + HSourceID + ",'" + HMainSourceFlag + "','" + HMacAddress + "','" + HMainSourceID + "','" + HIPAddress + "','" + HLinkNETMode + "','" + HCollectMode + "','" + HCollectClass + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                   "," + HSourceID + ",'" + HMainSourceFlag + "','" + HMacAddress + "','" + HMainSourceID + "','" + HIPAddress + "','" + HLinkNETMode + "','" + HCollectMode + "','" + HCollectClass + "',"+ HCREATEORGID + ","+ HUSEORGID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                objJsonResult = AddBillSub(msg3, msg4, HInterID, hbillno, 1);
                //保存后控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBillMain_AfterSaveCtrl " + HInterID.ToString() + ", '" + hbillno + "','" + HBillNote + "',1 ", "h_p_Gy_EquipFileBillMain_AfterSaveCtrl");
                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_AfterSaveCtrl " + HInterID.ToString() + ", '" + hbillno + "','" + HBillNote + "',1 ", "h_p_Gy_EquipFileBill_AfterSaveCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存失败!原因:保存前判断失败,请与网络管理人员联系";
@@ -431,7 +484,8 @@
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
@@ -489,6 +543,7 @@
                long HInterID = list[0].HInterID;
                string HEquipFileNumber = list[0].HEquipFileNumber;
                string hbillno = list[0].HBillNo;
                string HEquipFileNo = list[0].HEquipFileNo;         //    varchar(50)    //设备编码(唯一)
                string HName = list[0].HName;                //    âˆš    varchar(100)         //设备名称
                string HModel = list[0].HModel;               //   âˆš     varchar(100)         //设备规格
@@ -523,6 +578,7 @@
                int HEquipDotCheckRuleInterID = list[0].HEquipDotCheckRuleInterID;
                int HEquipMaintainRuleInterID = list[0].HEquipMaintainRuleInterID;
                int HSourceID = list[0].HSourceID;
                int HUSEORGID = list[0].HUSEORGID;
                if (!DBUtility.ClsPub.AllowNumber(HEquipFileNumber))
@@ -548,6 +604,31 @@
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                string HBillNote = "";
                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_BeforeSaveCtrl " + HInterID.ToString() + ", '" + hbillno + "','" + HBillNote + "',1 ", "h_p_Gy_EquipFileBill_BeforeSaveCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存失败!原因:保存前判断失败,请与网络管理人员联系";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("Update Gy_EquipFileBillMain set " +
                    " HEquipFileNumber='" + HEquipFileNumber + "'" +
@@ -573,6 +654,7 @@
                    ",HLogo='" + HLogo + "'" +
                    ",HSellSupID=" + HSellSupID +
                    ",HMakeSupID= " + HMakeSupID +
                    ",HUSEORGID= " + HUSEORGID +
                    ",HUpDater= '" + HUpDater + "'" +
                    ",HUpDateDate= GETDATE()" +
                    ",HEquipDotCheckRuleInterID='" + HEquipDotCheckRuleInterID + "'" +
@@ -590,6 +672,32 @@
                //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                //
                objJsonResult = AddBillSub(msg3, msg4, HInterID, list[0].HBillNo, 2);
                //保存后控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_AfterSaveCtrl " + HInterID.ToString() + ", '" + hbillno + "','" + HBillNote + "',1 ", "h_p_Gy_EquipFileBill_AfterSaveCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存失败!原因:保存前判断失败,请与网络管理人员联系";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
                    objJsonResult.data = null;
                    oCN.RollBack();
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                //objJsonResult.data = null;
                return objJsonResult;
@@ -852,6 +960,28 @@
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                {
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_BeforeDelCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_EquipFileBill_BeforeDelCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
@@ -860,9 +990,53 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_AfterDelCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_EquipFileBill_AfterDelCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                }
                else
                {
                    //反审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_BeforeUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_EquipFileBill_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
@@ -875,6 +1049,29 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //反审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_EquipFileBill_AfterUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_EquipFileBill_AfterUnCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                }
                oCN.Commit();//提交事务
@@ -971,6 +1168,80 @@
        }
        #endregion
        #region è®¾å¤‡æ¡£æ¡ˆä½œåºŸ/反作废功能
        [Route("Gy_EquipFileBill/DeleteGy_EquipFileBill")]
        [HttpGet]
        public object DeleteGy_EquipFileBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_EquipFileBill_Close", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限关闭!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                oCN.BeginTran();//开始事务
                //Type 1 ä½œåºŸ  2  åä½œåºŸ
                if (Type == 1)
                {
                    if (!BillOld.Cancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    if (!BillOld.AbandonCancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                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 è®¾å¤‡æ¡£æ¡ˆåˆ—表 æ ‘状图 è®¾å¤‡åˆ†ç±»æŸ¥è¯¢
        public class TreeModel
        {
WebAPI/Controllers/WebAPIController.cs
@@ -5172,14 +5172,15 @@
                //保存
                //保存完毕后处理
                bool bResult;
                string sExeReturnInfo = "";
                if (oBill.oModel.HItemID == 0)
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddNew();
                    bResult = oBill.AddNew(ref sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyByID(oBill.oModel.HItemID);
                    bResult = oBill.ModifyByID(oBill.oModel.HItemID, ref sExeReturnInfo);
                }
                if (bResult)
                {
@@ -5194,7 +5195,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.Message = "保存失败!" + sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
@@ -5273,7 +5274,54 @@
                //    return objJsonResult;
                //}
                //删除前控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_InspectValue_BeforeDelCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.RunProc("delete Gy_InspectValue where HItemID=" + HItemID);
                //删除后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectValue_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_InspectValue_AfterDelCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
@@ -6241,14 +6289,15 @@
                //保存
                //保存完毕后处理
                bool bResult;
                string sExeReturnInfo = "";
                if (oBill.oModel.HItemID == 0)
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddNew();
                    bResult = oBill.AddNew(ref sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyByID(oBill.oModel.HItemID);
                    bResult = oBill.ModifyByID(oBill.oModel.HItemID, ref sExeReturnInfo);
                }
                if (bResult)
                {
@@ -6263,7 +6312,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.Message = "保存失败!" + sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
@@ -6342,7 +6391,55 @@
                //    return objJsonResult;
                //}
                //删除前控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_InspectInstruMent_BeforeDelCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.RunProc("delete Gy_InspectInstruMent where HItemID=" + HItemID);
                //删除后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_InspectInstruMent_AfterDelCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
@@ -11787,14 +11884,15 @@
                //保存
                //保存完毕后处理
                bool bResult;
                string sExeReturnInfo = "";
                if (oBill.oModel.HItemID == 0)
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddNew();
                    bResult = oBill.AddNew(ref sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyByID(oBill.oModel.HItemID);
                    bResult = oBill.ModifyByID(oBill.oModel.HItemID, ref sExeReturnInfo);
                }
                if (bResult)
                {
@@ -11809,7 +11907,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.Message = "保存失败!" + sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
@@ -11898,8 +11996,54 @@
                    return objJsonResult;
                }
                //删除前控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_ErrMsgBackType_BeforeDelCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.RunProc("delete Gy_ErrMsgBackType where HItemID=" + HItemID);
                //删除后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_ErrMsgBackType_AfterDelCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
@@ -15066,6 +15210,732 @@
        }
        #endregion
        #region  å·¥è‰ºè·¯çº¿å¤§ç±»  è®¾ç½®åˆ—表/保存/编辑/删除方法
        /// <summary>
        ///  å·¥è‰ºè·¯çº¿å¤§ç±» ä¿å­˜
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("SaveGy_RoutingGroup")]
        [HttpPost]
        public object SaveGy_RoutingGroup([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();
            //查看权限
            if (!DBUtility.ClsPub.Security_Log("Gy_RoutingGroup_Edit", 1, false, msg2))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无保存权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            Int64 HItemID = 0;
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            //获取最大ID值赋值
            DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_RoutingGroup ", "Gy_RoutingGroup");
            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"]);
                maxid += 1;
                HItemID = maxid;
            }
            ListModels oListModels = new ListModels();
            try
            {
                WebAPI.DLL.ClsGy_RoutingGroup_Ctl oBill = new WebAPI.DLL.ClsGy_RoutingGroup_Ctl();
                List<Model.ClsGy_RoutingGroup_Model> lsmain = new List<Model.ClsGy_RoutingGroup_Model>();
                msg1 = msg1.Replace("\\", "");
                msg1 = msg1.Replace("\n", "");
                lsmain = oListModels.getObjectByJson_Gy_RoutingGroup(msg1);
                foreach (Model.ClsGy_RoutingGroup_Model oItem in lsmain)
                {
                    if (oItem.HNumber.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码不能为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (oItem.HName.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!名称不能为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim()))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码中不能出现连续‘.’并且首位末位不能为‘.’!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //查询数据中是否存在重复代码
                    ds = oCN.RunProcReturn("select * from  Gy_RoutingGroup where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_RoutingGroup");
                    if (oItem.HNumber.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //新增时判断
                    if (oItem.HItemID == 0)
                    {
                        if (ds == null || ds.Tables[0].Rows.Count == 0)
                        {
                        }
                        else
                        {
                            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;
                            }
                        }
                    }
                    //得到短代码
                    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.HShortNumber = sShortNumber;//短代码
                    oItem.HEndFlag = true;//末级标志
                    oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //等级
                    oItem.HMakeEmp = msg2; //创建人
                    oBill.oModel = oItem;
                }
                //保存
                //保存完毕后处理
                bool bResult;
                string sExeReturnInfo = "";
                if (oBill.oModel.HItemID == 0)
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddNew(ref sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyByID(oBill.oModel.HItemID, ref sExeReturnInfo);
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #region ä¿®æ”¹ å·¥è‰ºè·¯çº¿å¤§ç±» èŽ·å–ç»‘å®šæ•°æ®
        [Route("Gy_RoutingGroup/EditGy_RoutingGroup")]
        [HttpGet]
        public object EditGy_RoutingGroup(long HInterID)
        {
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingGroup where HItemID=" + HInterID, "h_v_Gy_RoutingGroup");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "";
                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;
            }
        }
        /// <summary>
        /// å·¥è‰ºè·¯çº¿å¤§ç±» å®¡æ ¸ã€åå®¡æ ¸
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_RoutingGroup/AuditGy_RoutingGroup")]
        [HttpGet]
        public object AuditGy_RoutingGroup(int HInterID, int IsAudit, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_RoutingGroup_Check", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_RoutingGroup where HItemID=" + HInterID, "Gy_RoutingGroup");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsAudit == 0)  //审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_RoutingGroup_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RoutingGroup_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_RoutingGroup set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RoutingGroup_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RoutingGroup_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
                    objJsonResult.data = null;
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_RoutingGroup_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RoutingGroup_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_RoutingGroup set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RoutingGroup_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RoutingGroup_AfterUnCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反审核成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// å·¥è‰ºè·¯çº¿å¤§ç±» ç¦ç”¨ã€åç¦ç”¨
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_RoutingGroup/StopGy_RoutingGroup")]
        [HttpGet]
        public object StopGy_RoutingGroup(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_RoutingGroup_Close", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_RoutingGroup where HItemID=" + HInterID, "Gy_RoutingGroup");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_RoutingGroup_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RoutingGroup_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_RoutingGroup set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RoutingGroup_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RoutingGroup_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_RoutingGroup_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RoutingGroup_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_RoutingGroup set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RoutingGroup_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RoutingGroup_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        /// <summary>
        /// å·¥è‰ºè·¯çº¿å¤§ç±» åˆ é™¤åŠŸèƒ½
        /// </summary>
        /// <returns></returns>
        [Route("DeltetGy_RoutingGroup")]
        [HttpGet]
        public object DeltetGy_RoutingGroup(string HItemID, string user)
        {
            DataSet ds;
            //string ModRightNameCheck = "Sc_ProcessReport_check";
            try
            {
                //删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_RoutingGroup_Delete", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无删除权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (string.IsNullOrWhiteSpace(HItemID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HItemID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();//开始事务
                ds = oCN.RunProcReturn("select * from Gy_RoutingGroup where HItemID=" + HItemID, "Gy_RoutingGroup");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已审核!不能进行删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已禁用!不能进行删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //删除前控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_RoutingGroup_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_RoutingGroup_BeforeDelCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.RunProc("delete Gy_RoutingGroup where HItemID=" + HItemID);
                //删除后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RoutingGroup_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_RoutingGroup_AfterDelCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                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  çŽ¯å¢ƒæ£€æµ‹å•  è®¾ç½®åˆ—表/保存/编辑/删除方法
        /// <summary>
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_DotCheckBillController.cs
@@ -100,7 +100,57 @@
                ds = oCN.RunProcReturn("Select * from Gy_DotCheck Where HItemID='" + HItemID + "'", "Gy_DotCheck", ref DBUtility.ClsPub.sExeReturnInfo);
                if (ds.Tables[0].Rows.Count != 0)
                {
                    oCN.BeginTran();
                    //删除前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_DotCheck_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_DotCheck_BeforeDelCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    ds = oCN.RunProcReturn("Delete from Gy_DotCheck Where HItemID='" + HItemID + "'", "Gy_DotCheck", ref DBUtility.ClsPub.sExeReturnInfo);
                    //删除后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_DotCheck_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_DotCheck_AfterDelCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.Commit();
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除成功";
@@ -176,10 +226,14 @@
                string HNumber = list[0].HNumber;
                string HName = list[0].HName;
                string HShortNumber = list[0].HNumber;
                long HLevel = list[0].HLevel;
                long HUSEORGID = list[0].HUSEORGID;
                string HHelpCode = list[0].HHelpCode;
                string HRemark = list[0].HRemark;
                bool HStopflag = list[0].HStopflag;
                string HUseFlag = list[0].HUseFlag;
                string HModifyEmp = msg3;
                string HDotCheckType = list[0].HDotCheckType;
                bool HEndFlag = list[0].HEndFlag;
                Int64 HDotCheckItemClassID = list[0].HDotCheckItemClassID;
                //判断权限
@@ -214,17 +268,68 @@
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_DotCheck_BeforeSaveCtrl " + msg3 + ",'1'", "h_p_Gy_DotCheck_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("Update Gy_DotCheck set " +
                    " HNumber='" + HNumber + "'" +
                    ",HName='" + HName + "'" +
                    ",HModifyEmp='" + HModifyEmp + "'" +
                    ",HModifyTime=getdate()" +
                    ",HShortNumber='" + HShortNumber + "'" +
                    ",HUSEORGID=" + HUSEORGID  +
                    ",HHelpCode='" + HHelpCode + "'" +
                    ",HStopflag='" + HStopflag + "'" +
                    ",HDotCheckType='" + HDotCheckType + "'" +
                    ",HDotCheckItemClassID=" + HDotCheckItemClassID +                     
                    ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //修改子项目代码
                //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_DotCheck_AfterSaveCtrl " + msg3 + ",'1'", "h_p_Gy_DotCheck_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
@@ -267,11 +372,15 @@
                string HName = list[0].HName;
                string HShortNumber = list[0].HNumber;
                long HLevel = list[0].HLevel;
                long HUSEORGID = list[0].HUSEORGID;
                long HCREATEORGID = list[0].HCREATEORGID;
                string HHelpCode = list[0].HHelpCode;
                string HRemark = list[0].HRemark;
                bool HStopflag = list[0].HStopflag;
                string HUseFlag = list[0].HUseFlag;
                string HMakeEmp = list[0].HMakeEmp;
                bool HEndFlag = list[0].HEndFlag;
                string HDotCheckType = list[0].HDotCheckType;
                Int64 HDotCheckItemClassID = list[0].HDotCheckItemClassID;
                //判断权限
                if (!ClsPub.Security_Log("Gy_DotCheck_Edit", 1, false, msg3))
@@ -296,14 +405,64 @@
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_DotCheck_BeforeSaveCtrl " + msg3 + ",'1'", "h_p_Gy_DotCheck_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("Insert into Gy_DotCheck " +
                   " (HNumber,HName,HHelpCode,HShortNumber" +
                   ",HLevel,HEndFlag,HStopflag,HRemark,HParentID,HDotCheckItemClassID ) " +
                   ",HLevel,HEndFlag,HStopflag,HRemark,HParentID,HDotCheckItemClassID" +
                  ",HMakeEmp,HMakeTime,HUSEORGID,HCREATEORGID,HUseFlag,HDotCheckType" +
                   " ) " +
                   " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," +
                    +HLevel + ",1," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "',0," + HDotCheckItemClassID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                    +HLevel + ",1," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "',0," + HDotCheckItemClassID + "" +
                      ",'" + HMakeEmp + "',getdate()," + HUSEORGID + "," + HCREATEORGID + ",'" + HUseFlag + "','"+ HDotCheckType + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                //oCN.RunProc("Update Gy_MouldType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_DotCheck_AfterSaveCtrl " + msg3 + ",'1'", "h_p_Gy_DotCheck_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -687,5 +846,379 @@
            }
        }
        #endregion
        #region ç‚¹æ£€é¡¹ç›®å®¡æ ¸ã€åå®¡æ ¸
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_DotCheck/AuditGy_DotCheck")]
        [HttpGet]
        public object AuditGy_DotCheck(int HInterID, int IsAudit, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_DotCheck_Check", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_DotCheck  where HItemID=" + HInterID, "Gy_DotCheck ");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsAudit == 0)  //审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_DotCheck_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_DotCheck_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_DotCheck set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_DotCheck_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_DotCheck_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
                    objJsonResult.data = null;
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_DotCheck_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_DotCheck_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_DotCheck set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_DotCheck_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_DotCheck_AfterUnCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反审核成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ç‚¹æ£€é¡¹ç›®ç¦ç”¨ã€åç¦ç”¨
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_DotCheck/StopGy_DotCheck")]
        [HttpGet]
        public object StopGy_DotCheck(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //禁用权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_DotCheck_Stop", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_DotCheck where HItemID=" + HInterID, "Gy_Material");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_DotCheck_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_DotCheck_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_DotCheck set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_DotCheck_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_DotCheck_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_DotCheck_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_DotCheck_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_DotCheck set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_DotCheck_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_DotCheck_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_MaintainBillController.cs
@@ -81,6 +81,87 @@
        }
        #endregion
        #region ç»´ä¿®éªŒæ”¶é¡¹ç›®åˆ†ç±» æ ‘形图(根据代码展开树状图)
        public class TreeModel
        {
            public string id { get; set; }
            public string title { get; set; }
            public List<TreeModel> children = new List<TreeModel>();
        }
        [Route("Gy_Maintain/Gy_MaintainTreeList")]
        [HttpGet]
        public object Gy_RepairClassTreeList()
        {
            try
            {
                string sql1 = string.Format("select hitemid,hnumber,hname from Gy_MaintainClass order by hnumber");
                ds = oCN.RunProcReturn(sql1, "Gy_RepairClass");
                List<TreeModel> treeModels = new List<TreeModel>();
                TreeModel first = new TreeModel();
                first.id = "0";
                first.title = "保养项目分类设置";
                treeModels.Add(first);
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    var strLen = row["hnumber"].ToString().Split('.');
                    if (strLen.Length == 1)
                    {
                        TreeModel tree = new TreeModel();
                        tree.id = row["hitemid"].ToString();
                        tree.title = row["hname"].ToString();
                        treeModels[0].children.Add(tree);
                    }
                }
                digui(ds.Tables[0], treeModels[0].children, 2);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels);
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// é€’归函数
        /// </summary>
        public void digui(DataTable dt, List<TreeModel> tree, int num)
        {
            for (int m = 0; m < tree.Count; m++)
            {
                tree[m].children = new List<TreeModel>();
                for (int i = 0; i < dt.Rows.Count; i++)//第一次循环,得到所有根节点的子集
                {
                    var strLen = dt.Rows[i]["hnumber"].ToString().Split('.');
                    if (strLen.Length == num && dt.Rows[i]["hnumber"].ToString().Contains(tree[m].id + "."))
                    {
                        TreeModel tbjson = new TreeModel();
                        tbjson.id = dt.Rows[i]["hitemid"].ToString();
                        tbjson.title = dt.Rows[i]["hname"].ToString();
                        tree[m].children.Add(tbjson);
                    }
                }
                var strLens = tree[m].id.Split('.');
                for (int i = 0; i < tree[m].children.Count; i++)
                {
                    digui(dt, tree[m].children, strLens.Length + 2);//再次用子集去循环,拿出子集的子集
                }
            }
        }
        #endregion
        #region ä¿å…»é¡¹ç›®åˆ é™¤
        [Route("Gy_Maintain/DeleteMaintain")]
        [HttpGet]
@@ -100,7 +181,53 @@
                ds = oCN.RunProcReturn("Select * from Gy_Maintain Where HItemID='" + HItemID + "'", "Gy_Maintain", ref DBUtility.ClsPub.sExeReturnInfo);
                if (ds.Tables[0].Rows.Count != 0)
                {
                    //删除前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_Maintain_BeforeDelCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    ds = oCN.RunProcReturn("Delete from Gy_Maintain Where HItemID='" + HItemID + "'", "Gy_Maintain", ref DBUtility.ClsPub.sExeReturnInfo);
                    //删除后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_Maintain_AfterDelCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除成功";
@@ -134,7 +261,7 @@
        {
            try
            {
                ds = oCN.RunProcReturn("select * from Gy_Maintain where HItemID=" + HInterID, "Gy_Maintain");
                ds = oCN.RunProcReturn("select * from h_v_Gy_Maintain where HItemID=" + HInterID, "h_v_Gy_Maintain");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -180,6 +307,10 @@
                string HRemark = list[0].HRemark;
                bool HStopflag = list[0].HStopflag;
                string HUseFlag = list[0].HUseFlag;
                string HModifyEmp = msg4;
                string HMaintainType = list[0].HMaintainType;
                long HUSEORGID = list[0].HUSEORGID;
                long HMaintainClassID = list[0].HMaintainClassID;
                //判断权限
                if (!ClsPub.Security_Log("Gy_Maintain_Edit", 1, false, msg4))
@@ -213,17 +344,69 @@
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeSaveCtrl " + msg3 + ",'1'", "h_p_Gy_Maintain_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("Update Gy_Maintain set " +
                    " HNumber='" + HNumber + "'" +
                    ",HName='" + HName + "'" +
                    ",HModifyEmp='" + HModifyEmp + "'" +
                    ",HMaintainType='" + HMaintainType + "'" +
                    ",HModifyTime=getdate()" +
                     ",HUSEORGID='" + HUSEORGID + "'" +
                     ",HMaintainClassID='" + HMaintainClassID + "'" +
                    ",HShortNumber='" + HShortNumber + "'" +
                    ",HHelpCode='" + HHelpCode + "'" +
                    ",HStopflag='" + HStopflag + "'" +
                    ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //修改子项目代码
                //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterSaveCtrl " + msg3 + ",'1'", "h_p_Gy_Maintain_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -254,7 +437,8 @@
                string msg1 = _value.ToString();
                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                string msg2 = sArray[0].ToString();
                string msg3 = sArray[1].ToString();//当前人
                string msg3 = sArray[2].ToString();//当前人
                string msg4 = sArray[1].ToString();
                //反序列化
                msg2 = "[" + msg2.ToString() + "]";
@@ -271,6 +455,11 @@
                string HUseFlag = list[0].HUseFlag;
                bool HEndFlag = list[0].HEndFlag;
                int HParentID = list[0].HParentID;
                string HMakeEmp = list[0].HMakeEmp;
                string HMaintainType = list[0].HMaintainType;
                long HUSEORGID = list[0].HUSEORGID;
                long HCREATEORGID = list[0].HCREATEORGID;
                long HMaintainClassID = list[0].HMaintainClassID;
                //判断权限
                if (!ClsPub.Security_Log("Gy_Maintain_Edit", 1, false, msg3))
@@ -295,14 +484,63 @@
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeSaveCtrl " + msg3 + ",'1'", "h_p_Gy_Maintain_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("Insert into Gy_Maintain " +
                   " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                   ",HLevel,HEndFlag,HStopflag,HRemark) " +
                   ",HLevel,HEndFlag,HStopflag,HRemark" +
                 ",HMakeEmp,HMakeTime,HUSEORGID,HCREATEORGID,HUseFlag,HMaintainType,HMaintainClassID) " +
                   " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID.ToString()+","
                    + HLevel + ",1," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                    + HLevel + ",1," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "'" +
                    ",'" + HMakeEmp + "',getdate()," + HUSEORGID + "," + HCREATEORGID + ",'" + HUseFlag + "','" + HMaintainType + "',"+ HMaintainClassID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                //oCN.RunProc("Update Gy_MouldType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterSaveCtrl " + msg3 + ",'1'", "h_p_Gy_Maintain_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -322,7 +560,110 @@
        }
        #endregion
        #region ä¿å…»é¡¹ç›®å®¡æ ¸/反审核
        //#region ä¿å…»é¡¹ç›®å®¡æ ¸/反审核
        //[Route("Gy_Maintain/AuditGy_Maintain")]
        //[HttpGet]
        //public object AuditGy_Maintain(string HInterID, int Type, string user)
        //{
        //    try
        //    {
        //        //判断是否有审核权限
        //        if (!DBUtility.ClsPub.Security_Log("Gy_Maintain_Check", 1, false, user))
        //        {
        //            objJsonResult.code = "0";
        //            objJsonResult.count = 0;
        //            objJsonResult.Message = "无权限审核!";
        //            objJsonResult.data = null;
        //            return objJsonResult;
        //        }
        //        if (string.IsNullOrWhiteSpace(HInterID))
        //        {
        //            objJsonResult.code = "0";
        //            objJsonResult.count = 0;
        //            objJsonResult.Message = "HInterID为空!";
        //            objJsonResult.data = null;
        //            return objJsonResult;
        //        }
        //        DAL.ClsGy_Maintain_Ctl oBill = new DAL.ClsGy_Maintain_Ctl();
        //        ClsPub.CurUserName = user;
        //        oCN.BeginTran();//开始事务
        //        //Type 1 å®¡æ ¸  2  åå®¡æ ¸
        //        if (Type == 1)
        //        {
        //            //判断单据是否已经审核
        //            DataSet ds;
        //            string sql = "select * from  Gy_Maintain  where HItemID = " + HInterID;
        //            ds = oCN.RunProcReturn(sql, oBill.MvarItemKey);
        //            if (ds.Tables[0].Rows[0]["HCheckEmp"] != null && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
        //            {
        //                objJsonResult.code = "0";
        //                objJsonResult.count = 0;
        //                objJsonResult.Message = "单据已审核!不能再次审核!";
        //                objJsonResult.data = null;
        //                return objJsonResult;
        //            }
        //            //审核单据
        //            if (!oBill.AuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
        //            {
        //                objJsonResult.code = "0";
        //                objJsonResult.count = 1;
        //                objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
        //                objJsonResult.data = null;
        //                return objJsonResult;
        //            }
        //        }
        //        else
        //        {
        //            //判断单据是否已经反审核
        //            DataSet ds;
        //            string sql = "select * from  Gy_Maintain  where HItemID = " + HInterID;
        //            ds = oCN.RunProcReturn(sql, oBill.MvarItemKey);
        //            if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
        //            {
        //                if (ds.Tables[0].Rows[0]["HCheckEmp"] == null || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
        //                {
        //                    objJsonResult.code = "0";
        //                    objJsonResult.count = 0;
        //                    objJsonResult.Message = "单据未审核!不需要反审核!";
        //                    objJsonResult.data = null;
        //                    return objJsonResult;
        //                }
        //                //反审核单据
        //                if (!oBill.DeAuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
        //                {
        //                    objJsonResult.code = "0";
        //                    objJsonResult.count = 1;
        //                    objJsonResult.Message = "反审核失败!原因:" + ClsPub.sExeReturnInfo;
        //                    objJsonResult.data = null;
        //                    return objJsonResult;
        //                }
        //            }
        //        }
        //        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_Maintain/AuditGy_Maintain")]
        [HttpGet]
        public object AuditGy_Maintain(string HInterID, int Type, string user)
@@ -366,6 +707,29 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_Maintain_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    //审核单据
                    if (!oBill.AuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
@@ -375,6 +739,29 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_Maintain_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                }
                else
@@ -393,6 +780,29 @@
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核前控制=========================================
                        ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_Maintain_BeforeUnCheckCtrl");
                        if (ds == null)
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核前判断失败!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //=========================================================
                        //反审核单据
                        if (!oBill.DeAuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
@@ -402,6 +812,29 @@
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核后控制=========================================
                        DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_Maintain_AfterUnCheckCtrl");
                        if (ds2 == null)
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核后判断失败!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //=========================================================
                    }
                }
@@ -425,6 +858,191 @@
        }
        #endregion
        #region ç»´ä¿®éªŒæ”¶é¡¹ç›®ç¦ç”¨ã€åç¦ç”¨
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_Maintain/StopGy_Maintain")]
        [HttpGet]
        public object StopGy_Maintain(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //禁用权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_Maintain_Stop", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_Maintain where HItemID=" + HInterID, "Gy_Material");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_Maintain_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_Maintain set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_Maintain_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_Maintain_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_Maintain_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_Maintain set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Maintain_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_Maintain_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ä¿å…»é¡¹ç›®æ–‡ä»¶ä¸Šä¼ 
        [Route("Gy_Maintain/Gy_Maintain_Excel")]
        [HttpPost]
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_RepairBillController.cs
@@ -81,6 +81,89 @@
        }
        #endregion
        #region ç»´ä¿®é¡¹ç›®åˆ†ç±» æ ‘形图(根据代码展开树状图)
        public class TreeModel
        {
            public string id { get; set; }
            public string title { get; set; }
            public List<TreeModel> children = new List<TreeModel>();
        }
        [Route("Gy_RepairClass/Gy_RepairClassTreeList")]
        [HttpGet]
        public object Gy_RepairClassTreeList()
        {
            try
            {
                string sql1 = string.Format("select hitemid,hnumber,hname from Gy_RepairClass order by hnumber");
                ds = oCN.RunProcReturn(sql1, "Gy_RepairClass");
                List<TreeModel> treeModels = new List<TreeModel>();
                TreeModel first = new TreeModel();
                first.id = "0";
                first.title = "维修项目分类设置";
                treeModels.Add(first);
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    var strLen = row["hnumber"].ToString().Split('.');
                    if (strLen.Length == 1)
                    {
                        TreeModel tree = new TreeModel();
                        tree.id = row["hitemid"].ToString();
                        tree.title = row["hname"].ToString();
                        treeModels[0].children.Add(tree);
                    }
                }
                digui(ds.Tables[0], treeModels[0].children, 2);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels);
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// é€’归函数
        /// </summary>
        public void digui(DataTable dt, List<TreeModel> tree, int num)
        {
            for (int m = 0; m < tree.Count; m++)
            {
                tree[m].children = new List<TreeModel>();
                for (int i = 0; i < dt.Rows.Count; i++)//第一次循环,得到所有根节点的子集
                {
                    var strLen = dt.Rows[i]["hnumber"].ToString().Split('.');
                    if (strLen.Length == num && dt.Rows[i]["hnumber"].ToString().Contains(tree[m].id + "."))
                    {
                        TreeModel tbjson = new TreeModel();
                        tbjson.id = dt.Rows[i]["hitemid"].ToString();
                        tbjson.title = dt.Rows[i]["hname"].ToString();
                        tree[m].children.Add(tbjson);
                    }
                }
                var strLens = tree[m].id.Split('.');
                for (int i = 0; i < tree[m].children.Count; i++)
                {
                    digui(dt, tree[m].children, strLens.Length + 2);//再次用子集去循环,拿出子集的子集
                }
            }
        }
        #endregion
        #region ç»´ä¿®é¡¹ç›®åˆ é™¤
        [Route("Gy_Repair/DeleteRepair")]
        [HttpGet]
@@ -100,7 +183,57 @@
                ds = oCN.RunProcReturn("Select * from Gy_Repair Where HItemID='" + HItemID + "'", "Gy_Repair", ref DBUtility.ClsPub.sExeReturnInfo);
                if (ds.Tables[0].Rows.Count != 0)
                {
                    oCN.BeginTran();
                    //删除前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_Repair_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_Repair_BeforeDelCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    ds = oCN.RunProcReturn("Delete from Gy_Repair Where HItemID='" + HItemID + "'", "Gy_Repair", ref DBUtility.ClsPub.sExeReturnInfo);
                    //删除后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Repair_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_Repair_AfterDelCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.Commit();
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除成功";
@@ -134,7 +267,7 @@
        {
            try
            {
                ds = oCN.RunProcReturn("select * from Gy_Repair where HItemID=" + HInterID, "Gy_Repair");
                ds = oCN.RunProcReturn("select * from h_v_Gy_Repair where HItemID=" + HInterID, "h_v_Gy_Repair");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -180,6 +313,11 @@
                string HRemark = list[0].HRemark;
                bool HStopflag = list[0].HStopflag;
                string HUseFlag = list[0].HUseFlag;
                string HModifyEmp = msg3;
                string HRepairType = list[0].HRepairType;
                long HUSEORGID = list[0].HUSEORGID;
                long HRepairClassID = list[0].HRepairClassID;
                //判断权限
                if (!ClsPub.Security_Log("Gy_Repair_Edit", 1, false, msg4))
@@ -204,16 +342,68 @@
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_Repair_BeforeSaveCtrl " + msg3 + ",'1'", "h_p_Gy_Repair_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("Update Gy_Repair set " +
                    " HNumber='" + HNumber + "'" +
                    ",HName='" + HName + "'" +
                    ",HShortNumber='" + HShortNumber + "'" +
                    ",HModifyEmp='" + HModifyEmp + "'" +
                    ",HModifyTime=getdate()" +
                    ",HUSEORGID='" + HUSEORGID + "'" +
                    ",HRepairClassID='" + HRepairClassID + "'" +
                    ",HHelpCode='" + HHelpCode + "'" +
                    ",HStopflag='" + HStopflag + "'" +
                    ",HRepairType='" + HRepairType + "'" +
                    ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //修改子项目代码
                //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Repair_AfterSaveCtrl " + msg3 + ",'1'", "h_p_Gy_Repair_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
@@ -245,7 +435,8 @@
                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[1].ToString();
                string msg3 = sArray[2].ToString();//当前人
                //反序列化
                msg2 = "[" + msg2.ToString() + "]";
@@ -255,12 +446,17 @@
                string HNumber = list[0].HNumber;
                string HName = list[0].HName;
                string HShortNumber = list[0].HNumber;
                long HUSEORGID = list[0].HUSEORGID;
                long HCREATEORGID = list[0].HCREATEORGID;
                long HLevel = list[0].HLevel;
                string HHelpCode = list[0].HHelpCode;
                string HRemark = list[0].HRemark;
                bool HStopflag = list[0].HStopflag;
                string HUseFlag = list[0].HUseFlag;
                bool HEndFlag = list[0].HEndFlag;
                string HMakeEmp = list[0].HMakeEmp;
                string HRepairType = list[0].HRepairType;
                long HRepairClassID = list[0].HRepairClassID;
                //判断权限
                if (!ClsPub.Security_Log("Gy_Repair_Edit", 1, false, msg3))
@@ -285,14 +481,63 @@
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_Repair_BeforeSaveCtrl " + msg3 + ",'1'", "h_p_Gy_Repair_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("Insert into Gy_Repair " +
                   " (HNumber,HName,HHelpCode,HShortNumber" +
                   ",HLevel,HEndFlag,HStopflag,HRemark,HParentID) " +
                   ",HLevel,HEndFlag,HStopflag,HRemark,HParentID" +
                   ",HMakeEmp,HMakeTime,HUSEORGID,HCREATEORGID,HUseFlag,HRepairType,HRepairClassID) " +
                   " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," +
                    +HLevel + ",1," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "',0)", ref DBUtility.ClsPub.sExeReturnInfo);
                    +HLevel + ",1," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "',0" +
                    ",'" + HMakeEmp + "',getdate()," + HUSEORGID + "," + HCREATEORGID + ",'" + HUseFlag + "','"+ HRepairType + "',"+ HRepairClassID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                //oCN.RunProc("Update Gy_MouldType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Repair_AfterSaveCtrl " + msg3 + ",'1'", "h_p_Gy_Repair_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -356,6 +601,29 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_Repair_BeforeCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_Repair_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    //审核单据
                    if (!oBill.AuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
@@ -365,6 +633,29 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Repair_AfterCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_Repair_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                }
                else
@@ -383,6 +674,29 @@
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核前控制=========================================
                        ds = oCN.RunProcReturn("Exec h_p_Gy_Repair_BeforeUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_Repair_BeforeUnCheckCtrl");
                        if (ds == null)
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核前判断失败!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //=========================================================
                        //反审核单据
                        if (!oBill.DeAuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
@@ -392,6 +706,29 @@
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核后控制=========================================
                        DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Repair_AfterUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_Repair_AfterUnCheckCtrl");
                        if (ds2 == null)
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核后判断失败!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //=========================================================
                    }
                }
@@ -415,6 +752,191 @@
        }
        #endregion
        #region ç»´ä¿®é¡¹ç›®ç¦ç”¨ã€åç¦ç”¨
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_Repair/StopGy_Repair")]
        [HttpGet]
        public object StopGy_Repair(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //禁用权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_Repair_Stop", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_Repair where HItemID=" + HInterID, "Gy_Material");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_Repair_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_Repair_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_Repair set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Repair_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_Repair_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_Repair_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_Repair_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_Repair set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Repair_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_Repair_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ç»´ä¿®é¡¹ç›®æ–‡ä»¶ä¸Šä¼ 
        [Route("Gy_Repair/Gy_Repair_Excel")]
        [HttpPost]
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_RepairCheckBillController.cs
@@ -81,6 +81,87 @@
        }
        #endregion
        #region ç»´ä¿®éªŒæ”¶é¡¹ç›®åˆ†ç±» æ ‘形图(根据代码展开树状图)
        public class TreeModel
        {
            public string id { get; set; }
            public string title { get; set; }
            public List<TreeModel> children = new List<TreeModel>();
        }
        [Route("Gy_RepairCheckClass/Gy_RepairCheckClassTreeList")]
        [HttpGet]
        public object Gy_RepairClassTreeList()
        {
            try
            {
                string sql1 = string.Format("select hitemid,hnumber,hname from Gy_RepairCheckClass order by hnumber");
                ds = oCN.RunProcReturn(sql1, "Gy_RepairClass");
                List<TreeModel> treeModels = new List<TreeModel>();
                TreeModel first = new TreeModel();
                first.id = "0";
                first.title = "维修验收项目分类设置";
                treeModels.Add(first);
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    var strLen = row["hnumber"].ToString().Split('.');
                    if (strLen.Length == 1)
                    {
                        TreeModel tree = new TreeModel();
                        tree.id = row["hitemid"].ToString();
                        tree.title = row["hname"].ToString();
                        treeModels[0].children.Add(tree);
                    }
                }
                digui(ds.Tables[0], treeModels[0].children, 2);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels);
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// é€’归函数
        /// </summary>
        public void digui(DataTable dt, List<TreeModel> tree, int num)
        {
            for (int m = 0; m < tree.Count; m++)
            {
                tree[m].children = new List<TreeModel>();
                for (int i = 0; i < dt.Rows.Count; i++)//第一次循环,得到所有根节点的子集
                {
                    var strLen = dt.Rows[i]["hnumber"].ToString().Split('.');
                    if (strLen.Length == num && dt.Rows[i]["hnumber"].ToString().Contains(tree[m].id + "."))
                    {
                        TreeModel tbjson = new TreeModel();
                        tbjson.id = dt.Rows[i]["hitemid"].ToString();
                        tbjson.title = dt.Rows[i]["hname"].ToString();
                        tree[m].children.Add(tbjson);
                    }
                }
                var strLens = tree[m].id.Split('.');
                for (int i = 0; i < tree[m].children.Count; i++)
                {
                    digui(dt, tree[m].children, strLens.Length + 2);//再次用子集去循环,拿出子集的子集
                }
            }
        }
        #endregion
        #region ç»´ä¿®éªŒæ”¶é¡¹ç›®åˆ é™¤
        [Route("Gy_RepairCheck/DeleteRepairCheck")]
        [HttpGet]
@@ -97,10 +178,61 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("Select * from Gy_RepairCheck Where HItemID='" + HItemID + "'", "Gy_RepairCheck", ref DBUtility.ClsPub.sExeReturnInfo);
                if (ds.Tables[0].Rows.Count != 0)
                {
                    oCN.BeginTran();
                    //删除前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_Repair_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_Repair_BeforeDelCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    ds = oCN.RunProcReturn("Delete from Gy_RepairCheck Where HItemID='" + HItemID + "'", "Gy_RepairCheck", ref DBUtility.ClsPub.sExeReturnInfo);
                    //删除后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_Repair_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_Repair_AfterDelCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.Commit();
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除成功";
@@ -134,7 +266,7 @@
        {
            try
            {
                ds = oCN.RunProcReturn("select * from Gy_RepairCheck where HItemID=" + HInterID, "Gy_RepairCheck");
                ds = oCN.RunProcReturn("select * from h_v_Gy_RepairCheck where HItemID=" + HInterID, "h_v_Gy_RepairCheck");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -180,6 +312,10 @@
                string HRemark = list[0].HRemark;
                bool HStopflag = list[0].HStopflag;
                string HUseFlag = list[0].HUseFlag;
                string HModifyEmp = msg4;
                string HRepairCheckType = list[0].HRepairCheckType;
                long HUSEORGID = list[0].HUSEORGID;
                long HRepairCheckClassID = list[0].HRepairCheckClassID;
                //判断权限
                if (!ClsPub.Security_Log("Gy_RepairCheck_Edit", 1, false, msg4))
@@ -201,6 +337,7 @@
                    return objJsonResult;
                }
                oDept.MvarItemKey = "Gy_RepairCheck";
                if (oDept.HavSameNumber(HItemID, HNumber))
                {
                    objJsonResult.code = "0";
@@ -213,16 +350,67 @@
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_RepairCheck_BeforeSaveCtrl " + msg3 + ",'1'", "h_p_Gy_RepairCheck_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("Update Gy_RepairCheck set " +
                    " HNumber='" + HNumber + "'" +
                    ",HName='" + HName + "'" +
                    ",HModifyEmp='" + HModifyEmp + "'" +
                    ",HRepairCheckType='" + HRepairCheckType + "'" +
                    ",HModifyTime=getdate()" +
                     ",HUSEORGID='" + HUSEORGID + "'" +
                     ",HRepairCheckClassID='" + HRepairCheckClassID + "'" +
                    ",HShortNumber='" + HShortNumber + "'" +
                    ",HHelpCode='" + HHelpCode + "'" +
                    ",HStopflag='" + HStopflag + "'" +
                    ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //修改子项目代码
                //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairCheck_AfterSaveCtrl " + msg3 + ",'1'", "h_p_Gy_RepairCheck_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
@@ -254,7 +442,8 @@
                string msg1 = _value.ToString();
                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                string msg2 = sArray[0].ToString();
                string msg3 = sArray[1].ToString();//当前人
                string msg3 = sArray[2].ToString();//当前人
                string msg4 = sArray[1].ToString();
                //反序列化
                msg2 = "[" + msg2.ToString() + "]";
@@ -265,11 +454,17 @@
                string HName = list[0].HName;
                string HShortNumber = list[0].HNumber;
                long HLevel = list[0].HLevel;
                long HUSEORGID = list[0].HUSEORGID;
                long HCREATEORGID = list[0].HCREATEORGID;
                string HHelpCode = list[0].HHelpCode;
                string HRemark = list[0].HRemark;
                bool HStopflag = list[0].HStopflag;
                string HUseFlag = list[0].HUseFlag;
                bool HEndFlag = list[0].HEndFlag;
                string HMakeEmp = list[0].HMakeEmp;
                string HRepairCheckType = list[0].HRepairCheckType;
                long HRepairCheckClassID = list[0].HRepairCheckClassID;
                //判断权限
                if (!ClsPub.Security_Log("Gy_RepairCheck_Edit", 1, false, msg3))
@@ -294,14 +489,64 @@
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_RepairCheck_BeforeSaveCtrl " + msg3 + ",'1'", "h_p_Gy_RepairCheck_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                //主表
                oCN.RunProc("Insert into Gy_RepairCheck " +
                   " (HNumber,HName,HHelpCode,HShortNumber" +
                   ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime) " +
                   ",HLevel,HEndFlag,HStopflag,HRemark" +
                  ",HMakeEmp,HMakeTime,HUSEORGID,HCREATEORGID,HUseFlag,HRepairCheckType,HRepairCheckClassID) " +
                   " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," +
                    +HLevel + ",1," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "',getdate())", ref DBUtility.ClsPub.sExeReturnInfo);
                    +HLevel + ",1," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "'" +
                    ",'" + HMakeEmp + "',getdate()," + HUSEORGID + "," + HCREATEORGID + ",'" + HUseFlag + "','" + HRepairCheckType + "',"+ HRepairCheckClassID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                //oCN.RunProc("Update Gy_MouldType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairCheck_AfterSaveCtrl " + msg3 + ",'1'", "h_p_Gy_RepairCheck_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -573,5 +818,385 @@
            }
        }
        #endregion
        #region ç»´ä¿®éªŒæ”¶é¡¹ç›®å®¡æ ¸/反审核
        [Route("Gy_RepairCheck/AuditGy_RepairCheck")]
        [HttpGet]
        public object AuditGy_RepairCheck(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有审核权限
                if (!DBUtility.ClsPub.Security_Log("Gy_RepairCheck_Check", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限审核!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DAL.ClsGy_RepairCheck_Ctl oBill = new DAL.ClsGy_RepairCheck_Ctl();
                ClsPub.CurUserName = user;
                oCN.BeginTran();//开始事务
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                {
                    //判断单据是否已经审核
                    DataSet ds;
                    string sql = "select * from  Gy_RepairCheck  where HItemID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, oBill.MvarItemKey);
                    if (ds.Tables[0].Rows[0]["HCheckEmp"] != null && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已审核!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_RepairCheck_BeforeCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_RepairCheck_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    //审核单据
                    if (!oBill.AuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairCheck_AfterCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_RepairCheck_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                }
                else
                {
                    //判断单据是否已经反审核
                    DataSet ds;
                    string sql = "select * from  Gy_RepairCheck  where HItemID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, oBill.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"] == null || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核前控制=========================================
                        ds = oCN.RunProcReturn("Exec h_p_Gy_RepairCheck_BeforeUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_RepairCheck_BeforeUnCheckCtrl");
                        if (ds == null)
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核前判断失败!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //=========================================================
                        //反审核单据
                        if (!oBill.DeAuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "反审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核后控制=========================================
                        DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairCheck_AfterUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_RepairCheck_AfterUnCheckCtrl");
                        if (ds2 == null)
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核后判断失败!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //=========================================================
                    }
                }
                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 ç»´ä¿®éªŒæ”¶é¡¹ç›®ç¦ç”¨ã€åç¦ç”¨
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_RepairCheck/StopGy_RepairCheck")]
        [HttpGet]
        public object StopGy_RepairCheck(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //禁用权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_RepairCheck_Stop", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_RepairCheck where HItemID=" + HInterID, "Gy_Material");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_RepairCheck_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairCheck_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_RepairCheck set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairCheck_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairCheck_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_RepairCheck_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairCheck_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_RepairCheck set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairCheck_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairCheck_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_RepairCheckClassController.cs
New file
@@ -0,0 +1,2380 @@
using DBUtility;
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;
using System.Web;
using WebAPI.Controllers.SCGL.日计划管理;
using System.IO;
namespace WebAPI.Controllers.基础资料.基础资料
{
    public class Gy_RepairCheckClassController : ApiController
    {
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        Models.ClsGy_RepairCheck oDept = new Models.ClsGy_RepairCheck();
        Models.ClsGy_RepairCheck oDeptHlp = new Models.ClsGy_RepairCheck();
        #region ç»´ä¿®éªŒæ”¶é¡¹ç›®åˆ†ç±»åˆ—表查询
        [Route("Gy_RepairCheckClass/list")]
        [HttpGet]
        public object list(string sWhere,string user)
        {
            try
            {
                //查询权限
                if (!DBUtility.ClsPub.Security_Log("Gy_RepairCheckClass_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查询权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                List<object> columnNameList = new List<object>();
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Gy_RepairCheckClass where 1=1 order by HItemID ", "h_v_Gy_RepairCheckClass");
                }
                else
                {
                    string sql = "select * from h_v_Gy_RepairCheckClass where 1 = 1 " + sWhere + " order by HItemID ";
                    ds = oCN.RunProcReturn(sql, "h_v_Gy_RepairCheckClass");
                }
                //添加列名
                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.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region  ç»´ä¿®éªŒæ”¶é¡¹ç›®åˆ†ç±»  è®¾ç½®åˆ—表/保存/编辑/删除方法
        /// <summary>
        ///  ç»´ä¿®éªŒæ”¶é¡¹ç›®åˆ†ç±» ä¿å­˜
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("SaveGy_RepairCheckClass")]
        [HttpPost]
        public object SaveGy_RepairCheckClass([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();
            //查看权限
            if (!DBUtility.ClsPub.Security_Log("Gy_RepairCheckClass_Edit", 1, false, msg2))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无保存权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            Int64 HItemID = 0;
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            //获取最大ID值赋值
            DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_RepairCheckClass ", "Gy_RepairCheckClass");
            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"]);
                maxid += 1;
                HItemID = maxid;
            }
            ListModels oListModels = new ListModels();
            try
            {
                DAL.ClsGy_RepairCheckClass_Ctl oBill = new DAL.ClsGy_RepairCheckClass_Ctl();
                List<Model.ClsGy_RepairCheckClass_Model> lsmain = new List<Model.ClsGy_RepairCheckClass_Model>();
                msg1 = msg1.Replace("\\", "");
                msg1 = msg1.Replace("\n", "");
                lsmain = oListModels.getObjectByJson_Gy_RepairCheckClass(msg1);
                foreach (Model.ClsGy_RepairCheckClass_Model oItem in lsmain)
                {
                    if (oItem.HNumber.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码不能为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (oItem.HName.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!名称不能为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim()))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码中不能出现连续‘.’并且首位末位不能为‘.’!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //查询数据中是否存在重复代码
                    ds = oCN.RunProcReturn("select * from  Gy_RepairCheckClass where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_RepairCheckClass");
                    if (oItem.HNumber.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //新增时判断
                    if (oItem.HItemID == 0)
                    {
                        if (ds == null || ds.Tables[0].Rows.Count == 0)
                        {
                        }
                        else
                        {
                            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;
                            }
                        }
                    }
                    //得到短代码
                    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.HShortNumber = sShortNumber;//短代码
                    oItem.HEndFlag = true;//末级标志
                    oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //等级
                    oItem.HMakeEmp = msg2; //创建人
                    oBill.oModel = oItem;
                }
                //保存
                //保存完毕后处理
                bool bResult;
                string sExeReturnInfo = "";
                if (oBill.oModel.HItemID == 0)
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddNew(ref sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyByID(oBill.oModel.HItemID, ref sExeReturnInfo);
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #region ä¿®æ”¹ ç»´ä¿®éªŒæ”¶é¡¹ç›®åˆ†ç±» èŽ·å–ç»‘å®šæ•°æ®
        [Route("Gy_RepairCheckClass/EditGy_RepairCheckClass")]
        [HttpGet]
        public object EditGy_RepairCheckClass(long HInterID)
        {
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_Gy_RepairCheckClass where HItemID=" + HInterID, "h_v_Gy_RepairCheckClass");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "";
                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
        /// <summary>
        /// ç»´ä¿®éªŒæ”¶é¡¹ç›®åˆ†ç±» å®¡æ ¸ã€åå®¡æ ¸
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_RepairCheckClass/AuditGy_RepairCheckClass")]
        [HttpGet]
        public object AuditGy_RepairCheckClass(int HInterID, int IsAudit, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_RepairCheckClass_Check", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_RepairCheckClass where HItemID=" + HInterID, "Gy_RepairCheckClass");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsAudit == 0)  //审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_RepairCheckClass_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairCheckClass_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_RepairCheckClass set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairCheckClass_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairCheckClass_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
                    objJsonResult.data = null;
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_RepairCheckClass_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairCheckClass_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_RepairCheckClass set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairCheckClass_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairCheckClass_AfterUnCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反审核成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// ç»´ä¿®éªŒæ”¶é¡¹ç›®åˆ†ç±» ç¦ç”¨ã€åç¦ç”¨
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_RepairCheckClass/StopGy_RepairCheckClass")]
        [HttpGet]
        public object StopGy_RepairCheckClass(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_RepairCheckClass_Close", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_RepairCheckClass where HItemID=" + HInterID, "Gy_RepairCheckClass");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_RepairCheckClass_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairCheckClass_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_RepairCheckClass set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairCheckClass_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairCheckClass_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_RepairCheckClass_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairCheckClass_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_RepairCheckClass set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairCheckClass_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairCheckClass_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// ç»´ä¿®éªŒæ”¶é¡¹ç›®åˆ†ç±» åˆ é™¤åŠŸèƒ½
        /// </summary>
        /// <returns></returns>
        [Route("DeltetGy_RepairCheckClass")]
        [HttpGet]
        public object DeltetGy_RepairCheckClass(string HItemID, string user)
        {
            DataSet ds;
            //string ModRightNameCheck = "Sc_ProcessReport_check";
            try
            {
                //删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_RepairCheckClass_Delete", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无删除权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (string.IsNullOrWhiteSpace(HItemID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HItemID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();//开始事务
                ds = oCN.RunProcReturn("select * from Gy_RepairCheckClass where HItemID=" + HItemID, "Gy_RepairCheckClass");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已审核!不能进行删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已禁用!不能进行删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //删除前控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_RepairCheckClass_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_RepairCheckClass_BeforeDelCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.RunProc("delete Gy_RepairCheckClass where HItemID=" + HItemID);
                //删除后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairCheckClass_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_RepairCheckClass_AfterDelCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                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_RepairClass/list")]
        [HttpGet]
        public object Gy_RepairClasslist(string sWhere, string user)
        {
            try
            {
                //查询权限
                if (!DBUtility.ClsPub.Security_Log("Gy_RepairClass_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查询权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                List<object> columnNameList = new List<object>();
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Gy_RepairClass where 1=1 order by HItemID ", "h_v_Gy_RepairClass");
                }
                else
                {
                    string sql = "select * from h_v_Gy_RepairClass where 1 = 1 " + sWhere + " order by HItemID ";
                    ds = oCN.RunProcReturn(sql, "h_v_Gy_RepairClass");
                }
                //添加列名
                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.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region  ç»´ä¿®é¡¹ç›®åˆ†ç±»  è®¾ç½®åˆ—表/保存/编辑/删除方法
        /// <summary>
        ///  ç»´ä¿®é¡¹ç›®åˆ†ç±» ä¿å­˜
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("SaveGy_RepairClass")]
        [HttpPost]
        public object SaveGy_RepairClass([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();
            //查看权限
            if (!DBUtility.ClsPub.Security_Log("Gy_RepairClass_Edit", 1, false, msg2))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无保存权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            Int64 HItemID = 0;
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            //获取最大ID值赋值
            DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_RepairClass ", "Gy_RepairClass");
            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"]);
                maxid += 1;
                HItemID = maxid;
            }
            ListModels oListModels = new ListModels();
            try
            {
                DAL.ClsGy_RepairClass_Ctl oBill = new DAL.ClsGy_RepairClass_Ctl();
                List<Model.ClsGy_RepairClass_Model> lsmain = new List<Model.ClsGy_RepairClass_Model>();
                msg1 = msg1.Replace("\\", "");
                msg1 = msg1.Replace("\n", "");
                lsmain = oListModels.getObjectByJson_Gy_RepairClass(msg1);
                foreach (Model.ClsGy_RepairClass_Model oItem in lsmain)
                {
                    if (oItem.HNumber.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码不能为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (oItem.HName.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!名称不能为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim()))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码中不能出现连续‘.’并且首位末位不能为‘.’!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //查询数据中是否存在重复代码
                    ds = oCN.RunProcReturn("select * from  Gy_RepairClass where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_RepairClass");
                    if (oItem.HNumber.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //新增时判断
                    if (oItem.HItemID == 0)
                    {
                        if (ds == null || ds.Tables[0].Rows.Count == 0)
                        {
                        }
                        else
                        {
                            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;
                            }
                        }
                    }
                    //得到短代码
                    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.HShortNumber = sShortNumber;//短代码
                    oItem.HEndFlag = true;//末级标志
                    oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //等级
                    oItem.HMakeEmp = msg2; //创建人
                    oBill.oModel = oItem;
                }
                //保存
                //保存完毕后处理
                bool bResult;
                string sExeReturnInfo = "";
                if (oBill.oModel.HItemID == 0)
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddNew(ref sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyByID(oBill.oModel.HItemID, ref sExeReturnInfo);
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #region ä¿®æ”¹ ç»´ä¿®é¡¹ç›®åˆ†ç±» èŽ·å–ç»‘å®šæ•°æ®
        [Route("Gy_RepairClass/EditGy_RepairClass")]
        [HttpGet]
        public object EditGy_RepairClass(long HInterID)
        {
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_Gy_RepairClass where HItemID=" + HInterID, "h_v_Gy_RepairClass");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "";
                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
        /// <summary>
        /// ç»´ä¿®é¡¹ç›®åˆ†ç±» å®¡æ ¸ã€åå®¡æ ¸
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_RepairClass/AuditGy_RepairClass")]
        [HttpGet]
        public object AuditGy_RepairClass(int HInterID, int IsAudit, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_RepairClass_Check", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_RepairClass where HItemID=" + HInterID, "Gy_RepairClass");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsAudit == 0)  //审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_RepairClass_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairClass_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_RepairClass set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairClass_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairClass_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
                    objJsonResult.data = null;
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_RepairClass_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairClass_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_RepairClass set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairClass_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairClass_AfterUnCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反审核成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// ç»´ä¿®é¡¹ç›®åˆ†ç±» ç¦ç”¨ã€åç¦ç”¨
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_RepairClass/StopGy_RepairClass")]
        [HttpGet]
        public object StopGy_RepairClass(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_RepairClass_Close", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_RepairClass where HItemID=" + HInterID, "Gy_RepairClass");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_RepairClass_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairClass_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_RepairClass set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairClass_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairClass_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_RepairClass_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairClass_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_RepairClass set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairClass_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_RepairClass_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// ç»´ä¿®é¡¹ç›®åˆ†ç±» åˆ é™¤åŠŸèƒ½
        /// </summary>
        /// <returns></returns>
        [Route("DeltetGy_RepairClass")]
        [HttpGet]
        public object DeltetGy_RepairClass(string HItemID, string user)
        {
            DataSet ds;
            //string ModRightNameCheck = "Sc_ProcessReport_check";
            try
            {
                //删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_RepairClass_Delete", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无删除权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (string.IsNullOrWhiteSpace(HItemID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HItemID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();//开始事务
                ds = oCN.RunProcReturn("select * from Gy_RepairClass where HItemID=" + HItemID, "Gy_RepairClass");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已审核!不能进行删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已禁用!不能进行删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //删除前控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_RepairClass_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_RepairClass_BeforeDelCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.RunProc("delete Gy_RepairClass where HItemID=" + HItemID);
                //删除后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_RepairClass_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_RepairClass_AfterDelCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                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_MaintainClass/list")]
        [HttpGet]
        public object Gy_MaintainClasslist(string sWhere, string user)
        {
            try
            {
                //查询权限
                if (!DBUtility.ClsPub.Security_Log("Gy_MaintainClass_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查询权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                List<object> columnNameList = new List<object>();
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Gy_MaintainClass where 1=1 order by HItemID ", "h_v_Gy_MaintainClass");
                }
                else
                {
                    string sql = "select * from h_v_Gy_MaintainClass where 1 = 1 " + sWhere + " order by HItemID ";
                    ds = oCN.RunProcReturn(sql, "h_v_Gy_MaintainClass");
                }
                //添加列名
                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.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region  ä¿å…»é¡¹ç›®åˆ†ç±»  è®¾ç½®åˆ—表/保存/编辑/删除方法
        /// <summary>
        ///  ä¿å…»é¡¹ç›®åˆ†ç±» ä¿å­˜
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("SaveGy_MaintainClass")]
        [HttpPost]
        public object SaveGy_MaintainClass([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();
            //查看权限
            if (!DBUtility.ClsPub.Security_Log("Gy_MaintainClass_Edit", 1, false, msg2))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无保存权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            Int64 HItemID = 0;
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            //获取最大ID值赋值
            DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_MaintainClass ", "Gy_MaintainClass");
            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"]);
                maxid += 1;
                HItemID = maxid;
            }
            ListModels oListModels = new ListModels();
            try
            {
                DAL.ClsGy_MaintainClass_Ctl oBill = new DAL.ClsGy_MaintainClass_Ctl();
                List<Model.ClsGy_MaintainClass_Model> lsmain = new List<Model.ClsGy_MaintainClass_Model>();
                msg1 = msg1.Replace("\\", "");
                msg1 = msg1.Replace("\n", "");
                lsmain = oListModels.getObjectByJson_Gy_MaintainClass(msg1);
                foreach (Model.ClsGy_MaintainClass_Model oItem in lsmain)
                {
                    if (oItem.HNumber.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码不能为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (oItem.HName.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!名称不能为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim()))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码中不能出现连续‘.’并且首位末位不能为‘.’!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //查询数据中是否存在重复代码
                    ds = oCN.RunProcReturn("select * from  Gy_MaintainClass where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_MaintainClass");
                    if (oItem.HNumber.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //新增时判断
                    if (oItem.HItemID == 0)
                    {
                        if (ds == null || ds.Tables[0].Rows.Count == 0)
                        {
                        }
                        else
                        {
                            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;
                            }
                        }
                    }
                    //得到短代码
                    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.HShortNumber = sShortNumber;//短代码
                    oItem.HEndFlag = true;//末级标志
                    oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //等级
                    oItem.HMakeEmp = msg2; //创建人
                    oBill.oModel = oItem;
                }
                //保存
                //保存完毕后处理
                bool bResult;
                string sExeReturnInfo = "";
                if (oBill.oModel.HItemID == 0)
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddNew(ref sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyByID(oBill.oModel.HItemID, ref sExeReturnInfo);
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #region ä¿®æ”¹ ä¿å…»é¡¹ç›®åˆ†ç±» èŽ·å–ç»‘å®šæ•°æ®
        [Route("Gy_MaintainClass/EditGy_MaintainClass")]
        [HttpGet]
        public object EditGy_MaintainClass(long HInterID)
        {
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_Gy_MaintainClass where HItemID=" + HInterID, "h_v_Gy_MaintainClass");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "";
                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
        /// <summary>
        /// ä¿å…»é¡¹ç›®åˆ†ç±» å®¡æ ¸ã€åå®¡æ ¸
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_MaintainClass/AuditGy_MaintainClass")]
        [HttpGet]
        public object AuditGy_MaintainClass(int HInterID, int IsAudit, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_MaintainClass_Check", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_MaintainClass where HItemID=" + HInterID, "Gy_MaintainClass");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsAudit == 0)  //审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_MaintainClass_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_MaintainClass_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_MaintainClass set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_MaintainClass_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_MaintainClass_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
                    objJsonResult.data = null;
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_MaintainClass_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_MaintainClass_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_MaintainClass set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_MaintainClass_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_MaintainClass_AfterUnCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反审核成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// ä¿å…»é¡¹ç›®åˆ†ç±» ç¦ç”¨ã€åç¦ç”¨
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_MaintainClass/StopGy_MaintainClass")]
        [HttpGet]
        public object StopGy_MaintainClass(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_MaintainClass_Close", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_MaintainClass where HItemID=" + HInterID, "Gy_MaintainClass");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_MaintainClass_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_MaintainClass_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_MaintainClass set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_MaintainClass_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_MaintainClass_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_MaintainClass_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_MaintainClass_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_MaintainClass set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_MaintainClass_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_MaintainClass_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// ä¿å…»é¡¹ç›®åˆ†ç±» åˆ é™¤åŠŸèƒ½
        /// </summary>
        /// <returns></returns>
        [Route("DeltetGy_MaintainClass")]
        [HttpGet]
        public object DeltetGy_MaintainClass(string HItemID, string user)
        {
            DataSet ds;
            //string ModRightNameCheck = "Sc_ProcessReport_check";
            try
            {
                //删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_MaintainClass_Delete", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无删除权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (string.IsNullOrWhiteSpace(HItemID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HItemID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();//开始事务
                ds = oCN.RunProcReturn("select * from Gy_MaintainClass where HItemID=" + HItemID, "Gy_MaintainClass");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已审核!不能进行删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已禁用!不能进行删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //删除前控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_MaintainClass_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_MaintainClass_BeforeDelCtrl");
                if (ds == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.RunProc("delete Gy_MaintainClass where HItemID=" + HItemID);
                //删除后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_MaintainClass_AfterDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_MaintainClass_AfterDelCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                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_ShiftsController.cs
@@ -808,9 +808,53 @@
                oCn.BeginTran();
                //删除前控制=========================================
                ds = oCn.RunProcReturn("Exec h_p_Gy_WorkShift_BeforeDelCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_WorkShift_BeforeDelCtrl");
                if (ds == null)
                {
                    oCn.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCn.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCn.RunProc("delete from Gy_WorkShift where HInterID = " + HInterID);
                oCn.RunProc("delete from Gy_WorkShiftSub where HInterID= " + HInterID);
                //删除后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_WorkShift_AfterDelCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_WorkShift_AfterDelCtrl");
                if (ds2 == null)
                {
                    oCn.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCn.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCn.Commit();
@@ -873,5 +917,381 @@
        #endregion
        #region ç­æ¬¡å®¡æ ¸ã€åå®¡æ ¸
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_ShiftsController/AuditGy_Shifts")]
        [HttpGet]
        public object AuditGy_Shifts(int HInterID, int IsAudit, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_Shifts_Check", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCn.RunProcReturn("select * from Gy_WorkShift  where HInterID=" + HInterID, "Gy_WorkShift ");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsAudit == 0)  //审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCn.BeginTran();
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    ds = oCn.RunProcReturn("Exec h_p_Gy_WorkShift_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_WorkShift_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCn.RunProc("update Gy_WorkShift set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HInterID=" + HInterID);
                    //审核后控制=========================================
                    DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_WorkShift_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_WorkShift_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
                    objJsonResult.data = null;
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    ds = oCn.RunProcReturn("Exec h_p_Gy_WorkShift_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_WorkShift_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCn.RunProc("update Gy_WorkShift set HCheckEmp='',HCheckTime=null where HInterID=" + HInterID);
                    //反审核后控制=========================================
                    DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_WorkShift_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_WorkShift_AfterUnCheckCtrl");
                    if (ds2 == null)
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反审核成功";
                    objJsonResult.data = null;
                }
                oCn.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ç­æ¬¡ç¦ç”¨ã€åç¦ç”¨
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_ShiftsController/StopGy_Shifts")]
        [HttpGet]
        public object StopGy_Shifts(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_Shifts_Stop", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCn.RunProcReturn("select * from Gy_WorkShift where HInterID=" + HInterID, "Gy_Material");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCn.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCn.RunProcReturn("Exec h_p_Gy_WorkShift_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_WorkShift_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCn.RunProc("update Gy_WorkShift set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HInterID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_WorkShift_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_WorkShift_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCn.RunProcReturn("Exec h_p_Gy_WorkShift_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_WorkShift_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCn.RunProc("update Gy_WorkShift set HStopEmp='',HStopTime=null,HStopflag=0 where HInterID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_WorkShift_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Gy_WorkShift_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCn.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCn.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/Êý¾Ýͬ²½/¶¤¶¤Í¬²½/DD_DataSynchronizationController.cs
@@ -74,9 +74,12 @@
        }
        #region å˜é‡
        private string AppKey = "dingiokapm2dvjrhzl2g";                                                                             //已创建的企业内部应用的AppKey。
        private string AppSecret = "dPUD7tN3BGVYAC4lDzhpcBH7O4FWFDdjLJWa6cVRBQj5U7GJ4Gwr7Vohnv0oPBOr";                             //已创建的企业内部应用的AppSecret。
        private long AgentID = 3188176952;                                                                                          //应用的AgentId
        //private string AppKey = "dingiokapm2dvjrhzl2g";                                                                             //已创建的企业内部应用的AppKey。
        //private string AppSecret = "dPUD7tN3BGVYAC4lDzhpcBH7O4FWFDdjLJWa6cVRBQj5U7GJ4Gwr7Vohnv0oPBOr";                             //已创建的企业内部应用的AppSecret。
        //private long AgentID = 3188176952;                                                                                          //应用的AgentId
        private string AppKey = "dingj3hskhwk8jioofub";                                                                             //已创建的企业内部应用的AppKey。
        private string AppSecret = "qGPbXJGJtFI__FYGdzZPIjHZP_o1jI1KnM4_bbKx9AUuXcYqr3UN6nkQeSe8GcT7";                             //已创建的企业内部应用的AppSecret。
        private long AgentID = 3553515838;                                                                                          //应用的AgentId
        public string accessToken = "";                                                                                           //调用该接口的访问凭证。
        private string ProcessInstanceId = "";                                                                                     //审批实例ID。
        #endregion
@@ -593,6 +596,7 @@
        #region èŽ·å– å®œæ­æŒ‡å®šå•据的实例ID列表--指定分页的数据
        public bool getInstanceIDList_Page_YiDa(string appType, string systemToken, string userID, string formUuid, int pageNumber, int pageSize, ref YD_GetInstanceIDListResponse response, ref string msg)
        {
            LogService.Write("查看4-传递参数:appType=" + appType + ",systemToken=" + systemToken + ",formUuid=" + formUuid + ",userID=" + userID + ",pageSize=" + pageSize + ",pageNumber=" + pageNumber+ ",accessToken="+ this.accessToken);
            AlibabaCloud.SDK.Dingtalkyida_1_0.Client client = CreateClient4();
            AlibabaCloud.SDK.Dingtalkyida_1_0.Models.GetInstanceIdListHeaders getInstanceIdListHeaders = new AlibabaCloud.SDK.Dingtalkyida_1_0.Models.GetInstanceIdListHeaders();
            getInstanceIdListHeaders.XAcsDingtalkAccessToken = this.accessToken;
@@ -639,7 +643,9 @@
                {
                    // err ä¸­å«æœ‰ code å’Œ message å±žæ€§ï¼Œå¯å¸®åŠ©å¼€å‘å®šä½é—®é¢˜
                }
                msg = "错误代码" + err.Code + ":" + err.Message;
                LogService.Write("查看4-报错信息1:"+ msg);
                return false;
            }
@@ -654,6 +660,7 @@
                    // err ä¸­å«æœ‰ code å’Œ message å±žæ€§ï¼Œå¯å¸®åŠ©å¼€å‘å®šä½é—®é¢˜
                }
                msg = "错误代码" + err.Code + ":" + err.Message;
                LogService.Write("查看4-报错信息2:" + msg);
                return false;
            }
        }
@@ -662,6 +669,7 @@
        #region èŽ·å– å®œæ­æŒ‡å®šå•据的实例ID列表
        public bool getInstanceIDList_YiDa(string appType, string systemToken, string userID, string formUuid, int pageNumber, int pageSize, ref List<string> IDList, ref string msg)
        {
            LogService.Write("查看4-1查询");
            YD_GetInstanceIDListResponse response = new YD_GetInstanceIDListResponse();
            do
            {
@@ -980,7 +988,7 @@
                        return false;
                    }
                    LogService.Write("查看1-数据查询1");
                    for (int i = 0; i < response.Body.Result.Count; i++)
                    {
                        try
@@ -1028,6 +1036,7 @@
                            //    oItem.HEmployeeID = ((List<object>)response.Body.Result[i].FormData["employeeField_lo6w37hf_id"])[0].ToString().Replace("'", "");
                            //}
                            LogService.Write("查看1-数据查询-循环里面2:"+ oItem.HInstanceID);
                            //签到表
                            if (keys.Contains("dateField_ls9ma7h3"))
@@ -1056,7 +1065,7 @@
                                oItem.HEmployeeID = ((List<object>)response.Body.Result[i].FormData["employeeField_ls9ma7h5_id"])[0].ToString().Replace("'", "");
                            }
                            LogService.Write("查看1-数据查询-循环里面3:获取实例状态:"+ oItem.HInstanceStatus);
                            //获取实例状态
                            GetInstanceByIdResponse response1 = new GetInstanceByIdResponse();
@@ -1097,7 +1106,7 @@
                                oItem.HApprovedResult = "";
                            }
                            LogService.Write("查看1-数据查询-循环里面4:数据新增:" + oItem.HApprovedResult);
                            lsmain.Add(oItem);
                        }catch(Exception e)
@@ -1156,7 +1165,8 @@
            try
            {
              oCN.BeginTran();
                LogService.Write("查看1-新增数据");
                oCN.BeginTran();
                foreach (YD_FenCengShenHeQianDaoBiao oItem in lsmain)
                {
                    string sql_searchRepeat = "select * from DD_FenCengShenHeQianDaoBiao where HInstanceID = '" + oItem.HInstanceID + "'";
@@ -1194,10 +1204,12 @@
                    oCN.RunProc(sql_main);
                }
                oCN.Commit();
                LogService.Write("查看1-新增数据结束");
                return true;
            }catch(Exception e)
            {
                msg = e.Message;
                LogService.Write("查看1-报错" + msg);
                oCN.RollBack();
                return false;
            }
@@ -1759,7 +1771,7 @@
                        return false;
                    }
                    LogService.Write("查看4-循环-查询数据");
                    for (int i = 0; i < response.Body.Result.Count; i++)
                    {
                        try
@@ -1775,6 +1787,8 @@
                            oItem.HUpdateDate = response.Body.Result[i].ModifiedTimeGMT.Replace("T", " ").Replace("Z", "").Replace("'", ""); ;
                            oItem.HInstanceID = response.Body.Result[i].FormInstanceId.Replace("'", ""); ;
                            oItem.HOriginator = response.Body.Result[i].Originator.Name.NameInChinese.Replace("'", ""); ;
                            LogService.Write("查看4-循环-获取id-查询数据"+ oItem.HInstanceID);
                            int startindex = response.Body.Result[i].Title.IndexOf("zh_CN") + 8;
                            oItem.HTitle = startIndex + response.Body.Result[i].Title.Substring(startindex).Replace("\"}", "").Replace("'", "");
@@ -1795,6 +1809,8 @@
                            {
                                return false;
                            }
                            LogService.Write("查看4-循环-获取状态-查询数据" + oItem.HInstanceStatus);
                            oItem.HInstanceStatus = response1.Body.InstanceStatus;
                            if (oItem.HInstanceStatus == "RUNNING")
@@ -1916,6 +1932,8 @@
                            
                            oItem.HQuestion_Duty = sub2List;
                            LogService.Write("查看4-循环-新增结束-查询数据" + oItem.HQuestion_Duty.Count);
                            lsmain.Add(oItem);
                        }
                        catch (Exception e)
@@ -1957,9 +1975,10 @@
            List<string> IDList = new List<string>();
            if (getInstanceIDList_YiDa(appType, systemToken, userID, formUuid, pageNumber, pageSize, ref IDList, ref msg) == false)
            {
                LogService.Write("查看4-1-返回");
                return false;
            }
            LogService.Write("查看4-1");
            //获取详细信息并附加到列表lsmain中
            List<YD_QRQCWenTiTiJiaoBiao> lsmain = new List<YD_QRQCWenTiTiJiaoBiao>();
            if (getInstanceDetailList_QRQCWenTiTiJiaoBiao__YiDa(appType, systemToken, userID, formUuid, IDList, ref lsmain, ref msg) == false)
@@ -1969,6 +1988,7 @@
            try
            {
                LogService.Write("查看4-新增");
                oCN.BeginTran();
                foreach (YD_QRQCWenTiTiJiaoBiao oItem in lsmain)
                {
@@ -2055,11 +2075,13 @@
                }
                oCN.Commit();
                LogService.Write("查看4-新增结束");
                return true;
            }
            catch (Exception e)
            {
                msg = e.Message;
                LogService.Write("查看4-新增报错:"+ msg);
                oCN.RollBack();
                return false;
            }
WebAPI/DLL/ClsGy_ErrMsgBackType_Ctl.cs
@@ -13,12 +13,27 @@
        public string HOldNumber;
        public Model.ClsGy_ErrMsgBackType_Model oModel = new Model.ClsGy_ErrMsgBackType_Model();
        //新增
        public override bool AddNew()
        public  bool AddNew(ref string sReturn)
        {
            //
            try
            {
                oCn.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_BeforeSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_ErrMsgBackType_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.RunProc("Insert into " + MvarItemKey + " " +
                    " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                    ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID) " +
@@ -26,6 +41,23 @@
                    "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "','" +DateTime.Now+ "','" + oModel.HUSEORGID + "','" + oModel.HUseFlag + "','" + oModel.HMakeEmp+ "','" + oModel.HUSEORGID + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_AfterSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_ErrMsgBackType_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //=========================================================
                oCn.Commit();
                return true;
            }
@@ -37,12 +69,27 @@
        }
        //修改
        public override bool ModifyByID(Int64 sItemID)
        public bool ModifyByID(Int64 sItemID, ref string sReturn)
        {
            try
            {
                
                oCn.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_BeforeSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_ErrMsgBackType_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.RunProc("Update " + MvarItemKey + " set " +
                    " HNumber='" + oModel.HNumber + "'" +
                    ",HName='" + oModel.HName + "'" +
@@ -59,6 +106,22 @@
                //将上级 ä¸ºéžæœ«çº§
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_ErrMsgBackType_AfterSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_ErrMsgBackType_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //=========================================================
                oCn.Commit();
                return true;
            }
WebAPI/DLL/ClsGy_InspectInstruMent_Ctl.cs
@@ -12,12 +12,30 @@
        public string HOldNumber;
        public Model.ClsGy_InspectInstruMent_Model oModel = new Model.ClsGy_InspectInstruMent_Model();
        //新增
        public override bool AddNew()
        public  bool AddNew(ref string sExeReturnInfo)
        {
            //
            try
            {
                oCn.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_InspectInstruMent_BeforeSaveCtrl " + oModel.HMakeEmp + ",'1'", "h_p_Gy_InspectInstruMent_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCn.RollBack();
                    sExeReturnInfo = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCn.RollBack();
                    sExeReturnInfo = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.RunProc("Insert into " + MvarItemKey + " " +
                    " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                    ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID,HERPItemID" +
@@ -27,6 +45,24 @@
                    ",'" + oModel.HCalibrationStatus.ToString() + "','" + oModel.HCalibrationDate.ToString() + "','" + oModel.HValidDate.ToString() + "','" + oModel.HExpiryDay.ToString() + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_InspectInstruMent_AfterSaveCtrl " + oModel.HMakeEmp + ",'1'", "h_p_Gy_InspectInstruMent_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCn.RollBack();
                    sExeReturnInfo = "保存后判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCn.RollBack();
                    sExeReturnInfo = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.Commit();
                return true;
            }
@@ -38,12 +74,29 @@
        }
        //修改
        public override bool ModifyByID(Int64 sItemID)
        public  bool ModifyByID(Int64 sItemID, ref string sExeReturnInfo)
        {
            try
            {
                
                oCn.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_InspectInstruMent_BeforeSaveCtrl " + oModel.HMakeEmp + ",'1'", "h_p_Gy_InspectInstruMent_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCn.RollBack();
                    sExeReturnInfo = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCn.RollBack();
                    sExeReturnInfo = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.RunProc("Update " + MvarItemKey + " set " +
                    " HNumber='" + oModel.HNumber + "'" +
                    ",HName='" + oModel.HName + "'" +
@@ -64,6 +117,23 @@
                //将上级 ä¸ºéžæœ«çº§
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_InspectInstruMent_AfterSaveCtrl " + oModel.HMakeEmp + ",'1'", "h_p_Gy_InspectInstruMent_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCn.RollBack();
                    sExeReturnInfo = "保存后判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCn.RollBack();
                    sExeReturnInfo = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.Commit();
                return true;
            }
WebAPI/DLL/ClsGy_InspectValue_Ctl.cs
@@ -12,12 +12,29 @@
        public string HOldNumber;
        public Model.ClsGy_InspectValue_Model oModel = new Model.ClsGy_InspectValue_Model();
        //新增
        public override bool AddNew()
        public  bool AddNew(ref string sExeReturnInfo)
        {
            //
            try
            {
                oCn.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_InspectValue_BeforeSaveCtrl " + oModel.HMakeEmp + ",'1'", "h_p_Gy_InspectValue_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCn.RollBack();
                    sExeReturnInfo = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCn.RollBack();
                    sExeReturnInfo = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.RunProc("Insert into " + MvarItemKey + " " +
                    " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                    ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID,HERPItemID) " +
@@ -25,6 +42,24 @@
                    "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "','" +DateTime.Now+ "','" + oModel.HUSEORGID + "','" + oModel.HUseFlag + "','" + oModel.HMakeEmp+ "','" + oModel.HUSEORGID + "','" + 0 + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_InspectValue_AfterSaveCtrl " + oModel.HMakeEmp + ",'1'", "h_p_Gy_InspectValue_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCn.RollBack();
                    sExeReturnInfo = "保存后判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCn.RollBack();
                    sExeReturnInfo = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.Commit();
                return true;
            }
@@ -36,12 +71,29 @@
        }
        //修改
        public override bool ModifyByID(Int64 sItemID)
        public  bool ModifyByID(Int64 sItemID, ref string sExeReturnInfo)
        {
            try
            {
                
                oCn.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_InspectValue_BeforeSaveCtrl " + oModel.HMakeEmp + ",'1'", "h_p_Gy_InspectValue_BeforeSaveCtrl");
                if (ds == null)
                {
                    oCn.RollBack();
                    sExeReturnInfo = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCn.RollBack();
                    sExeReturnInfo = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.RunProc("Update " + MvarItemKey + " set " +
                    " HNumber='" + oModel.HNumber + "'" +
                    ",HName='" + oModel.HName + "'" +
@@ -58,6 +110,25 @@
                //将上级 ä¸ºéžæœ«çº§
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_InspectValue_AfterSaveCtrl " + oModel.HMakeEmp + ",'1'", "h_p_Gy_InspectValue_AfterSaveCtrl");
                if (ds2 == null)
                {
                    oCn.RollBack();
                    sExeReturnInfo = "保存后判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCn.RollBack();
                    sExeReturnInfo = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.Commit();
                return true;
            }
WebAPI/DLL/ClsGy_RoutingGroup_Ctl.cs
New file
@@ -0,0 +1,165 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace WebAPI.DLL
{
    public class ClsGy_RoutingGroup_Ctl : DBUtility.ClsGy_Base_Ctl
    {
           SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        //原代码 ç”¨äºŽ æ›¿æ¢å­é¡¹ç›®
        public string HOldNumber;
        public Model.ClsGy_RoutingGroup_Model oModel = new Model.ClsGy_RoutingGroup_Model();
        //新增
        public  bool AddNew(ref string sReturn)
        {
            //
            try
            {
                oCn.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_RoutingGroup_BeforeSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_RoutingGroup_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.RunProc("Insert into " + MvarItemKey + " " +
                    " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                    ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID) " +
                    " Values('" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() +
                    "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "','" +DateTime.Now+ "','" + oModel.HUSEORGID + "','" + oModel.HUseFlag + "','" + oModel.HMakeEmp+ "','" + oModel.HUSEORGID + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_RoutingGroup_AfterSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_RoutingGroup_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //=========================================================
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //修改
        public bool ModifyByID(Int64 sItemID, ref string sReturn)
        {
            try
            {
                oCn.BeginTran();
                //保存前控制=========================================
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_RoutingGroup_BeforeSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_RoutingGroup_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.RunProc("Update " + MvarItemKey + " set " +
                    " HNumber='" + oModel.HNumber + "'" +
                    ",HName='" + oModel.HName + "'" +
                    ",HShortNumber='" + oModel.HShortNumber + "'" +
                    ",HHelpCode='" + oModel.HHelpCode + "'" +
                    ",HModifyTime='" + DateTime.Now + "'" +
                    ",HUSEORGID='" + oModel.HUSEORGID + "'" +
                    ",HModifyEmp ='" + oModel.HMakeEmp + "'" +
                    ",HUseFlag='" + oModel.HUseFlag + "'" +
                    ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) +
                    ",HRemark= '" + oModel.HRemark + "' 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);
                //
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_RoutingGroup_AfterSaveCtrl " + oModel.HMakeEmp + ",'2'", "h_p_Gy_RoutingGroup_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //=========================================================
                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_RoutingGroup_Ctl()
        {
            MvarItemKey = "Gy_RoutingGroup";
            MvarReportTitle = "工艺路线大类";
            oModel = new Model.ClsGy_RoutingGroup_Model();
        }
    }
}
WebAPI/ListModels.cs
@@ -1314,6 +1314,55 @@
            return list;
        }
        /// <summary>
        /// å¤„理新增工艺路线大类表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsGy_RoutingGroup_Model> getObjectByJson_Gy_RoutingGroup(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_RoutingGroup_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_RoutingGroup_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理新增 ç»´ä¿®éªŒæ”¶é¡¹ç›®åˆ†ç±» è¡¨çš„json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsGy_RepairCheckClass_Model> getObjectByJson_Gy_RepairCheckClass(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_RepairCheckClass_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_RepairCheckClass_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理新增 ç»´ä¿®é¡¹ç›®åˆ†ç±» è¡¨çš„json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsGy_RepairClass_Model> getObjectByJson_Gy_RepairClass(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_RepairClass_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_RepairClass_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理新增 ä¿å…»é¡¹ç›®åˆ†ç±» è¡¨çš„json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsGy_MaintainClass_Model> getObjectByJson_Gy_MaintainClass(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_MaintainClass_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_MaintainClass_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理新增异常类型表的json
        /// </summary>
WebAPI/Models/CheckItem.cs
@@ -18,12 +18,15 @@
        public string HHelpCode { get; set; }   // åŠ©è®°ç 
        public string HRemark { get; set; }    //备注
        public string HMakeEmp { get; set; }
        public bool HStopflag { get; set; }  //禁用标志
        public bool HUseFlag { get; set; }   //使用状态
        public string HUseFlag { get; set; }   //使用状态
        public long HQCCheckClassID { get; set; } //检验项目类别ID
        public long HUSEORGID { get; set; }
        public long HCREATEORGID { get; set; }
        public string HQCCheckClassName { get; set; }//检验项目类别
        public string HDefaultResult { get; set; }//默认结论
WebAPI/Models/ClsGy_DotCheck.cs
@@ -14,9 +14,13 @@
        public string HShortNumber;   //短代码
        public int HParentID;       //父级
        public int HLevel;         //等级
        public int HCREATEORGID;
        public int HUSEORGID;
        public bool HEndFlag;        //末级标志
        public bool HStopflag;      //禁用标志
        public string HRemark;         //备注
        public string HMakeEmp;
        public string HDotCheckType;
        public string HUseFlag = "未使用";
        public Int64 HDotCheckItemClassID; //点检项目分类
WebAPI/Models/ClsGy_EquipFileMain.cs
@@ -36,6 +36,8 @@
        public int HEquipDotCheckRuleInterID=0;
        public int HEquipMaintainRuleInterID=0;
        public int HSourceID = 0;
        public int HCREATEORGID;
        public int HUSEORGID;
        public string HIPAddress;              // varchar(50) //数采IP地址
        public string HLinkNETMode;              // varchar(50) //联网方式
        public string HCollectMode;              // varchar(50) //采集方式
WebAPI/Models/ClsGy_Maintain.cs
@@ -14,9 +14,14 @@
        public string HShortNumber;   //短代码
        public int HParentID=0;       //父级
        public int HLevel;         //等级
        public int HMaintainClassID;
        public int HUSEORGID;
        public int HCREATEORGID;
        public bool HEndFlag;        //末级标志
        public bool HStopflag;      //禁用标志
        public string HRemark;         //备注
        public string HMakeEmp;
        public string HMaintainType;
        public string HUseFlag = "未使用";
        
WebAPI/Models/ClsGy_Repair.cs
@@ -14,9 +14,14 @@
        public string HShortNumber;   //短代码
        public int HParentID;       //父级
        public int HLevel;         //等级
        public int HUSEORGID;
        public int HCREATEORGID;
        public int HRepairClassID;
        public bool HEndFlag;        //末级标志
        public bool HStopflag;      //禁用标志
        public string HRemark;         //备注
        public string HMakeEmp;
        public string HRepairType;
        public string HUseFlag = "未使用";
    }
}
WebAPI/Models/ClsGy_RepairCheck.cs
@@ -14,9 +14,14 @@
        public string HShortNumber;   //短代码
        public int HParentID;       //父级
        public int HLevel;         //等级
        public int HRepairCheckClassID;
        public int HUSEORGID;
        public int HCREATEORGID;
        public bool HEndFlag;        //末级标志
        public bool HStopflag;      //禁用标志
        public string HRemark;         //备注
        public string HMakeEmp;
        public string HRepairCheckType;
        public string HUseFlag = "未使用";
WebAPI/Models/Gy_Mould.cs
@@ -67,6 +67,8 @@
        public int HMadeSupID { get; set; }
        public int HNowWHID { get; set; }
        public int HNowSPID { get; set; }
        public int HCREATEORGID { get; set; }
        public int HUSEORGID { get; set; }
        public double HInitLife { get; set; }
        public string HMouldUseStatus { get; set; }
WebAPI/Models/»ù´¡×ÊÁÏ/Warehouse.cs
@@ -21,6 +21,7 @@
        public Int64 HEmpID { get; set; }
        public string HAddress { get; set; }
        public string HPhone { get; set; }
        public string HWarehouseType { get; set; }
        public Int64 HSPGroupID { get; set; }
        public Int64 HSPFlag { get; set; }
        public Int64 HSTOCKPROPERTY { get; set; }
WebAPI/WebAPI.csproj
@@ -609,6 +609,7 @@
    <Compile Include="Controllers\基础资料\基础资料\Gy_PaymentConditionListBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_DisposeWayController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_ProcMulController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_RepairCheckClassController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_ScrapReasonController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_TemporaryAreaController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_RateTypeController.cs" />
@@ -740,6 +741,7 @@
    <Compile Include="DbUntil\DataFormatUntil.cs" />
    <Compile Include="DLL\ClsGy_BadPhenomena_Ctl.cs" />
    <Compile Include="DLL\ClsGy_EnvironmentTestItem_Ctl.cs" />
    <Compile Include="DLL\ClsGy_RoutingGroup_Ctl.cs" />
    <Compile Include="DLL\ClsGy_ProcMul_Ctl.cs" />
    <Compile Include="DLL\ClsGy_TechnologyParameterType_Ctl.cs" />
    <Compile Include="DLL\ClsGy_InspectInstruMent_Ctl.cs" />
@@ -1166,6 +1168,7 @@
    <Folder Include="Views\Gy_PaymentConditionListBill\" />
    <Folder Include="Views\Gy_RateType\" />
    <Folder Include="Views\Gy_RecConditionBill\" />
    <Folder Include="Views\Gy_RepairCheckClass\" />
    <Folder Include="Views\Gy_RoutingGroup\" />
    <Folder Include="Views\Gy_SettleStyle\" />
    <Folder Include="Views\Gy_SOPBill\" />