From e5125bd15c9951cdefa1846264ac726108fc0534 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期五, 30 五月 2025 19:14:24 +0800
Subject: [PATCH] 客户标签;测试记录优化

---
 DAL/生产管理/客户标签/ClsSc_CustomerTagInfo.cs                       |  370 +++++++++++++
 WebAPI/Controllers/SBGL/Gy_EquipTypeController.cs            |   89 ++
 Model/基础资料/基础资料/ClsGy_EquipStatus_Model.cs                   |   11 
 WebAPI/Controllers/基础资料/基础资料/Gy_EquipStatusController.cs     |  285 +++++++++
 WebAPI/Controllers/Open_PrintTemController.cs                |    2 
 WebAPI/Controllers/BaseSet/Gy_ConkTypeController.cs          |   65 ++
 Model/Model.csproj                                           |    2 
 WarM/条码打印/Gy_BarCodeBill_Rework.cs                           |   11 
 DAL/基础资料/公用基础资料/ClsGy_EquipStatus_Ctl.cs                     |   34 +
 Model/生产管理/客户标签/ClsSc_CustomerTagInfoMain.cs                 |   11 
 WebAPI/ListModels.cs                                         |   24 
 WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs         |    2 
 WebAPI/Controllers/生产管理/客户标签/Sc_CustomerTagController.cs     |  676 ++++++++++++++++++++++++
 DAL/DAL.csproj                                               |    1 
 DBUtility/基础资料/ClsGy_Base_Ctl.cs                             |   12 
 WebAPI/Controllers/基础资料/基础资料/Gy_MateNumRelationController.cs |    4 
 Model/生产管理/客户标签/ClsSc_CustomerTagInfoSub.cs                  |   27 
 WebAPI/Models/Gy_MateNumRelation_Sec.cs                      |    2 
 WebAPI/WebAPI.csproj                                         |    1 
 19 files changed, 1,576 insertions(+), 53 deletions(-)

diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj
index 510bc72..e1da68a 100644
--- a/DAL/DAL.csproj
+++ b/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="鐢熶骇绠$悊\鎺掍骇瑙i攣鐢宠鍗昞ClsJIT_UnLockRequestBill.cs" />
     <Compile Include="鐢熶骇绠$悊\鎺掍骇閿佸畾鐢宠鍗昞ClsJIT_LockRequestBill.cs" />
     <Compile Include="绯荤粺鍏敤\ClsXt_DefineBillMainSet.cs" />
diff --git "a/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_EquipStatus_Ctl.cs" "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_EquipStatus_Ctl.cs"
index 845618e..172bcbd 100644
--- "a/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_EquipStatus_Ctl.cs"
+++ "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_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 + "'" +
diff --git "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\345\256\242\346\210\267\346\240\207\347\255\276/ClsSc_CustomerTagInfo.cs" "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\345\256\242\346\210\267\346\240\207\347\255\276/ClsSc_CustomerTagInfo.cs"
new file mode 100644
index 0000000..7b717bd
--- /dev/null
+++ "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\345\256\242\346\210\267\346\240\207\347\255\276/ClsSc_CustomerTagInfo.cs"
@@ -0,0 +1,370 @@
+锘縰sing 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 鍥哄畾浠g爜
+
+        ~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);
+                //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+                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);
+            }
+        }
+    }
+}
diff --git "a/DBUtility/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_Base_Ctl.cs" "b/DBUtility/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_Base_Ctl.cs"
index 2f41816..41b1b7f 100644
--- "a/DBUtility/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_Base_Ctl.cs"
+++ "b/DBUtility/\345\237\272\347\241\200\350\265\204\346\226\231/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 鍥哄畾浠g爜
         //鏄惁瀛樺湪瀛愰」鐩�
         public bool HavChildCodes(Int64 sItemID)
diff --git a/Model/Model.csproj b/Model/Model.csproj
index 39d53b1..a60b15d 100644
--- a/Model/Model.csproj
+++ b/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="鐢熶骇绠$悊\鎺掍骇瑙i攣鐢宠鍗昞ClsJIT_UnLockRequestBillMain.cs" />
     <Compile Include="鐢熶骇绠$悊\鎺掍骇瑙i攣鐢宠鍗昞ClsJIT_UnLockRequestBillSub.cs" />
     <Compile Include="鐢熶骇绠$悊\鎺掍骇閿佸畾鐢宠鍗昞ClsJIT_LockRequestBillMain.cs" />
