yusijie
2025-05-30 e5125bd15c9951cdefa1846264ac726108fc0534
客户标签;测试记录优化
15个文件已修改
4个文件已添加
1629 ■■■■■ 已修改文件
DAL/DAL.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/基础资料/公用基础资料/ClsGy_EquipStatus_Ctl.cs 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/生产管理/客户标签/ClsSc_CustomerTagInfo.cs 370 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DBUtility/基础资料/ClsGy_Base_Ctl.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/Model.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_EquipStatus_Model.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/客户标签/ClsSc_CustomerTagInfoMain.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/客户标签/ClsSc_CustomerTagInfoSub.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WarM/条码打印/Gy_BarCodeBill_Rework.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BaseSet/Gy_ConkTypeController.cs 65 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/Open_PrintTemController.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SBGL/Gy_EquipTypeController.cs 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_EquipStatusController.cs 285 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_MateNumRelationController.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/生产管理/客户标签/Sc_CustomerTagController.cs 676 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/Gy_MateNumRelation_Sec.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/DAL.csproj
@@ -99,6 +99,7 @@
    <Compile Include="ClsPM_WorkPlanMonthBillMain.cs" />
    <Compile Include="源单\InterFace源单\Cls_S_IF_ICMOBillList_CusBarCodeBill.cs" />
    <Compile Include="源单\InterFace源单\Cls_S_IF_ICMOReportBillList_CusBarCodeBill.cs" />
    <Compile Include="生产管理\客户标签\ClsSc_CustomerTagInfo.cs" />
    <Compile Include="生产管理\排产解锁申请单\ClsJIT_UnLockRequestBill.cs" />
    <Compile Include="生产管理\排产锁定申请单\ClsJIT_LockRequestBill.cs" />
    <Compile Include="系统公用\ClsXt_DefineBillMainSet.cs" />
