From f46017c7fc76869b18a7927afe4756c41e2763cf Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期三, 22 二月 2023 11:15:31 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Models/Gy_RoutingBillSub.cs                                   |    5 
 WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs                  |  142 +++++
 Pub_Class/CustomerCls/ClsXt_SystemParameter.cs                       |   13 
 WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs         |  402 ++++++++++++++++
 Model/车间管理/ClsSc_ProcessExchangeBillMain.cs                          |    1 
 Model/Model.csproj                                                   |    2 
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormImportController.cs |   47 +
 WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs          |  120 +++++
 WebAPI/Controllers/LMESController.cs                                 |   12 
 Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs                   |    2 
 DAL/车间管理/ClsSc_ProcExchWorkBackBill.cs                               |  136 +++++
 DAL/车间管理/ClsSc_ProcessExchangeBill.cs                                |    7 
 WebAPI/Controllers/生产管理/生产任务单/Sc_ICMOBillController.cs               |  263 ++++++++++
 DAL/基础资料/公用基础资料/ClsGy_Warehouse_View.cs                              |   21 
 Model/车间管理/ClsSc_ProcExchWorkBackBillMain.cs                         |   32 +
 WebAPI/ListModels.cs                                                 |   18 
 Model/车间管理/ClsSc_ProcExchWorkBackBillSub.cs                          |   37 +
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs   |   55 +
 WebAPI/Controllers/SCGL/日计划管理/Sc_WorkBillSortBillController.cs       |   80 ++
 DAL/DAL.csproj                                                       |    1 
 WebAPI/Controllers/Sc_ProcessMangementController.cs                  |   34 +
 WebAPI/WebAPI.csproj                                                 |    2 
 22 files changed, 1,355 insertions(+), 77 deletions(-)

diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj
index e1bbe84..a6f36bb 100644
--- a/DAL/DAL.csproj
+++ b/DAL/DAL.csproj
@@ -621,6 +621,7 @@
     <Compile Include="璐ㄦ绠$悊\ClsQC_POStockInCheckBill.cs" />
     <Compile Include="璐ㄦ绠$悊\ClsQC_ProcessCheckBill.cs" />
     <Compile Include="璐ㄦ绠$悊\ClsQC_ProdReportCheckBill.cs" />
+    <Compile Include="杞﹂棿绠$悊\ClsSc_ProcExchWorkBackBill.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsSc_CutMaterProcExchBill.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsSc_MaterBackBill.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsSc_MaterDownBill.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_Warehouse_View.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_Warehouse_View.cs"
index 4522e8d..b2c83f3 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_Warehouse_View.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_Warehouse_View.cs"
@@ -66,7 +66,26 @@
             {
                 throw (e);
             }
-        } 
+        }
+        //鏍规嵁浠g爜杩斿洖椤圭洰淇℃伅
+        public override bool GetInfoByName(string sNumber)
+        {
+            DataSet DS;
+            try
+            {
+                DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HName='" + sNumber + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo);
+                if (DS.Tables[0].Rows.Count == 0)
+                    return false;
+                else
+                {
+                    return GetInfo(DS);
+                }
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
         //杩斿洖椤圭洰淇℃伅
         public override bool GetInfo(DataSet Ds)
         {
diff --git "a/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcExchWorkBackBill.cs" "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcExchWorkBackBill.cs"
new file mode 100644
index 0000000..8eb5420
--- /dev/null
+++ "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcExchWorkBackBill.cs"
@@ -0,0 +1,136 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data;
+
+namespace DAL
+{
+    public  class ClsSc_ProcExchWorkBackBill : DBUtility.ClsXt_BaseBill
+    {
+        public Model.ClsSc_ProcExchWorkBackBillMain omodel = new Model.ClsSc_ProcExchWorkBackBillMain();
+        public List<Model.ClsSc_ProcExchWorkBackBillSub> DetailColl = new List<Model.ClsSc_ProcExchWorkBackBillSub>();
+
+        public ClsSc_ProcExchWorkBackBill()
+        {
+            base.MvarItemKeySub = "Sc_ProcExchWorkBackBillSub";
+            base.MvarItemKeySub2 = "";
+            base.MvarItemKeySub3 = "";
+            base.MvarItemKeySub4 = "";
+            base.MvarItemKey= "Sc_ProcExchWorkBackBillMain";
+            base.MvarReportTitle= "宸ュ簭杩斿伐鐢宠鍗�";
+            base.BillType = "3796";
+            base.HBillSubType = "3796";
+
+        }
+
+        #region 鍥哄畾浠g爜
+
+        ~ClsSc_ProcExchWorkBackBill()
+        {
+            DetailColl = null;
+        }
+       
+        #endregion   鑷畾涔夋柟娉�
+        //淇敼鍗曟嵁
+        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //
+                oCn.BeginTran();
+                //鏇存柊涓昏〃
+                oCn.RunProc("UpDate Sc_ProcExchWorkBackBillMain set  " +
+                " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
+                //",HDate='" + omodel.HDate + "'" +
+                //",HYear='" + omodel.HYear.ToString() + "'" +
+                //",HPeriod='" + omodel.HPeriod.ToString() + "'" +
+                ",HRemark='" + omodel.HRemark + "'" +
+                ",HUpDater='" + omodel.HMaker + "'" +
+                ",HUpDateDate=getdate()" +
+                //========================================
+                ",HInnerBillNo='" + omodel.HInnerBillNo.ToString() +"'"+
+                ",HEmpID=" + omodel.HEmpID.ToString() +
+                " where HInterID=" + lngBillKey.ToString());
+                //鍒犻櫎鍏宠仈
+                DeleteRelation(ref sReturn, lngBillKey);
+                //鍒犻櫎瀛愯〃
+                DeleteBillSub(lngBillKey);
+                //鎻掑叆瀛愯〃
+                omodel.HInterID = lngBillKey;
+                foreach (Model.ClsSc_ProcExchWorkBackBillSub oSub in DetailColl)
+                {
+                    oCn.RunProc("Insert into Sc_ProcExchWorkBackBillSub (HInterID, HEntryID, HCloseMan, HEntryCloseDate, HCloseType" +
+                        ", HRemark, HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType" +
+                        ", HRelationQty, HRelationMoney, HBillNo_bak, HProcNo, HProcID" +
+                        ", HWorkRemark, HCenterID, HDeptID, HSupID, HSupFlag" +
+                        ", HQty)values(" +
+                        $"{omodel.HInterID}, {oSub.HEntryID.ToString()}, '{oSub.HCloseMan.ToString()}', GETDATE(), {(oSub.HCloseType == true ? 1 : 0)}" +
+                        $",'{oSub.HRemark.ToString()}', {oSub.HSourceInterID.ToString()},{oSub.HSourceEntryID.ToString()}, '{oSub.HSourceBillNo.ToString()}', '{oSub.HSourceBillType.ToString()}'" +
+                        $",{oSub.HRelationQty.ToString()},{oSub.HRelationMoney.ToString()}, '{oSub.HBillNo_bak.ToString()}', '{oSub.HProcNo.ToString()}',{oSub.HProcID.ToString()}" +
+                        $", '{oSub.HWorkRemark.ToString()}', {oSub.HCenterID.ToString()},{oSub.HDeptID.ToString()},{oSub.HSupID.ToString()},{(oSub.HSupFlag == true ? 1 : 0)}" +
+                        $", {oSub.HQty.ToString()}) ");
+                }
+
+                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);
+                //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+                oCn.BeginTran();
+                //涓昏〃
+                oCn.RunProc("insert Into Sc_ProcExchWorkBackBillMain(HBillType, HBillSubType, HInterID, HBillNo, HDate,HBillStatus" +
+                    ", HMaker, HMakeDate, HYear, HPeriod, HRemark" +
+                    ", HICMOInterID, HICMOBillNo, HICMOEntryID, HProcExchInterID, HProcExchEntryID" +
+                    ", HProcExchBillNo, HProcExchBegNO, HProcExchEndNO, HProcBegID, HProcEndID" +
+                    ", HMaterID, HUnitID, HEmpID, HPlanQty, HQty" +
+                    ", HExplanation, HInnerBillNo, HWorkShopID, HOrderProcNo, HPRDORGID) values(" +
+                    $"'{omodel.HBillType}','{omodel.HBillSubType}',{omodel.HInterID},'{omodel.HBillNo}','{omodel.HDate}',1" +
+                    $",'{omodel.HMaker}','{omodel.HMakeDate}',{omodel.HYear},{omodel.HPeriod},'{omodel.HRemark}'" +
+                    $",{omodel.HICMOInterID},'{omodel.HICMOBillNo}',{omodel.HICMOEntryID},{omodel.HProcExchInterID},{omodel.HProcExchEntryID}" +
+                    $",'{omodel.HProcExchBillNo}',{omodel.HProcExchBegNO},{omodel.HProcExchEndNO},{omodel.HProcBegID},{omodel.HProcEndID}" +
+                    $",{omodel.HMaterID},{omodel.HUnitID},{omodel.HEmpID},{omodel.HPlanQty},{omodel.HQty}" +
+                    $",'{omodel.HExplanation}','{omodel.HInnerBillNo}',{omodel.HWorkShopID},'{omodel.HOrderProcNo}',{omodel.HPRDORGID})");
+                //鎻掑叆瀛愯〃
+                foreach (Model.ClsSc_ProcExchWorkBackBillSub oSub in DetailColl)
+                {
+                    oCn.RunProc("Insert into Sc_ProcExchWorkBackBillSub (HInterID, HEntryID, HCloseMan, HEntryCloseDate, HCloseType" +
+                        ", HRemark, HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType" +
+                        ", HRelationQty, HRelationMoney, HBillNo_bak, HProcNo, HProcID" +
+                        ", HWorkRemark, HCenterID, HDeptID, HSupID, HSupFlag" +
+                        ", HQty)values(" +
+                        $"{omodel.HInterID}, {oSub.HEntryID.ToString()}, '{oSub.HCloseMan.ToString()}', GETDATE(), {(oSub.HCloseType== true ? 1:0)}" +
+                        $",'{oSub.HRemark.ToString()}', {oSub.HSourceInterID.ToString()},{oSub.HSourceEntryID.ToString()}, '{oSub.HSourceBillNo.ToString()}', '{oSub.HSourceBillType.ToString()}'" +
+                        $",{oSub.HRelationQty.ToString()},{oSub.HRelationMoney.ToString()}, '{oSub.HBillNo_bak.ToString()}', '{oSub.HProcNo.ToString()}',{oSub.HProcID.ToString()}" +
+                        $", '{oSub.HWorkRemark.ToString()}', {oSub.HCenterID.ToString()},{oSub.HDeptID.ToString()},{oSub.HSupID.ToString()},{(oSub.HSupFlag== true?1:0)}" +
+                        $", {oSub.HQty.ToString()}) ");
+                }
+               
+                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+             
+    }
+
+}
diff --git "a/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBill.cs" "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBill.cs"
index eab9620..2ec97af 100644
--- "a/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBill.cs"
+++ "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBill.cs"
@@ -293,9 +293,8 @@
                 ",HProdMaterCode,HSeOrderBillNo,HCusShortName,HCusNeedMaterial,HPlanSendGoodsDate" +
                 ",HProdMaterName,HCusName,HWorkRemark,HImportNote,HMaterNumber_A" +
                 ",HMaterNumber_B,HMaterNumber_C,HMaterNumber_D,HProdType,HMaterShortName" +
-                ",HMaterIDA,HMaterIDB,HMaterIDC,HMaterIDD,HICMOEntryID" +
-                ",HPicNumVer,HPicNumAssemble,HMaterTexture,HProductNum,HVerNum,HPRDORGID,HBLFlag,HCusNumber,HPickLabel,HPickLabelNumber,HXTNumber,HXTModel,HWorkBillSortNo" +
-                ") " +
+                ",HMaterIDA,HMaterIDB,HMaterIDC,HMaterIDD,HICMOEntryID" +        ",HPicNumVer,HPicNumAssemble,HMaterTexture,HProductNum,HVerNum,HPRDORGID,HBLFlag,HCusNumber,HPickLabel,HPickLabelNumber,HXTNumber,HXTModel,HWorkBillSortNo" +
+               ", HRoutingBillID) " +
                 " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker + "',getdate()," + "" + (omodel.HPrevMainSourceInterID == 0 ? omodel.HInterID : omodel.HPrevMainSourceInterID) +
                 "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HBatchNo + "'," + omodel.HMainMaterID.ToString() + "," + omodel.HKeyMaterID.ToString() + "," + omodel.HNo.ToString() + ",'" + omodel.HOrderProcNO + "'" +
                 "," + omodel.HWWOrderInterID.ToString() + "," + omodel.HWWOrderEntryID.ToString() + ",'" + omodel.HWWOrderBillNo + "'," + omodel.HICMOInterID.ToString() + "," + omodel.HEquipMentID.ToString() +
@@ -307,7 +306,7 @@
                 ",'" + omodel.HMaterNumber_B + "','" + omodel.HMaterNumber_C + "','" + omodel.HMaterNumber_D + "','" + omodel.HProdType + "','" + omodel.HMaterShortName + "'" +
                 ",'" + omodel.HMaterIDA + "','" + omodel.HMaterIDB + "','" + omodel.HMaterIDC + "','" + omodel.HMaterIDD + "'," + omodel.HICMOEntryID +
                 ",'" + omodel.HPicNumVer + "','" + omodel.HPicNumAssemble + "','" + omodel.HMaterTexture + "','" + omodel.HProductNum + "','" + omodel.HVerNum + "','"+ omodel.HPRDORGID+ "','"+omodel.HBLFlag+ "','" + omodel.HCusNumber + "','" + omodel.HPickLabel + "','" + omodel.HPickLabelNumber + "','" + omodel.HXTNumber + "','" + omodel.HXTModel + "','" + omodel.HWorkBillSortNo + 
-                "') ");
+                "',"+ omodel.HRoutingBillID + ") ");
                 sErr = sErr + "1;";
                 //鎻掑叆瀛愯〃
                 foreach (Model.ClsSc_ProcessExchangeBillSub oSub in DetailColl)