diff --git "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_EquipStatus_Model.cs" "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_EquipStatus_Model.cs"
index e9ef4fd..a5d186f 100644
--- "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_EquipStatus_Model.cs"
+++ "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_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; }
+
     }
 }
diff --git "a/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\345\256\242\346\210\267\346\240\207\347\255\276/ClsSc_CustomerTagInfoMain.cs" "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\345\256\242\346\210\267\346\240\207\347\255\276/ClsSc_CustomerTagInfoMain.cs"
new file mode 100644
index 0000000..2d8aef1
--- /dev/null
+++ "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\345\256\242\346\210\267\346\240\207\347\255\276/ClsSc_CustomerTagInfoMain.cs"
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsSc_CustomerTagInfoMain : DBUtility.ClsXt_BaseBillMain
+    {
+
+    }
+}
diff --git "a/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\345\256\242\346\210\267\346\240\207\347\255\276/ClsSc_CustomerTagInfoSub.cs" "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\345\256\242\346\210\267\346\240\207\347\255\276/ClsSc_CustomerTagInfoSub.cs"
new file mode 100644
index 0000000..7be545a
--- /dev/null
+++ "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\345\256\242\346\210\267\346\240\207\347\255\276/ClsSc_CustomerTagInfoSub.cs"
@@ -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 ;
+	}
+}
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill_Rework.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill_Rework.cs"
index 985e9f9..081fe4b 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill_Rework.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill_Rework.cs"
@@ -666,13 +666,10 @@
                             }
                             if (HBarCodeType == "鍞竴鏉$爜")
                             {
-                                //鏉$爜缂栧彿 = 鏉$爜鍓嶇紑 + 娴佹按鍙�
-                                TM = sTMNumber + LSH2;
-
-                                //鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃�
-                                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() : "";
+                                //鏉$爜缂栧彿 = 宸ュ巶浠g爜锛�1锛� + 骞� + 杞﹂棿浠g爜锛�060113锛� + 鏈� + 鍨嬪彿 + 鏃� + 娴佹按鍙�
+                                TM = 1 + sYear + 060113 + sPeriod + HModelLeft + sDay + LSH;
                             }
 
                             HEntryID = j + 1;
diff --git a/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs b/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
index c9a3aa8..86a0289 100644
--- a/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
+++ b/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)  //瀹℃牳鍒ゆ柇
diff --git a/WebAPI/Controllers/BaseSet/Gy_ConkTypeController.cs b/WebAPI/Controllers/BaseSet/Gy_ConkTypeController.cs
index 4b70e17..20a17db 100644
--- a/WebAPI/Controllers/BaseSet/Gy_ConkTypeController.cs
+++ b/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 + "涓浉鍚岀殑浠g爜锛�" + 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");
diff --git a/WebAPI/Controllers/Open_PrintTemController.cs b/WebAPI/Controllers/Open_PrintTemController.cs
index 11ac7be..ef8c5a4 100644
--- a/WebAPI/Controllers/Open_PrintTemController.cs
+++ b/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 + "') ";
             }
diff --git a/WebAPI/Controllers/SBGL/Gy_EquipTypeController.cs b/WebAPI/Controllers/SBGL/Gy_EquipTypeController.cs
index 898371b..b6db605 100644
--- a/WebAPI/Controllers/SBGL/Gy_EquipTypeController.cs
+++ b/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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
                 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;
+                }
+                //=========================================================
 
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
                 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);
                 //淇敼涓婄骇涓洪潪鏈骇浠g爜
                 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;
+                }
+                //=========================================================
 
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
                 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();//寮�濮嬩簨鍔�
 
diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_EquipStatusController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_EquipStatusController.cs"
index 45a9080..a048b9c 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_EquipStatusController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_EquipStatusController.cs"
@@ -1,5 +1,7 @@
-锘縰sing Newtonsoft.Json;
+锘縰sing 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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.list = columnNameList;
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region  璁惧鐘舵�� 缂栬緫
         [Route("Gy_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 = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
-                        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 + "涓浉鍚岀殑浠g爜锛�" + 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
+
     }
 }