DAL/»ù´¡×ÊÁÏ/¹«Óûù´¡×ÊÁÏ/ClsGy_EquipStatus_Ctl.cs
@@ -12,11 +12,26 @@
        public string HOldNumber;
        public Model.ClsGy_EquipStatus_Model oModel = new Model.ClsGy_EquipStatus_Model();
        //新增
        public override bool AddNew()
        public override bool AddNew(ref string sReturn)
        {
            try
            {
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_EquipStatus_BeforeSaveCtrl '" + oModel.HNumber + "','" + oModel.HName + "'," + oModel.HUSEORGID + ",1,0 ", "h_p_Gy_EquipStatus_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($@"insert into Gy_EquipStatus(HNumber,HName ,HShortNumber  ,HParentID ,HLevel 
                                ,HEndFlag  ,HStopflag  ,HRemark ,HHelpCode ,HUseFlag
@@ -40,10 +55,25 @@
        }
        //修改
        public override bool ModifyByID(Int64 sItemID)
        public override bool ModifyByID(Int64 sItemID, ref string sReturn)
        {
            try
            {
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_EquipStatus_BeforeSaveCtrl '" + oModel.HNumber + "','" + oModel.HName + "'," + oModel.HUSEORGID + ",3," + sItemID, "h_p_Gy_EquipStatus_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 " + MvarItemKey + " set " +
                    " HNumber='" + oModel.HNumber + "'" +
DAL/Éú²ú¹ÜÀí/¿Í»§±êÇ©/ClsSc_CustomerTagInfo.cs
New file
@@ -0,0 +1,370 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public  class ClsSc_CustomerTagInfo : DBUtility.ClsXt_BaseBill
    {
        public Model.ClsSc_CustomerTagInfoMain omodel = new Model.ClsSc_CustomerTagInfoMain();
        public List<Model.ClsSc_CustomerTagInfoSub> DetailColl = new List<Model.ClsSc_CustomerTagInfoSub>();
        public ClsSc_CustomerTagInfo()
        {
            base.MvarItemKeySub = "Sc_CustomerTagInfoSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey = "Sc_CustomerTagInfoMain";
            base.MvarReportTitle = "客户标签信息";
            base.BillType = "10003";
            base.HBillSubType = "10003";
        }
        #region å›ºå®šä»£ç 
        ~ClsSc_CustomerTagInfo()
        {
            DetailColl = null;
        }
        #endregion   è‡ªå®šä¹‰æ–¹æ³•
        //删除关联
        public override void DeleteRelation(ref string sReturn, Int64 lngBillKey)
        {
            try
            {
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //新增关联
        public override void AddNewRelation(ref string sReturn, Int64 lngBillKey)
        {
            try
            {
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Sc_CustomerTagInfo_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Sc_CustomerTagInfo_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();
                string mainSql = "update Sc_CustomerTagInfoMain set " +
                    "HDate = '" + omodel.HDate + "'" +
                    ",HRemark = '" + omodel.HRemark + "'" +
                    ",HUpDater = '" + omodel.HUpDater + "'" +
                    ",HUpDateDate = " + "getdate()" + "" +
                    " where HInterID = " + lngBillKey;
               //更新主表
               oCn.RunProc(mainSql);
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
                DeleteBillSub(lngBillKey);
                //插入子表
                omodel.HInterID = lngBillKey;
                foreach (Model.ClsSc_CustomerTagInfoSub oSub in DetailColl)
                {
                    string subSql = "Insert into Sc_CustomerTagInfoSub" +
                     " (HInterID,HEntryID,HRemark,HBillNo_bak,HMaterID,HCustID,HEPE,HPU,HSKU" +
                     ",HSIZE1,HSIZE2,HLBS,HOZ,HUPC,HSKU2,HFABRIC,HSN,HSize,HCustMaterNumber,HCustMaterName,HCustMaterModel" +
                     ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
                     ") values(" +
                     "" + omodel.HInterID.ToString() +
                     "," + oSub.HEntryID +
                     ",'" + oSub.HRemark + "'" +
                     ",'" + oSub.HBillNo_bak + "'" +
                     "," + oSub.HMaterID +
                     "," + oSub.HCustID +
                     ",'" + oSub.HEPE + "'" +
                     ",'" + oSub.HPU + "'" +
                     ",'" + oSub.HSKU + "'" +
                     ",'" + oSub.HSIZE1 + "'" +
                     ",'" + oSub.HSIZE2 + "'" +
                     ",'" + oSub.HLBS + "'" +
                     ",'" + oSub.HOZ + "'" +
                     ",'" + oSub.HUPC + "'" +
                     ",'" + oSub.HSKU2 + "'" +
                     ",'" + oSub.HFABRIC + "'" +
                     ",'" + oSub.HSN + "'" +
                     ",'" + oSub.HSize + "'" +
                     ",'" + oSub.HCustMaterNumber + "'" +
                     ",'" + oSub.HCustMaterName + "'" +
                     ",'" + oSub.HCustMaterModel + "'" +
                     "," + oSub.HSourceInterID.ToString() + "" +
                     "," + oSub.HSourceEntryID.ToString() + "" +
                     ",'" + oSub.HSourceBillNo + "'" +
                     ",'" + oSub.HSourceBillType + "'" +
                     ") ";
                    oCn.RunProc(subSql);
                }
                //更新订单关联数量
                AddNewRelation(ref sReturn, omodel.HInterID);
                //控制关联数量
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Sc_CustomerTagInfo_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Sc_CustomerTagInfo_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后控制判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //============================
                //
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //新增单据
        public override bool AddBill(ref string sReturn)
        {
            try
            {
                //得到mainid
                //omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
                //若MAINDI重复则重新获取
                if (IsExistBillNo(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HBillNo, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew, omodel.HInterID))
                {
                    omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
                }
                if (IsExistMainID(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HInterID, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew))
                {
                    omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Sc_CustomerTagInfo_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Sc_CustomerTagInfo_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();
                //主表
                string mainSql = "Insert Into Sc_CustomerTagInfoMain" +
                    "(HInterID,HBillNo,HDate,HYear,HPeriod,HRemark,HMaker,HMakeDate,HBillStatus" +
                    ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
                    ") " +
                    "values(" +
                    "" + omodel.HInterID.ToString() + "" +
                    ",'" + omodel.HBillNo + "'" +
                    ",'" + omodel.HDate + "'" +
                    "," + omodel.HYear.ToString() + "" +
                    "," + omodel.HPeriod.ToString() + "" +
                    ",'" + omodel.HRemark + "'" +
                    ",'" + omodel.HMaker + "'" +
                    "," + "getdate()" + "" +
                    "," + "1" + "" +
                    "," + omodel.HMainSourceInterID + "" +
                    "," + omodel.HMainSourceEntryID + "" +
                    ",'" + omodel.HMainSourceBillNo + "'" +
                    ",'" + omodel.HMainSourceBillType + "'" +
                    ") ";
                oCn.RunProc(mainSql);
                //插入子表
                foreach (Model.ClsSc_CustomerTagInfoSub oSub in DetailColl)
                {
                    string subSql = "Insert into Sc_CustomerTagInfoSub" +
                     " (HInterID,HEntryID,HRemark,HBillNo_bak,HMaterID,HCustID,HEPE,HPU,HSKU" +
                     ",HSIZE1,HSIZE2,HLBS,HOZ,HUPC,HSKU2,HFABRIC,HSN,HSize,HCustMaterNumber,HCustMaterName,HCustMaterModel" +
                     ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
                     ") values(" +
                     "" + omodel.HInterID.ToString() +
                     "," + oSub.HEntryID +
                     ",'" + oSub.HRemark + "'" +
                     ",'" + oSub.HBillNo_bak + "'" +
                     "," + oSub.HMaterID +
                     "," + oSub.HCustID +
                     ",'" + oSub.HEPE + "'" +
                     ",'" + oSub.HPU + "'" +
                     ",'" + oSub.HSKU + "'" +
                     ",'" + oSub.HSIZE1 + "'" +
                     ",'" + oSub.HSIZE2 + "'" +
                     ",'" + oSub.HLBS + "'" +
                     ",'" + oSub.HOZ + "'" +
                     ",'" + oSub.HUPC + "'" +
                     ",'" + oSub.HSKU2 + "'" +
                     ",'" + oSub.HFABRIC + "'" +
                     ",'" + oSub.HSN + "'" +
                     ",'" + oSub.HSize + "'" +
                     ",'" + oSub.HCustMaterNumber + "'" +
                     ",'" + oSub.HCustMaterName + "'" +
                     ",'" + oSub.HCustMaterModel + "'" +
                     "," + oSub.HSourceInterID.ToString() + "" +
                     "," + oSub.HSourceEntryID.ToString() + "" +
                     ",'" + oSub.HSourceBillNo + "'" +
                     ",'" + oSub.HSourceBillType + "'" +
                     ") ";
                    oCn.RunProc(subSql);
                }
                //更新订单关联数量
                AddNewRelation(ref sReturn, omodel.HInterID);
                //控制关联数量
                //
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Sc_CustomerTagInfo_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Sc_CustomerTagInfo_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后控制判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //============================
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //显示单据
        public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //查询主表
                DataSet Ds ;
                Ds = oCn.RunProcReturn("Select * from Sc_CustomerTagInfoMain Where HInterID=" + lngBillKey.ToString(), "Sc_CustomerTagInfoMain");
                if(Ds.Tables[0].Rows.Count==0)
                {
                    sReturn = "单据未找到!";
                    return false;
                }
                //固定赋值===========================================
                omodel.HMainSourceBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMainSourceBillType"]);
                omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
                omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
                omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
                omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
                omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]);
                omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
                omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]);
                omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim();
                omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim();
                omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim();
                omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim();
                omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim();
                omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim();
                omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim();
                omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim();
                omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim();
                omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
                omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
                omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]);
                omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
                omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
                //========================================================
                //循环
                DataSet DsSub ;
                DsSub = oCn.RunProcReturn("Select * from Sc_CustomerTagInfoSub Where HInterID=" + lngBillKey.ToString(), "Sc_CustomerTagInfoSub");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Model.ClsSc_CustomerTagInfoSub oSub = new Model.ClsSc_CustomerTagInfoSub();
                    // å›ºå®šèµ‹å€¼===============================================
                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
                    oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]);
                    oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]);
                    oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim();
                    oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim();
                    oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]);
                    oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]);
                    oSub.HCloseMan =  DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]);
                    oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]);
                    oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]);
                    oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim();
                    //===================================================
                    oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]);
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
    }
}
DBUtility/»ù´¡×ÊÁÏ/ClsGy_Base_Ctl.cs
@@ -16,12 +16,24 @@
            return true;
        }
        //新增基础资料
        public virtual bool AddNew(ref string sReturn)
        {
            return true;
        }
        //修改
        public virtual bool ModifyByID(Int64 sItemID)
        {
            return true;
        }
        //修改(返回异常信息)
        public virtual bool ModifyByID(Int64 sItemID, ref string sReturn)
        {
            return true;
        }
        #region å›ºå®šä»£ç 
        //是否存在子项目
        public bool HavChildCodes(Int64 sItemID)