diff --git a/Model/Model.csproj b/Model/Model.csproj
index 1bb0952..2c07905 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -580,6 +580,8 @@
     <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSc_MouldStockBillSub.cs" />
     <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipConkBookBillMain.cs" />
     <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipConkBookBillSub.cs" />
+    <Compile Include="杞﹂棿绠$悊\ClsSc_ProcExchWorkBackBillSub.cs" />
+    <Compile Include="杞﹂棿绠$悊\ClsSc_ProcExchWorkBackBillMain.cs" />
     <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipWorkBeforeCheckBillMain.cs" />
     <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipWorkBeforeCheckBillSub.cs" />
     <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipStockInCheckBillSub.cs" />
diff --git "a/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcExchWorkBackBillMain.cs" "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcExchWorkBackBillMain.cs"
new file mode 100644
index 0000000..181a72e
--- /dev/null
+++ "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcExchWorkBackBillMain.cs"
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsSc_ProcExchWorkBackBillMain : DBUtility.ClsXt_BaseBillMain
+    {
+        public Int64 HPrintQty { get; set; }  //打印次数
+        public Int64 HICMOInterID { get; set; }
+        public Int64 HICMOEntryID { get; set; }
+        public Int64 HProcExchInterID { get; set; }
+        public Int64 HProcExchEntryID { get; set; }
+        public Int64 HProcExchBegNO { get; set; }
+        public Int64 HProcExchEndNO { get; set; }
+        public Int64 HProcBegID { get; set; }
+        public Int64 HProcEndID { get; set; }
+        public Int64 HMaterID { get; set; }
+        public Int64 HUnitID { get; set; }
+        public Int64 HEmpID { get; set; }
+        public Int64 HWorkShopID { get; set; }
+        public Int64 HPRDORGID { get; set; }
+        public string HICMOBillNo { get; set; } 
+        public string HProcExchBillNo { get; set; } 
+        public string HExplanation { get; set; } 
+        public string HBatchNo { get; set; } 
+        public string HOrderProcNo { get; set; } 
+        public string HInnerBillNo { get; set; } 
+        public double HPlanQty { get; set; } 
+        public double HQty { get; set; } 
+    }
+}
diff --git "a/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcExchWorkBackBillSub.cs" "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcExchWorkBackBillSub.cs"
new file mode 100644
index 0000000..a7a1f01
--- /dev/null
+++ "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcExchWorkBackBillSub.cs"
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsSc_ProcExchWorkBackBillSub : DBUtility.ClsXt_BaseBillSub
+    {
+        public string HBillNo_bak;        //单据号(备份,以免内码丢失,找不到对应主表)
+        public Int64 HItemSubID; //自增列(GUID)
+        public Int64 HProcNo { get; set; }
+        public Int64 HProcID { get; set; }
+        public Int64 HCenterID { get; set; }
+        public Int64 HSupID { get; set; }
+        public Int64 HDeptID { get; set; }
+        public Int64 HICMOInterID { get; set; }
+        public Int64 HSeOrderInterID { get; set; }
+        public Int64 HSeOrderEntryID { get; set; }
+        public Int64 HICMOEntryID { get; set; }
+        public Int64 HWWOrderInterID { get; set; }
+        public Int64 HWWOrderEntryID { get; set; }
+        public bool HSupFlag { get; set; }
+        public string HWorkRemark { get; set; }
+        public string HMouldNo { get; set; }
+        public string HWWOrderBillNo { get; set; }
+        public string HProcWorkNum { get; set; }
+        public string HICMOBillNo { get; set; }
+        public string HSeOrderBillNo { get; set; }
+        public string HTimeUnit { get; set; }
+        public string HProcType { get; set; }
+        public double HQty { get; set; }
+        public double HPlanWorkTimes { get; set; }
+        public double HStdWorkTime { get; set; }
+        public DateTime HPlanBeginDate { get; set; }
+        public DateTime HPlanEndDate { get; set; }
+    }
+}
diff --git "a/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBillMain.cs" "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBillMain.cs"
index 8811c67..ece4cac 100644
--- "a/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBillMain.cs"
+++ "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBillMain.cs"
@@ -72,5 +72,6 @@
         public string HPickLabelNumber;
         public string HXTNumber;
         public string HXTModel;