\ No newline at end of file
diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MateNumRelationController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MateNumRelationController.cs"
index 9a2db52..b1932ff 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MateNumRelationController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_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();
diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\345\256\242\346\210\267\346\240\207\347\255\276/Sc_CustomerTagController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\345\256\242\346\210\267\346\240\207\347\255\276/Sc_CustomerTagController.cs"
new file mode 100644
index 0000000..28f39b5
--- /dev/null
+++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\345\256\242\346\210\267\346\240\207\347\255\276/Sc_CustomerTagController.cs"
@@ -0,0 +1,676 @@
+锘縰sing 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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                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();
+                    }
+                    //濡傛灉琛ㄦ牸绗琲琛岀殑绗竴鍒椾负绌猴紝鍒欏垽鏂负杩欎竴琛岀殑鏁版嵁涓虹┖锛岃烦鍑哄惊鐜苟涓斾笉鎶婃暟鎹啓鍏� tb2
+                    if (ExcelDs.Tables[0].Rows[i][0].ToString() == "")
+                    {
+                        continue;
+                    }
+                    else
+                    {
+                        tb2.Rows.Add(row);
+                    }
+                }
+
+                var error = "";
+
+                //鏌ヨ宸ュ簭宸ヤ环娌℃湁鐨勫垪
+                if (!tb2.Columns.Contains("鐗╂枡浠g爜"))
+                    error += "娌℃湁鎵惧埌銆愮墿鏂欎唬鐮併�戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("鐗╂枡鍚嶇О"))
+                    error += "娌℃湁鎵惧埌銆愮墿鏂欏悕绉般�戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("瀹㈡埛浠g爜"))
+                    error += "娌℃湁鎵惧埌銆愬鎴蜂唬鐮併�戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("瀹㈡埛鍚嶇О"))
+                    error += "娌℃湁鎵惧埌銆愬鎴峰悕绉般�戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("EPE%"))
+                    error += "娌℃湁鎵惧埌銆怑PE%銆戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("PU%"))
+                    error += "娌℃湁鎵惧埌銆怭U%銆戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("SKU"))
+                    error += "娌℃湁鎵惧埌銆怱KU銆戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("SIZE1"))
+                    error += "娌℃湁鎵惧埌銆怱IZE1銆戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("SIZE2"))
+                    error += "娌℃湁鎵惧埌銆怱IZE2銆戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("LBS"))
+                    error += "娌℃湁鎵惧埌銆怢BS銆戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("OZ"))
+                    error += "娌℃湁鎵惧埌銆怬Z銆戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("UPC A"))
+                    error += "娌℃湁鎵惧埌銆怳PC A銆戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("SKU2"))
+                    error += "娌℃湁鎵惧埌銆怱KU2銆戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("FABRIC"))
+                    error += "娌℃湁鎵惧埌銆怓ABRIC銆戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("SN鍙�"))
+                    error += "娌℃湁鎵惧埌銆怱N鍙枫�戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("灏哄"))
+                    error += "娌℃湁鎵惧埌銆愬昂瀵搞�戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("瀹㈡埛鎸囧畾浠g爜"))
+                    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]["鐗╂枡浠g爜"].ToString());
+                    HMaterName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鐗╂枡鍚嶇О"].ToString());
+                    HCustNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["瀹㈡埛浠g爜"].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]["瀹㈡埛鎸囧畾浠g爜"].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["鐗╂枡浠g爜"];
+                    string HMaterName = item["鐗╂枡鍚嶇О"];
+                    string HCustNumber = item["瀹㈡埛浠g爜"];
+                    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["瀹㈡埛鎸囧畾浠g爜"];
+                    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 瀹㈡埛鏍囩妗f鐢熸垚
+        [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 = "璁㈠崟淇℃伅涓嶅叏锛丠ICMOInterID锛�" + 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
+
+    }
+}
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index a30b31d..66a839a 100644
--- a/WebAPI/ListModels.cs
+++ b/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>
diff --git a/WebAPI/Models/Gy_MateNumRelation_Sec.cs b/WebAPI/Models/Gy_MateNumRelation_Sec.cs
index 2643e84..3a3ce30 100644
--- a/WebAPI/Models/Gy_MateNumRelation_Sec.cs
+++ b/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
 
     }
 }
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index e6daa8b..3ca5990 100644
--- a/WebAPI/WebAPI.csproj
+++ b/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" />

--
Gitblit v1.9.1