Model/Model.csproj
@@ -159,6 +159,8 @@
    <Compile Include="基础资料\基础资料\ClsGy_EnvironmentTestItem_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_TechnologyParameterType_Model .cs" />
    <Compile Include="基础资料\基础资料\ClsGy_RestDay_Model.cs" />
    <Compile Include="生产管理\客户标签\ClsSc_CustomerTagInfoMain.cs" />
    <Compile Include="生产管理\客户标签\ClsSc_CustomerTagInfoSub.cs" />
    <Compile Include="生产管理\排产解锁申请单\ClsJIT_UnLockRequestBillMain.cs" />
    <Compile Include="生产管理\排产解锁申请单\ClsJIT_UnLockRequestBillSub.cs" />
    <Compile Include="生产管理\排产锁定申请单\ClsJIT_LockRequestBillMain.cs" />
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_EquipStatus_Model.cs
@@ -6,15 +6,6 @@
{
    public class ClsGy_EquipStatus_Model : DBUtility.ClsGy_Base_Model
    {
        public DateTime HMakeTime { get; set; }
        public DateTime HCheckTime { get; set; }
        public DateTime HModifyTime { get; set; }
        public DateTime HStopTime { get; set; }
        public string HMakeEmp { get; set; }
        public string HCheckEmp { get; set; }
        public string HModifyEmp { get; set; }
        public string HStopEmp { get; set; }
        public int HUSEORGID { get; set; }
        public int HCREATEORGID { get; set; }
    }
}
Model/Éú²ú¹ÜÀí/¿Í»§±êÇ©/ClsSc_CustomerTagInfoMain.cs
New file
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSc_CustomerTagInfoMain : DBUtility.ClsXt_BaseBillMain
    {
    }
}
Model/Éú²ú¹ÜÀí/¿Í»§±êÇ©/ClsSc_CustomerTagInfoSub.cs
New file
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSc_CustomerTagInfoSub : DBUtility.ClsXt_BaseBillSub
    {
        public Int64 HMaterID ;
        public Int64 HCustID ;
        public string HEPE ;
        public string HPU ;
        public string HSKU ;
        public string HSIZE1 ;
        public string HSIZE2 ;
        public string HLBS ;
        public string HOZ ;
        public string HUPC ;
        public string HSKU2 ;
        public string HFABRIC ;
        public string HSN ;
        public string HSize ;
        public string HCustMaterNumber ;
        public string HCustMaterName ;
        public string HCustMaterModel ;
    }
}
WarM/ÌõÂë´òÓ¡/Gy_BarCodeBill_Rework.cs
@@ -666,13 +666,10 @@
                            }
                            if (HBarCodeType == "唯一条码")
                            {
                                //条码编号 = æ¡ç å‰ç¼€ + æµæ°´å·
                                TM = sTMNumber + LSH2;
                                //条码前缀 = ç»„织代码 + ç‰©æ–™ä»£ç  + å¹´ + æœˆ + æ—¥
                                sTMNumber = HOrgNumber + sMaterID + sYear + sPeriod + sDay;
                                Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号
                                LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                                Int32 HModelLen = grdMain.Rows[j].Cells[HMaterModelCol].Value.ToString().Length;
                                string HModelLeft = HModelLen >= 4 ? grdMain.Rows[j].Cells[HMaterModelCol].Value.ToString() : "";
                                //条码编号 = å·¥åŽ‚ä»£ç ï¼ˆ1) + å¹´ + è½¦é—´ä»£ç ï¼ˆ060113) + æœˆ + åž‹å· + æ—¥ + æµæ°´å·
                                TM = 1 + sYear + 060113 + sPeriod + HModelLeft + sDay + LSH;
                            }
                            HEntryID = j + 1;
WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
@@ -305,7 +305,7 @@
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_BadReason where  HNumber='" + HNumber + "' and HUSEORGID='" + HOrgID + "'", "Gy_BadReason");
                var ds = oCN.RunProcReturn("select * from Gy_BadReason with(nolock) where  HNumber='" + HNumber + "' and HUSEORGID='" + HOrgID + "'", "Gy_BadReason");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsAudit == 0)  //审核判断
WebAPI/Controllers/BaseSet/Gy_ConkTypeController.cs
@@ -18,6 +18,7 @@
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        ClsXt_SystemParameter oClsXt_SystemParameter = new ClsXt_SystemParameter();
        /// <summary>
        /// è¿”回故障类别列表
@@ -169,7 +170,7 @@
                    //保存前控制=========================================      
                    string sql1 = "exec h_p_Gy_ConkType_BeforeSaveCtrl " + HMakeEmp + ",'" + 1 + "'";
                    string sql1 = "exec h_p_Gy_ConkType_BeforeSaveCtrl '" + HNumber + "','" + HName + "'," + HUSEORGID + ",1,0";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_ConkType_BeforeSaveCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
@@ -185,7 +186,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
@@ -235,7 +236,7 @@
                    oCN.BeginTran();
                    //保存前控制=========================================      
                    string sql1 = "exec h_p_Gy_ConkType_BeforeSaveCtrl " + HMakeEmp + ",'" + 2 + "'";
                    string sql1 = "exec h_p_Gy_ConkType_BeforeSaveCtrl '" + HNumber + "','" + HName + "'," + HUSEORGID + ",3," + HItemID;
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_ConkType_BeforeSaveCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
@@ -251,7 +252,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
@@ -306,11 +307,48 @@
     
                    oCN.Commit();
                }
                objJsonResult.code = "0";
                //自动审核功能
                if (HItemID == 0)
                {
                    ds = oCN.RunProcReturn("select HItemID,HNumber,HName from Gy_ConkType with(nolock) where HNumber='" + HNumber + "' and HUSEORGID = " + HUSEORGID, "Gy_ConkType");
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "保存成功!自动审核失败找不到对应单据";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else if (ds.Tables[0].Rows.Count > 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "相同使用组织下,出现" + ds.Tables[0].Rows.Count + "个相同的代码:" + ds.Tables[0].Rows[0]["HNumber"];
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        string sAutoCheck = oClsXt_SystemParameter.GetSingleSystemParameter("Gy_ConkType_AutoCheck", ref DBUtility.ClsPub.sExeReturnInfo);
                        objJsonResult.Verify = "N";
                        if (sAutoCheck == "Y")
                        {
                            objJsonResult.code = "1";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "保存成功";
                            objJsonResult.data = ds.Tables[0].Rows[0]["HItemID"].ToString();
                            objJsonResult.Verify = "Y";
                            return objJsonResult;
                        }
                    }
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "保存成功!";
                //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                objJsonResult.data = 1;
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
@@ -336,7 +374,7 @@
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_Gy_ConkTypeList where HitemID=" + HInterID, "h_v_Gy_ConkTypeList");
                ds = oCN.RunProcReturn("select * from h_v_Gy_ConkType_Edit where HitemID=" + HInterID, "h_v_Gy_ConkType_Edit");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
@@ -364,7 +402,7 @@
            }
        }
        [Route("DeltetGy_ConkType")]
        [HttpGet]
        public object DeltetGy_ConkType(string HItemID, string user)