+        public string HRoutingBillID;//工艺路线ID
     }
 }
diff --git a/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs b/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs
index 2c08827..a24457e 100644
--- a/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs
+++ b/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs
@@ -1393,6 +1393,12 @@
                         omodel.MES_StationOutBill_InStockType = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
                     }
 
+                    //===========工艺路线
+                    //保存到数据库时自动加上转工序
+                    if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "Gy_RoutingBill_SaveAutoLastProc")
+                    {
+                        omodel.Gy_RoutingBill_SaveAutoLastProc = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
+                    }
 
                     //=======JIT
 
@@ -2905,6 +2911,13 @@
                         omodel.MES_StationEntrustOutBill_SaveAutoAddnew = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
                     }
 
+                    //=========工艺路线
+                    //自动新增   保存到数据库时自动加上转工序
+                    if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "Gy_RoutingBill_SaveAutoLastProc")
+                    {
+                        omodel.Gy_RoutingBill_SaveAutoLastProc = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
+                    }
+
                     //报工台,工序汇报自动审核参数
                     if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "Sc_MESProceReportWorkBill_AutoCheck")
                     {
diff --git a/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs b/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs
index 1332e4d..565e056 100644
--- a/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs
+++ b/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs
@@ -425,6 +425,8 @@
         public string Sc_MouldProdOutBill_MouldLifeCtrlType; //保存时器具寿命控制类型 (Y 强制控制, N 仅提示)
 
 
+        //工艺路线
+        public string Gy_RoutingBill_SaveAutoLastProc; //保存到数据库时自动加上转工序
 
     }
          