@@ -420,6 +458,17 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "" || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据当前处于不能删除状态!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                //删除前控制=========================================      
                string sql1 = "exec h_p_Gy_ConkType_BeforeDelCtrl " + HItemID + ",'" + user + "'";
                ds = oCN.RunProcReturn(sql1, "h_p_Gy_ConkType_BeforeDelCtrl");
WebAPI/Controllers/Open_PrintTemController.cs
@@ -30,7 +30,7 @@
        {
            sWhere = " Where 1=1 ";
            //sWhere = " Where HStopFlag=0  and HEndFlag=1  and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
            if (HNumber != "")
            if (HNumber != "" && HNumber != null && HNumber != "undefined")
            {
                sWhere = sWhere + " and ( HNumber = '" + HNumber + "') ";
            }
WebAPI/Controllers/SBGL/Gy_EquipTypeController.cs
@@ -12,6 +12,8 @@
using WebAPI.Controllers.SCGL.日计划管理;
using System.IO;
using SyntacticSugar.constant;
using Newtonsoft.Json;
namespace WebAPI.Controllers.SBGL
{
    public class Gy_EquipTypeController : ApiController
@@ -32,6 +34,7 @@
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //if (!DBUtility.ClsPub.Security_Log("Gy_EquipTypeList", 1, false, user))
                //{
                //    objJsonResult.code = "0";
@@ -40,13 +43,22 @@
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                ds = oCN.RunProcReturn("select HItemID,HParentID,HNumber,HName,HLevel, case when HEndFlag<>0 then 'Y'else ' 'end HEndFlag,case when HStopFlag <> 0 then 'Y'else ' 'end HStopFlag, HRemark, HUseFlag,HMakeEmp,HMakeTime,HCheckEmp,HCheckTime,HModifyEmp,HModifyTime,HCloseEmp,HCloseTime from Gy_EquipFileType where 1=1 " + sWhere+ " order by HItemID ", "Gy_EquipFileType");
                ds = oCN.RunProcReturn("select * from h_v_Gy_EquipFileTypeList where 1=1 " + sWhere+ " order by HItemID ", "h_v_Gy_EquipFileTypeList");
                //添加列名
                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 ex)
@@ -134,7 +146,8 @@
                string msg1 = _value.ToString();
                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                string msg2 = sArray[0].ToString();
                string msg4 = sArray[1].ToString();
                string msg4 = sArray[2].ToString();
                string HUseOrgID = sArray[3].ToString();
                if (!DBUtility.ClsPub.Security_Log("Gy_EquipType_Edit", 1, false, msg4))
                {
@@ -159,6 +172,8 @@
                bool HStopflag = list[0].HStopflag;
                string HUseFlag = list[0].HUseFlag;
                bool HEndFlag = list[0].HEndFlag;
                long HUSEORGID = list[0].HUSEORGID;
                long HCREATEORGID = list[0].HCREATEORGID;
                if (!DBUtility.ClsPub.AllowNumber(HNumber))
@@ -170,19 +185,38 @@
                    return objJsonResult;
                }
                //保存前控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipType_BeforeSaveCtrl  '" + HNumber.ToString() + "','" + HName + "'," + HUSEORGID + ",1,0", " h_p_Gy_EquipType_BeforeSaveCtrl ");
                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;
                }
                //=========================================================
                //若MAINDI重复则重新获取
                oCN.BeginTran();
                //主表
                oCN.RunProc("Insert into Gy_EquipFileType " +
                   " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                   ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HMakeEmp) " +
                   ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HMakeEmp,HUSEORGID,HCREATEORGID) " +
                   " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID +
                   "," + HLevel + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "',getdate(),'" + msg4 + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                   "," + HLevel + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "',getdate(),'" + msg4 + "'," + HUSEORGID + "," + HCREATEORGID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCN.RunProc("Update Gy_EquipFileType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "新增成功!";
@@ -242,6 +276,7 @@
                string HRemark = list[0].HRemark;
                bool HStopflag = list[0].HStopflag;
                string HUseFlag = list[0].HUseFlag;
                long HUSEORGID = list[0].HUSEORGID;
                if (!DBUtility.ClsPub.AllowNumber(HNumber))
                {
@@ -262,6 +297,25 @@
                    return objJsonResult;
                }
                //保存前控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipType_BeforeSaveCtrl  '" + HNumber.ToString() + "','" + HName + "'," + HUSEORGID + ",3," + HItemID, " h_p_Gy_EquipType_BeforeSaveCtrl ");
                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;
                }
                //=========================================================
                //若MAINDI重复则重新获取
                oCN.BeginTran();
@@ -275,6 +329,7 @@
                    ",HModifyTime=getdate()" +
                    ",HModifyEmp='" + msg4 + "'" +
                    ",HStopflag='" + HStopflag + "'" +
                     ",HUSEORGID=" + HUSEORGID +
                    ",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);
@@ -307,7 +362,7 @@
        {
            try
            {
                ds = oCN.RunProcReturn("select * from Gy_EquipFileType where HItemID=" + HInterID, "Gy_EquipFileType");
                ds = oCN.RunProcReturn("select * from h_v_Gy_EquipFileTypeEdit with(nolock) where HItemID=" + HInterID, "h_v_Gy_EquipFileTypeEdit");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -352,6 +407,26 @@
                    return objJsonResult;
                }
                //审核前控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipType_BeforeAuditCtrl  " + HInterID + ",'" + Type + "'", " h_p_Gy_EquipType_BeforeAuditCtrl ");
                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;
                }
                //=========================================================
                ClsPub.CurUserName = user;
                oCN.BeginTran();//开始事务
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_EquipStatusController.cs
@@ -1,5 +1,7 @@
using Newtonsoft.Json;
using DBUtility;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections.Generic;
using System.Data;
@@ -16,6 +18,7 @@
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        public DAL.ClsGy_EquipStatus_Ctl BillOld = new DAL.ClsGy_EquipStatus_Ctl();
        #region  è®¾å¤‡çŠ¶æ€ åˆ—表
        [Route("Gy_EquipStatus/Gy_EquipStatusList")]