diff --git a/WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs
new file mode 100644
index 0000000..a954a0e
--- /dev/null
+++ b/WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs
@@ -0,0 +1,402 @@
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Pub_Class;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Web.Http;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers.CJGL
+{
+    public class Sc_ProcExchWorkBackBillController : ApiController
+    {
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+        private json objJsonResult = new json();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        DataSet ds;
+
+        #region 宸ュ簭杩斿伐鐢宠鍗曞垪琛�
+        [Route("Sc_ProcExchWorkBackBill/Sc_ProcExchWorkBackBillList")]
+        [HttpGet]
+        public object Sc_ProcExchWorkBackBillList(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sc_ProcExchWorkBackBill_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡璇㈡潈闄�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                string sql1 = "select * from h_v_Sc_ProcExchWorkBackBillList where 1 = 1  ";
+                string sql = sql1 + sWhere + " order by hmainid desc";
+                ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcExchWorkBackBillList");
+
+                //娣诲姞鍒楀悕
+                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("Sc_ProcExchWorkBackBill/GetProcessExchangeBillSub")]
+        [HttpGet]
+        public object GetProcessExchangeBillSub_cf(string sWhere)
+        {
+            DataSet ds;
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                string sql = string.Format(@"select top 2 * from h_v_Sc_ProcessExchangeBillQuerySub");
+                ds = oCN.RunProcReturn(sql + sWhere, "h_v_Sc_ProcessExchangeBillQuerySub");
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+                objJsonResult.data = null;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region 宸ュ簭杩斿伐鐢宠鍗�  鏂板/缂栬緫
+        /// <summary>
+        /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Sc_ProcExchWorkBackBill/Sc_ProcExchWorkBackBillAddBill")]
+        [HttpPost]
+        public object Sc_ProcExchWorkBackBillAddBill([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 msg3 = sArray[1].ToString();//瀛愯〃
+            int msg5 = int.Parse(sArray[2].ToString());//绫诲瀷
+            string msg6 = sArray[3].ToString();//鐢ㄦ埛
+
+            ListModels oListModels = new ListModels();
+
+            try
+            {
+                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Edit", 1, false, msg6))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //涓昏〃
+                DAL.ClsSc_ProcExchWorkBackBill oBill = new DAL.ClsSc_ProcExchWorkBackBill();
+                List<Model.ClsSc_ProcExchWorkBackBillMain> lsmain = new List<Model.ClsSc_ProcExchWorkBackBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_ClsSc_ProcExchWorkBackBillMain(msg2);
+                foreach (Model.ClsSc_ProcExchWorkBackBillMain oItem in lsmain)
+                {
+                    oItem.HBillType = "3796";
+                    oItem.HBillSubType = "3796";
+                    oItem.HBillStatus = 1;
+                    oItem.HMaker = msg6;
+                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                    oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
+
+                    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_ProcExchWorkBackBillSub> ls = new List<Model.ClsSc_ProcExchWorkBackBillSub>();
+                ls = oListModels.getObjectByJson_ClsSc_ProcExchWorkBackBillSub(msg3);
+                int i = 0;
+                foreach (Model.ClsSc_ProcExchWorkBackBillSub oItemSub in ls)
+                {
+
+                    i++;
+                    oItemSub.HEntryID = i;
+                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+                    oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+                    oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
+                    oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
+                    oItemSub.HBillNo_bak = oBill.omodel.HBillNo;     //澶囦唤鍗曟嵁鍙�
+                    oItemSub.HCloseMan = "";     
+                    oItemSub.HSourceBillNo = "";     
+                    oItemSub.HSourceBillType = "";     
+                    oBill.DetailColl.Add(oItemSub);
+                }
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (msg5==1)
+                {
+                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else
+                {
+                    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 宸ュ簭杩斿伐鐢宠鍗� 鍒犻櫎
+        /// <summary>
+        /// 宸ュ簭杩斿伐鐢宠鍗�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Sc_ProcExchWorkBackBill/DelProcExchWorkBackBill")]
+        [HttpGet]
+        public object DelProcExchWorkBackBill(string HInterID, string user)
+        {
+            //缂栬緫鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log("Sc_ProcExchWorkBackBill_Drop", 1, false, user))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+
+            Int64 lngBillKey = 0;
+            lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+            if (lngBillKey == 0)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            DAL.ClsSc_ProcExchWorkBackBill oBill = new DAL.ClsSc_ProcExchWorkBackBill();
+            ds = oCN.RunProcReturn("select * from Sc_ProcExchWorkBackBillMain where HInterID=" + lngBillKey, "Sc_ProcExchWorkBackBillMain");
+
+            if (ds.Tables[0].Rows.Count>0)
+            {
+               
+                if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo);
+
+                if (IsDete)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            else
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍗曟嵁鏈壘鍒�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ュ簭杩斿伐鐢宠鍗� 瀹℃牳
+        [Route("Sc_ProcExchWorkBackBill/set_CheckBill")]
+        [HttpGet]
+        public object set_CheckBill(int HInterID, string CurUserName)
+        {
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Sc_ProcExchWorkBackBill_Check", 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (HInterID == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁ID涓�0锛屼笉鑳藉鏍革紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                DataSet Ds = oCN.RunProcReturn("Select * from Sc_ProcExchWorkBackBillMain Where HInterID=" + HInterID, "Sc_ProcExchWorkBackBillMain");
+                if (Ds.Tables[0].Rows.Count > 0)
+                {
+                    //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
+                    if (Ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                  
+                    //瀹℃牳
+                    if (Cj_StationInBillCheckBill(HInterID, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳鎴愬姛!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    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;
+            }
+        }
+
+        //瀹℃牳
+        public bool Cj_StationInBillCheckBill(Int64 HInterID, string CurUserName, ref string sReturn)
+        {
+            try
+            {
+                oCN.BeginTran();
+                oCN.RunProc(" Update Sc_ProcExchWorkBackBillMain set HChecker='" + CurUserName + "',HBillStatus=2,HCheckDate='getdate()' Where HInterID=" + HInterID.ToString());
+                oCN.RunProc("exec h_p_ProcExchWorkBackBill_Check_In " + HInterID.ToString());
+                oCN.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCN.RollBack();
+                return false; ;
+            }
+        }
+        #endregion
+
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
index 832c040..9eb7c33 100644
--- a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
+++ b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
@@ -373,6 +373,126 @@
         //}
         #endregion
 
+        #region[鎵归噺鏂板鍗曟嵁-淇濆瓨鎸夐挳]
+        /// <summary>
+        /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Sc_ProcessExchangeBill/AddBill_pl")]
+        [HttpPost]
+        public object AddBill_pl([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 msg3 = sArray[1].ToString();//鍗曟嵁鍙峰強鏁伴噺
+            string msg4 = sArray[2].ToString();//宸ヨ壓璺嚎
+            string msg5 = sArray[3].ToString();//绫诲瀷
+            string msg6 = sArray[4].ToString();//鐢ㄦ埛
+
+            ListModels oListModels = new ListModels();
+
+            try
+            {
+                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Edit", 1, false, msg6))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //鍗曟嵁鍙� 鍙婃暟閲�
+                DAL.ClsSc_ProcessExchangeBill oBill = new DAL.ClsSc_ProcessExchangeBill();
+                List<Model.ClsSc_ProcessExchangeBillMain> ListHbillNo = new List<Model.ClsSc_ProcessExchangeBillMain>();
+                msg3 = msg3.Replace("\\", "");
+                msg3 = msg3.Replace("\n", "");  //\n
+                ListHbillNo = JsonConvert.DeserializeObject<List<Model.ClsSc_ProcessExchangeBillMain>>(msg3);
+
+                //涓昏〃淇℃伅
+                Model.ClsSc_ProcessExchangeBillMain Main = new Model.ClsSc_ProcessExchangeBillMain();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                Main = JsonConvert.DeserializeObject<Model.ClsSc_ProcessExchangeBillMain>(msg2);
+
+                DBUtility.ClsPub.CurUserName = msg6;
+                Main.HMaker = msg6;  //鍒跺崟浜�
+                Main.HBillType = "3772";
+                Main.HBillSubType = "3772";
+                Main.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                Main.HMaterID = Main.HMaterID2;
+                if (DBUtility.ClsPub.isStrNull(Main.HDate) == "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+
+                //琛ㄤ綋鏁版嵁
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg4 = msg4.Substring(1, msg4.Length - 2);
+                msg4 = msg4.Replace("\\", "");
+                msg4 = msg4.Replace("\n", "");  //\n
+                List<Model.ClsSc_ProcessExchangeBillSub> ls = new List<Model.ClsSc_ProcessExchangeBillSub>();
+                ls = oListModels.getObjectByJson_Sc_ProcessExchangeBillSub(msg4);
+
+                //寰幆鏂板鍗曟嵁
+                for (int i = 0; i < ListHbillNo.Count; i++)
+                {
+                    Main.HBillNo = ListHbillNo[i].HBillNo;
+                    Main.HQty = ListHbillNo[i].HQty;
+                    oBill.omodel = Main;
+
+                    int j = 0;
+                    foreach (Model.ClsSc_ProcessExchangeBillSub oItemSub in ls)
+                    {
+                        j++;
+                        oItemSub.HEntryID = j;
+                        oItemSub.HQty = Main.HQty;
+                        oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                        oBill.DetailColl.Add(oItemSub);
+                    }
+                    //淇濆瓨
+                    //淇濆瓨瀹屾瘯鍚庡鐞�
+                    bool bResult=false;
+                    if (msg5 == "2")
+                    {
+                        bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    }
+                    oBill.DetailColl.Clear();
+                    if (!bResult)
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+
+        #endregion
+
         #region 宸ュ簭娴佽浆鍗″垪琛ㄦ樉绀哄櫒鍏锋竻鍗曚俊鎭�
         [Route("Sc_ProcessExchangeBillList/QJQD")]
         [HttpGet]
diff --git a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
index 16390e8..9cd90b3 100644
--- a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
+++ b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
@@ -27,8 +27,10 @@
         DAL.ClsIF_Material_View oMaterHlp = new DAL.ClsIF_Material_View();
         public DAL.ClsGy_Process_View oProcHlp = new DAL.ClsGy_Process_View();
         DAL.ClsGy_WorkCenter_View oCenHlp = new DAL.ClsGy_WorkCenter_View();
+        DAL.ClsGy_Warehouse_View oCenWare = new DAL.ClsGy_Warehouse_View();
         Gy_RoutingBill_temporary omdelMian = new Gy_RoutingBill_temporary();
         public string BillType = "3301";
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
 
         #region 鏈煡
         /// <summary>
@@ -162,7 +164,7 @@
                 double HStdSourceQty = mainList[0].HStdSourceQty;//鏍囧噯璧勬簮鏁�
                 double HAddSourceRate = mainList[0].HAddSourceRate;//鍔犺祫婧愬閲�
                 double HDelSourceRate = mainList[0].HDelSourceRate;//鍑忚祫婧愬噺閲�
-                int HPRDORGID = mainList[0].HOrgID;  //鐢熶骇缁勭粐
+                int HPRDORGID = mainList[0].HPRDORGID;  //鐢熶骇缁勭粐
                 int HOrgID = mainList[0].HOrgID;  //缁勭粐
                 string HPicNumVer = mainList[0].HPicNumVer;//鍥惧彿鐗堟湰
                 string HPicNumAssemble = mainList[0].HPicNumAssemble;//鎬昏鍥惧彿
@@ -170,7 +172,7 @@
                 string HProductNum = mainList[0].HProductNum;//鎴愬搧缂栧彿
                 string HVerNum = mainList[0].HVerNum;//鐗堟湰
                 int IsProNo = mainList[0].IsProNo;//鏄惁杞伐搴�
-
+              
                 if (OperationType == 2)
                 {
                     ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingBillList where  鍗曟嵁鍙�='" + HBillNo + "'", "h_v_Gy_RoutingBillList");
@@ -206,8 +208,8 @@
                 { //淇敼
                     oCN.RunProc("update Gy_RoutingBillMain  set " +
                        "HDate='" + HDate +
-                       "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',HMaker='" + HMaker +
-                       "',Hmakedate=getdate(),HMaterID='" + HMaterID + "',HName='" + HName + "',HMaterTypeID='" + HMaterTypeID +
+                       "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker +
+                       "',hupdatedate=getdate(),HMaterID='" + HMaterID + "',HName='" + HName + "',HMaterTypeID='" + HMaterTypeID +
                        "',HRoutingGroupID='" + HRoutingGroupID + "',HUnitID='" + HUnitID + "',HMaterNumber='" + HMaterNumber + "',HUnitNumber='" + HUnitNumber +
                        "',HStandard='" + Convert.ToString(HStandard ? 1 : 0) + "',HMainGroupID='" + HMainGroupID + "',HMainProcID='" + HMainProcID + "',HMainCenterID='" + HMainCenterID +
                        "',HMainTimeUnit='" + HMainTimeUnit + "',HMainUnitTime='" + HMainUnitTime + "',HMainWorkQty='" + HMainWorkQty + "',HMainPrice='" + HMainPrice +
@@ -229,14 +231,32 @@
                     return objJsonResult;
                 }
 
-                if (IsProNo == 1 && OperationType == 1)
+                string sErrMsg = "";
+                if (oSystemParameter.ShowBill(ref sErrMsg))
                 {
-                    //璁剧疆杞伐搴�
-                    oCN.RunProc("exec Gy_RoutingBill_LastProNo " + HInterID);
+                    if (oSystemParameter.omodel.WMS_CampanyName == "鐟炰笌绁�")
+                    {
+                        if (oSystemParameter.omodel.Gy_RoutingBill_SaveAutoLastProc == "Y" && OperationType == 1)
+                        {
+                            //璁剧疆杞伐搴�
+                            oCN.RunProc("exec Gy_RoutingBill_LastProNo " + HInterID);
+                        }
+                    }
+                    else if (IsProNo == 1 && OperationType == 1)
+                    {
+                        //璁剧疆杞伐搴�
+                        oCN.RunProc("exec Gy_RoutingBill_LastProNo " + HInterID);
+                    }
                 }
 
-                //璁剧疆榛樿宸ヨ壓璺嚎
-                oCN.RunProc("exec h_p_Gy_RoutingBillCheck " + HInterID);  //璁剧疆榛樿宸ヨ壓璺嚎
+
+                //鏄惁鍕鹃�夐粯璁ゅ伐鑹鸿矾绾�
+                if (HStandard)
+                {
+                    //璁剧疆榛樿宸ヨ壓璺嚎
+                    oCN.RunProc("exec h_p_Gy_RoutingBillCheck " + HInterID);  //璁剧疆榛樿宸ヨ壓璺嚎
+                }
+             
                 //鍒ゆ柇鏄惁閲嶅宸ュ簭鍙�
                 ds = oCN.RunProcReturn("exec h_p_Gy_RoutingCtrl " + HInterID, "h_p_Gy_RoutingCtrl");
 
@@ -308,7 +328,7 @@
                     ",HProcID_S,HCenterID_S,HWorkQty_S,HSubStdEmpQty_S,HMouldNo,HChangeMould" +
                     ",HPackStd,HPack,HPutArea,HMyWorkDays,HMyFixWorkDays,HPassRate" +
                     ",HTechnologyParameter,HPicNum,HProcCheckNote" +
-                    ",HOverRate,HProcWorkNum" +
+                    ",HOverRate,HProcWorkNum,HBadWHID,HWasterWHID, HWHID " +
                     ") values("
                     + HInterID + "," + i + "," + oSub.HProcID.ToString() + ",'" + oSub.HProcNo + "'," + oSub.HSupID.ToString() + "," + Convert.ToString(oSub.HSupFlag ? 1 : 0) + "" +
                     "," + oSub.HWorkQty.ToString() + "," + oSub.HCenterID.ToString() + ",'" + oSub.HTimeUnit.ToString() + "'," + oSub.HUnitTime.ToString() +
@@ -320,7 +340,7 @@
                    "," + oSub.HProcID_S.ToString() + "," + oSub.HCenterID_S.ToString() + "," + oSub.HWorkQty_S.ToString() + ", " + oSub.HSubStdEmpQty_S.ToString() + ",'" + oSub.HMouldNo + "'," + oSub.HChangeMould.ToString() +
                    ",'" + oSub.HPackStd + "','" + oSub.HPack + "','" + oSub.HPutArea + "'," + oSub.HMyWorkDays.ToString() + "," + oSub.HMyFixWorkDays.ToString() + "," + oSub.HPassRate.ToString() +
                    ",'" + oSub.HTechnologyParameter.ToString() + "','" + oSub.HPicNum.ToString() + "','" + oSub.HProcCheckNote.ToString() +
-                   "', " + oSub.HOverRate.ToString() + ",'" + oSub.HProcWorkNum.ToString() + "'" +
+                   "', " + oSub.HOverRate.ToString() + ",'" + oSub.HProcWorkNum.ToString() + "'," + oSub.HBadWHID.ToString()+"," + oSub.HWasterWHID.ToString()+"," + oSub.HWHID.ToString() +
                     ") ");
                 }
             }
@@ -441,6 +461,15 @@
                 if (!tb2.Columns.Contains("鑹巼"))
                     error += "娌℃湁鎵惧埌銆愯壇鐜囥�戠殑鏍囬";
 
+                if (!tb2.Columns.Contains("涓嶈壇鍝佷粨"))
+                    error += "娌℃湁鎵惧埌銆愪笉鑹搧浠撱�戠殑鏍囬";
+
+                if (!tb2.Columns.Contains("鎶ュ簾鍝佷粨"))
+                    error += "娌℃湁鎵惧埌銆愭姤搴熷搧浠撱�戠殑鏍囬";
+
+                if (!tb2.Columns.Contains("鑹搧浠�"))
+                    error += "娌℃湁鎵惧埌銆愯壇鍝佷粨銆戠殑鏍囬";
+
                 if (error.Length > 0)
                 {
                     objJsonResult.code = "0";
@@ -502,12 +531,12 @@
                                 , 鑹巼, 宸ュ簭宸ヤ环, 涓嶅悎鏍煎崟浠�, 鎶ュ簾鍗曚环, 鏈亾鍥哄畾寮�宸ュぉ鏁�, 鏈亾寮�宸ヤ綑閲�, 涓婇亾绛夊緟澶╂暟
                                 , 涓婇亾寰幆鍛ㄦ湡, 鑷姩杞Щ, 澶栧崗鏍囪, 渚涘簲鍟嗕唬鐮�, 渚涘簲鍟�, 宸ヨ壓鍙傛暟, 鍥剧焊缂栧彿
                                 , 鏈伐搴忕‘璁よ褰�, 澶囨敞, 鍥惧彿鐗堟湰, 鎬昏鍥惧彿, 鏉愯川, 鎴愬搧缂栧彿, 鐗堟湰
-                                , 妯″叿缂栧彿, 绋嬪簭鍙�, 鐝骇瀹氶, 宸ヨ壓璺嚎鍚嶇О, 鏃堕棿鍗曚綅,宸ヨ壓璺嚎浠g爜)values
+                                , 妯″叿缂栧彿, 绋嬪簭鍙�, 鐝骇瀹氶, 宸ヨ壓璺嚎鍚嶇О, 鏃堕棿鍗曚綅,宸ヨ壓璺嚎浠g爜,涓嶈壇鍝佷粨,鎶ュ簾鍝佷粨,鑹搧浠�)values
                                 ('" + tb2.Rows[i]["浜у搧浠g爜"].ToString() + "','" + tb2.Rows[i]["浜у搧鍚嶇О"].ToString() + "','" + tb2.Rows[i]["宸ュ簭搴忓彿"].ToString() + "','" + tb2.Rows[i]["宸ュ簭浠g爜"].ToString() + "','" + tb2.Rows[i]["宸ュ簭"].ToString() + "','" + tb2.Rows[i]["宸ヤ綔涓績"].ToString() + "','" + tb2.Rows[i]["鍔犲伐鏁伴噺"].ToString() + "'" +
                                 ",'" + tb2.Rows[i]["鑹巼"].ToString() + "','" + (tb2.Rows[i]["宸ュ簭宸ヤ环"].ToString() == "" ? "0" : tb2.Rows[i]["宸ュ簭宸ヤ环"].ToString()) + "','" + tb2.Rows[i]["涓嶅悎鏍煎崟浠�"].ToString() + "','" + tb2.Rows[i]["鎶ュ簾鍗曚环"].ToString() + "','" + tb2.Rows[i]["鏈亾鍥哄畾寮�宸ュぉ鏁�"].ToString() + "','" + tb2.Rows[i]["鏈亾寮�宸ヤ綑閲�"].ToString() + "','" + tb2.Rows[i]["涓婇亾绛夊緟澶╂暟"].ToString() + "'" +
                                 ",'" + tb2.Rows[i]["涓婇亾寰幆鍛ㄦ湡"].ToString() + "','" + tb2.Rows[i]["鑷姩杞Щ"].ToString() + "','" + tb2.Rows[i]["澶栧崗鏍囪"].ToString() + "','" + tb2.Rows[i]["渚涘簲鍟嗕唬鐮�"].ToString() + "','" + tb2.Rows[i]["渚涘簲鍟�"].ToString() + "','" + tb2.Rows[i]["宸ヨ壓鍙傛暟"].ToString() + "','" + tb2.Rows[i]["鍥剧焊缂栧彿"].ToString() + "'" +
                                 ",'" + tb2.Rows[i]["鏈伐搴忕‘璁よ褰�"].ToString() + "','" + tb2.Rows[i]["澶囨敞"].ToString() + "','" + tb2.Rows[i]["鍥惧彿鐗堟湰"].ToString() + "','" + tb2.Rows[i]["鎬昏鍥惧彿"].ToString() + "','" + tb2.Rows[i]["鏉愯川"].ToString() + "','" + tb2.Rows[i]["鎴愬搧缂栧彿"].ToString() + "','" + tb2.Rows[i]["鐗堟湰"].ToString() + "'" +
-                                ",'" + tb2.Rows[i]["妯″叿缂栧彿"].ToString() + "','" + tb2.Rows[i]["绋嬪簭鍙�"].ToString() + "','" + tb2.Rows[i]["鐝骇瀹氶"].ToString() + "','" + tb2.Rows[i]["宸ヨ壓璺嚎鍚嶇О"].ToString() + "','" + tb2.Rows[i]["鏃堕棿鍗曚綅"].ToString() + "','" + tb2.Rows[i]["宸ヨ壓璺嚎浠g爜"].ToString() + "')");
+                                ",'" + tb2.Rows[i]["妯″叿缂栧彿"].ToString() + "','" + tb2.Rows[i]["绋嬪簭鍙�"].ToString() + "','" + tb2.Rows[i]["鐝骇瀹氶"].ToString() + "','" + tb2.Rows[i]["宸ヨ壓璺嚎鍚嶇О"].ToString() + "','" + tb2.Rows[i]["鏃堕棿鍗曚綅"].ToString() + "','" + tb2.Rows[i]["宸ヨ壓璺嚎浠g爜"].ToString() + "','" + tb2.Rows[i]["涓嶈壇鍝佷粨"].ToString() + "','" + tb2.Rows[i]["鎶ュ簾鍝佷粨"].ToString() + "','" + tb2.Rows[i]["鑹搧浠�"].ToString() + "')");
                 }
 
                 objJsonResult.code = "1";
@@ -540,12 +569,12 @@
                 Single sWorkQty = 0;
                 Single sHPassRate = 0;
 
-                //
                 sHNumber = DBUtility.ClsPub.isStrNull(dt.Rows[i]["浜у搧浠g爜"].ToString());
                 sHNumberCen = DBUtility.ClsPub.isStrNull(dt.Rows[i]["宸ヤ綔涓績"].ToString());
                 sHNamePoc = DBUtility.ClsPub.isStrNull(dt.Rows[i]["宸ュ簭"].ToString());
                 sWorkQty = DBUtility.ClsPub.isSingle(dt.Rows[i]["鍔犲伐鏁伴噺"].ToString());
                 sHPassRate = DBUtility.ClsPub.isSingle(dt.Rows[i]["鑹巼"].ToString());
+             
                 if (sHNumber != "")
                 {
                     // 
@@ -608,9 +637,92 @@
                             sErrMsg = sErrMsg + "[" + sHNumberCen + "]宸ヤ綔涓績涓嶅瓨鍦╘r\n";
                         }
                         b = true;
-
                     }
 
+
+                    string sErr = "";
+                    if (oSystemParameter.ShowBill(ref sErr))
+                    {
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鐟炰笌绁�")
+                        {
+                            string HBadWHName = ""; //涓嶈壇鍝佷粨
+                            string HWasterWHName = ""; //鎶ュ簾鍝佷粨
+                            string HWHName = ""; //鑹搧浠�
+
+                            HBadWHName = DBUtility.ClsPub.isStrNull(dt.Rows[i]["涓嶈壇鍝佷粨"].ToString());
+                            HWasterWHName = DBUtility.ClsPub.isStrNull(dt.Rows[i]["鎶ュ簾鍝佷粨"].ToString());
+                            HWHName = DBUtility.ClsPub.isStrNull(dt.Rows[i]["鑹搧浠�"].ToString());
+
+                            //鍒ゆ柇鏄惁涓虹┖
+                            if (HBadWHName == "")
+                            {
+                                sErrMsg = sErrMsg + "绗�" + index + "琛� :涓嶈壇鍝佷粨涓嶈兘涓虹┖ !\r\n";
+                                b = true;
+                            }
+
+                            if (HWasterWHName == "")
+                            {
+                                sErrMsg = sErrMsg + "绗�" + index + "琛� :鎶ュ簾鍝佷粨涓嶈兘涓虹┖ !\r\n";
+                                b = true;
+                            }
+
+                            if (HWHName == "")
+                            {
+                                sErrMsg = sErrMsg + "绗�" + index + "琛� :鑹搧浠撲笉鑳戒负绌� !\r\n";
+                                b = true;
+                            }
+
+                            //鍒ゆ柇浠撳簱鏄惁閲嶅
+                            if (HBadWHName == HWasterWHName)
+                            {
+                                sErrMsg = sErrMsg + "涓嶈壇鍝佷粨鍜屾姤搴熷搧浠撻噸澶峔r\n";
+                                b = true;
+                            }
+
+                            if (HWasterWHName == HWHName)
+                            {
+                                sErrMsg = sErrMsg + "鎶ュ簾鍝佷粨鍜岃壇鍝佷粨閲嶅\r\n";
+                                b = true;
+                            }
+
+                            if (HBadWHName == HWHName)
+                            {
+                                sErrMsg = sErrMsg + "涓嶈壇鍝佷粨鍜岃壇鍝佷粨閲嶅\r\n";
+                                b = true;
+                            }
+
+                            //寰楀埌浠撳簱鍐呯爜
+                            if (!oCenWare.GetInfoByName(HBadWHName))
+                            {
+                                sMsg = "[" + HBadWHName + "]浠撳簱涓嶅瓨鍦�";
+                                if (sErrMsg.Contains(sMsg) == false)
+                                {
+                                    sErrMsg = sErrMsg + "[" + HBadWHName + "]浠撳簱涓嶅瓨鍦╘r\n";
+                                }
+                                b = true;
+                            }
+
+                            if (!oCenWare.GetInfoByName(HWasterWHName))
+                            {
+                                sMsg = "[" + HWasterWHName + "]浠撳簱涓嶅瓨鍦�";
+                                if (sErrMsg.Contains(sMsg) == false)
+                                {
+                                    sErrMsg = sErrMsg + "[" + HWasterWHName + "]浠撳簱涓嶅瓨鍦╘r\n";
+                                }
+                                b = true;
+                            }
+
+                            if (!oCenWare.GetInfoByName(HWHName))
+                            {
+                                sMsg = "[" + HWHName + "]浠撳簱涓嶅瓨鍦�";
+                                if (sErrMsg.Contains(sMsg) == false)
+                                {
+                                    sErrMsg = sErrMsg + "[" + HWHName + "]浠撳簱涓嶅瓨鍦╘r\n";
+                                }
+                                b = true;
+                            }
+                        }
+                    }
                 }
             }
             if (b == true)
diff --git a/WebAPI/Controllers/LMESController.cs b/WebAPI/Controllers/LMESController.cs
index a0df8cc..6d3ed8f 100644
--- a/WebAPI/Controllers/LMESController.cs
+++ b/WebAPI/Controllers/LMESController.cs
@@ -600,8 +600,7 @@
             try
             {
                 List<object> columnNameList = new List<object>();
-                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
-                //{
+               
                 //娣诲姞鍒楀悕
                 foreach (DataColumn col in ds.Tables[0].Columns)
                 {
@@ -616,15 +615,6 @@
                 objJsonResult.list = columnNameList;
                 objJsonResult.data = ds.Tables[0];
                 return objJsonResult;
-                //}
-                //else
-                //{
-                //objJsonResult.code = "0";
-                //objJsonResult.count = 0;
-                //objJsonResult.Message = "鏃犳暟鎹�";
-                //objJsonResult.data = null;
-                //return objJsonResult;
-                //}
             }
             catch (Exception e)
             {
diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
index 8733e1a..5118795 100644
--- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
+++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
@@ -1217,30 +1217,67 @@
         #region 鐢熶骇鏃ヨ鍒掑钩鍙� 鐢熶骇璁㈠崟鏌ヨ
         [Route("JIT_DayPlanPlatFormBill/JIT_ICMOBillList")]
         [HttpGet]
-        public object JIT_ICMOBillList(string hmainid, string HEntryID)
+        public object JIT_ICMOBillList(string hmainid)
         {
             try
             {
-                DataSet dt = new DataSet();
-                ds = oCN.RunProcReturn($"exec h_p_ICMOBillList_PrimarySubTable '{hmainid}','{HEntryID}'", "h_p_ICMOBillList_PrimarySubTable");
-
-                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+                var list = hmainid.Split(',');
+                List<DataTable> listdt = new List<DataTable>();
+                DataTable dtable = new DataTable("dt");
+                for (int i = 0; i < list.Length; i++)
                 {
-                    dt = oCN.RunProcReturn($"select * from  h_v_JIT_Sc_WorkBillSortBillList where 婧愬崟涓诲唴鐮� in({ds.Tables[0].Rows[i]["婧愬崟涓诲唴鐮�"].ToString()}) and  婧愬崟瀛愬唴鐮� in({ds.Tables[0].Rows[i]["婧愬崟瀛愬唴鐮�"].ToString()})", "h_v_JIT_Sc_WorkBillSortBillList");
+                    var listEvery = list[i].Split('_');
+                   
+                    ds = oCN.RunProcReturn($"exec h_p_ICMOBillList_PrimarySubTable '{listEvery[0]}','{listEvery[1]}'", "h_p_ICMOBillList_PrimarySubTable");
+
+                    var dt = oCN.RunProcReturn($"select * from  h_v_JIT_Sc_WorkBillSortBillList where 婧愬崟涓诲唴鐮� in({ds.Tables[0].Rows[0]["婧愬崟涓诲唴鐮�"].ToString()}) and  婧愬崟瀛愬唴鐮� in({ds.Tables[0].Rows[0]["婧愬崟瀛愬唴鐮�"].ToString()})", "h_v_JIT_Sc_WorkBillSortBillList");
                     if (dt.Tables[0].Rows.Count > 0)
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
-                        objJsonResult.Message = "鐢熶骇鏄庣粏琛岄噸澶�,閲嶅鐨勭敓浜ц鍗曞彿:"+ ds.Tables[0].Rows[i]["鐢熶骇璁㈠崟鍙�"].ToString()+",鏄庣粏琛屽彿:"+ ds.Tables[0].Rows[i]["鐢熶骇璁㈠崟鏄庣粏琛屽彿"].ToString();
+                        objJsonResult.Message = "鐢熶骇鏄庣粏琛岄噸澶�,閲嶅鐨勭敓浜ц鍗曞彿:" + ds.Tables[0].Rows[i]["鐢熶骇璁㈠崟鍙�"].ToString() + ",鏄庣粏琛屽彿:" + ds.Tables[0].Rows[i]["鐢熶骇璁㈠崟鏄庣粏琛屽彿"].ToString();
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
+                    if (i == 0)
+                    {
+                        //娣诲姞鍒楀悕
+                        for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
+                        {
+                            dtable.Columns.Add(ds.Tables[0].Columns[j].ToString());
+                        }
+                    }
+                    listdt.Add(ds.Tables[0]);
                 }
-              
+
+                //鑾峰彇闆嗗悎鏁版嵁
+                for (int i = 0; i < listdt.Count; i++)
+                {
+                    DataRow row = dtable.NewRow();
+                    for (int j = 0; j < listdt[i].Columns.Count; j++)
+                    {
+                        if (listdt[i].Columns[j].ColumnName == "璁″垝鏁伴噺")
+                        {
+                            row[j] = double.Parse(listdt[i].Rows[0][j].ToString()).ToString();
+                        }
+                        else
+                        {
+                            row[j] = listdt[i].Rows[0][j].ToString();
+                        }
+                    }
+                    dtable.Rows.Add(row);
+                }
+
+                //娣诲姞鍔ㄦ�佹棩鏈�
+                for (int j = 1; j <= 31; j++)
+                {
+                    dtable.Columns.Add(DateTime.Now.AddDays(j - 1).ToString("yyyy-MM-dd"), typeof(Int32));
+                }
+
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
-                objJsonResult.data = ds.Tables[0];
+                objJsonResult.data = dtable;
                 return objJsonResult;
             }
             catch (Exception e)
diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs"
index aaa2eef..c905be2 100644
--- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs"
+++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs"
@@ -59,6 +59,7 @@
                 tb2.Columns.Add("HSourceID", typeof(Int32));//鐢熶骇璧勬簮id
                 tb2.Columns.Add("ICMOBillHInterID", typeof(Int32));//鐢熶骇璁㈠崟涓籭d
                 tb2.Columns.Add("ICMOBillHEntryID", typeof(Int32));//鐢熶骇璁㈠崟瀛恑d
+                tb2.Columns.Add("HProdORGID", typeof(Int32));//缁勭粐id
 
                 //娣诲姞鏁版嵁
                 for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
@@ -151,18 +152,60 @@
                     {
                         //鍛樺伐
                         ds = oCN.RunProcReturn($"select * from Gy_Employee  where HNumber='{tb2.Rows[i]["鍛樺伐缂栫爜"].ToString()}'", "Gy_Employee");
-                        if (ds.Tables[0].Rows.Count > 0)
+                        if (ds.Tables[0].Rows.Count > 0) {
                             tb2.Rows[i]["鍛樺伐缂栫爜"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = $"绗瑊i + 1}琛�,鍛樺伐鏌ユ棤鏁版嵁!";
+                            objJsonResult.data = tb2;
+                            return objJsonResult;
+                        }
 
                         //璁¢噺鍗曚綅
                         ds = oCN.RunProcReturn($"select * from Gy_Unit  where HNumber='{tb2.Rows[i]["璁¢噺鍗曚綅"].ToString()}'", "Gy_Unit");
                         if (ds.Tables[0].Rows.Count > 0)
+                        {
                             tb2.Rows[i]["HUnitID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = $"绗瑊i + 1}琛�,璁¢噺鍗曚綅鏌ユ棤鏁版嵁!";
+                            objJsonResult.data = tb2;
+                            return objJsonResult;
+                        }
 
                         //鐢熶骇璧勬簮
                         ds = oCN.RunProcReturn($"select * from Gy_Source  where HNumber='{tb2.Rows[i]["鐢熶骇璧勬簮缂栫爜*"].ToString()}'", "Gy_Source");
                         if (ds.Tables[0].Rows.Count > 0)
+                        {
                             tb2.Rows[i]["HSourceID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                        }
+                        else {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = $"绗瑊i+1}琛�,鐢熶骇璧勬簮鏌ユ棤鏁版嵁!";
+                            objJsonResult.data = tb2;
+                            return objJsonResult;
+                        }
+                    }
+                    //缁勭粐
+                    ds = oCN.RunProcReturn($"select * from Xt_ORGANIZATIONS  where HNumber='{tb2.Rows[i]["缁勭粐缂栫爜*"].ToString()}'", "Xt_ORGANIZATIONS");
+                    if (ds.Tables[0].Rows.Count > 0)
+                    {
+                        tb2.Rows[i]["HProdORGID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = $"绗瑊i + 1}琛�,缁勭粐鏌ユ棤鏁版嵁!";
+                        objJsonResult.data = tb2;
+                        return objJsonResult;
                     }
                 }
 
@@ -257,7 +300,7 @@
                         HInterID = DBUtility.ClsPub.CreateBillID_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo);//鑾峰緱涓�涓柊鐨刬d
                         var HICMOBillNo = list[i]["鐢熶骇璁㈠崟鍙�*"].ToString();
                         var HICMOEntrySEQ = list[i]["鐢熶骇璁㈠崟鏄庣粏琛屽彿*"].ToString();
-                        var HProdORGID = list[i]["缁勭粐缂栫爜*"].ToString();
+                        var HProdORGID = list[i]["HProdORGID"].ToString();
                         var HWorkShopID = list[i]["HWorkShopID"].ToString();
                         var HSourceID = list[i]["HSourceID"].ToString();
                         var HYX = list[i]["浼樺厛绾�"].ToString();
diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs"
index 4a507a7..aa5e8df 100644
--- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs"
+++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs"
@@ -242,7 +242,7 @@
         #region 鏃ヨ鍒掑伐鍗� 鍒犻櫎
         [Route("Sc_WorkBillSortBill/DelWorkBillSortBillList")]
         [HttpGet]
-        public object DelWorkBillSortBillList(string HInterID, string HEntryID, string User)
+        public object DelWorkBillSortBillList(string HInterID,int DataType, string User)
         {
             try
             {
@@ -255,30 +255,72 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-
-                ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkBillSortBillList where 1=1 and hmainid=" + HInterID, "h_v_JIT_Sc_WorkBillSortBillList");
-
-                if (ds.Tables[0].Rows.Count > 0)
+                //DataType 1=鏃ヨ鍒掑伐鍗� 澶氶�夊垹闄�   2=鏃ヨ鍒掑钩鍙板閫夊垹闄�
+                if (DataType == 1)
                 {
-                    if (ds.Tables[0].Rows[0]["鍗曟嵁鐘舵��"].ToString() != "1")
+                    var NumData = HInterID.Split(',');
+
+                    for (int i = 0; i < NumData.Length; i++)
                     {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "褰撳墠鍗曟嵁涓嶈兘鍒犻櫎锛�";
-                        objJsonResult.data = null;
-                        return objJsonResult;
+                        var NumData_T = NumData[i].Split('_');
+
+                        ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkBillSortBillList where 1=1 and hmainid=" + NumData_T[0], "h_v_JIT_Sc_WorkBillSortBillList");
+
+                        if (ds.Tables[0].Rows.Count > 0)
+                        {
+                            if (ds.Tables[0].Rows[0]["鍗曟嵁鐘舵��"].ToString() != "1")
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "褰撳墠鍗曟嵁涓嶈兘鍒犻櫎锛�";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+
+                            oCN.BeginTran();//寮�鍚簨鍔�
+
+                            if (ds.Tables[0].Rows.Count == 1)
+                            {
+                                oCN.RunProc($"delete from Sc_WorkBillSortBillMain where HInterID={ NumData_T[0]}");
+                            }
+                            oCN.RunProc($"delete from Sc_WorkBillSortBillSub where HInterID={ NumData_T[0]} and HEntryID={ NumData_T[1]}");
+
+                            oCN.Commit();//缁撴潫浜嬪姟
+                        }
                     }
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else if (DataType == 2)
+                {
+                    var NumData = HInterID.Split(',');
 
-                    oCN.BeginTran();//寮�鍚簨鍔�
-
-                    if (ds.Tables[0].Rows.Count == 1)
+                    for (int i = 0; i < NumData.Length; i++)
                     {
-                        oCN.RunProc($"delete from Sc_WorkBillSortBillMain where HInterID={HInterID}");
+                        ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkBillSortBillList where 1=1 and hmainid=" + NumData[i], "h_v_JIT_Sc_WorkBillSortBillList");
+
+                        if (ds.Tables[0].Rows.Count > 0)
+                        {
+                            if (ds.Tables[0].Rows[0]["鍗曟嵁鐘舵��"].ToString() != "1")
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "褰撳墠鍗曟嵁涓嶈兘鍒犻櫎锛�";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+
+                            oCN.BeginTran();//寮�鍚簨鍔�
+
+                            oCN.RunProc($"delete from Sc_WorkBillSortBillSub where HInterID={ NumData[i]}");
+                            oCN.RunProc($"delete from Sc_WorkBillSortBillMain where HInterID={ NumData[i]}");
+
+                            oCN.Commit();//缁撴潫浜嬪姟
+                        }
                     }
-                    oCN.RunProc($"delete from Sc_WorkBillSortBillSub where HInterID={HInterID} and HEntryID={HEntryID}");
-
-                    oCN.Commit();//缁撴潫浜嬪姟
-
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
diff --git a/WebAPI/Controllers/Sc_ProcessMangementController.cs b/WebAPI/Controllers/Sc_ProcessMangementController.cs
index 53cbe50..246256d 100644
--- a/WebAPI/Controllers/Sc_ProcessMangementController.cs
+++ b/WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -20,7 +20,7 @@
         public DBUtility.ClsPub.Enum_BillStatus BillStatus;
 
         private json objJsonResult = new json();
-
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
 
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         DataSet ds;
@@ -712,7 +712,21 @@
                     FentityModel.Add("FBaseRealQty", item["鏁伴噺"].ToString());//
                     FentityModel.Add("FOwnerTypeId", "BD_OwnerOrg");//
                     FentityModel.Add("FOwnerId", new JObject() { ["FNumber"] = item["HPrdOrgNumber"].ToString() });//
-                    FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 浠撳簱 
+                    string sErr = "";
+                    if (oSystemParameter.ShowBill(ref sErr))
+                    {
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鐟炰笌绁�")
+                        {
+                            if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "宸ヨ壓璺嚎")
+                            {
+                                FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumbers"].ToString() }); // 浠撳簱 
+                            }
+                            else if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "宸ュ簭")
+                            {
+                                FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 浠撳簱 
+                            }
+                        }
+                    }
                     FentityModel.Add("FLot", new JObject() { ["FNumber"] = item["HBatchNo"].ToString() }); //鎵瑰彿
                     FentityModel.Add("FISBACKFLUSH", "true");//  
                     FentityModel.Add("FWorkShopId1", new JObject() { ["FNumber"] = item["HWorkShopNumber"].ToString() }); //  鐢熶骇杞﹂棿
@@ -951,7 +965,21 @@
                     FentityModel.Add("FBaseRealQty", item["鏁伴噺"].ToString());//
                     FentityModel.Add("FOwnerTypeId", "BD_OwnerOrg");//
                     FentityModel.Add("FOwnerId", new JObject() { ["FNumber"] = item["HPrdOrgNumber"].ToString() });//
-                    FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 浠撳簱 
+                    string sErr = "";
+                    if (oSystemParameter.ShowBill(ref sErr))
+                    {
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鐟炰笌绁�")
+                        {
+                            if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "宸ヨ壓璺嚎")
+                            {
+                                FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumbers"].ToString() }); // 浠撳簱 
+                            }
+                            else if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "宸ュ簭")
+                            {
+                                FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 浠撳簱 
+                            }
+                        }
+                    }
                     FentityModel.Add("FLot", new JObject() { ["FNumber"] = item["HBatchNo"].ToString() }); //鎵瑰彿
                     FentityModel.Add("FISBACKFLUSH", "true");//  
                     FentityModel.Add("FWorkShopId1", new JObject() { ["FNumber"] = item["HWorkShopNumber"].ToString() }); //  鐢熶骇杞﹂棿
diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
index 2339256..9c0b28c 100644
--- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
+++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
@@ -25,6 +25,7 @@
 
         //鑾峰彇绯荤粺鍙傛暟
         Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+        public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
 
         #region 鐢熶骇浠诲姟鍗� 淇濆瓨/缂栬緫鍔熻兘
         [Route("Sc_ICMOBill/ICMOBillEdit")]
@@ -392,6 +393,7 @@
             string msg2 = sArray[0].ToString(); //涓昏〃鏁版嵁
             int OperationType = int.Parse(sArray[1].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 3淇敼
             string user = sArray[2].ToString();
+            int HEntryID = int.Parse(sArray[3].ToString());
 
             try
             {
@@ -441,15 +443,15 @@
                 else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                 { //淇敼
                     oCN.RunProc("update Sc_ICMOBillMain  set " +
-                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" +
+                                "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
                                 ", HSeOrderBillNo='" + HSeOrderBillNo + "', HSeOrderInterID=" + HSeOrderInterID + ", HSeOrderEntryID=" + HSeOrderEntryID + ", HEmpID=" + HEmpID + ", HCusID=" + HCusID + "" +
                                 ", HCenterID=" + HCenterID + ",HBomID=" + HBomID + " where HInterID=" + HInterID);
 
                     //鍒犻櫎瀛愯〃
-                    oCN.RunProc("delete from Sc_ICMOBillSub where HInterID='" + HInterID + "'");
+                    oCN.RunProc("delete from Sc_ICMOBillSub where HInterID='" + HInterID + "' and HEntryID='" + HEntryID + "'");
                 }
                 //淇濆瓨瀛愯〃
-                objJsonResult = AddBillSub_NoTable(msg3, HInterID, OperationType);
+                objJsonResult = AddBillSub_NoTable(msg3, HInterID, OperationType, HEntryID);
 
                 if (objJsonResult.code == "0")
                 {
@@ -476,7 +478,7 @@
             }
         }
 
-        public json AddBillSub_NoTable(string msg3, long HInterID, int OperationType)
+        public json AddBillSub_NoTable(string msg3, long HInterID, int OperationType,int HEntryID)
         {
             ClsSc_ICMOBillSub oSub = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsSc_ICMOBillSub>(msg3);
             if (oSub.HQty <= 0 || oSub.HQty == null)
@@ -515,14 +517,14 @@
                 return objJsonResult;
             }
 
-            if (oSub.HBomID == 0)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "BOM涓嶈兘涓虹┖";
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
+            //if (oSub.HBomID == 0)
+            //{
+            //    objJsonResult.code = "0";
+            //    objJsonResult.count = 0;
+            //    objJsonResult.Message = "BOM涓嶈兘涓虹┖";
+            //    objJsonResult.data = null;
+            //    return objJsonResult;
+            //}
 
             oCN.RunProc($@"Insert into Sc_ICMOBillSub 
                 (HInterID,HENTRYID,HQty
@@ -531,7 +533,7 @@
                 ,HMaterID,HUnitID,HRemark,HSourceID,HDeptID,HSTATUS
                 ,HBomID,HEntryCusID
 				,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney) 
-                 values({HInterID},1,{(oSub.HQty == null ? 0 : oSub.HQty)}
+                 values({HInterID},{HEntryID},{(oSub.HQty == null ? 0 : oSub.HQty)}
                 ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
                 ,'{(oSub.HBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HBeginDate.ToString())}','{(oSub.HEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HEndDate.ToString())}'
                 ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},{oSub.HSTATUS}
@@ -547,6 +549,241 @@
         }
         #endregion
 
+        #region 鐢熶骇浠诲姟鍗曞鏍�/鍙嶅鏍稿姛鑳�
+        [Route("Sc_ICMOBill/CheckSc_ICMOReportBill")]
+        [HttpGet]
+        public object CheckSc_ICMOReportBill(string HInterID,int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBill_Check", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬鏍�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 瀹℃牳  2  鍙嶅鏍�
+                if (Type == 1)
+                {
+                    if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                        DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl");
+                        //if (DBUtility.ClsPub.isInt(DSet.Tables[0].Rows[0]["Hback"]) != 0)
+                        //{
+                        //    objJsonResult.code = "0";
+                        //    objJsonResult.count = 1;
+                        //    objJsonResult.Message = "璇ヤ换鍔″崟宸蹭笅鎺ㄦ祦杞崱锛屼笉鍏佽鍙嶅鏍�" + DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[0]["HBackRemark"]);
+                        //    objJsonResult.data = null;
+                        //    return objJsonResult;
+                        //}
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐢熶骇浠诲姟鍗曞叧闂�/鍙嶅叧闂姛鑳�
+        [Route("Sc_ICMOBill/CloseSc_ICMOReportBill")]
+        [HttpGet]
+        public object CloseSc_ICMOReportBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBill_Close", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 鍏抽棴  2  鍙嶅叧闂�
+                if (Type == 1)
+                {
+                    if (!BillOld.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    if (!BillOld.CancelClose(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐢熶骇浠诲姟鍗曚綔搴�/鍙嶄綔搴熷姛鑳�
+        [Route("Sc_ICMOBill/CancellSc_ICMOReportBill")]
+        [HttpGet]
+        public object CancellSc_ICMOReportBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBill_Delete", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愪綔搴�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 浣滃簾  2  鍙嶄綔搴�
+                if (Type == 1)
+                {
+                    if (!BillOld.Cancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    if (!BillOld.AbandonCancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
         #region 鐢熶骇浠诲姟鍗曞垹闄ゅ姛鑳�
         [Route("Sc_ICMOBill/DeltetSc_ICMOReportBill")]
         [HttpGet]
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index 2e51f32..3066b3a 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -1502,6 +1502,24 @@
             return list;
         }
 
+        ///宸ュ簭杩斿伐鐢宠鍗� 涓昏〃
+        ///ClsSc_ProcExchWorkBackBillMain
+        public List<Model.ClsSc_ProcExchWorkBackBillMain> getObjectByJson_ClsSc_ProcExchWorkBackBillMain(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsSc_ProcExchWorkBackBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_ProcExchWorkBackBillMain>>(jsonString);
+            return list;
+        }
+
+        ///宸ュ簭杩斿伐鐢宠鍗� 瀛愯〃
+        ///ClsSb_EquipStockInCheckBillSub
+        public List<Model.ClsSc_ProcExchWorkBackBillSub> getObjectByJson_ClsSc_ProcExchWorkBackBillSub(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsSc_ProcExchWorkBackBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_ProcExchWorkBackBillSub>>(jsonString);
+            return list;
+        }
+
         ///璁惧鎶曚骇妫�楠岄獙鏀跺崟 瀛愯〃
         ///ClsSb_EquipWorkBeforeCheckBillSub
         public List<Model.ClsSb_EquipWorkBeforeCheckBillSub> getObjectByJson_ClsSb_EquipWorkBeforeCheckBillSub(string jsonString)
diff --git a/WebAPI/Models/Gy_RoutingBillSub.cs b/WebAPI/Models/Gy_RoutingBillSub.cs
index 4547697..4d4634f 100644
--- a/WebAPI/Models/Gy_RoutingBillSub.cs
+++ b/WebAPI/Models/Gy_RoutingBillSub.cs
@@ -65,5 +65,10 @@
         public string HProcCheckNote = "";        // varchar(2000)  鏈伐搴忕‘璁よ褰�
         public string HProcWorkNum = "";        // varchar(100)  绋嬪簭鍙�
 
+        //鐟炵惇鏂板姞瀛楁
+        public int HBadWHID { get; set; }  //涓嶈壇鍝佷粨
+        public int HWasterWHID { get; set; } //鎶ュ簾浠�
+        public int HWHID { get; set; }  //鑹搧浠�
+
     }
 }
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index eaecc16..65e571c 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -395,6 +395,7 @@
     <Compile Include="Controllers\CJGL\Cj_StationOutBillController.cs" />
     <Compile Include="Controllers\CJGL\Cj_StationInBillController.cs" />
     <Compile Include="Controllers\CJGL\Cj_StationEntrustOutBillController.cs" />
+    <Compile Include="Controllers\CJGL\Sc_ProcExchWorkBackBillController.cs" />
     <Compile Include="Controllers\CJGL\Sc_WorkBillAutoSortBillMainController.cs" />
     <Compile Include="Controllers\Gy_MateMouldController.cs" />
     <Compile Include="Controllers\Gy_StdMinPickQtyController.cs" />
@@ -979,6 +980,7 @@
     <Folder Include="Views\Sc_MouldRepairSendWorkBill\" />
     <Folder Include="Views\Sc_MouldScrapRequestBill\" />
     <Folder Include="Views\Sc_MouldStatusChangeBill\" />
+    <Folder Include="Views\Sc_ProcessExchangeIssueBill\" />
     <Folder Include="Views\Sc_WorkBillAutoSortBillMain\" />
     <Folder Include="Views\Sc_WorkBillSortBill\" />
     <Folder Include="Views\Sc_WorkDemandPlanBill\" />

--
Gitblit v1.9.1