@@ -57,6 +60,46 @@
        }
        #endregion
        #region  è®¾å¤‡çŠ¶æ€ ç¼–辑列表
        [Route("Gy_EquipStatus/Gy_EquipStatusEdit")]
        [HttpGet]
        public object Gy_EquipStatusEdit(string sWhere, string user, string Organization)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                string sql1 = string.Format(@"select * from h_v_Gy_EquipStatus_Edit where ä½¿ç”¨ç»„织='" + Organization + "'");
                string sql = sql1 + sWhere;
                ds = oCN.RunProcReturn(sql, "h_v_Gy_EquipStatus_Edit");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.list = columnNameList;
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region  è®¾å¤‡çŠ¶æ€ ç¼–辑
        [Route("Gy_EquipStatus/Gy_EquipStatusEdit")]
        [HttpPost]
@@ -68,9 +111,11 @@
            string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg1 = sArray[0].ToString();
            string msg2 = sArray[1].ToString();
            string OperationType = sArray[2].ToString();
            //string msg_HUSEORGID = sArray[2].ToString();
            Int64 HItemID = 0;
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            ClsXt_SystemParameter oClsXt_SystemParameter = new ClsXt_SystemParameter();
            ListModels oListModels = new ListModels();
@@ -88,7 +133,7 @@
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码不能为空!";
                        objJsonResult.data = 1;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oItem.HName.Trim() == "")
@@ -96,12 +141,12 @@
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!名称不能为空!";
                        objJsonResult.data = 1;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //查询数据中是否存在重复代码
                    ds = oCN.RunProcReturn("select * from  Gy_EquipStatus where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_EquipStatus");
                    ds = oCN.RunProcReturn("select * from  Gy_EquipStatus with(nolock) where HNumber='" + oItem.HNumber.Trim() + "'", "Gy_EquipStatus");
                    if (oItem.HItemID == 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
@@ -200,7 +245,7 @@
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!短代码为空!";
                        objJsonResult.data = 1;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //oItem.HUSEORGID = Convert.ToInt32(msg_HUSEORGID); //组织id
@@ -212,21 +257,57 @@
                //保存
                //保存完毕后处理
                bool bResult;
                if (oBill.oModel.HItemID == 0)
                if (Convert.ToInt32(OperationType) == 1 || Convert.ToInt32(OperationType) == 2)
                {
                    bResult = oBill.AddNew();
                    bResult = oBill.AddNew(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyByID(oBill.oModel.HItemID);
                    bResult = oBill.ModifyByID(oBill.oModel.HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                if (bResult)
                {
                    //自动审核功能
                    if (oBill.oModel.HItemID == 0)
                    {
                        ds = oCN.RunProcReturn("select HItemID,HNumber,HName from Gy_EquipStatus with(nolock) where HNumber='" + oBill.oModel.HNumber.Trim() + "' and HUSEORGID = " + oBill.oModel.HUSEORGID, "Gy_EquipStatus");
                        if (ds.Tables[0].Rows.Count == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "保存成功!自动审核失败找不到对应单据";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else if (ds.Tables[0].Rows.Count > 1)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "相同使用组织下,出现" + ds.Tables[0].Rows.Count + "个相同的代码:" + ds.Tables[0].Rows[0]["HNumber"];
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            string sAutoCheck = oClsXt_SystemParameter.GetSingleSystemParameter("Gy_EquipStatus_AutoCheck", ref DBUtility.ClsPub.sExeReturnInfo);
                            objJsonResult.Verify = "N";
                            if (sAutoCheck == "Y")
                            {
                                objJsonResult.code = "1";
                                objJsonResult.count = 1;
                                objJsonResult.Message = "保存成功";
                                objJsonResult.data = ds.Tables[0].Rows[0]["HItemID"].ToString();
                                objJsonResult.Verify = "Y";
                                return objJsonResult;
                            }
                        }
                    }
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                    objJsonResult.data = 1;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
@@ -234,7 +315,7 @@
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = 1;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
@@ -243,7 +324,7 @@
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
@@ -267,8 +348,8 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();//开始事务
                ds = oCN.RunProcReturn("select * from Gy_EquipStatus where HItemID=" + HItemID, "Gy_EquipStatus");
                ds = oCN.RunProcReturn("select * from Gy_EquipStatus with(nolock) where HItemID=" + HItemID, "Gy_EquipStatus");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
@@ -277,10 +358,21 @@
                    objJsonResult.data = null;
                    return objJsonResult; ;
                }
                else
                {
                    if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "" || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据当前处于不能删除状态!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]);
                if (HStopflag)
                {
                    oCN.RollBack();//回滚事务
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "数据已禁用无法删除!";
@@ -289,7 +381,7 @@
                }
                oCN.RunProc("delete from Gy_EquipStatus where HItemID=" + HItemID);
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "* æ•°æ®åˆ é™¤æˆåŠŸï¼";
@@ -307,5 +399,168 @@
            }
        }
        #endregion
        #region è®¾å¤‡çŠ¶æ€å®¡æ ¸/反审核功能
        [Route("Gy_EquipStatus/CheckGy_EquipStatus")]
        [HttpGet]
        public object CheckGy_EquipStatus(string HInterID, int Type, string user)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //审核前控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_EquipStatus_BeforeAuditCtrl  " + HInterID + ",'" + Type + "'", " h_p_Gy_EquipStatus_BeforeAuditCtrl ");
                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;
                }
                //=========================================================
                DBUtility.ClsPub.CurUserName = user;
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                {
                    if (!BillOld.AuditByID2(int.Parse(HInterID), ref DBUtility.ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    if (BillOld.DeAuditByID2(int.Parse(HInterID), ref DBUtility.ClsPub.sExeReturnInfo))
                    {
                        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                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_EquipStatus/StopGy_EquipStatus")]
        [HttpGet]
        public object StopGy_EquipStatus(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                var ds = oCN.RunProcReturn("select * from Gy_EquipStatus with(nolock) where HItemID=" + HInterID, "Gy_EquipStatus");
                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)  //禁用判断
                {
                    oCN.RunProc("update Gy_EquipStatus set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    oCN.RunProc("update Gy_EquipStatus set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    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_MateNumRelationController.cs
@@ -282,8 +282,8 @@
                foreach (Models.Gy_MateNumRelation_Sec oItem in lsmain)
                {
                    //重新写入关联数据
                    oCN.RunProc("insert into Gy_MateNumRelation_Sec (HCusID,HMaterID,HCusRelationNumber,HCusRelationName,HMaker,HMakeDate) " +
                        "values ('" + msg3 + "','" + oItem.HMaterID + "','" + oItem.HCusRelationNumber + "','" + oItem.HCusRelationName + "','" + msg4 + "',getdate() " +
                    oCN.RunProc("insert into Gy_MateNumRelation_Sec (HCusID,HMaterID,HCusRelationNumber,HCusRelationName,HMaker,HMakeDate,HCusRelationModel,HTemplateID) " +
                        "values ('" + msg3 + "','" + oItem.HMaterID + "','" + oItem.HCusRelationNumber + "','" + oItem.HCusRelationName + "','" + msg4 + "',getdate(),' " + oItem.HCusRelationModel + "'," + oItem.HTemplateID +
                        ")");
                }
                oCN.Commit();
WebAPI/Controllers/Éú²ú¹ÜÀí/¿Í»§±êÇ©/Sc_CustomerTagController.cs
New file
@@ -0,0 +1,676 @@
using DBUtility;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using WebAPI.Controllers.SCGL.日计划管理;
using WebAPI.Models;
namespace WebAPI.Controllers.生产管理.客户标签
{
    public class Sc_CustomerTagController : ApiController
    {
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        public DAL.ClsSc_CustomerTagInfo BillOld = new DAL.ClsSc_CustomerTagInfo();
        #region å®¢æˆ·æ ‡ç­¾ä¿¡æ¯ æŸ¥è¯¢-分页
        [Route("Sc_CustomerTagInfo/PageList")]
        [HttpGet]
        public object PageList(string sWhere, string user, string Organization, int page, int size)
        {
            try
            {
                List<object> columnNameList = new List<object>();  //定义声明变量 ï¼ŒæŠŠé€šè¿‡ new List<object>()创建的 å®žä¾‹ï¼Œèµ‹å€¼ç»™å˜é‡
                //判断是否有查询权限
                if (!DBUtility.ClsPub.Security_Log("Sc_CustomerTagInfo_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限查询!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_Sc_CustomerTagInfoList " + page + "," + size + ",'" + Organization + "'," + "''", "h_p_Sc_CustomerTagInfoList");
                }
                else
                {
                    sWhere = sWhere.Replace("'", "''");
                    ds = oCN.RunProcReturn("exec h_p_Sc_CustomerTagInfoList " + page + "," + size + ",'" + Organization + "','" + sWhere + "'", "h_p_Sc_CustomerTagInfoList");
                }
                //添加列名
                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 = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                objJsonResult.Message = "Sucess!";
                objJsonResult.list = columnNameList;
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å®¢æˆ·æ ‡ç­¾ä¿¡æ¯ ç¼–辑获取信息
        [Route("Sc_CustomerTagInfo/EditCX")]
        [HttpGet]
        public object EditCX(long HInterID)
        {
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_Sc_CustomerTagInfoEdit where hmainid=" + HInterID, "h_v_Sc_CustomerTagInfoEdit");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "false!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å®¢æˆ·æ ‡ç­¾ä¿¡æ¯ ä¿å­˜
        [Route("Sc_CustomerTagInfo/SaveCustomerTagInfo")]
        [HttpPost]
        public object SaveCustomerTagInfo([FromBody] JObject msg)
        {
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString();
            string user = sArray[2].ToString();
            string OperationType = sArray[3].ToString();
            ListModels oListModels = new ListModels();
            try
            {
                //判断权限
                if (!DBUtility.ClsPub.Security_Log("Sc_CustomerTagInfo_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无保存权限";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DAL.ClsSc_CustomerTagInfo oBill = new DAL.ClsSc_CustomerTagInfo();
                List<Model.ClsSc_CustomerTagInfoMain> lsmain = new List<Model.ClsSc_CustomerTagInfoMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");  //\n
                lsmain = oListModels.getCustomerTagInfoMainByJson(msg2);
                foreach (Model.ClsSc_CustomerTagInfoMain oItem in lsmain)
                {
                    oItem.HMaker = user;
                    oItem.HUpDater = user;
                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!没有单据日期,无法保存!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    oBill.omodel = oItem;
                }
                //表体数据
                //按 },{来拆分数组 //去掉【和】
                msg3 = msg3.Substring(1, msg3.Length - 2);
                msg3 = msg3.Replace("\\", "");
                msg3 = msg3.Replace("\n", "");  //\n
                List<Model.ClsSc_CustomerTagInfoSub> ls = new List<Model.ClsSc_CustomerTagInfoSub>();
                ls = oListModels.getCustomerTagInfoSubByJson(msg3);
                int i = 0;
                foreach (Model.ClsSc_CustomerTagInfoSub oItemSub in ls)
                {
                    i++;
                    oItemSub.HEntryID = i;
                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    oItemSub.HCloseType = false;
                    oItemSub.HCloseMan = "";
                    oBill.DetailColl.Add(oItemSub);
                }
                //进行 ä¼šè®¡æœŸé—´ ç»“è´¦ çš„判断和控制
                string s = "";
                int sYear = 0;
                int sPeriod = 0;
                DateTime HDate = DateTime.Now;
                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
                {
                    objJsonResult.Message = s;
                    return objJsonResult;
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (Convert.ToInt32(OperationType) == 1)                                //新增保存
                {
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else if (Convert.ToInt32(OperationType) == 4)                          //下推保存
                {
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else                                                                    //编辑保存
                {
                    if (BillOld.ShowBill(lsmain[0].HInterID, ref s) == false)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "此单据有误!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //判断是否可编辑
                    if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "此单据已经被审核,不允许修改!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (BillOld.omodel.HBillStatus > 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = s + ",不允许修改";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #endregion
        #region å®¢æˆ·æ ‡ç­¾ä¿¡æ¯ æ–‡ä»¶ä¸Šä¼ 
        [Route("Sc_CustomerTagInfo/Sc_CustomerTagInfo_Excel")]
        [HttpPost]
        public object Sc_CustomerTagInfo_Excel()
        {
            try
            {
                //获取文件名称
                var file = HttpContext.Current.Request.Files[0];
                //获取文件物理路径
                string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName);
                //保存文件
                file.SaveAs(ExcelPath);
                NpoiHelper np = new NpoiHelper();
                DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0");
                //删除文件
                File.Delete(ExcelPath);
                //创建临时表
                DataTable tb2 = new DataTable("dt2");
                //添加列名
                for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++)
                {
                    tb2.Columns.Add(ExcelDs.Tables[0].Rows[0][i].ToString());
                }
                //模板缺少列 ä½†éœ€è¦ä»Žæ•°æ®åº“中查询出来显示在页面的字段
                tb2.Columns.Add("HMaterID", typeof(Int32));//物料ID
                tb2.Columns.Add("HCustID", typeof(Int32));//客户ID
                //添加数据
                for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
                {
                    DataRow row = tb2.NewRow();
                    for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++)
                    {
                        row[j] = ExcelDs.Tables[0].Rows[i][j].ToString();
                    }
                    //如果表格第i行的第一列为空,则判断为这一行的数据为空,跳出循环并且不把数据写入 tb2
                    if (ExcelDs.Tables[0].Rows[i][0].ToString() == "")
                    {
                        continue;
                    }
                    else
                    {
                        tb2.Rows.Add(row);
                    }
                }
                var error = "";
                //查询工序工价没有的列
                if (!tb2.Columns.Contains("物料代码"))
                    error += "没有找到【物料代码】的标题,";
                if (!tb2.Columns.Contains("物料名称"))
                    error += "没有找到【物料名称】的标题,";
                if (!tb2.Columns.Contains("客户代码"))
                    error += "没有找到【客户代码】的标题,";
                if (!tb2.Columns.Contains("客户名称"))
                    error += "没有找到【客户名称】的标题,";
                if (!tb2.Columns.Contains("EPE%"))
                    error += "没有找到【EPE%】的标题,";
                if (!tb2.Columns.Contains("PU%"))
                    error += "没有找到【PU%】的标题,";
                if (!tb2.Columns.Contains("SKU"))
                    error += "没有找到【SKU】的标题,";
                if (!tb2.Columns.Contains("SIZE1"))
                    error += "没有找到【SIZE1】的标题,";
                if (!tb2.Columns.Contains("SIZE2"))
                    error += "没有找到【SIZE2】的标题,";
                if (!tb2.Columns.Contains("LBS"))
                    error += "没有找到【LBS】的标题,";
                if (!tb2.Columns.Contains("OZ"))
                    error += "没有找到【OZ】的标题,";
                if (!tb2.Columns.Contains("UPC A"))
                    error += "没有找到【UPC A】的标题,";
                if (!tb2.Columns.Contains("SKU2"))
                    error += "没有找到【SKU2】的标题,";
                if (!tb2.Columns.Contains("FABRIC"))
                    error += "没有找到【FABRIC】的标题,";
                if (!tb2.Columns.Contains("SN号"))
                    error += "没有找到【SN号】的标题,";
                if (!tb2.Columns.Contains("尺寸"))
                    error += "没有找到【尺寸】的标题,";
                if (!tb2.Columns.Contains("客户指定代码"))
                    error += "没有找到【客户指定代码】的标题,";
                if (!tb2.Columns.Contains("客户指定名称"))
                    error += "没有找到【客户指定名称】的标题,";
                if (!tb2.Columns.Contains("客户指定规格"))
                    error += "没有找到【客户指定规格】的标题,";
                if (error.Length > 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = $"Excel模板存在错误,{error}\r\n";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                for (int i = 0; i <= tb2.Rows.Count - 1; i++)
                {
                    string HMaterNumber = "";
                    string HMaterName = "";
                    string HCustNumber = "";
                    string HCustName = "";
                    string HEPE = "";
                    string HPU = "";
                    string HSKU = "";
                    string HSIZE1 = "";
                    string HSIZE2 = "";
                    string HLBS = "";
                    string HOZ = "";
                    string HUPC = "";
                    string HSKU2 = "";
                    string HFABRIC = "";
                    string HSN = "";
                    string HSize = "";
                    string HCustMaterNumber = "";
                    string HCustMaterName = "";
                    string HCustMaterModel = "";
                    HMaterNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["物料代码"].ToString());
                    HMaterName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["物料名称"].ToString());
                    HCustNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["客户代码"].ToString());
                    HCustName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["客户名称"].ToString());
                    HEPE = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["EPE%"].ToString());
                    HPU = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["PU%"].ToString());
                    HSKU = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["SKU"].ToString());
                    HSIZE1 = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["SIZE1"].ToString());
                    HSIZE2 = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["SIZE2"].ToString());
                    HLBS = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["LBS"].ToString());
                    HOZ = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["OZ"].ToString());
                    HUPC = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["UPC A"].ToString());
                    HSKU2 = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["SKU2"].ToString());
                    HFABRIC = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["FABRIC"].ToString());
                    HSN = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["SN号"].ToString());
                    HSize = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["尺寸"].ToString());
                    HCustMaterNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["客户指定代码"].ToString());
                    HCustMaterName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["客户指定名称"].ToString());
                    HCustMaterModel = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["客户指定规格"].ToString());
                    //检查表格数据
                    int index = i + 1;
                    if (HMaterNumber != "" && HMaterName != "")
                    {
                        //查询物料
                        ds = oCN.RunProcReturn("select HItemID,HNumber,HName,HModel from Gy_Material with(nolock) where  HNumber='" + HMaterNumber + "' and HName='" + HMaterName + "'", "Gy_Material");
                        if (ds.Tables[0].Rows.Count == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "第" + index + "行,物料不存在!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            tb2.Rows[i]["HMaterID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
                        }
                        //查询客户
                        ds = oCN.RunProcReturn("select HItemID,HNumber,HName from Gy_Customer with(nolock) where  HNumber='" + HCustNumber + "'", "Gy_Process");
                        if (ds.Tables[0].Rows.Count == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "第" + index + "行,客户不存在!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            tb2.Rows[i]["HCustID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
                        }
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "第" + index + "行,物料信息不全(物料代码,物料名称)";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = error;
                objJsonResult.data = tb2;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å®¢æˆ·æ ‡ç­¾ä¿¡æ¯ å¯¼å…¥(保存)
        [Route("Sc_CustomerTagInfo/Sc_CustomerTagInfo_btnSave")]
        [HttpPost]
        public object Sc_CustomerTagInfo_btnSave([FromBody] JObject sMainSub)
        {
            var _value = sMainSub["sMainSub"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { "&和" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string user = sArray[1].ToString();
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Sc_CustomerTagInfo_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无保存权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                List<object> Excel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<object>>(msg2);
                List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
                foreach (JObject item in Excel)
                {
                    Dictionary<string, string> dic = new Dictionary<string, string>();
                    foreach (var itm in item.Properties())
                    {
                        dic.Add(itm.Name, itm.Value.ToString());
                    }
                    list.Add(dic);
                }
                oCN.BeginTran();
                long HInterID =  DBUtility.ClsPub.CreateBillID("10003", ref DBUtility.ClsPub.sExeReturnInfo);
                string HBillNo = DBUtility.ClsPub.CreateBillCode("10003", ref DBUtility.ClsPub.sExeReturnInfo,true);
                string mainSql = "Insert Into Sc_CustomerTagInfoMain" +
                   "(HInterID,HBillNo,HDate,HYear,HPeriod,HRemark,HMaker,HMakeDate,HBillStatus" +
                   ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
                   ") " +
                   "values(" +
                   "" + HInterID +
                   ",'" + HBillNo + "'" +
                   ",getdate()" +
                   ",Year(getdate())" +
                   ",Month(getdate())" +
                   "," + "''" +
                   ",'" + "Excel" + "'" +
                   "," + "getdate()" + "" +
                   "," + "1" + "" +
                   "," + 0 + "" +
                   "," + 0 + "" +
                   ",'" + "''" + "'" +
                   ",'" + "''" + "'" +
                   ") ";
                oCN.RunProc(mainSql);
                int i = 1;
                foreach (Dictionary<string, string> item in list)
                {
                    string HMaterNumber = item["物料代码"];
                    string HMaterName = item["物料名称"];
                    string HCustNumber = item["客户代码"];
                    string HCustName = item["客户名称"];
                    string HEPE = item["EPE%"];
                    string HPU = item["PU%"];
                    string HSKU = item["SKU"];
                    string HSIZE1 = item["SIZE1"];
                    string HSIZE2 = item["SIZE2"];
                    string HLBS = item["LBS"];
                    string HOZ = item["OZ"];
                    string HUPC = item["UPC A"];
                    string HSKU2 = item["SKU2"];
                    string HFABRIC = item["FABRIC"];
                    string HSN = item["SN号"];
                    string HSize = item["尺寸"];
                    string HCustMaterNumber = item["客户指定代码"];
                    string HCustMaterName = item["客户指定名称"];
                    string HCustMaterModel = item["客户指定规格"];
                    Int32 HMaterID = Convert.ToInt32(item["HMaterID"]);
                    Int32 HCustID = Convert.ToInt32(item["HCustID"]);
                    ds = oCN.RunProcReturn("select HMaterID,HCustID from Sc_CustomerTagInfoSub with(nolock) where HMaterID=" + HMaterID + " and HCustID = " + HCustID, "Sc_CustomerTagInfoSub");
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        string sql = "insert into Sc_CustomerTagInfoSub(HInterID,HEntryID,HRemark,HBillNo_bak,HMaterID,HCustID,HEPE,HPU,HSKU,HSIZE1,HSIZE2,HLBS,HOZ,HUPC,HSKU2" +
                            ",HFABRIC,HSN,HSize,HCustMaterNumber,HCustMaterName,HCustMaterModel,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType)" +
                            $"values('{HInterID}', '{i}','{""}', '{HBillNo}', '{HMaterID}', '{HCustID}', '{HEPE}','{HPU}','{HSKU}','{HSIZE1}','{HSIZE2}','{HLBS}','{HOZ}','{HUPC}','{HSKU2}','{HFABRIC}','{HSN}','{HSize}','{HCustMaterNumber}','{HCustMaterName}','{HCustMaterModel}',{0},{0},'{""}','{""}')";
                        oCN.RunProc(sql);
                        i++;
                    }
                    else
                    {
                        oCN.RunProc("update Sc_CustomerTagInfoSub set HEPE='" + HEPE + "',HPU='" + HPU + "',HSKU='" + HSKU + "',HSIZE1='" + HSIZE1 + "',HSIZE2='" + HSIZE2 + "',HLBS='" + HLBS + "',HOZ='" + HOZ + "',HUPC='" + HUPC + "',HSKU2='" + HSKU2 + "',HFABRIC='" + HFABRIC + "',HSN='" + HSN + "',HSize='" + HSize + "',HCustMaterNumber='" + HCustMaterNumber + "',HCustMaterName='" + HCustMaterName + "',HCustMaterModel='" + HCustMaterModel + "'  where HMaterID=" + HMaterID + " and HCustID=" + HCustID);
                    }
                    i++;
                }
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "导入成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                LogService.Write(e);
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å®¢æˆ·æ ‡ç­¾æ¡£æ¡ˆç”Ÿæˆ
        [Route("Sc_CustomerTagBarCode/Save")]
        [HttpGet]
        public object BarCodeSave(string HICMOInterID, string HICMOEntryID)
        {
            try
            {
                if (HICMOInterID == null || HICMOInterID.Equals("") || HICMOEntryID == null || HICMOEntryID.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "订单信息不全!HICMOInterID:" + HICMOInterID + ",HICMOEntryID:" + HICMOEntryID;
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_Sc_CustomerTagBarCode_AutoSave " + HICMOInterID + "," + HICMOEntryID, "h_p_Sc_CustomerTagBarCode_AutoSave");
                }
                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;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/ListModels.cs
@@ -227,6 +227,30 @@
        }
        /// <summary>
        /// å®¢æˆ·æ ‡ç­¾ååºåˆ—化
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsSc_CustomerTagInfoMain> getCustomerTagInfoMainByJson(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsSc_CustomerTagInfoMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_CustomerTagInfoMain>>(jsonString);
            return list;
        }
        /// <summary>
        /// å®¢æˆ·æ ‡ç­¾ååºåˆ—化子表
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsSc_CustomerTagInfoSub> getCustomerTagInfoSubByJson(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsSc_CustomerTagInfoSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_CustomerTagInfoSub>>(jsonString);
            return list;
        }
        /// <summary>
        /// é€€è´§é€šçŸ¥å•反序列化
        /// </summary>
        /// <param name="jsonString"></param>
WebAPI/Models/Gy_MateNumRelation_Sec.cs
@@ -24,6 +24,8 @@
        public bool HUsed { get; set; }     //使用标记
        public string HCusRelationModel { get; set; }         //客户物料规格
        public long HTemplateID { get; set; }  //打印模板ID
    }
}
WebAPI/WebAPI.csproj
@@ -726,6 +726,7 @@
    <Compile Include="Controllers\数据同步\钉钉同步\DD_DataSynchronizationController.cs" />
    <Compile Include="Controllers\条码管理\MouldController.cs" />
    <Compile Include="Controllers\条码管理\WEBSController.cs" />
    <Compile Include="Controllers\生产管理\客户标签\Sc_CustomerTagController.cs" />
    <Compile Include="Controllers\生产管理\报工台工序\Sc_MaterToSourceStepBillController.cs" />
    <Compile Include="Controllers\生产管理\报工台工序\Sc_MESBeginStepWorkBillController.cs" />
    <Compile Include="Controllers\生产管理\报工台工序\Sc_MESEndStepWorkBillController.cs" />