From e79ef1f195754b2afdc8e1e149d64774c7757ad9 Mon Sep 17 00:00:00 2001
From: ch <37327@LLOOCCY>
Date: 星期四, 20 十月 2022 22:52:14 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/WebAPI.csproj.user                                            |    4 
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormImportController.cs |    5 
 WarM/条码打印/Gy_BarCodeBill.cs                                          |   18 
 WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs              |   44 
 WebAPI/Controllers/CJGL/Cj_CallGoodsBillMainController.cs            |    2 
 WarM/条码打印/Gy_BarCodeBillList.designer.cs                             |   92 +
 WebAPI/Models/Gy_UserUser.cs                                         |   14 
 WebAPI/Controllers/CJGL/Cj_CallGoodsBillBackController.cs            |    1 
 WebAPI/Models/基础资料/Gy_Process.cs                                     |    6 
 WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs           |  375 ++++--
 Model/基础资料/其他基础资料/ClsGy_MateMould_Model.cs                           |   25 
 WebAPI/Controllers/BLL/Xt_UserController.cs                          |  332 ++++++
 DAL/基础资料/其他基础资料/ClsGy_MateMould_Ctl.cs                               |  197 +++
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs               |   22 
 WebAPI/Controllers/WebAPIController.cs                               |  130 ++
 APSM/装配智能排程/Sc_ICMOAutoSortBill.resx                                 |   12 
 WebAPI/Controllers/NewApiController.cs                               |   66 +
 WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs        |   23 
 WebAPI/Controllers/BaseSet/Gy_ProcessController.cs                   |   17 
 WebAPI/Controllers/SCGL/日计划管理/JIT_ICMOSortBillController.cs          |   39 
 WebAPI/ListModels.cs                                                 |   48 
 WebAPI/Models/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs                     |    2 
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs   |  127 +
 APSM/装配智能排程/Sc_ICMOAutoSortBill.cs                                   |    4 
 DAL/DAL.csproj                                                       |    1 
 WebAPI/Models/ClsGy_MateMould.cs                                     |   23 
 WebAPI/WebAPI.csproj                                                 |   17 
 WebAPI/Models/Employee.cs                                            |   30 
 WebAPI/Models/StationBill.cs                                         |    4 
 WebAPI/Models/Gy_UserCustomer.cs                                     |   14 
 WebAPI/Controllers/工资管理/Pay_PurchaseWallclothBillController.cs       |    8 
 Model/Model.csproj                                                   |    1 
 WebAPI/Controllers/LMESController.cs                                 |   41 
 WebAPI/Controllers/CJGL/Cj_SendGoodsBillController.cs                |  106 ++
 WebAPI/Controllers/SCGL/Sc_CallGoodsBackRequestBillController.cs     |    5 
 WebAPI/Models/Gy_UserMater.cs                                        |   14 
 WebAPI/Controllers/Pay_ReportController.cs                           |  372 +++++++
 WarM/条码打印/Gy_BarCodeBillList.cs                                      |  127 ++
 WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs         |   34 
 APSM/Sc_ICMOSortBillFun.cs                                           |    4 
 WebAPI/Service/YqnQbService.cs                                       |  116 ++
 WarM/条码打印/Gy_BarCodeBillList.resx                                    |   24 
 Pub_Class/CustomerCls/ClsXt_SystemParameter.cs                       |   14 
 Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs                   |    5 
 WebAPI/Controllers/CJGL/Cj_StationInBillController.cs                |   22 
 WebAPI/Controllers/Gy_MateMouldController.cs                         |  253 ++++
 WebAPI/Controllers/CJGL/Mes_OrderProcFlowAllReportController.cs      |  170 +++
 APSM/装配智能排程/Sc_ICMOAutoSortBill.designer.cs                          |    9 
 WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs                |   32 
 49 files changed, 2,755 insertions(+), 296 deletions(-)

diff --git a/APSM/Sc_ICMOSortBillFun.cs b/APSM/Sc_ICMOSortBillFun.cs
index 39d6cdb..31418ba 100644
--- a/APSM/Sc_ICMOSortBillFun.cs
+++ b/APSM/Sc_ICMOSortBillFun.cs
@@ -2002,7 +2002,7 @@
                     {
                         if (sLeftQty > 0)
                         {
-                            if (DBUtility.ClsPub.isDate(ds.Tables[0].Rows[i]["日期"]) == DBUtility.ClsPub.isDate(grd.Columns[j].Tag))
+                            if (DBUtility.ClsPub.isDate(ds.Tables[0].Rows[i]["日期"]) == DBUtility.ClsPub.isDate(grd.Columns[j].Tag)) //表格的标题上 保存了日期;
                             {
                                 //如果时间被 上道余量占用 则 跳过
                                 b = false;
@@ -2044,7 +2044,7 @@
                                                 oClsGridValues.Add(oSub);
                                             }
                                         }
-                                        else
+                                        else //卓力不需要考虑加班,下面的这一段不需要
                                         {
                                             if (sLeftQty > sWorkQty * DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["最大剩余工时"]))
                                             {
diff --git "a/APSM/\350\243\205\351\205\215\346\231\272\350\203\275\346\216\222\347\250\213/Sc_ICMOAutoSortBill.cs" "b/APSM/\350\243\205\351\205\215\346\231\272\350\203\275\346\216\222\347\250\213/Sc_ICMOAutoSortBill.cs"
index 18e8fa9..ffc531e 100644
--- "a/APSM/\350\243\205\351\205\215\346\231\272\350\203\275\346\216\222\347\250\213/Sc_ICMOAutoSortBill.cs"
+++ "b/APSM/\350\243\205\351\205\215\346\231\272\350\203\275\346\216\222\347\250\213/Sc_ICMOAutoSortBill.cs"
@@ -692,7 +692,7 @@
                         //判断资源剩余工时,是否大于 生产周期
                         if (DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[j]["剩余工时"]) > sLeftProdTimes)
                         {
-                            if (iLeftQty > 0)
+                            if (iLeftQty > 0) // 生产订单剩余数量
                             {
                                 //在本资源上生产
                                 //获取该生产资源的剩余工时进行排程。
@@ -705,7 +705,7 @@
                                 dsSub = Sc_ICMOSortBillFun.GetWorkSourceTimeBySource(oCn, lSourceID);
                                 if (dsSub == null || dsSub.Tables[0].Rows.Count == 0)
                                 {
-                                    continue;
+                                    continue;//如果没有剩余则 执行下一个生产订单
                                 }
                                 if (dsSub != null  )//不加班排程
                                 {
diff --git "a/APSM/\350\243\205\351\205\215\346\231\272\350\203\275\346\216\222\347\250\213/Sc_ICMOAutoSortBill.designer.cs" "b/APSM/\350\243\205\351\205\215\346\231\272\350\203\275\346\216\222\347\250\213/Sc_ICMOAutoSortBill.designer.cs"
index f05e6a7..396a38b 100644
--- "a/APSM/\350\243\205\351\205\215\346\231\272\350\203\275\346\216\222\347\250\213/Sc_ICMOAutoSortBill.designer.cs"
+++ "b/APSM/\350\243\205\351\205\215\346\231\272\350\203\275\346\216\222\347\250\213/Sc_ICMOAutoSortBill.designer.cs"
@@ -107,6 +107,7 @@
             this.Tool.SuspendLayout();
             this.pPic.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.spc1)).BeginInit();
             this.spc1.Panel1.SuspendLayout();
             this.spc1.Panel2.SuspendLayout();
             this.spc1.SuspendLayout();
@@ -866,12 +867,13 @@
             this.grdSourceBill.Margin = new System.Windows.Forms.Padding(4);
             this.grdSourceBill.Name = "grdSourceBill";
             this.grdSourceBill.ReadOnly = true;
+            this.grdSourceBill.RowHeadersWidth = 51;
             this.grdSourceBill.RowTemplate.Height = 23;
             this.grdSourceBill.Size = new System.Drawing.Size(1571, 745);
             this.grdSourceBill.TabIndex = 20;
             this.grdSourceBill.CellBeginEdit += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.grdSourceBill_CellBeginEdit);
-            this.grdSourceBill.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.grdSourceBill_CellEndEdit);
             this.grdSourceBill.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.grdSourceBill_CellClick);
+            this.grdSourceBill.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.grdSourceBill_CellEndEdit);
             this.grdSourceBill.EditingControlShowing += new System.Windows.Forms.DataGridViewEditingControlShowingEventHandler(this.grdSourceBill_EditingControlShowing);
             this.grdSourceBill.KeyDown += new System.Windows.Forms.KeyEventHandler(this.grdSourceBill_KeyDown);
             // 
@@ -898,6 +900,7 @@
             this.grdMain.Margin = new System.Windows.Forms.Padding(4);
             this.grdMain.Name = "grdMain";
             this.grdMain.ReadOnly = true;
+            this.grdMain.RowHeadersWidth = 51;
             this.grdMain.RowTemplate.Height = 23;
             this.grdMain.Size = new System.Drawing.Size(1571, 745);
             this.grdMain.TabIndex = 21;
@@ -941,6 +944,7 @@
             this.grdSource.Margin = new System.Windows.Forms.Padding(4);
             this.grdSource.Name = "grdSource";
             this.grdSource.ReadOnly = true;
+            this.grdSource.RowHeadersWidth = 51;
             this.grdSource.RowTemplate.Height = 23;
             this.grdSource.Size = new System.Drawing.Size(1571, 0);
             this.grdSource.TabIndex = 0;
@@ -968,6 +972,7 @@
             this.grdICMO.Margin = new System.Windows.Forms.Padding(4);
             this.grdICMO.Name = "grdICMO";
             this.grdICMO.ReadOnly = true;
+            this.grdICMO.RowHeadersWidth = 51;
             this.grdICMO.RowTemplate.Height = 23;
             this.grdICMO.Size = new System.Drawing.Size(1571, 0);
             this.grdICMO.TabIndex = 1;
@@ -994,6 +999,7 @@
             this.grdProcFlow.Margin = new System.Windows.Forms.Padding(4);
             this.grdProcFlow.Name = "grdProcFlow";
             this.grdProcFlow.ReadOnly = true;
+            this.grdProcFlow.RowHeadersWidth = 51;
             this.grdProcFlow.RowTemplate.Height = 23;
             this.grdProcFlow.Size = new System.Drawing.Size(1579, 7);
             this.grdProcFlow.TabIndex = 2;
@@ -1022,6 +1028,7 @@
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
             this.spc1.Panel1.ResumeLayout(false);
             this.spc1.Panel2.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.spc1)).EndInit();
             this.spc1.ResumeLayout(false);
             this.tabControl1.ResumeLayout(false);
             this.tabPage3.ResumeLayout(false);
diff --git "a/APSM/\350\243\205\351\205\215\346\231\272\350\203\275\346\216\222\347\250\213/Sc_ICMOAutoSortBill.resx" "b/APSM/\350\243\205\351\205\215\346\231\272\350\203\275\346\216\222\347\250\213/Sc_ICMOAutoSortBill.resx"
index 607f103..07005d2 100644
--- "a/APSM/\350\243\205\351\205\215\346\231\272\350\203\275\346\216\222\347\250\213/Sc_ICMOAutoSortBill.resx"
+++ "b/APSM/\350\243\205\351\205\215\346\231\272\350\203\275\346\216\222\347\250\213/Sc_ICMOAutoSortBill.resx"
@@ -112,15 +112,15 @@
     <value>2.0</value>
   </resheader>
   <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
-  <metadata name="Tool.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+  <metadata name="Tool.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>17, 17</value>
   </metadata>
-  <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="Tool.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         /9j/4AAQSkZJRgABAQEASABIAAD/4QSARXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAAB
@@ -4204,10 +4204,10 @@
         //////////////////////////////////////////////////////////////////////8A
 </value>
   </data>
-  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>95, 17</value>
   </metadata>
-  <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>25</value>
   </metadata>
 </root>
\ No newline at end of file
diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj
index ff369fb..82212a3 100644
--- a/DAL/DAL.csproj
+++ b/DAL/DAL.csproj
@@ -86,6 +86,7 @@
     <Compile Include="鍩虹璧勬枡\InterFace鍩虹璧勬枡\ClsIF_ORGANIZATIONS_View.cs" />
     <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_FactoryDayOff_Ctl.cs" />
     <Compile Include="鍩虹璧勬枡\鍏敤鍩虹璧勬枡\ClsGy_FactoryDayOff_View.cs" />
+    <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_MateMould_Ctl.cs" />
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_QCCheckProject_View.cs" />
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_StdWorkTimes_Ctl.cs" />
     <Compile Include="婧愬崟\ERP婧愬崟\Cls_S_Sc_ABJJD.cs" />
diff --git "a/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MateMould_Ctl.cs" "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MateMould_Ctl.cs"
new file mode 100644
index 0000000..1a11afe
--- /dev/null
+++ "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MateMould_Ctl.cs"
@@ -0,0 +1,197 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+
+namespace DAL
+{
+    public class ClsGy_MateMould_Ctl : DBUtility.ClsGy_Base_Ctl
+    {
+        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+        //鍘熶唬鐮� 鐢ㄤ簬 鏇挎崲瀛愰」鐩�
+        public string HOldNumber;
+        public List<Model.ClsGy_MateMould_Model> DetailColl = new List<Model.ClsGy_MateMould_Model>();
+
+        //鍙嶅鏍�
+        public bool AbandonCheck(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                oCn.RunProc(" Update Gy_MateMouldInfo set HChecker='',HCheckDate=null Where HItemID=" + lngBillKey.ToString());
+                sReturn = "";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                return false;
+            }
+        }
+
+        //瀹℃牳
+        public bool CheckBill(Int64 lngBillKey, ref string sReturn)
+        {
+
+            try
+            {
+                oCn.RunProc(" Update Gy_MateMouldInfo set HUsed=0,HChecker='" + DBUtility.ClsPub.CurUserName + "',HCheckDate='" + DBUtility.ClsPub.GetServerDate(-1) + "' Where HItemID=" + lngBillKey.ToString());
+                //灏嗗叾浠� 宸ヤ环璁剧疆涓� 鍋滅敤
+                oCn.RunProc(" exec h_p_Gy_MateMouldStopflag   " + lngBillKey.ToString());
+                //
+                sReturn = "";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                return false;
+            }
+        }
+
+
+        //鏂板
+        public override bool AddNew()
+        {
+
+            try
+            {
+                oCn.BeginTran();
+                //鎻掑叆瀛愯〃
+                foreach (Model.ClsGy_MateMould_Model oSub in DetailColl)
+                {
+                    oCn.RunProc("Insert into Gy_MateMouldInfo " +
+                        " (HMaterID,HRelationID,HUnitID" +
+                        ",HBeginDate,HEndDate" +
+                        ",HUsed,HRemark,HMaker,HMakeDate)" +
+                        " values(" + oSub.HMaterID.ToString() + "," + oSub.HRelationID.ToString() + "," + oSub.HUnitID.ToString() +
+                        ",'" + oSub.HBeginDate.ToShortDateString() + "','" + oSub.HEndDate.ToShortDateString() + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "') ");
+                }
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+
+        //淇敼
+        public override bool ModifyByID(Int64 sItemID)
+        {
+            try
+            {
+                oCn.BeginTran();
+                DeleteByID(sItemID);        //鍒犻櫎璁板綍
+                //鎻掑叆琛�
+                foreach (Model.ClsGy_MateMould_Model oSub in DetailColl)
+                {
+                    oCn.RunProc("Insert into Gy_MateMouldInfo " +
+                        " (HMaterID,HRelationID,HUnitID" +
+                        ",HBeginDate,HEndDate" +
+                        ",HUsed,HRemark,HMaker,HMakeDate)" +
+                        " values(" + oSub.HMaterID.ToString() + "," + oSub.HRelationID.ToString() + "," + oSub.HUnitID.ToString() +
+                        ",'" + oSub.HBeginDate.ToShortDateString() + "','" + oSub.HEndDate.ToShortDateString() + "'," + Convert.ToString(oSub.HUsed ? 1 : 0) + ",'" + oSub.HRemark + "','" + oSub.HMaker + "','" + oSub.HMakeDate + "') ");
+                }
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+
+        //鏄剧ず鍗曟嵁
+        public bool ShowBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //鏌ヨ涓昏〃
+                DataSet DsSub = new DataSet();
+                DsSub = oCn.RunProcReturn("Select * from Gy_MateMouldInfo Where HitemID=" + lngBillKey.ToString(), "Gy_MateMouldInfo");
+                DetailColl.Clear();//娓呯┖
+                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
+                {
+                    Model.ClsGy_MateMould_Model oSub = new Model.ClsGy_MateMould_Model();
+                    oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]);
+                    oSub.HRelationID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HRelationID"]);
+                    oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]);
+                    oSub.HBeginDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HBeginDate"]);
+                    oSub.HEndDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEndDate"]);
+                    oSub.HRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HRemark"]);
+                    oSub.HMaker = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMaker"]);
+                    oSub.HMakeDate = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMakeDate"]);
+                    oSub.HChecker = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HChecker"]);
+                    oSub.HCheckDate = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCheckDate"]);
+
+                    DetailColl.Add(oSub);
+                }
+                sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                return false;
+            }
+        }
+
+        //鎵规敼鍗曟嵁
+        //public bool BatchModifyBill(Int64 lngBillKey, double sPrice, ref string sReturn)
+        //{
+        //    try
+        //    {
+        //        oCn.BeginTran();
+        //        oCn.RunProc(" Update Gy_MateMouldInfo set HPrice=" + sPrice.ToString() + "  Where HItemID=" + lngBillKey.ToString());
+        //        sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
+        //        oCn.Commit();
+        //        return true;
+        //    }
+        //    catch (Exception e)
+        //    {
+        //        sReturn = e.Message;
+        //        oCn.RollBack();
+        //        return false;
+        //    }
+        //}
+
+        //鏍规嵁鐗╂枡鍜屽伐搴忚繑鍥炲伐浠�   //b 鍗曚环涓簍ure锛屽畾棰濅负false
+        //public double LoadProcPrice(Int64 sMaterID, Int64 sProcID, Int64 sSourceID, bool b)
+        //{
+        //    double sPrice = 0;
+        //    try
+        //    {
+        //        //鏌ヨ涓昏〃
+        //        DataSet DsSub = new DataSet();
+        //        DsSub = oCn.RunProcReturn("Select top 1 * from Gy_ProcPrice Where HStopflag=0 and HEndDate>=convert(varchar(10),Getdate(),120)  and HChecker<>''  and HMaterID=" + sMaterID.ToString() + " and HProcID=" + sProcID.ToString() + " and HSourceID=" + sSourceID.ToString(), "Gy_ProcPrice");
+        //        if (DsSub == null)
+        //        {
+        //            return 0;
+        //        }
+        //        if (b)
+        //        {
+        //            sPrice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[0]["HPrice"]);
+        //        }
+        //        else
+        //        {
+        //            sPrice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[0]["HFixPrice"]);
+        //        }
+        //        return sPrice;
+        //    }
+        //    catch (Exception e)
+        //    {
+        //        return 0;
+        //    }
+        //}
+
+        //鏋勯�犲嚱鏁�
+        public ClsGy_MateMould_Ctl()
+        {
+            MvarItemKey = "Gy_MateMouldInfo";
+            MvarReportTitle = "妯″叿瀵瑰簲浜у搧璧勬枡";
+        }
+    }
+}
diff --git a/Model/Model.csproj b/Model/Model.csproj
index 1eed0d9..df0774c 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -290,6 +290,7 @@
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_CostCenterDeptRelation_Model.cs" />
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_CostItemAccount_Model.cs" />
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_MateMouldInfo_Model.cs" />
+    <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_MateMould_Model.cs" />
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_MatePriceProperty_Model.cs" />
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_QCCheckProjectMain.cs" />
     <Compile Include="鍩虹璧勬枡\鍏朵粬鍩虹璧勬枡\ClsGy_QCCheckProjectSub.cs" />
diff --git "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MateMould_Model.cs" "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MateMould_Model.cs"
new file mode 100644
index 0000000..06230cf
--- /dev/null
+++ "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MateMould_Model.cs"
@@ -0,0 +1,25 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Model
+{
+    public class ClsGy_MateMould_Model :  DBUtility.ClsGy_Base_Model
+    {
+        public long HItemID;
+        public long HMaterID;
+        public long HRelationID;
+        public long HUnitID;
+        public bool HUsed;         //褰撳墠姝e湪鍚敤
+        public DateTime HBeginDate;
+        public DateTime HEndDate;
+        public string HRemark;
+        public string HMaker;
+        public string HMakeDate;
+        public string HChecker;
+        public string HCheckDate;
+        public string HType;
+        public long HMouldQty;
+    }
+}
diff --git a/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs b/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs
index a1dc33f..99bd236 100644
--- a/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs
+++ b/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs
@@ -135,7 +135,19 @@
                     {
                         omodel.Sc_ICMOReportBill_MESFlag = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
                     }
-
+                    //收料通知单(送货单、到货确认)
+                    if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "Cg_POInStockBill_BarCodeCtl")
+                    {
+                        omodel.Cg_POInStockBill_BarCodeCtl = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
+                    }
+                    if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "Cg_POInStockBill_AutoCheck")
+                    {
+                        omodel.Cg_POInStockBill_AutoCheck = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
+                    }
+                    if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "Cg_POInStockBill_ERPMode")
+                    {
+                        omodel.Cg_POInStockBill_ERPMode = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
+                    }
                     //采购入库单
                     if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "Kf_POStockInBill_AutoCheck")
                     {
diff --git a/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs b/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs
index c0021e9..ae55eff 100644
--- a/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs
+++ b/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs
@@ -22,6 +22,11 @@
         public string Sc_ICMOReportBill_UpdateSourceInterID;    //上传后回填条码档案源单信息
         public string Sc_ICMOReportBill_MESFlag;                //生产汇报单同步MES标记,Y为同步
 
+        //收料通知单(送货单、到货确认)
+        public string Cg_POInStockBill_AutoCheck;       //是否自动审核
+        public string Cg_POInStockBill_ERPMode;         //WMS系统同步至ERP的类型(WISE、CLOUD)
+        public string Cg_POInStockBill_BarCodeCtl;                 //到货确认必须扫码箱条码
+
         //采购入库
         public string Kf_POStockInBill_AutoCheck;       //是否自动审核
         public string Kf_POStockInBill_ERPMode;         //WMS系统同步至ERP的类型(WISE、CLOUD)
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
index b70b19d..73b5cbf 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
@@ -823,10 +823,10 @@
                         Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                                                                                                                     //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
                         LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
-                        LSHlen = 5;
-                        if (sTMNumber.Length != 16)
+                        LSHlen = 4;
+                        if (sTMNumber.Length != 16 && sTMNumber.Length != 15)
                         {
-                            MessageBox.Show("鏉$爜闀垮害涓嶅16浣嶏紝鏄惁鏁版嵁涓嶅叏锛佸埗閫犳湰閮�1浣�:[0] + 鏈哄瀷浠g爜5浣�:[" + HModelName + "] + 骞存湀鏃�5浣�:["+ HBarCodeDate + "] + 鎵规鍙�2浣�:[" + HBarCodeBatchNo  + "]+ 鍘嬬缉鏈�1浣�:["+ HYasuoji + "]+00 ; ");
+                            MessageBox.Show("鏉$爜闀垮害涓嶅15鎴�16浣嶏紝鏄惁鏁版嵁涓嶅叏锛佸埗閫犳湰閮�1浣�:[0] + 鏈哄瀷浠g爜5浣�:[" + HModelName + "] + 骞存湀鏃�4鎴�5浣�:["+ HBarCodeDate + "] + 鎵规鍙�2浣�:[" + HBarCodeBatchNo  + "]+ 鍘嬬缉鏈�1浣�:["+ HYasuoji + "]+00 ; ");
                             return;
                         }
                     }
@@ -838,10 +838,10 @@
                         Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                                                                                                                     //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
                         LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
-                        LSHlen = 5;
-                        if (sTMNumber.Length != 18)
+                        LSHlen = 4;
+                        if (sTMNumber.Length != 18 && sTMNumber.Length != 17)
                         {
-                            MessageBox.Show("鏉$爜闀垮害涓嶅18浣嶏紝鏄惁鏁版嵁涓嶅叏锛佺墿鏂欎唬鐮�11浣�:["+ HMaterNumber.Replace(".", "") + "]+骞存湀鏃�5浣�:["+ HBarCodeDate + "]+鎵规鍙�2浣�:[" + HBarCodeBatchNo  + "];");
+                            MessageBox.Show("鏉$爜闀垮害涓嶅17鎴�18浣嶏紝鏄惁鏁版嵁涓嶅叏锛佺墿鏂欎唬鐮�11浣�:["+ HMaterNumber.Replace(".", "") + "]+骞存湀鏃�4鎴�5浣�:["+ HBarCodeDate + "]+鎵规鍙�2浣�:[" + HBarCodeBatchNo  + "];");
                             return;
                         }
                     }
@@ -868,6 +868,7 @@
                     HMinQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HMinQtyCol].Value);
                     HSumQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HQtyCol].Value);
                     n = 0;
+                    int nn = 0;
                     for (int i = k; i < HBQty; i++)
                     {
                         if (HSumQty - HMinQty > 0)
@@ -984,8 +985,11 @@
                         grdSub.Rows[i].Cells[HGiveAwayFlag2Col] = oCell;
                         k = k + 1;
                         n = n + 1;
-                        oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
+                        //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
+                        nn = nn + 1;
                     }
+                    //鍚庡彴鎵归噺鎵ц璇彞
+                    oCn.RunProc("exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "'," + nn.ToString() + " ");
                 }
             }
             string HWei = "";      //灏炬暟
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.cs"
index 28c328d..0d742fb 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.cs"
@@ -37,6 +37,7 @@
         public string PrintQtyCtl = "";         //鏉$爜鎵撳嵃娆℃暟鎺у埗
         public string UpdatePrintQtyCtl = "";   //鏉$爜鎵撳嵃娆℃暟鏇存柊
         public string SourceQtyCtl = "";        //瓒呮簮鍗曟暟閲忔帶鍒�
+        public string CampanyName = "";         //瀹㈡埛瀹氬埗鍖栧悕绉�
 
         #region  鍥哄畾浠g爜
 
@@ -70,6 +71,7 @@
                 PrintQtyCtl = oSystemParameter.omodel.BarCode_PrintQtyCtl;
                 UpdatePrintQtyCtl = oSystemParameter.omodel.BarCode_UpdatePrintQtyCtl;
                 SourceQtyCtl = oSystemParameter.omodel.BarCode_SourceQtyCtl;
+                CampanyName = oSystemParameter.omodel.WMS_CampanyName;
             }
         }
 
@@ -598,9 +600,134 @@
 
 
 
+
+
+
         #endregion
 
 
+        #region  缁戝畾鎵樻潯鐮�
+        private void bdBarCode_Pack_Click(object sender, EventArgs e)
+        {
+            if (grdMain.CurrentRow == null)
+            {
+                MessageBox.Show("璇峰厛閫夋嫨闇�瑕佺粦瀹氱殑鏉$爜锛�", "鎻愮ず");
+                return;
+            }
+            else
+            {
+                Int64 hmainid = 0;
+                string HItemID = "";
+                string s = "";
+                string HBarCode_Pack = "";
+                for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
+                {
+                    if (s.Length > 4500)
+                    {
+                        HItemID = HItemID + "#" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString());
+                        s = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString());
+                    }
+                    else
+                    {
+                        HItemID = HItemID + "," + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString());
+                        s = s + "," + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString());
+                    }
+
+                    //鑾峰彇鎵樻潯鐮佸彿锛氭墭鏉$爜=鎵�閫夋潯鐮佷腑娴佹按鍙锋渶澶х殑鏉$爜+鈥�-1鈥�
+                    if (hmainid<DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString()))
+                    {
+                        hmainid = DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString());
+                        HBarCode_Pack = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value) + "-1";
+                    }
+                }
+
+                try
+                {
+                    oCn.BeginTran();
+                    Int64 HFlag = 0;
+                    HItemID = HItemID.Remove(0, 1);     //鍘绘帀瀛楃涓茬涓�涓瓧绗�
+                    string[] NewHItemID;
+                    NewHItemID = HItemID.Split(Convert.ToChar("#"));
+
+                    for (int i = 0; i <= NewHItemID.Length - 1; i++)
+                    {
+                        if(i == NewHItemID.Length - 1)
+                        {
+                            HFlag = 1;
+                        }
+                        //鎵樻潯鐮佺粦瀹氬墠鍒ゆ柇锛屽洖濉墭鏉$爜淇℃伅锛岀敓鎴愭墭鏉$爜
+                        DataSet DS = oCn.RunProcReturn("exec h_p_Gy_BarCodeBill_BindPack '" + NewHItemID[i] + "','" + HBarCode_Pack + "','" + CampanyName + "'," + HFlag + ",'" + DBUtility.ClsPub.CurUserName + "'", "h_p_Gy_BarCodeBill_BindPack");
+                        if (DS == null || DS.Tables[0].Rows.Count <= 0)
+                        {
+                            oCn.CnClose();
+                            oCn.CnDispose();
+                            MessageBox.Show("缁戝畾骞剁敓鎴愭墭鏉$爜鍒ゆ柇閿欒锛�");
+                            return;
+                        }
+                        else if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0][0]) == "1")
+                        {
+                            oCn.CnClose();
+                            oCn.CnDispose();
+                            MessageBox.Show(DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HRemark"]));
+                            return;
+                        }
+                    }
+
+                    MessageBox.Show("缁戝畾骞剁敓鎴愭墭鏉$爜鎴愬姛锛�", "鎻愮ず");
+                    Display();
+                    oCn.Commit();
+                }
+                catch (Exception e2)
+                {
+                    oCn.RollBack();
+                    throw (e2);
+                }
+            }
+        }
+
+        #endregion
+
+
+        #region  瑙g粦鎵樻潯鐮�
+        private void jbBarCode_Pack_Click(object sender, EventArgs e)
+        {
+            if (grdMain.CurrentRow == null)
+            {
+                MessageBox.Show("璇峰厛閫夋嫨闇�瑕佽В缁戠殑鏉$爜锛�", "鎻愮ず");
+                return;
+            }
+            if (grdMain.SelectedRows.Count != 1)
+            {
+                MessageBox.Show("涓�娆″彧鍏佽閫変腑涓�琛屾潯鐮佽褰曪紝璇烽噸鏂伴�夋嫨闇�瑕佽В缁戠殑鏉$爜锛�");
+                return;
+            }
+            else
+            {
+                Int64 HItemID = 0;
+                HItemID = DBUtility.ClsPub.isLong(grdMain.SelectedRows[0].Cells[Fun_GetCol("hmainid")].Value);
+
+                //鎵樻潯鐮佽В缁戝墠鍒ゆ柇锛屽洖濉墭鏉$爜淇℃伅锛屽垹闄ゆ墭鏉$爜
+                DataSet DS = oCn.RunProcReturn("exec h_p_Gy_BarCodeBill_UnBindPack " + HItemID + ",'" + CampanyName + "'", "h_p_Gy_BarCodeBill_UnBindPack");
+                if (DS == null || DS.Tables[0].Rows.Count <= 0)
+                {
+                    MessageBox.Show("瑙g粦骞跺垹闄ゆ墭鏉$爜鍒ゆ柇閿欒锛�");
+                    return;
+                }
+                else if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0][0]) == "1")
+                {
+                    MessageBox.Show(DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HRemark"]));
+                    return;
+                }
+                else
+                {
+                    MessageBox.Show("瑙g粦骞跺垹闄ゆ墭鏉$爜鎴愬姛锛�", "鎻愮ず");
+                    Display();
+                }
+            }
+        }
+
+        #endregion
+
 
 
     }
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.designer.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.designer.cs"
index 95a0fd1..35a647e 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.designer.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.designer.cs"
@@ -36,6 +36,9 @@
             this.lbldj = new System.Windows.Forms.Label();
             this.lblCaption = new System.Windows.Forms.Label();
             this.Tool = new System.Windows.Forms.ToolStrip();
+            this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton();
+            this.eXCELToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.cSVToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.dy = new System.Windows.Forms.ToolStripButton();
             this.yl = new System.Windows.Forms.ToolStripButton();
             this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
@@ -59,9 +62,9 @@
             this.timer2 = new System.Windows.Forms.Timer(this.components);
             this.grdMain = new System.Windows.Forms.DataGridView();
             this.grdPrint = new System.Windows.Forms.DataGridView();
-            this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton();
-            this.eXCELToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.cSVToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.bdBarCode_Pack = new System.Windows.Forms.ToolStripButton();
+            this.jbBarCode_Pack = new System.Windows.Forms.ToolStripButton();
+            this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
             this.pPic.SuspendLayout();
             this.panel1.SuspendLayout();
             this.Tool.SuspendLayout();
@@ -141,6 +144,9 @@
             this.toolStripSeparator5,
             this.zf,
             this.fzf,
+            this.toolStripSeparator4,
+            this.bdBarCode_Pack,
+            this.jbBarCode_Pack,
             this.toolStripSeparator6,
             this.tc,
             this.toolStripSeparator3,
@@ -156,6 +162,34 @@
             this.Tool.Stretch = true;
             this.Tool.TabIndex = 16;
             this.Tool.Text = "toolStrip1";
+            // 
+            // toolStripDropDownButton1
+            // 
+            this.toolStripDropDownButton1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.eXCELToolStripMenuItem,
+            this.cSVToolStripMenuItem});
+            this.toolStripDropDownButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButton1.Image")));
+            this.toolStripDropDownButton1.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
+            this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
+            this.toolStripDropDownButton1.Name = "toolStripDropDownButton1";
+            this.toolStripDropDownButton1.Size = new System.Drawing.Size(45, 47);
+            this.toolStripDropDownButton1.Text = "寮曞嚭";
+            this.toolStripDropDownButton1.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
+            this.toolStripDropDownButton1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
+            // 
+            // eXCELToolStripMenuItem
+            // 
+            this.eXCELToolStripMenuItem.Name = "eXCELToolStripMenuItem";
+            this.eXCELToolStripMenuItem.Size = new System.Drawing.Size(112, 22);
+            this.eXCELToolStripMenuItem.Text = "EXCEL";
+            this.eXCELToolStripMenuItem.Click += new System.EventHandler(this.eXCELToolStripMenuItem_Click);
+            // 
+            // cSVToolStripMenuItem
+            // 
+            this.cSVToolStripMenuItem.Name = "cSVToolStripMenuItem";
+            this.cSVToolStripMenuItem.Size = new System.Drawing.Size(112, 22);
+            this.cSVToolStripMenuItem.Text = "CSV";
+            this.cSVToolStripMenuItem.Click += new System.EventHandler(this.cSVToolStripMenuItem_Click);
             // 
             // dy
             // 
@@ -388,33 +422,38 @@
             this.grdPrint.TabIndex = 8;
             this.grdPrint.Visible = false;
             // 
-            // toolStripDropDownButton1
+            // bdBarCode_Pack
             // 
-            this.toolStripDropDownButton1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.eXCELToolStripMenuItem,
-            this.cSVToolStripMenuItem});
-            this.toolStripDropDownButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButton1.Image")));
-            this.toolStripDropDownButton1.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
-            this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
-            this.toolStripDropDownButton1.Name = "toolStripDropDownButton1";
-            this.toolStripDropDownButton1.Size = new System.Drawing.Size(45, 47);
-            this.toolStripDropDownButton1.Text = "寮曞嚭";
-            this.toolStripDropDownButton1.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
-            this.toolStripDropDownButton1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
+            this.bdBarCode_Pack.AutoSize = false;
+            this.bdBarCode_Pack.Image = ((System.Drawing.Image)(resources.GetObject("bdBarCode_Pack.Image")));
+            this.bdBarCode_Pack.ImageAlign = System.Drawing.ContentAlignment.BottomCenter;
+            this.bdBarCode_Pack.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
+            this.bdBarCode_Pack.ImageTransparentColor = System.Drawing.Color.White;
+            this.bdBarCode_Pack.Name = "bdBarCode_Pack";
+            this.bdBarCode_Pack.Size = new System.Drawing.Size(70, 47);
+            this.bdBarCode_Pack.Text = "缁戝畾鎵樻潯鐮�";
+            this.bdBarCode_Pack.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
+            this.bdBarCode_Pack.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
+            this.bdBarCode_Pack.Click += new System.EventHandler(this.bdBarCode_Pack_Click);
             // 
-            // eXCELToolStripMenuItem
+            // jbBarCode_Pack
             // 
-            this.eXCELToolStripMenuItem.Name = "eXCELToolStripMenuItem";
-            this.eXCELToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
-            this.eXCELToolStripMenuItem.Text = "EXCEL";
-            this.eXCELToolStripMenuItem.Click += new System.EventHandler(this.eXCELToolStripMenuItem_Click);
+            this.jbBarCode_Pack.AutoSize = false;
+            this.jbBarCode_Pack.Image = ((System.Drawing.Image)(resources.GetObject("jbBarCode_Pack.Image")));
+            this.jbBarCode_Pack.ImageAlign = System.Drawing.ContentAlignment.BottomCenter;
+            this.jbBarCode_Pack.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
+            this.jbBarCode_Pack.ImageTransparentColor = System.Drawing.Color.Magenta;
+            this.jbBarCode_Pack.Name = "jbBarCode_Pack";
+            this.jbBarCode_Pack.Size = new System.Drawing.Size(70, 47);
+            this.jbBarCode_Pack.Text = "瑙g粦鎵樻潯鐮�";
+            this.jbBarCode_Pack.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
+            this.jbBarCode_Pack.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
+            this.jbBarCode_Pack.Click += new System.EventHandler(this.jbBarCode_Pack_Click);
             // 
-            // cSVToolStripMenuItem
+            // toolStripSeparator4
             // 
-            this.cSVToolStripMenuItem.Name = "cSVToolStripMenuItem";
-            this.cSVToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
-            this.cSVToolStripMenuItem.Text = "CSV";
-            this.cSVToolStripMenuItem.Click += new System.EventHandler(this.cSVToolStripMenuItem_Click);
+            this.toolStripSeparator4.Name = "toolStripSeparator4";
+            this.toolStripSeparator4.Size = new System.Drawing.Size(6, 50);
             // 
             // Gy_BarCodeBillList
             // 
@@ -475,5 +514,8 @@
         private System.Windows.Forms.ToolStripDropDownButton toolStripDropDownButton1;
         private System.Windows.Forms.ToolStripMenuItem eXCELToolStripMenuItem;
         private System.Windows.Forms.ToolStripMenuItem cSVToolStripMenuItem;
+        private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
+        private System.Windows.Forms.ToolStripButton bdBarCode_Pack;
+        private System.Windows.Forms.ToolStripButton jbBarCode_Pack;
     }
 }
\ No newline at end of file
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.resx" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.resx"
index b4b5f1e..2f86434 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.resx"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.resx"
@@ -4029,6 +4029,30 @@
         8iQ1XvVn58xU1WnxG1zAJmn61pmIPgBiIY95z/CSIgAAAABJRU5ErkJggg==
 </value>
   </data>
+  <data name="bdBarCode_Pack.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAG3SURBVDhPfVLdK0NhHH5LSXGn/QculCsfUbtRLl1JbhQh
+        taxNNPnOolY+yhjjQo12oRQ3bhWiZGULF3Kv5Nucbeacs4/HeX/HnJ289tRT7+/5/Z7nfc+vw+bXgvD4
+        NuFZDojpC2DOvwX/1i6YCDPeDXEjDyu+C5oRhrgX1knMZrMQkfe83vNf45+QydlVEtKZDETkvaWlkMlk
+        Chn3LFOhptIQMQsgsHmElvYetHXYcHB4YgpjIzOLJMhKCiIqagoZLUVKJPEWlWg2UlOKs3KmB7ncC3RI
+        yioKMfc5Zc4IkhUMCAOXVgvY4OQsNeJJBYl/qKYM8/ZtQr9QCwlZtFf0j3lI+PiUIQmoaHvg/RJ7mMzX
+        KlDtv6NXUIBjeJoG3mNfiMbNlFXdXGy/MplZAGB1QeqxPtcUHV4lbUkxg7K2PK4XOW7+N3PYBiaoeI5+
+        4uXDINdWu1hhM0evc5SEx7c4nt4TRL51rvEAXLT+MR+fGn8m67YPUXH/IuH+NUbkNZnVB0C5opD8m3Me
+        QndfXpGHXECnlRF/ZILJ09zWhaqGJlTVG+R6ZW0jeAgNadjZ29f72iz36Cpj3yFNGCz1c9N0AAAAAElF
+        TkSuQmCC
+</value>
+  </data>
+  <data name="jbBarCode_Pack.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADSSURBVDhPlZPRDYQgEERpxgaswlCGv/ZBSXwbC6AAC7AA
+        G9hj1huCuMS7SUYi8l4IqhvHUf5tHRWc59ntcRy3dgXrusq2baUppUf3fe8L3mD0J0EPZLsCC0Sdcw8B
+        5hgV4HBaEIt14bIUCYUyTUViCmpYhqFICLM61wq41YcEbeDbDmqwbpEYMKICC0QhRhUwYMQUEGxhS6KC
+        EIJ472We51dYm8+DEr1Cgm8BkhijCeNe575vhZJLk8OdQMCvkhKM+FfwjBIdc4oAgaQtFlpzV0Q+Xg/P
+        E8pc2+4AAAAASUVORK5CYII=
+</value>
+  </data>
   <data name="tc.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
diff --git a/WebAPI/Controllers/BLL/Xt_UserController.cs b/WebAPI/Controllers/BLL/Xt_UserController.cs
index e04db05..2ffba78 100644
--- a/WebAPI/Controllers/BLL/Xt_UserController.cs
+++ b/WebAPI/Controllers/BLL/Xt_UserController.cs
@@ -770,5 +770,337 @@
             }
         }
         #endregion
+
+        #region  鏍规嵁鐢ㄦ埛缂栫爜鏌ユ壘宸插垎閰嶈亴鍛樺垪琛�
+        [Route("Xt_User/UserEmployeelistPlaylist")]
+        [HttpGet]
+        public object UserEmployeelistPlaylist(string HUserID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn("select HEmployeeID HItemID,鑱屽憳浠g爜 HNumber,鑱屽憳鍚嶇О HName from h_v_Gy_UserEmployeeRelationList where HUserID='" + HUserID + "' ", "h_v_Gy_UserEmployeeRelationList");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犺亴鍛樹俊鎭紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐢ㄦ埛鍏宠仈鑱屽憳淇濆瓨
+        [Route("Xt_User/SaveUserEmployee")]
+        [HttpPost]
+        public object SaveUserEmployee([FromBody] JObject msg)
+        {
+            var _value = msg["msg"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+
+            ListModels oListModels = new ListModels();
+            try
+            {
+                List<Models.Employee> lsmain = new List<Models.Employee>();
+                msg2 = msg2.Substring(1, msg2.Length - 2);
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Employee(msg2);
+                oCN.BeginTran();
+                //鍒犻櫎宸茬粡鍏宠仈鐨勬暟鎹�
+                oCN.RunProc("Delete From Gy_UserEmployeeRelation  where HUserID='" + msg3.ToString() + "'");
+                foreach (Models.Employee oItem in lsmain)
+                {
+                    //閲嶆柊鍐欏叆鍏宠仈鏁版嵁
+                    oCN.RunProc("insert into Gy_UserEmployeeRelation (HEmployeeID,HUserID) values ('" + oItem.HItemID + "','" + msg3.ToString() + "')");
+                }
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region  鏍规嵁鐢ㄦ埛缂栫爜鏌ユ壘宸插垎閰嶇敤鎴峰垪琛�
+        [Route("Xt_User/UserPlaylist")]
+        [HttpGet]
+        public object UserPlaylist(string HUserID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn("select HUserID2,鐢ㄦ埛浠g爜 HUserNumber2,鐢ㄦ埛鍚嶇О HUserName2 from h_v_Gy_UserUserList where HUserID='" + HUserID + "' ", "h_v_Gy_UserUserList");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犵敤鎴蜂俊鎭紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐢ㄦ埛鍏宠仈鐢ㄦ埛淇濆瓨
+        [Route("Xt_User/SaveUserUser")]
+        [HttpPost]
+        public object SaveUserUser([FromBody] JObject msg)
+        {
+            var _value = msg["msg"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+
+            ListModels oListModels = new ListModels();
+            try
+            {
+                List<Models.Gy_UserUser> lsmain = new List<Models.Gy_UserUser>();
+                msg2 = msg2.Substring(1, msg2.Length - 2);
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_UserUser(msg2);
+                oCN.BeginTran();
+                //鍒犻櫎宸茬粡鍏宠仈鐨勬暟鎹�
+                oCN.RunProc("Delete From Gy_UserByUserRelation  where HUserID='" + msg3.ToString() + "'");
+                foreach (Models.Gy_UserUser oItem in lsmain)
+                {
+                    //閲嶆柊鍐欏叆鍏宠仈鏁版嵁
+                    oCN.RunProc("insert into Gy_UserByUserRelation (HUserID2,HUserID,HBillType,HUseFlag) values ('" + oItem.HUserID2 + "','" + msg3.ToString() + "','" + "" + "','" + "" + "')");
+                }
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                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("Xt_User/MaterPlaylist")]
+        [HttpGet]
+        public object MaterPlaylist(string HUserID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn("select HMaterID,鐗╂枡浠g爜 HMaterNumber,鐗╂枡鍚嶇О HMaterName from h_v_Gy_UserMaterList where HUserID='" + HUserID + "' ", "h_v_Gy_UserMaterList");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犵墿鏂欎俊鎭紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐢ㄦ埛鍏宠仈鐗╂枡淇濆瓨
+        [Route("Xt_User/SaveUserMater")]
+        [HttpPost]
+        public object SaveUserMater([FromBody] JObject msg)
+        {
+            var _value = msg["msg"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+
+            ListModels oListModels = new ListModels();
+            try
+            {
+                List<Models.Gy_UserMater> lsmain = new List<Models.Gy_UserMater>();
+                msg2 = msg2.Substring(1, msg2.Length - 2);
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_UserMater(msg2);
+                oCN.BeginTran();
+                //鍒犻櫎宸茬粡鍏宠仈鐨勬暟鎹�
+                oCN.RunProc("Delete From Gy_UserMaterRelation  where HUserID='" + msg3.ToString() + "'");
+                foreach (Models.Gy_UserMater oItem in lsmain)
+                {
+                    //閲嶆柊鍐欏叆鍏宠仈鏁版嵁
+                    oCN.RunProc("insert into Gy_UserMaterRelation (HMaterID,HUserID) values ('" + oItem.HMaterID + "','" + msg3.ToString() + "')");
+                }
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                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("Xt_User/CustomerPlaylist")]
+        [HttpGet]
+        public object CustomerPlaylist(string HUserID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn("select HCusID,瀹㈡埛浠g爜 HCustomerNumber,瀹㈡埛鍚嶇О HCustomerName from h_v_Gy_UserCustomerList where HUserID='" + HUserID + "' ", "h_v_Gy_UserCustomerList");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲鎴蜂俊鎭紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐢ㄦ埛鍏宠仈鐗╂枡淇濆瓨
+        [Route("Xt_User/SaveUserCustomer")]
+        [HttpPost]
+        public object SaveUserCustomer([FromBody] JObject msg)
+        {
+            var _value = msg["msg"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+
+            ListModels oListModels = new ListModels();
+            try
+            {
+                List<Models.Gy_UserCustomer> lsmain = new List<Models.Gy_UserCustomer>();
+                msg2 = msg2.Substring(1, msg2.Length - 2);
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_UserCustomer(msg2);
+                oCN.BeginTran();
+                //鍒犻櫎宸茬粡鍏宠仈鐨勬暟鎹�
+                oCN.RunProc("Delete From Gy_UserCustomerRelation  where HUserID='" + msg3.ToString() + "'");
+                foreach (Models.Gy_UserCustomer oItem in lsmain)
+                {
+                    //閲嶆柊鍐欏叆鍏宠仈鏁版嵁
+                    oCN.RunProc("insert into Gy_UserCustomerRelation (HCusID,HUserID) values ('" + oItem.HCusID + "','" + msg3.ToString() + "')");
+                }
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/BaseSet/Gy_ProcessController.cs b/WebAPI/Controllers/BaseSet/Gy_ProcessController.cs
index 105b64e..a995beb 100644
--- a/WebAPI/Controllers/BaseSet/Gy_ProcessController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_ProcessController.cs
@@ -327,6 +327,13 @@
 
                 long HWorkCenterID = list[0].HWorkCenterID;    //宸ヤ綔涓績
 
+                long HBadWHID = list[0].HBadWHID; //涓嶈壇浠撳簱
+                long HWasterWHID = list[0].HWasterWHID; //鎶ュ簾浠撳簱
+                long HBadCountDevelopWHID = list[0].HBadCountDevelopWHID; //鐮斿彂涓嶈壇鍝佷粨搴�
+                long HWWBadWHID = list[0].HWWBadWHID; //濮斿涓嶈壇浠撳簱
+                long HWWWasterWHID = list[0].HWWWasterWHID; //濮斿鎶ュ簾浠撳簱
+                long HWHID = list[0].HWHID; //鑹搧浠撳簱
+
 
                 //鍒ゆ柇鏉冮檺
                 //if (!ClsPub.Security_Log("Gy_Process_Edit", 1, false, msg3))
@@ -365,13 +372,13 @@
                         ",HTypeFlow,HTypeCount,HDeptNumber,HSNo" +
                         ",HLevel,HEndFlag,HStopflag,HRemark,HDeptID,HBarCodeForBase,HProcessID_K3,HBillSubType,HAutoTrunFlag" +
                         ",HFixPrice,HOverFixPrice,HProcMulID,HProcCheckNote" +
-                        ",HUSEORGID,HWorkCenterID) " +
+                        ",HUSEORGID,HWorkCenterID,HBadWHID,HWasterWHID,HBadCountDevelopWHID,HWWBadWHID,HWWWasterWHID,HWHID) " +
                         " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID.ToString() +
                         "," + Convert.ToString(HTypeFlow ? 1 : 0) + "," + Convert.ToString(HTypeCount ? 1 : 0) + ",'" + HDeptNumber + "','" + HSNo.ToString() +
                         "'," + HLevel.ToString() + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "'," + HDeptID +
                         ",'" + HBarCode + "'," + HProcessID_K3 + ",'" +HBillSubType + "'," + Convert.ToString(HAutoTrunFlag ? 1 : 0) +
                         ",'" + HFixPrice.ToString() + "'," + HOverFixPrice.ToString() + "," + HProcMulID.ToString() + ",'" + HProcCheckNote.ToString() + "'" +
-                        ","+ HUSEORGID + "," + HWorkCenterID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
+                        ","+ HUSEORGID + "," + HWorkCenterID + "," + HBadWHID + "," + HWasterWHID + "," + HBadCountDevelopWHID + "," + HWWBadWHID + "," + HWWWasterWHID + "," + HWHID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                     //淇敼涓婄骇涓洪潪鏈骇浠g爜
                     oCN.RunProc("Update Gy_Process set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                     oCN.Commit();
@@ -403,6 +410,12 @@
                         ",HOverFixPrice= " + HOverFixPrice +
                         ",HProcMulID= " + HProcMulID +
                         ",HWorkCenterID= " + HWorkCenterID +
+                        ",HBadWHID= " + HBadWHID +
+                        ",HWasterWHID= " + HWasterWHID +
+                        ",HBadCountDevelopWHID= " + HBadCountDevelopWHID +
+                        ",HWWBadWHID= " + HWWBadWHID +
+                        ",HWWWasterWHID= " + HWWWasterWHID +
+                        ",HWHID= " + HWHID +
                         ",HProcCheckNote='" + HProcCheckNote + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                     //淇敼涓婄骇涓洪潪鏈骇浠g爜
                     oCN.RunProc("Update Gy_Process set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
diff --git a/WebAPI/Controllers/CJGL/Cj_CallGoodsBillBackController.cs b/WebAPI/Controllers/CJGL/Cj_CallGoodsBillBackController.cs
index 18e425f..c71dd6c 100644
--- a/WebAPI/Controllers/CJGL/Cj_CallGoodsBillBackController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_CallGoodsBillBackController.cs
@@ -29,6 +29,7 @@
             public int HOrgID;//缁勭粐
             public string HPZStatus;//鍝佽川纭
             public string HCKStatus;//浠撳簱鎺ユ敹
+            public string Arbitrarily;//浠绘剰鍙傛暟
         }
 
         [Route("Cj_CallGoodsBillBack/CallGoodsBillBackMainList")]
diff --git a/WebAPI/Controllers/CJGL/Cj_CallGoodsBillMainController.cs b/WebAPI/Controllers/CJGL/Cj_CallGoodsBillMainController.cs
index 86f7f43..1a1ca70 100644
--- a/WebAPI/Controllers/CJGL/Cj_CallGoodsBillMainController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_CallGoodsBillMainController.cs
@@ -31,7 +31,7 @@
                     return objJsonResult;
                 }
 
-                ds = oCN.RunProcReturn("select * from h_v_IF_JIT_CallGoodsBillList where 1=1 " + sWhere + " order by hmainid desc", "h_v_IF_JIT_CallGoodsBillList");
+                ds = oCN.RunProcReturn("select * from h_v_IF_JIT_CallGoodsBillList where 1=1 " + sWhere + " and 鍒跺崟浜�='"+user+"'  order by hmainid desc", "h_v_IF_JIT_CallGoodsBillList");
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
diff --git a/WebAPI/Controllers/CJGL/Cj_SendGoodsBillController.cs b/WebAPI/Controllers/CJGL/Cj_SendGoodsBillController.cs
index f4e8778..a34dd50 100644
--- a/WebAPI/Controllers/CJGL/Cj_SendGoodsBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_SendGoodsBillController.cs
@@ -29,6 +29,8 @@
             public string MaterialCode { get; set; }
             public string MaterialName { get; set; }
             public string MaterialModel { get; set; }
+            public string Arbitrarily { get; set; }
+            public string HBillStatus { get; set; }
             public int? HOrgID;
         }
 
@@ -61,7 +63,7 @@
                 JIT_SendGoodsBill com = JsonConvert.DeserializeObject<JIT_SendGoodsBill>(sWhere.ToString());
 
                 ds = oCN.RunProcReturn($"exec h_p_JIT_DeptCheckGoodsBillList_Query '{com.HBeginDate}','{com.HEndDate.AddDays(1).AddSeconds(-1)}','{com.HBillNo}','{com.HDeptName}'," +
-                   $"'{com.MaterialCode}','{com.MaterialName}','{com.MaterialModel}','{com.HOrgID}'", "h_p_JIT_DeptCheckGoodsBillList_Query");
+                   $"'{com.MaterialCode}','{com.MaterialName}','{com.MaterialModel}','{com.HOrgID}','{com.HBillStatus}'", "h_p_JIT_DeptCheckGoodsBillList_Query");
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -115,5 +117,107 @@
             }
         }
         #endregion
+
+        #region 杞﹂棿鏀舵枡鍒楄〃 鎾ら攢纭鏀舵枡
+        [Route("Cj_SendGoodsBill/DeptCheckGoodsBillList_revoke")]
+        [HttpGet]
+        public object DeptCheckGoodsBillList_revoke(string HInterID, string HEntryID, string User)
+        {
+            try
+            {
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("JIT_SendGoodsBill_Check", 1, false, User))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲鏍告潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+              oCN.RunProc($"update JIT_SendGoodsBillMain set HChecker='' ,HCheckDate=null,HBillStatus=1  where HInterID='{HInterID}'");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "宸插畬鎴愭挙閿�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 杞﹂棿鏀舵枡鍒楄〃 鍒犻櫎
+        [Route("Cj_SendGoodsBill/DeleteBill")]
+        [HttpGet]
+        public object DeleteBill(string HInterID,string HEntryID, string User)
+        {
+            try
+            {
+                DataSet dataset = new DataSet();
+                //鑾峰彇杞﹂棿閰嶉�佸崟鎹暟鎹�
+                dataset = oCN.RunProcReturn($"select * from JIT_SendGoodsBillMain a inner join JIT_SendGoodsBillSub b on a.HInterID = b.HInterID where  a.HInterID={HInterID} and HEntryID={HEntryID}  ", "JIT_SendGoodsBillMain");
+
+                var HQty = double.Parse(dataset.Tables[0].Rows[0]["HQty"].ToString());
+
+                //鑾峰彇鎷f枡閰嶉�佸崟鐨勬暟鎹�
+                ds = oCN.RunProcReturn($"select * from JIT_ComplementGoodsBillMain a inner join JIT_ComplementGoodsBillSub b on a.HInterID = b.HInterID where  a.HInterID={(dataset.Tables[0].Rows[0]["HMainSourceInterID"].ToString())} and  b.HMaterID={(dataset.Tables[0].Rows[0]["HMaterID"].ToString())} and  b.HWHID={(dataset.Tables[0].Rows[0]["HWHID"].ToString())} ", "JIT_ComplementGoodsBillMain");
+
+                //鑾峰彇鎷f枡閰嶉�佸崟_LK琛� 鏁版嵁
+                ds = oCN.RunProcReturn($"select * from JIT_ComplementGoodsBillSub_LK where  HInterID={(ds.Tables[0].Rows[0]["HInterID"].ToString())} and HSendQTY<>0 order by HSendQTY", "JIT_SendGoodsBillMain");
+
+                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+                {
+                    var HSendQTY = double.Parse(ds.Tables[0].Rows[i]["HSendQTY"].ToString());
+
+                    //淇敼璋冩嫧鏁伴噺 
+                    oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY-{(HSendQTY > HQty ? HQty : HSendQTY)} where HInterID={ds.Tables[0].Rows[i]["HInterID"].ToString()}  and HEntryID={ds.Tables[0].Rows[i]["HEntryID"].ToString()} ");
+
+                    HQty -= HSendQTY;
+                    if (HQty <= 0)
+                    {
+                        break;
+                    }
+                }
+
+                dataset = oCN.RunProcReturn($"select * from JIT_SendGoodsBillMain a inner join JIT_SendGoodsBillSub b on a.HInterID = b.HInterID where  a.HInterID={HInterID} ", "JIT_SendGoodsBillMain");
+
+                //鍒犻櫎鏁版嵁
+                if (dataset.Tables[0].Rows.Count != 1)
+                {
+                    oCN.RunProc($"delete from  JIT_SendGoodsBillSub  where HInterID='{HInterID}' and HEntryID={HEntryID} ");
+                }
+                else
+                {
+                   
+                    oCN.RunProc($"delete from  JIT_SendGoodsBillMain  where HInterID='{HInterID}'");
+                    oCN.RunProc($"delete from  JIT_SendGoodsBillSub  where HInterID='{HInterID}' and HEntryID={HEntryID} ");
+                }
+              
+
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "宸插畬鎴愬垹闄�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
index 4e55383..c3752c1 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json.Linq;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
 using Pub_Class;
 using System;
 using System.Collections;
@@ -28,6 +29,7 @@
         {
             try
             {
+                List<object> columnNameList = new List<object>();
                 //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
                 if (!DBUtility.ClsPub.Security_Log("MES_StationEntrustInBill_Query", 1, false, user))
                 {
@@ -50,11 +52,20 @@
                     ds = oCN.RunProcReturn(sql, "h_v_MES_StationEntrustInBillList");
                 }
 
+                //娣诲姞鍒楀悕
+                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鍒楀璞$殑鍒楀悕
+                }
+
                 //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                 //{
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
+                objJsonResult.list = columnNameList;
                 objJsonResult.data = ds.Tables[0];
                 return objJsonResult;
                 //}
@@ -138,7 +149,7 @@
         {
             try
             {
-
+                List<object> columnNameList = new List<object>();
                 //寰楀埌淇℃伅
                 ds = oCN.RunProcReturn("exec h_p_Sc_ProcExchBilltransRelationQty " + HProcExchHinteID + "", "h_p_Sc_ProcExchBilltransRelationQty");
                 //鍐欏叆淇℃伅
@@ -150,10 +161,20 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
+                //娣诲姞鍒楀悕
+                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 = "0";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
                 objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
                 return objJsonResult;
             }
             catch (Exception e)
@@ -222,7 +243,7 @@
                 double HMoney = list[0].HMoney;//閲戦
                 string HRemark = list[0].HRemark;//澶囨敞
                 double HTaxRate = list[0].HTaxRate;//绋庣巼
-                long HProcNo = list[0].HProcNo;//娴佹按鍙�
+                string HProcNo = list[0].HProcNo;//娴佹按鍙�
                 string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙�
                 int HWWWorkOrderInterID = 0;//濮斿宸ュ崟鍙峰瓙鍐呯爜
                 int HWWWorkOrderEntryID = 0;//濮斿宸ュ崟鍙蜂富鍐呭悧
@@ -235,6 +256,7 @@
                 string HBarCode = list[0].HBarCode;//鏉″舰鐮�
                 string HAddr = "";
                 string HBarCodeMaker = "";
+                long HPRDOrgID = list[0].HPRDOrgID;//缁勭粐ID
                 if (HProcExchInterID <= 0)
                 {
                     objJsonResult.code = "0";
@@ -251,7 +273,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                if (HProcNo <= 0)
+                if (HProcNo == "")
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
@@ -320,7 +342,7 @@
                     ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationInTime,HSourceID" +
                     ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
                     ",HSupID,HTaxRate,HQty,HPrice,HMoney,HPieceQty" +
-                    ",HProcNo,HOrderProcNO,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID,HMainInterID" +
+                    ",HProcNo,HOrderProcNO,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID,HMainInterID,HPRDOrgID" +
                     ") " +
                     " values('3792','3792'," + HInterID.ToString() + ",'" + HBillNo + "','" + HBillStatus.ToString() + "',getdate(),'" + HMaker + "',getdate()" +
                     ",'" + HYear.ToString() + "','" + HPeriod.ToString() + "','" + HRemark + "','" + HInnerBillNo + "'" +
@@ -328,7 +350,7 @@
                     ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID +
                     "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" +
                     "," + HSupID + "," + HTaxRate + "," + HQty + "," + HPrice + "," + HMoney + "," + HPieceQty +
-                    ",'" + HProcNo + "','" + HOrderProcNO + "'" + ",'" + HWWWorkOrderBillNo + "'" + "," + HWWWorkOrderInterID + "" + "," + HWWWorkOrderEntryID + "," + HMainInterID +
+                    ",'" + HProcNo + "','" + HOrderProcNO + "'" + ",'" + HWWWorkOrderBillNo + "'" + "," + HWWWorkOrderInterID + "" + "," + HWWWorkOrderEntryID + "," + HMainInterID + "," + HPRDOrgID +
                     ") ");
                 }
                 else if ("Modify".Equals(eventType))
diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs
index 03d9a98..a661bf0 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json.Linq;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
 using Pub_Class;
 using System;
 using System.Collections;
@@ -28,6 +29,7 @@
         {
             try
             {
+                List<object> columnNameList = new List<object>();
                 //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
                 if (!DBUtility.ClsPub.Security_Log("MES_StationEntrustOutBill_Query", 1, false, user))
                 {
@@ -50,11 +52,21 @@
                     ds = oCN.RunProcReturn(sql, "h_v_MES_StationEntrustOutBillList");
                 }
 
+                //娣诲姞鍒楀悕
+                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鍒楀璞$殑鍒楀悕
+                }
+
+
                 //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                 //{
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
+                objJsonResult.list = columnNameList;
                 objJsonResult.data = ds.Tables[0];
                 return objJsonResult;
                 //}
@@ -132,7 +144,7 @@
                 double HMoney = list[0].HMoney;//閲戦
                 string HRemark = list[0].HRemark;//澶囨敞
                 double HTaxRate = list[0].HTaxRate;//绋庣巼
-                long HProcNo = list[0].HProcNo;//娴佹按鍙�
+                string HProcNo = list[0].HProcNo;//娴佹按鍙�
                 string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙�
                 int HWWWorkOrderInterID = 0;//濮斿宸ュ崟鍙峰瓙鍐呯爜
                 int HWWWorkOrderEntryID = 0;//濮斿宸ュ崟鍙蜂富鍐呭悧
@@ -157,6 +169,7 @@
                 double HMainSourceInterID = 0;
                 string HMainSourceBillNo = "";
                 string HMainSourceBillType = "3792";
+                long HPRDOrgID = list[0].HPRDOrgID;//缁勭粐ID
                 if (HProcExchInterID <= 0)
                 {
                     objJsonResult.code = "0";
@@ -173,7 +186,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                if (HProcNo <= 0)
+                if (HProcNo == "")
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
@@ -267,7 +280,7 @@
                     ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationOutTime,HSourceID" +
                     ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
                     ",HSupID,HTaxRate,HQty,HPrice,HMoney,HPrice_BHS,HMoney_BHS,HBadCount" +
-                    ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HProcNo,HOrderProcNO,HLastSubProc,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID,HMainInterID" +
+                    ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HProcNo,HOrderProcNO,HLastSubProc,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID,HMainInterID,HPRDOrgID" +
                     ") " +
                     " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" +
                     "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HInnerBillNo + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL +
@@ -275,7 +288,7 @@
                     ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID +
                     "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" +
                     "," + HSupID + "," + HTaxRate + "," + HQty + "," + HPrice + "," + HMoney + "," + HPrice_BHS + "," + HMoney_BHS + "," + HBadCount +
-                    "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + HProcNo + ",'" + HOrderProcNO + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + ",'" + HWWWorkOrderBillNo + "'," + HWWWorkOrderInterID + "," + HWWWorkOrderEntryID + "," + HMainInterID +
+                    "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + HProcNo + ",'" + HOrderProcNO + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + ",'" + HWWWorkOrderBillNo + "'," + HWWWorkOrderInterID + "," + HWWWorkOrderEntryID + "," + HMainInterID + "," + HPRDOrgID +
                     ") ");
                 }
                 else if ("Modify".Equals(eventType))
diff --git a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
index 6b5ed79..9656f57 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json.Linq;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
 using Pub_Class;
 using System;
 using System.Collections;
@@ -71,8 +72,8 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                long HProcNo = list[0].HProcNo;//娴佹按鍙�
-                if (HProcNo <= 0)
+                string HProcNo = list[0].HProcNo;//娴佹按鍙�
+                if (HProcNo == "")
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
@@ -122,6 +123,7 @@
                 string HSourceName = list[0].HSourceName;//鐢熶骇璧勬簮鍚嶇О
                 long HCenterID = list[0].HCenterID;//宸ヤ綔涓績ID
                 string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙�
+                long HPRDOrgID = list[0].HPRDOrgID;//缁勭粐ID
                 //鍗曟嵁瀹屾暣鎬у垽鏂�
                 if (HMaterID <= 0)
                 {
@@ -188,7 +190,7 @@
                     ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationInTime,HSourceID" +
                     ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
                     ",HSupID,HQty,HPrice,HMoney,HPieceQty,HSourceName,HCenterID" +
-                    ",HProcNo,HOrderProcNO,HMainInterID" +
+                    ",HProcNo,HOrderProcNO,HMainInterID,HPRDOrgID" +
                     ") " +
                     " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" +
                     "," + HYear + "," + HPeriod + ",'" + HRemark + "'" +
@@ -196,7 +198,7 @@
                     ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID +
                     "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" +
                     "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HPieceQty + ",'" + HSourceName + "'," + HCenterID +
-                    ",'" + HProcNo + "','" + HOrderProcNO + "'," + HMainInterID +
+                    ",'" + HProcNo + "','" + HOrderProcNO + "','" + HMainInterID + "'," + HPRDOrgID +
                     ") ");
                 }
                 else if ("Modify".Equals(eventType))
@@ -461,6 +463,7 @@
         {
             try
             {
+                List<object> columnNameList = new List<object>();
                 //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
                 if (!DBUtility.ClsPub.Security_Log("Cj_StationInBill_Query", 1, false, user))
                 {
@@ -482,12 +485,21 @@
                     ds = oCN.RunProcReturn(sql, "h_v_MES_StationInBillList");
                 }
 
+                //娣诲姞鍒楀悕
+                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鍒楀璞$殑鍒楀悕
+                }
+
                 //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                 //{
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
                 objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
                 return objJsonResult;
                 //}
                 //else
diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index 1441cb9..3dfb55c 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json.Linq;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
 using Pub_Class;
 using System;
 using System.Collections;
@@ -99,7 +100,7 @@
                 double HMoney = 0;
                 double HBadCount = list[0].HBadCount;//涓嶈壇鏁伴噺
                 long HCenterID = list[0].HCenterID;//宸ヤ綔涓績ID
-                long HProcNo = list[0].HProcNo;//娴佹按鍙�
+                string HProcNo = list[0].HProcNo;//娴佹按鍙�
                 string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙�
                 string HSourceNameList = list[0].HSourceNameList;//璁惧娓呭崟
                 long HMainSourceInterID = list[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
@@ -115,6 +116,7 @@
                 double HPriceRate = list[0].HPriceRate;//绯绘暟
                 double HWorkTimes = list[0].HWorkTimes;//宸ユ椂
                 long HQCCheckID = list[0].HQCCheckID;//妫�楠屽憳ID
+                long HPRDOrgID = list[0].HPRDOrgID;//缁勭粐ID
                 //鍗曟嵁瀹屾暣鎬у垽鏂�
                 if (HProcExchInterID <= 0)
                 {
@@ -132,7 +134,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                if (HProcNo <= 0)
+                if (HProcNo == "")
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
@@ -274,7 +276,7 @@
                     ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate,HSourceID2,HSourceID3,HSourceID4,HSourceID5" +
                     ",HSupID,HQty,HPrice,HMoney,HBadCount,HCenterID,HProcNo,HOrderProcNO,HSourceNameList" +
                     ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" +
-                    ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID,HMainInterID" +
+                    ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID,HMainInterID,HPRDOrgID" +
                     ") " +
                     " values('" + BillType + "','" + HBillSubType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate(),'" + HMouldNum + "'" +
                     "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL +
@@ -283,7 +285,7 @@
                     "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" + "," + HSourceID2 + "," + HSourceID3 + "," + HSourceID4 + "," + HSourceID5 +
                     "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HBadCount + "," + HCenterID + "," + HProcNo + ",'" + HOrderProcNO + "'" + ",'" + HSourceNameList + "'" +
                     "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + Convert.ToString(HLastSubProc ? 1 : 0) +
-                    "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + "," + HMainInterID +
+                    "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + "," + HMainInterID + "," + HPRDOrgID +
                     ") ");
                 }
                 else if ("Modify".Equals(eventType))
@@ -702,6 +704,7 @@
         {
             try
             {
+                List<object> columnNameList = new List<object>();
                 //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
                 if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user))
                 {
@@ -723,11 +726,20 @@
                     ds = oCN.RunProcReturn(sql, "h_v_MES_StationOutBillList");
                 }
 
+                //娣诲姞鍒楀悕
+                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鍒楀璞$殑鍒楀悕
+                }
+
                 //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                 //{
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
+                objJsonResult.list = columnNameList;
                 objJsonResult.data = ds.Tables[0];
                 return objJsonResult;
                 //}
diff --git a/WebAPI/Controllers/CJGL/Mes_OrderProcFlowAllReportController.cs b/WebAPI/Controllers/CJGL/Mes_OrderProcFlowAllReportController.cs
new file mode 100644
index 0000000..00411ab
--- /dev/null
+++ b/WebAPI/Controllers/CJGL/Mes_OrderProcFlowAllReportController.cs
@@ -0,0 +1,170 @@
+锘縰sing DBUtility;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Web.Http;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers.CJGL
+{
+    public class Mes_OrderProcFlowAllReportController : ApiController
+    {
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+        private json objJsonResult = new json();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        DataSet ds;
+
+        #region 杞﹂棿宸ュ簭鍏ㄧ▼璺熻釜鎶ヨ〃 鏌ヨ
+        [Route("Mes_OrderProcFlowAllReport/OrderProcFlowAllReportList")]
+        [HttpGet]
+        public object OrderProcFlowAllReportList(string sWhere)
+        {
+            try
+            {
+                //鍙嶅簭鍒楀寲浼犻�掔殑鍊�
+
+                ds = oCN.RunProcReturn($"exec h_p_Mes_OrderProcFlowAllReport " +sWhere+"", "h_p_Mes_OrderProcFlowAllReport");
+
+                List<object> listCol = new List<object>();
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string str = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    listCol.Add(JsonConvert.DeserializeObject(str));
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = listCol;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ュ簭鍦ㄥ埗鍝佹姤琛�(绾靛悜) 鏌ヨ
+        [Route("Mes_OrderProcFlowAllReport/WIPProcReportList")]
+        [HttpGet]
+        public object WIPProcReportList(string sWhere)
+        {
+            try
+            {
+                //鍙嶅簭鍒楀寲浼犻�掔殑鍊�
+
+                ds = oCN.RunProcReturn($"exec h_p_MES_WIPProcReport_New " + sWhere + "", "h_p_MES_WIPProcReport_New");
+
+                List<object> listCol = new List<object>();
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string str = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    listCol.Add(JsonConvert.DeserializeObject(str));
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = listCol;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 涓嶈壇鏄庣粏鑹巼鎶ヨ〃 鏌ヨ
+        [Route("Mes_OrderProcFlowAllReport/DefectiveDetailedYieldReportList")]
+        [HttpGet]
+        public object DefectiveDetailedYieldReportList(string sWhere)
+        {
+            try
+            {
+                //鍙嶅簭鍒楀寲浼犻�掔殑鍊�
+
+                ds = oCN.RunProcReturn("select * from h_v_DefectiveDetailedYieldReport where 1=1 "+sWhere+" order by HProcID", "h_v_DefectiveDetailedYieldReport");
+
+                List<object> listCol = new List<object>();
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string str = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    listCol.Add(JsonConvert.DeserializeObject(str));
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = listCol;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 涓嶈壇鏄庣粏鑹巼鎶ヨ〃 鏌ヨ
+        [Route("Mes_OrderProcFlowAllReport/StationOutSumReportList")]
+        [HttpGet]
+        public object StationOutSumReportList(string sWhere)
+        {
+            try
+            {
+                //鍙嶅簭鍒楀寲浼犻�掔殑鍊�
+
+                ds = oCN.RunProcReturn("exec h_p_Sc_StationOutSumReport_New " + sWhere + "", "h_p_Sc_StationOutSumReport_New");
+
+                List<object> listCol = new List<object>();
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string str = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    listCol.Add(JsonConvert.DeserializeObject(str));
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = listCol;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Controllers/Gy_MateMouldController.cs b/WebAPI/Controllers/Gy_MateMouldController.cs
new file mode 100644
index 0000000..595a5e4
--- /dev/null
+++ b/WebAPI/Controllers/Gy_MateMouldController.cs
@@ -0,0 +1,253 @@
+锘縰sing Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+using System.Web.Http;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers
+{
+    public class Gy_MateMouldController : ApiController
+    {
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+
+        private json objJsonResult = new json();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        DataSet ds;
+
+        /// <summary>
+        /// 杩斿洖浜у搧涓庡櫒鍏锋竻鍗曞垪琛�
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Gy_MateMould/list")]
+        [HttpGet]
+        public object list(string sWhere, string user, string Organization)
+        {
+            try
+            {
+                //缂栬緫鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log_second("Gy_MateMould", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                string sql1 = string.Format(@"select * from h_v_Gy_MateMouldInfoList where 1 =1 ");//where 缁勭粐鍚嶇О='" + Organization + "'
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn(sql1 + sWhere + " order by HItemID ", "h_v_Gy_MateMouldInfoList");
+                }
+                else
+                {
+                    string sql = sql1 + sWhere + " order by HItemID";
+                    ds = oCN.RunProcReturn(sql, "h_v_Gy_MateMouldInfoList");
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        /// <summary>
+        /// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Gy_MateMould/cx")]
+        [HttpGet]
+        public object cx(long HInterID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn("select * from h_v_Gy_MateMouldInfoList where HitemID=" + HInterID, "h_v_Gy_MateMouldInfoList");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "false锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        #region 浜у搧涓庡櫒鍏锋竻鍗曚繚瀛�
+        [Route("Gy_MateMould/set_SaveBill")]
+        [HttpPost]
+        public object set_SaveBill([FromBody] JObject sMainSub)
+        {
+            var _value = sMainSub["sMainSub"].ToString();
+            string msg1 = _value.ToString();
+            //淇濆瓨鍗曟嵁
+            return objJsonResult = AddBillMain(msg1);
+        }
+
+        public json AddBillMain(string msg1)
+        {
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+            string OperationType = sArray[2].ToString().Trim();
+            string msg4 = sArray[3].ToString();
+            bool bResult;
+            try
+            {
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_ProcPriceList_Edit", 1, false, msg4))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                msg2 = "[" + msg2.ToString() + "]";
+                List<ClsGy_MateMould> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsGy_MateMould>>(msg2);
+                List<ClsGy_MateMould> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsGy_MateMould>>(msg3);
+                DAL.ClsGy_MateMould_Ctl BillNew = new DAL.ClsGy_MateMould_Ctl();
+                BillNew.DetailColl = new List<Model.ClsGy_MateMould_Model>();
+                Model.ClsGy_MateMould_Model BillOld = new Model.ClsGy_MateMould_Model();
+                for (int i = 0; i < subList.ToArray().Length; i++)
+                {
+                    if (i >= 0)//HQty
+                    {
+                        Model.ClsGy_MateMould_Model oSub = new Model.ClsGy_MateMould_Model();
+                        oSub.HMaterID = DBUtility.ClsPub.isLong(subList[i].HMaterIDCol);
+                        oSub.HRelationID = DBUtility.ClsPub.isLong(subList[i].HRelationIDCol);
+                        oSub.HUnitID = DBUtility.ClsPub.isLong(subList[i].HUnitIDCol);
+                        oSub.HBeginDate = DBUtility.ClsPub.isDate(subList[i].HBeginDateCol);
+                        oSub.HEndDate = DBUtility.ClsPub.isDate(subList[i].HEndDateCol);
+                        oSub.HUsed = false;
+                        oSub.HMaker = DBUtility.ClsPub.isStrNull(mainList[0].HMaker);
+                        oSub.HMakeDate = DateTime.Today.ToString();
+                        oSub.HRemark = DBUtility.ClsPub.isStrNull(subList[i].HRemarkCol);
+                        BillNew.DetailColl.Add(oSub);
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鏃犳槑缁嗚淇℃伅!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                if (OperationType.Equals("1.1") || OperationType.Equals("1.2") || OperationType.Equals("2"))
+                {
+                    bResult = BillNew.AddNew();
+                }
+                else
+                {
+                    bResult = BillNew.ModifyByID(DBUtility.ClsPub.isLong(mainList[0].HItemID));
+                }
+                //鎻愮ず
+                if (bResult == true)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    //objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 缂栬緫鏃惰繑鍥炰骇鍝佷笌鍣ㄥ叿娓呭崟淇℃伅
+        [Route("Gy_MateMould/GetMateMouldValue")]
+        [HttpGet]
+        public object GetMateMouldValue(int HItemID)
+        {
+            try
+            {
+                ds = oCN.RunProcReturn("select " +
+                    "a.HItemID,ltrim(a.HMaterID)+'-'+ltrim(a.HRelationID) 妯″叿浜у搧瀵瑰簲琛ㄤ唬鐮�,a.HUnitID,b.HName HRelationNameCol" +
+                    ",b.HNumber HRelationNumberCol,a.HMaterID HMaterIDCol,c.HNumber HMaterNumberCol,c.HName HMaterNameCol,c.HModel HMaterModelCol" +
+                    ",a.HRelationID HRelationIDCol,d.HNumber HUnitNumberCol,d.HName HUnitNameCol" +
+                    ",a.HUnitID HUnitIDCol" +
+                    ",a.HBeginDate HBeginDateCol,a.HEndDate HEndDateCol" +
+                    ",a.HRemark HRemarkCol " +
+                    " from Gy_MateMouldInfo a " +
+                    " left join h_v_Gy_Mould b on a.HRelationID = b.HItemID " +
+                    " left join Gy_Material c on a.HMaterID = c.HItemID " +
+                    " left join Gy_Unit d on a.HUnitID = d.HItemID where a.HItemID = " + HItemID, "Gy_MateMouldInfo");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "false锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Controllers/LMESController.cs b/WebAPI/Controllers/LMESController.cs
index feb8c57..d039b77 100644
--- a/WebAPI/Controllers/LMESController.cs
+++ b/WebAPI/Controllers/LMESController.cs
@@ -174,13 +174,13 @@
         /// <returns></returns>
         [Route("LEMS/MES_Sc_ProcessExchangeIssue")]
         [HttpGet]
-        public object MES_Sc_ProcessExchangeIssue(string HGroupID, string HSourceID, string HEntryId)
+        public object MES_Sc_ProcessExchangeIssue(string HGroupID, string HSourceID, string HSourceSub1ID, string HSourceSub2ID, string HSourceSub3ID, string HEntryId)
         {
             DataSet ds;
             try
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                ds = oCN.RunProcReturn($"exec REALESE_Sc_ProcessExchangeIssue '{HGroupID}','{HSourceID}','{HEntryId}' ", "REALESE_Sc_ProcessExchangeIssue");
+                ds = oCN.RunProcReturn($"exec REALESE_Sc_ProcessExchangeIssue '{HGroupID}','{HSourceID}','{HSourceSub1ID}','{HSourceSub2ID}','{HSourceSub3ID}','{HEntryId}' ", "REALESE_Sc_ProcessExchangeIssue");
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
@@ -196,7 +196,42 @@
                 return objJsonResult;
             }
         }
-
+        /// <summary>
+        /// 宸ュ簭娴佽浆鍗℃寚娲炬棩鏈�
+        /// </summary>
+        /// <returns></returns>
+        [Route("LEMS/MES_Sc_ProcessExchangePlanDate")]
+        [HttpGet]
+        public object MES_Sc_ProcessExchangePlanDate(string HPlanBeginDate, string HPlanEndDate, string HEntryId)
+        {
+            DataSet ds;
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                string sql = string.Format(@"
+update Sc_ProcessExchangeBillSub set 
+HPlanBeginDate = '{0}', 
+HPlanEndDate = '{1}' 
+where cast(HInterID as varchar(20))  +'-'+  cast(HEntryID as varchar(20)) in 
+(
+ select * from fn_Split('{2}',',')
+)", HPlanBeginDate, HPlanEndDate, HEntryId);
+                oCN.RunProc(sql);
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "寮傚父锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
         /// <summary>
         /// 宸ュ簭娴佽浆鍗″弽涓嬭揪
         /// </summary>
diff --git a/WebAPI/Controllers/NewApiController.cs b/WebAPI/Controllers/NewApiController.cs
index 6686d48..cd2e310 100644
--- a/WebAPI/Controllers/NewApiController.cs
+++ b/WebAPI/Controllers/NewApiController.cs
@@ -168,5 +168,71 @@
         {
             return YqnQbService.DeleteProcess(hItemId);
         }
+        /// <summary>
+        /// 鑾峰彇涓嶈壇浠撳簱
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        [Route("api/newBill/getBadWHList")]
+        [HttpGet]
+        public ApiResult<DataSet> GetBadWHList(string sWhere)
+        {
+            return YqnQbService.GetBadWHList(sWhere);
+        }
+        /// <summary>
+        /// 鑾峰彇鎶ュ簾浠撳簱
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        [Route("api/newBill/getWasterWHList")]
+        [HttpGet]
+        public ApiResult<DataSet> GetWasterWHList(string sWhere)
+        {
+            return YqnQbService.GetWasterWHList(sWhere);
+        }
+        /// <summary>
+        /// 鑾峰彇鐮斿彂涓嶈壇鍝佷粨搴�
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        [Route("api/newBill/getBadCountDevelopWHList")]
+        [HttpGet]
+        public ApiResult<DataSet> GetBadCountDevelopWHList(string sWhere)
+        {
+            return YqnQbService.GetBadCountDevelopWHList(sWhere);
+        }
+        /// <summary>
+        /// 鑾峰彇濮斿涓嶈壇浠撳簱
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        [Route("api/newBill/getWWBadWHList")]
+        [HttpGet]
+        public ApiResult<DataSet> GetWWBadWHList(string sWhere)
+        {
+            return YqnQbService.GetWWBadWHList(sWhere);
+        }
+        /// <summary>
+        /// 鑾峰彇濮斿鎶ュ簾浠撳簱
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        [Route("api/newBill/getWWWasterWHList")]
+        [HttpGet]
+        public ApiResult<DataSet> GetWWWasterWHList(string sWhere)
+        {
+            return YqnQbService.GetWWWasterWHList(sWhere);
+        }
+        /// <summary>
+        /// 鑾峰彇鑹搧浠撳簱
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        [Route("api/newBill/getWHList")]
+        [HttpGet]
+        public ApiResult<DataSet> GetWHList(string sWhere)
+        {
+            return YqnQbService.GetWHList(sWhere);
+        }
     }
 }
diff --git a/WebAPI/Controllers/Pay_ReportController.cs b/WebAPI/Controllers/Pay_ReportController.cs
new file mode 100644
index 0000000..18881ba
--- /dev/null
+++ b/WebAPI/Controllers/Pay_ReportController.cs
@@ -0,0 +1,372 @@
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+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
+{
+    /// <summary>
+    /// 宸ヨ祫鎶ヨ〃鑿滃崟鍚勬ā鍧楁帴鍙�
+    /// </summary>
+    public class Pay_ReportController : ApiController
+    {
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+
+        private json objJsonResult = new json();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        DataSet ds;
+
+
+        #region [鑱屽憳鏄庣粏鍒楄〃]
+        [Route("Pay_EmpDet/list")]
+        [HttpGet]
+        public object PayEmpDetList(string HBDate, string HEDate, string HBENumber, string HEENumber, string HBMNumber, string HEMNumber, string HBPNumber, string HEPNumber)
+        {
+            List<object> columnNameList = new List<object>();
+            try
+            {
+                ds = oCN.RunProcReturn("exec h_p_Pay_EmpWorkQtyEntryReport '" + HBDate + "','" + HEDate + "','" + HBENumber + "','" + HEENumber + "','" + HBMNumber + "','" + HEMNumber + "','" + HBPNumber + "','" + HEPNumber + "'", "h_p_Pay_EmpWorkQtyEntryReport");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+                //foreach (DataColumn col in ds.Tables[1].Columns)
+                //{
+
+                //    Type dataType = col.DataType;
+                //    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                //    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                //}
+
+                //if (ds.Tables[1].Rows.Count > 0)
+                //{
+                //    objJsonResult.code = "1";
+                //    objJsonResult.count = ds.Tables[0].Rows.Count;
+                //    objJsonResult.Message = "鑾峰彇璧勬簮缁戝畾鏁版嵁鎴愬姛锛�";
+                //    objJsonResult.data = JsonConvert.DeserializeObject<DataTable>(JsonConvert.SerializeObject(ds.Tables[1], new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }));  //搴忓垪鍖朌ataSet涓殑鏃堕棿鏍煎紡锛岀劧鍚庡啀鍙嶅簭鍒楀寲鍥炴潵
+                //    objJsonResult.list = columnNameList;
+                //    return objJsonResult;
+                //}
+                //else
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳暟鎹紒";
+                //    objJsonResult.data = null;
+                //    objJsonResult.list = columnNameList;
+                //    return objJsonResult;
+                //}
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+                objJsonResult.list = columnNameList;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region [閮ㄩ棬鍙戞斁娓呭崟]
+        [Route("Pay_Department/list")]
+        [HttpGet]
+        public object PayDepartment(int HYear,int HPeriod,int DeptID)
+        {
+            List<object> columnNameList = new List<object>();
+            try
+            {
+                   ds = oCN.RunProcReturn("exec h_p_Pay_PayMentDeptSendList '" + HYear + "','" + HPeriod + "','" + DeptID + "'", "h_p_Pay_PayMentDeptSendList");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+                objJsonResult.list = columnNameList;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region [閮ㄩ棬骞村害鍒嗘瀽]
+        [Route("Pay_DepYearAnalyze/list")]
+        [HttpGet]
+        public object PayDepYearAnalyze(string DeptID,string EDeptID,int Year)
+        {
+            List<object> columnNameList = new List<object>();
+            try
+            {
+                ds = oCN.RunProcReturn("exec h_p_PayMentDeptYearReport '" + DeptID + "','" + EDeptID + "','" + Year + "'", "h_p_PayMentDeptYearReport");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+                objJsonResult.list = columnNameList;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region [宸ヨ祫鍙戞斁娓呭崟]
+        [Route("Pay_Wages/list")]
+        [HttpGet]
+        public object PayWages(int HYear, int HPeriod, int DeptID)
+        {
+            List<object> columnNameList = new List<object>();
+            try
+            {
+                ds = oCN.RunProcReturn("exec h_p_Pay_PayMentSendList '" + HYear + "','" + HPeriod + "','" + DeptID + "'", "h_p_Pay_PayMentSendList");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+                objJsonResult.list = columnNameList;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region [宸ヨ祫骞存姤琛╙
+        [Route("Pay_YearReport/list")]
+        [HttpGet]
+        public object PayYearReport(string DeptID, string EDeptID, int Year)
+        {
+            List<object> columnNameList = new List<object>();
+            try
+            {
+                ds = oCN.RunProcReturn("exec h_p_PayMentYearReport '" + DeptID + "','" + EDeptID + "','" + Year + "'", "h_p_PayMentYearReport");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+                objJsonResult.list = columnNameList;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region [鑰冨嫟姹囨�昏〃]
+        [Route("Pay_Attendance/list")]
+        [HttpGet]
+        public object PayAttendance(int HYear,int HPeriod, int DeptID, string HStatus,string HType)
+        {
+            List<object> columnNameList = new List<object>();
+            try
+            {
+                ds = oCN.RunProcReturn("exec h_p_Pay_WorkTimesList '" + HYear + "','" + HPeriod + "','" + DeptID + "','" + HStatus + "','" + HType+ "'", "h_p_Pay_WorkTimesList");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+                objJsonResult.list = columnNameList;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region [璁′欢宸ヨ祫姹囨�诲垎鏋怾
+        [Route("Pay_ByThePiece_SumAna/list")]
+        [HttpGet]
+        public object PayByThePieceSum(int HYear,int HPeriod,string DeptNumber, string DeptNumber2, string GroupNumber, string GroupNumber2)
+        {
+            List<object> columnNameList = new List<object>();
+            try
+            {
+                ds = oCN.RunProcReturn("exec h_p_Pay_EmpPayMentSumReport '" + HYear + "','" + HPeriod + "','" + DeptNumber + "','" + DeptNumber2 + "','" + GroupNumber + "','" + GroupNumber2 + "'", "h_p_Pay_EmpPayMentSumReport");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+                objJsonResult.list = columnNameList;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region [璁℃椂宸ヨ祫鏄庣粏琛╙
+        [Route("Pay_ByTheTime_Detail/list")]
+        [HttpGet]
+        public object PayByTheTimeDetail(string HBDate, string HEDate, string HBDeptNumber, string HEDeptNumber, string HBEmpNumber, string HEEmpNumber)
+        {
+            List<object> columnNameList = new List<object>();
+            try
+            {
+                ds = oCN.RunProcReturn("exec h_p_Pay_WorkTimesPayMentEntryReport '" + HBDate + "','" + HEDate + "','" + HBDeptNumber + "','" + HEDeptNumber + "','" + HBEmpNumber + "','" + HEEmpNumber + "'", "h_p_Pay_WorkTimesPayMentEntryReport");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+                objJsonResult.list = columnNameList;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region [璁℃椂宸ヨ祫姹囨�昏〃]
+        [Route("Pay_ByTheTime_Sum/list")]
+        [HttpGet]
+        public object PayByTheTimeSum(string HBDate, string HEDate, string HBDeptNumber, string HEDeptNumber, string HBEmpNumber, string HEEmpNumber)
+        {
+            List<object> columnNameList = new List<object>();
+            try
+            {
+                ds = oCN.RunProcReturn("exec h_p_Pay_WorkTimesPayMentSumReport '" + HBDate + "','" + HEDate + "','" + HBDeptNumber + "','" + HEDeptNumber + "','" + HBEmpNumber + "','" + HEEmpNumber + "'", "h_p_Pay_WorkTimesPayMentSumReport");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+                objJsonResult.list = columnNameList;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region [璁′欢宸ヨ祫鏄庣粏琛╙
+        [Route("Pay_ByThePiece_Detail/list")]
+        [HttpGet]
+        public object PayByThePieceDetail(string HBDate, string HEDate, string HBDeptNumber, string HEDeptNumber, string HBEmpNumber, string HEEmpNumber)
+        {
+            List<object> columnNameList = new List<object>();
+            try
+            {
+                ds = oCN.RunProcReturn("exec h_p_Pay_SingleBalBillEntryReport '" + HBDate + "','" + HEDate + "','" + HBDeptNumber + "','" + HEDeptNumber + "','" + HBEmpNumber + "','" + HEEmpNumber + "'", "h_p_Pay_SingleBalBillEntryReport");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+                objJsonResult.list = columnNameList;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region [璁′欢宸ヨ祫姹囨�昏〃]
+        [Route("Pay_ByThePiece_Sum/list")]
+        [HttpGet]
+        public object PayByThePieceSum(string HBDate, string HEDate, string HBDeptNumber, string HEDeptNumber, string HBEmpNumber, string HEEmpNumber)
+        {
+            List<object> columnNameList = new List<object>();
+            try
+            {
+                ds = oCN.RunProcReturn("exec h_p_Pay_SingleBalBillSumReport '" + HBDate + "','" + HEDate + "','" + HBDeptNumber + "','" + HEDeptNumber + "','" + HBEmpNumber + "','" + HEEmpNumber + "'", "h_p_Pay_SingleBalBillSumReport");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+                objJsonResult.list = columnNameList;
+            }
+            return objJsonResult;
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs b/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
index da480d9..fd4b567 100644
--- a/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
+++ b/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
@@ -464,5 +464,37 @@
             return objJsonResult;
         }
         #endregion
+
+        #region[鏍规嵁鏉$爜杩斿洖璁惧淇℃伅]
+        [Route("Gy_EquipFileMain/Gy_MouldFileBillBarCodeInfo")]
+        [HttpGet]
+        public object Gy_MouldFileBillBarCodeInfo(string HBarCode)
+        { 
+            DataTable ds; 
+            List<object> list = new List<object>();
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                //鑾峰彇閰嶄欢椤圭洰缂栬緫鏁版嵁
+                string sql1 = string.Format($"exec h_p_Gy_EquipFileGetInfoByBarCode {HBarCode}");
+                ds = oCN.RunProcReturn(sql1, "h_p_Gy_EquipFileGetInfoByBarCode").Tables[0]; 
+
+                list.Add(ds);//璁惧妗f 
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇璁惧淇℃伅鎴愬姛锛�";
+                objJsonResult.list = list;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛佽妫�鏌ユ潯褰㈢爜锛�" + e.ToString();
+                objJsonResult.data = null;
+            }
+            return objJsonResult;
+        }
+        #endregion
     }
 }
diff --git a/WebAPI/Controllers/SCGL/Sc_CallGoodsBackRequestBillController.cs b/WebAPI/Controllers/SCGL/Sc_CallGoodsBackRequestBillController.cs
index 481154e..8281cd6 100644
--- a/WebAPI/Controllers/SCGL/Sc_CallGoodsBackRequestBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_CallGoodsBackRequestBillController.cs
@@ -30,6 +30,7 @@
             public DateTime HEndDate { get; set; }//缁撴潫鏃堕棿
             public string ProcMul { get; set; }//宸ユ
             public string Hmaker { get; set; }//褰撳墠鐧诲綍浜�
+            public string Arbitrarily { get; set; }//浠绘剰鍙傛暟
         }
 
         [Route("Sc_CallGoodsBackRequestBill/JIT_CallGoodsBackRequestBillList")]
@@ -59,7 +60,7 @@
                 CallGoodsBackRequest com = JsonConvert.DeserializeObject<CallGoodsBackRequest>(sWhere.ToString());
 
                 ds = oCN.RunProcReturn($"exec h_p_JIT_BackGoodsRequestBillList_Query '{com.HBeginDate}','{com.HEndDate.AddDays(1).AddSeconds(-1)}','{com.HBillNo}','{com.MaterialNumber}'," +
-                    $"'{com.MaterialName}','{com.MaterialModel}','{com.HDeptName}','{com.ProcMul}','{com.Hmaker}','{com.HOrgID}'", "h_p_JIT_BackGoodsRequestBillList_Query");
+                        $"'{com.MaterialName}','{com.MaterialModel}','{com.HDeptName}','{com.ProcMul}','{com.Hmaker}','{com.HOrgID}'", "h_p_JIT_BackGoodsRequestBillList_Query");
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -236,7 +237,7 @@
                 for (int i = 0; i < listCa.Count; i++)
                 {
                     ds = oCN.RunProcReturn($"exec h_p_JIT_BackGoods_WHReceive {listCa[i].hmainid},{listCa[i].Hsubid}," +
-                 $"{listCa[i].HSPID},{user}", "h_p_JIT_BackGoods_WHReceive");
+                 $"{listCa[i].HSPID},'{user}'", "h_p_JIT_BackGoods_WHReceive");
 
                     if (ds.Tables[0].Rows[0][0].ToString() == "1")
                     {
diff --git a/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs b/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs
index 8b4ad48..dad1384 100644
--- a/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs
@@ -40,6 +40,7 @@
             public DateTime HEndDate { get; set; }//缁撴潫鏃堕棿
             public int ps { get; set; }//浠呮樉绀烘湭瀹屽叏閰嶉��
             public string user { get; set; }//褰撳墠鐧诲綍浜�
+            public string Arbitrarily { get; set; }//浠绘剰鍙傛暟
         }
 
         [Route("Sc_ComplementGoodBill/ComplementGoodBillList")]
@@ -68,8 +69,8 @@
                 //鍙嶅簭鍒楀寲浼犻�掔殑鍊�
                 ComplementGoodBill com = JsonConvert.DeserializeObject<ComplementGoodBill>(sWhere.ToString());
 
-                    ds = oCN.RunProcReturn($"exec h_p_JIT_CallGoodsPlatForm_Query '{com.HSeOrderBillNo}','{com.DepartmentName}','{com.MaterialNumber}','{com.MaterialName}'," +
-                    $"'{com.MaterialModel}','{com.HICMOBillNo}','{com.CPNumber}','{com.CPName}','{com.CPModel}','{com.HBeginDate}','{com.HEndDate.AddDays(1).AddSeconds(-1)}'," +
+                ds = oCN.RunProcReturn($"exec h_p_JIT_CallGoodsPlatForm_Query '{com.HSeOrderBillNo}','{com.DepartmentName}','{com.MaterialNumber}','{com.MaterialName}'," +
+                    $"'{com.MaterialModel}','{com.HICMOBillNo}','{com.CPNumber}','{com.CPName}','{com.CPModel}'," +
                     $"{com.ps},{com.Organization},'{com.user}' ", "h_p_JIT_CallGoodsPlatForm_Query");
 
                 objJsonResult.code = "1";
@@ -104,6 +105,7 @@
             public long HSTOCKID = 0;//HSTOCKID
             public string 閫�鏂欏師鍥� { get; set; }//閫�鏂欏師鍥�
             public int HMaterialID = 0; //HMaterialIDCol
+            public string 鐗╂枡浠g爜 = ""; 
             public string HSourceBillNo { get; set; }//HSourceBillNoCol
             public int 璋冨嚭浠撳簱鍙敤搴撳瓨鏁伴噺 = 0;//HKFQtyKYCol
             public int 璋冨嚭浠撳簱搴撳瓨鏁伴噺 = 0;//HKFQtySCol
@@ -187,6 +189,33 @@
                 {
                     if (listCa[i].HMaterialID != 0 && listCa[i].鍙枡鏁伴噺 > 0)
                     {
+                        var Hqty = 0.0;
+                        var TuiHqty = 0.0;
+                        //褰撳墠鍗曟嵁宸插彨鏂� 鍜� 宸查��鏂欐暟閲�
+                        ds = oCN.RunProcReturn($@"
+                                               select isnull(a.HQty,0) 宸插彨鏂欐暟閲�,isnull(b.HQty,0) 宸查��鏂欑敵璇锋暟閲� from (
+                                                select sum(b.HQty) HQty,c.HNumber ,b.HSourceBillNo
+                                                from JIT_CallGoodsBillMain a
+                                                join JIT_CallGoodsBillSub b on a.HInterID=b.HInterID
+                                                left join Gy_Material c on b.HMaterID=c.HItemID
+                                                where b.HSourceBillNo='{listCa[i].HSourceBillNo}'
+                                                group by c.HNumber,b.HSourceBillNo
+                                                ) a
+                                                left join (
+                                                select sum(b.HQty) HQty,c.HNumber,b.HSourceBillNo
+                                                from JIT_CallGoodsBackRequestBillMain a
+                                                inner join JIT_CallGoodsBackRequestBillSub b on a.HInterID=b.HInterID
+                                                left join Gy_Material c on b.HMaterID=c.HItemID
+                                                where b.HSourceBillNo='{listCa[i].HSourceBillNo}'
+                                                group by c.HNumber,b.HSourceBillNo
+                                                ) b  on a.HNumber=b.HNumber and a.HSourceBillNo=b.HSourceBillNo where a.HNumber='{listCa[i].鐗╂枡浠g爜}'", "JIT_CallGoodsBillMain");
+
+                        if (ds.Tables[0].Rows.Count > 0)
+                        {
+                            Hqty = double.Parse(ds.Tables[0].Rows[0]["宸插彨鏂欐暟閲�"].ToString());
+                            TuiHqty = double.Parse(ds.Tables[0].Rows[0]["宸查��鏂欑敵璇锋暟閲�"].ToString());
+                        }
+
                         if (listCa[i].鍙枡鏁伴噺 > listCa[i].璁″垝鍙戞枡鏁伴噺)
                         {
                             objJsonResult.code = "0";
@@ -196,7 +225,20 @@
                             return objJsonResult;
                         }
 
-                        if (listCa[i].搴撳瓨鏁伴噺 == 0 && listCa[i].鍙枡鏁伴噺 > 0)
+                        if((listCa[i].鍙枡鏁伴噺 + Hqty - TuiHqty)> listCa[i].璁″垝鍙戞枡鏁伴噺)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙枡鎬绘暟閲忓ぇ浜庤鍒掑彂鏂欐暟閲�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+
+                        ds = oCN.RunProcReturn("select * from h_v_JIT_WarehouseList where 浠撳簱ID=" + listCa[i].璋冨嚭浠撳簱id + "  and  鐗╂枡缂栫爜 = '" + listCa[i].鐗╂枡浠g爜 + "' and 搴撳瓨缁勭粐=" + listCa[i].HOutOrgID, "h_v_JIT_WarehouseList");
+
+                        var HSCWHIDCount= double.Parse(ds.Tables[0].Rows[0]["璋冨嚭浠撳簱鍙敤搴撳瓨鏁伴噺"].ToString());
+
+                        if (HSCWHIDCount == 0 && listCa[i].鍙枡鏁伴噺 > 0)
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
@@ -205,7 +247,7 @@
                             return objJsonResult;
                         }
 
-                        if (listCa[i].鍙枡鏁伴噺 > listCa[i].搴撳瓨鏁伴噺)
+                        if (listCa[i].鍙枡鏁伴噺 > HSCWHIDCount)
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
@@ -232,14 +274,14 @@
                             return objJsonResult;
                         }
 
-                        //if (listCa[i].璋冨嚭浠撳簱鍙敤搴撳瓨鏁伴噺 == 0)
-                        //{
-                        //    objJsonResult.code = "0";
-                        //    objJsonResult.count = 0;
-                        //    objJsonResult.Message = "璋冨嚭浠撳簱鍙敤搴撳瓨鏁伴噺涓�0!";
-                        //    objJsonResult.data = null;
-                        //    return objJsonResult;
-                        //}
+                        if (listCa[i].璋冨嚭浠撳簱id == listCa[i].璋冨叆浠撳簱id)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "璋冨嚭浠撳簱鍜岃皟鍏ヤ粨搴撲笉鑳戒竴鏍�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
 
                         j = 1;
 
@@ -391,7 +433,7 @@
             string msg2 = sArray[0].ToString();
             DBUtility.ClsPub.CurUserName = sArray[1].ToString();
             string HOrgID = sArray[2].ToString();
-            bool flag = false;
+            json flag =new json();
 
             try
             {
@@ -415,47 +457,17 @@
                 {
                     if (listCa[i].閫�鏂欐暟閲� > 0)
                     {
-                        if (listCa[i].閫�鏂欐暟閲� > listCa[i].宸查厤閫佹暟閲�)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "閫�鏂欐暟閲忓ぇ浜庡凡閰嶉�佹暟閲�!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        ds = oCN.RunProcReturn("select sum(d.HQty) HQty from JIT_CallGoodsBackRequestBillSub c inner join JIT_CallGoodsBackBillSub d on c.HInterID = d.HSourceInterID and c.HEntryID = d.HSourceEntryID and c.HMaterID = d.HMaterID " +
-                   $"where c.HSourceInterID={listCa[i].HSouceInterID} and c.HSourceEntryID ={listCa[i].HSourceEntryID} and c.HSourceBillNo = '{listCa[i].HSourceBillNo}' and c.HMaterID={listCa[i].HMaterialID}", "JIT_CallGoodsBackRequestBillSub");
-
-                        if ((double.Parse(ds.Tables[0].Rows[0][0].ToString()==""?"0": ds.Tables[0].Rows[0][0].ToString()) +listCa[i].閫�鏂欐暟閲�) > listCa[i].宸插彨鏂欐暟閲�)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = $"宸茬粡閫�鏂欐暟閲�:{double.Parse(ds.Tables[0].Rows[0][0].ToString())},鍙��鏂欐暟閲忎负:{(listCa[i].宸插彨鏂欐暟閲� - double.Parse(ds.Tables[0].Rows[0][0].ToString()))}!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        if (listCa[i].璋冨叆浠撳簱id == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "璇烽�夋嫨璋冨叆浠撳簱!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        if (listCa[i].璋冨嚭浠撳簱id == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "璇烽�夋嫨璋冨嚭浠撳簱!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        flag = AddICStockTuiBill(listCa[i], "666601", "涓嶈壇鍝侀��鏂�", HOrgID, ref DBUtility.ClsPub.sExeReturnInfo);
+                        flag = (json)AddICStockTuiBill(listCa[i], "666601", "涓嶈壇鍝侀��鏂�", HOrgID);
                         j = 1;
+
+                        if (flag.code == "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = objJsonResult.Message;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                     }
                 }
                 if (j == 0)
@@ -467,22 +479,11 @@
                     return objJsonResult;
                 }
 
-                if (flag)
-                {
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "涓嶈壇鍝侀��鏂欐垚鍔�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "涓嶈壇鍝侀��鏂欏け璐�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "涓嶈壇鍝侀��鏂欐垚鍔�!";
+                objJsonResult.data = null;
+                return objJsonResult;
             }
             catch (Exception e)
             {
@@ -495,10 +496,62 @@
         }
 
         //鏂板
-        public bool AddICStockTuiBill(CallGoodsBill listCa,string HBillType,string HBackType,string HOrgID, ref string sReturn)
+        public object AddICStockTuiBill(CallGoodsBill listCa,string HBillType,string HBackType,string HOrgID)
         {
             try
             {
+              
+
+                if (listCa.閫�鏂欐暟閲� > listCa.宸查厤閫佹暟閲� && listCa.宸查厤閫佹暟閲� > 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "閫�鏂欐暟閲忓ぇ浜庡凡閰嶉�佹暟閲�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (listCa.璋冨叆浠撳簱id == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "璇烽�夋嫨璋冨叆浠撳簱!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (listCa.璋冨嚭浠撳簱id == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "璇烽�夋嫨璋冨嚭浠撳簱!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                var THqty = 0.0;
+                ds = oCN.RunProcReturn($@"
+                                    select sum(b.HQty) HQty,c.HNumber,b.HSourceBillNo
+                                    from JIT_CallGoodsBackRequestBillMain a
+                                    inner join JIT_CallGoodsBackRequestBillSub b on a.HInterID=b.HInterID
+                                    left join Gy_Material c on b.HMaterID=c.HItemID
+                                    where c.HNumber='{listCa.鐗╂枡浠g爜}' and b.HSourceBillNo='{listCa.HSourceBillNo}'
+                                    group by c.HNumber,b.HSourceBillNo
+                                  ", "JIT_CallGoodsBackRequestBillMain");
+
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    THqty = double.Parse(ds.Tables[0].Rows[0]["HQty"].ToString());
+                }
+
+                if ((listCa.閫�鏂欐暟閲� + THqty) > listCa.宸查厤閫佹暟閲�)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "绱閫�鏂欐暟閲忓ぇ浜庡凡閰嶉�佹暟閲�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 Int64 lngBillKey = listCa.HSouceInterID == 0 ? 0 : listCa.HSouceInterID;
                 Int64 lngBillKeyEntry = listCa.HSourceEntryID == 0 ? 0 : listCa.HSourceEntryID;
                 double HQty = (double)(listCa.閫�鏂欐暟閲� == 0 ? 0 : listCa.閫�鏂欐暟閲�);
@@ -524,13 +577,17 @@
                        $" '{HBillType}','{DateTime.Now}','{HBillNo}',{HOrgID},'{ DBUtility.ClsPub.CurUserName}','{DateTime.Now}','','',0,0,0,''," +
                        $" 0, 0, {listCa.HOutOrgID}, {HOrgID}, 0,'{HBackType}')");
                  
-                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
                 oCN.Commit();
-                return true;
+
+                objJsonResult.code = "1";
+                objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
+                return objJsonResult;
             }
             catch (Exception e)
             {
-                sReturn = e.Message;
+                objJsonResult.code = "0";
+                objJsonResult.Message = e.Message; ;
+                return objJsonResult;
                 throw (e);
             }
         }
@@ -563,36 +620,23 @@
                 List<CallGoodsBill> listCa = new List<CallGoodsBill>();
                 //鑾峰彇琛ㄦ牸鏁版嵁闆嗗悎
                 listCa = JsonConvert.DeserializeObject<List<CallGoodsBill>>(msg2.ToString());
-                bool flag = false;
+                json flag = new json();
 
                 int j = 0;
                 for (int i = 0; i < listCa.Count; i++)
                 {
                     if (listCa[i].閫�鏂欐暟閲� > 0)
                     {
-                        if (listCa[i].閫�鏂欐暟閲� > listCa[i].宸查厤閫佹暟閲�)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "閫�鏂欐暟閲忓ぇ浜庡凡閰嶉�佹暟閲�!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        ds = oCN.RunProcReturn("select sum(d.HQty) HQty from JIT_CallGoodsBackRequestBillSub c inner join JIT_CallGoodsBackBillSub d on c.HInterID = d.HSourceInterID and c.HEntryID = d.HSourceEntryID and c.HMaterID = d.HMaterID " +
-                   $"where c.HSourceInterID={listCa[i].HSouceInterID} and c.HSourceEntryID ={listCa[i].HSourceEntryID} and c.HSourceBillNo = '{listCa[i].HSourceBillNo}' and c.HMaterID={listCa[i].HMaterialID}", "JIT_CallGoodsBackRequestBillSub");
-
-                        if ((double.Parse(ds.Tables[0].Rows[0][0].ToString() == "" ? "0" : ds.Tables[0].Rows[0][0].ToString()) + listCa[i].閫�鏂欐暟閲�) > listCa[i].宸插彨鏂欐暟閲�)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = $"宸茬粡閫�鏂欐暟閲�:{double.Parse(ds.Tables[0].Rows[0][0].ToString())},鍙��鏂欐暟閲忎负:{(listCa[i].宸插彨鏂欐暟閲� - double.Parse(ds.Tables[0].Rows[0][0].ToString()))}!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        flag = AddICStockTuiBill(listCa[i], "666602", " 浣欓噺閫�鏂�", HOrgID, ref DBUtility.ClsPub.sExeReturnInfo);
+                        flag =(json)AddICStockTuiBill(listCa[i], "666602", " 浣欓噺閫�鏂�", HOrgID);
                         j = 1;
+                        if (flag.code == "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = objJsonResult.Message;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                     }
                 }
                 if (j == 0)
@@ -604,23 +648,11 @@
                     return objJsonResult;
                 }
 
-                if (flag)
-                {
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "浣欓噺閫�鏂欐垚鍔�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "浣欓噺閫�鏂欏け璐�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-             
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "浣欓噺閫�鏂欐垚鍔�!";
+                objJsonResult.data = null;
+                return objJsonResult;
             }
             catch (Exception e)
             {
@@ -661,35 +693,22 @@
                 //鑾峰彇琛ㄦ牸鏁版嵁闆嗗悎
                 listCa = JsonConvert.DeserializeObject<List<CallGoodsBill>>(msg2.ToString());
 
-                bool flag = false;
+                json flag = new json();
                 int j = 0;
                 for (int i = 0; i < listCa.Count; i++)
                 {
                     if (listCa[i].閫�鏂欐暟閲� > 0)
                     {
-                        if (listCa[i].閫�鏂欐暟閲� > listCa[i].宸查厤閫佹暟閲�)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "閫�鏂欐暟閲忓ぇ浜庡凡閰嶉�佹暟閲�!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        ds = oCN.RunProcReturn("select sum(d.HQty) HQty from JIT_CallGoodsBackRequestBillSub c inner join JIT_CallGoodsBackBillSub d on c.HInterID = d.HSourceInterID and c.HEntryID = d.HSourceEntryID and c.HMaterID = d.HMaterID " +
-                   $"where c.HSourceInterID={listCa[i].HSouceInterID} and c.HSourceEntryID ={listCa[i].HSourceEntryID} and c.HSourceBillNo = '{listCa[i].HSourceBillNo}' and c.HMaterID={listCa[i].HMaterialID}", "JIT_CallGoodsBackRequestBillSub");
-
-                        if ((double.Parse(ds.Tables[0].Rows[0][0].ToString() == "" ? "0" : ds.Tables[0].Rows[0][0].ToString()) + listCa[i].閫�鏂欐暟閲�) > listCa[i].宸插彨鏂欐暟閲�)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = $"宸茬粡閫�鏂欐暟閲�:{double.Parse(ds.Tables[0].Rows[0][0].ToString())},鍙��鏂欐暟閲忎负:{(listCa[i].宸插彨鏂欐暟閲� - double.Parse(ds.Tables[0].Rows[0][0].ToString()))}!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-
-                        flag = AddICStockTuiBill(listCa[i], "666603", "鎶ュ簾閫�鏂�", HOrgID, ref DBUtility.ClsPub.sExeReturnInfo);
+                        flag =(json) AddICStockTuiBill(listCa[i], "666603", "鎶ュ簾閫�鏂�", HOrgID);
                         j = 1;
+                        if (flag.code == "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = objJsonResult.Message;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                     }
                 }
                 if (j == 0)
@@ -701,22 +720,11 @@
                     return objJsonResult;
                 }
 
-                if (flag)
-                {
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鎶ュ簾閫�鏂欐垚鍔�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鎶ュ簾閫�鏂欏け璐�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎶ュ簾閫�鏂欐垚鍔�!";
+                objJsonResult.data = null;
+                return objJsonResult;
             }
             catch (Exception e)
             {
@@ -936,5 +944,68 @@
         }
         #endregion
 
+        #region 鐢熶骇鍙枡骞冲彴  浠撳簱搴撳瓨鍒楄〃
+
+        [Route("Sc_ComplementGoodBill/GetWarehouseList_JIT")]
+        [HttpGet]
+        public object GetWarehouseList_JIT(string sWhere)
+        {
+            try
+            {
+                ds = oCN.RunProcReturn("select * from h_v_JIT_WarehouseList where 1=1 "+ sWhere, "h_v_JIT_WarehouseList"); 
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐢熶骇鍙枡骞冲彴  鏈敓鎴愭嫞鏂欑敵璇峰崟  鏈敓鎴愰��鏂欏崟
+        [Route("Sc_ComplementGoodBill/NotGeneratedMaterialList")]
+        [HttpGet]
+        public object NotGeneratedMaterialList(string sWhere, string user)
+        {
+            try
+            {
+                //鏌ヨ鍙枡鍗� 鏈敓鎴� 鎷f枡鍗� 鐨勬潯鏁�
+                //鏌ヨ閫�鏂欑敵璇峰崟  鏈敓鎴� 閫�鏂欏崟鐨� 鏉℃暟
+                ds = oCN.RunProcReturn($@"select count(*) 鏈敓鎴�	from JIT_CallGoodsBackRequestBillMain as a
+                                        inner join JIT_CallGoodsBackRequestBillSub as b on a.HInterID=b.HInterID
+                                         where  a.HISCheck =0   and a.HOrgID={sWhere} 
+                                        and a.HMaker = '{user}'
+	                                        union all
+                                        select count(*) 鏈敓鎴�  from JIT_CallGoodsBillMain a
+                                        join JIT_CallGoodsBillSub b on a.HInterID=b.HInterID
+                                         where b.HPSQty=0  and a.HOrgID={sWhere} 
+                                        and a.HMaker = '{user}'", "JIT_CallGoodsBackRequestBillMain");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs b/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs
index 1957e66..950740a 100644
--- a/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs
@@ -32,6 +32,7 @@
             public string HDeptName { get; set; }//閮ㄩ棬
             public string HJLStatus { get; set; }//鎷f枡鐘舵��
             public string user { get; set; }//鍒跺崟浜�
+            public string Arbitrarily { get; set; }//浠绘剰鍙傛暟
         }
 
         [Route("Sc_ComplementGoods/ComplementGoodsList")]
@@ -60,9 +61,8 @@
                 //鍙嶅簭鍒楀寲浼犻�掔殑鍊�
                 ComplementGoods com = JsonConvert.DeserializeObject<ComplementGoods>(sWhere.ToString());
 
-
                 ds = oCN.RunProcReturn($"exec h_p_JIT_ComplementGoodsBillList_Query '{com.MaterialNumber}','{com.MaterialName}','{com.MaterialModel}','{com.HGD}'," +
-                    $"'{com.HWHName}','{com.HDeptName}','{com.Organization}','{com.user}','{com.HJLStatus}','{com.HBeginDate}','{com.HEndDate}'", "h_p_JIT_ComplementGoodsBillList_Query");
+                       $"'{com.HWHName}','{com.HDeptName}','{com.Organization}','{com.user}','{com.HJLStatus}','{com.HBeginDate}','{com.HEndDate}'", "h_p_JIT_ComplementGoodsBillList_Query");
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -319,36 +319,27 @@
 
                     DataSet dsTable = new DataSet();
                     //鏌ヨJIT_ComplementGoodsBillSub_LK
-                    dsTable = oCN.RunProcReturn($"select  * from JIT_ComplementGoodsBillSub_LK where HMaterID={listCa[i].HMaterID}  and HInterID={SourceInterID} order by HSourceInterID ", "JIT_ComplementGoodsBillSub_LK");
+                    dsTable = oCN.RunProcReturn($"select  * from JIT_ComplementGoodsBillSub_LK where HMaterID={listCa[i].HMaterID}  and HInterID={SourceInterID} and HCallQTY<>HSendQTY  order by HSourceInterID ", "JIT_ComplementGoodsBillSub_LK");
 
+                    var HqtyCount = double.Parse(listCa[i].鏈鎷f枡鏁伴噺.ToString());
                     for (int j = 0; j < dsTable.Tables[0].Rows.Count; j++)
                     {
-                        if (double.Parse(dsTable.Tables[0].Rows[j]["HCallQTY"].ToString()) != double.Parse(dsTable.Tables[0].Rows[j]["HSendQTY"].ToString()))
-                        {
-                            if (double.Parse(dsTable.Tables[0].Rows[j]["HSendQTY"].ToString()) + listCa[i].鏈鎷f枡鏁伴噺 > double.Parse(dsTable.Tables[0].Rows[j]["HCallQTY"].ToString()))
-                            {
-                                var HCallQTY = double.Parse(dsTable.Tables[0].Rows[j]["HCallQTY"].ToString()) - double.Parse(dsTable.Tables[0].Rows[j]["HSendQTY"].ToString());
-                                //淇敼璋冩嫧鏁伴噺 瓒呭嚭閮ㄥ垎缁欎簣涓嬩竴鍒楁暟鎹�
-                                oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{HCallQTY} where HMaterID={listCa[i].HMaterID} " +
-                                    $" and HSourceInterID={double.Parse(dsTable.Tables[0].Rows[j]["HSourceInterID"].ToString())} and HInterID={SourceInterID} ");
+                        var HCallQTY = double.Parse(dsTable.Tables[0].Rows[j]["HCallQTY"].ToString()) - double.Parse(dsTable.Tables[0].Rows[j]["HSendQTY"].ToString());
 
-                                oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{(listCa[i].鏈鎷f枡鏁伴噺 - HCallQTY)} where HMaterID={listCa[i].HMaterID} " +
-                                   $" and HSourceInterID={dsTable.Tables[0].Rows[j + 1]["HSourceInterID"].ToString()} and HInterID={SourceInterID} ");
-                                break;
-                            }
-                            else
-                            {
-                                //淇敼璋冩嫧鏁伴噺
-                                oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{listCa[i].鏈鎷f枡鏁伴噺} where HMaterID={listCa[i].HMaterID} " +
-                                    $" and HSourceInterID={dsTable.Tables[0].Rows[j]["HSourceInterID"].ToString()} and HInterID={SourceInterID} ");
-                                break;
-                            }
+                        //淇敼璋冩嫧鏁伴噺 
+                        oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{(HCallQTY < HqtyCount ? HCallQTY : HqtyCount)} where HMaterID={listCa[i].HMaterID} " +
+                            $" and HSourceInterID={double.Parse(dsTable.Tables[0].Rows[j]["HSourceInterID"].ToString())} and HInterID={SourceInterID} ");
+
+                        HqtyCount -= HCallQTY;
+                        if (HqtyCount <= 0)
+                        {
+                            break;
                         }
                     }
                 }
 
-                //鍚屾閲戣澏鐩存帴璋冩嫧鍗�
-                objJsonResult = AddSendGoodsBillSynChronizAtion(HBillNo);
+                ////鍚屾閲戣澏鐩存帴璋冩嫧鍗�
+                //objJsonResult = AddSendGoodsBillSynChronizAtion(HBillNo);
 
                 oCN.Commit();
 
@@ -371,11 +362,9 @@
             }
             catch (Exception e)
             {
-                oCN.RollBack();
-
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = e.Message;
+                objJsonResult.Message = objJsonResult.Message;
                 return objJsonResult;
                 throw (e);
             }
@@ -455,6 +444,7 @@
                     }
                     else
                     {
+                        oCN.RollBack();
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
                         objJsonResult.Message = result;
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 1cdba47..563f79c 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"
@@ -41,7 +41,7 @@
                 omdelMian = JsonConvert.DeserializeObject<Sc_WorkBillSortBillMain>(sWhere);
 
                 ds = oCN.RunProcReturn($"exec h_p_JIT_Sc_WorkBillSortBill_Query '{omdelMian.HPlanBeginDate}',{(omdelMian.HProdORGID == null ? 0 : omdelMian.HProdORGID)},'{omdelMian.HSeOrderBillNo}'" +
-                    $",'{omdelMian.HPlanEndDate.AddDays(1).AddSeconds(-1)}',{omdelMian.HMaterID},'{omdelMian.HICMOBillNo}',{omdelMian.HWorkShopID}", "h_p_JIT_Sc_WorkBillSortBill_Query");
+                    $",'{omdelMian.HPlanEndDate.AddDays(1)}',{omdelMian.HMaterID},'{omdelMian.HICMOBillNo}',{omdelMian.HWorkShopID}", "h_p_JIT_Sc_WorkBillSortBill_Query");
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -73,7 +73,7 @@
             {
                 if (num == 1)
                 {
-                    ds = oCN.RunProcReturn($"select isnull(DATEDIFF(DAY,GETDATE(),CONVERT(varchar(10),max(HMasterDate),20)),0) DayNum from  Sc_WorkBillSortBillSub where HInterID in ({sWhere}) and  HMasterDate>=CONVERT(varchar(10),GETDATE(),20) and HLockedSub=1", "Sc_WorkBillSortBillSub");
+                    ds = oCN.RunProcReturn($"select isnull(DATEDIFF(DAY,GETDATE(),CONVERT(varchar(10),max(HMasterDate),20))+1,0) DayNum from  Sc_WorkBillSortBillSub where HInterID in ({sWhere}) and  HMasterDate>=CONVERT(varchar(10),GETDATE(),20) and HLockedSub=1", "Sc_WorkBillSortBillSub");
                 }
                 else if (num == 2)
                 {
@@ -187,8 +187,9 @@
                         var HOrderLev = list[i]["璁㈠崟绛夌骇"].ToString();
                         var HMainSourceInterID = list[i]["婧愬崟涓诲唴鐮�"].ToString();
                         var HMainSourceEntryID = list[i]["婧愬崟瀛愬唴鐮�"].ToString();
+                        var HPlanQty = list[i]["璁″垝鏁伴噺"].ToString();
 
-                        if (HSourceID == "")
+                        if (HSourceID == ""|| HSourceID == "0")
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
@@ -197,7 +198,7 @@
                             return objJsonResult;
                         }
 
-                        ds = oCN.RunProcReturn($"select * from  Sc_WorkBillSortBillMain where HMainSourceEntryID={HMainSourceEntryID}" +
+                        ds = oCN.RunProcReturn($"select * from  Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
                             $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain");
                         if (ds.Tables[0].Rows.Count > 0)
                         {
@@ -219,14 +220,55 @@
                             " HMaterID, HMaterName, HMaterModel, HUnitID, HSeOrderBillQty," +
                             " HOrderNeedQty, HSplitQty, HDayPlanSumQty,HPlanBeginDate," +
                             "HSeOrderBillNo,HICMOBillType,HSourceStockInQty,HLeftPlanQty,HOrderLev,HPreparatDate," +
-                            "HMainSourceInterID,HMainSourceEntryID)values" +
+                            "HMainSourceInterID,HMainSourceEntryID,HICMOInterID_Sec,HICMOEntryID_Sec,HPlanQty)values" +
                             $"({HInterID},'{HBillNo}',{DateTime.Now.Year},{DateTime.Now.Month},'{BillType}'," +
                             $"'{BillType}',GETDATE(),1,'{user}',getdate(),'{HICMOBillNo}','{HOrderType}'," +
                             $"{(HICMOEntrySEQ == "" ? 0.ToString() : HICMOEntrySEQ)},{(HWorkShopID == "" ? 0.ToString() : HWorkShopID)},{(HSourceID == "" ? 0.ToString() : HSourceID)}, {(HYX == "" ? 0.ToString() : HYX)}, {(HProdORGID == "" ? 0.ToString() : HProdORGID)}," +
                             $" {(HMaterID == "" ? 0.ToString() : HMaterID)}, '{HMaterName}', '{HMaterModel}', {(HUnitID == "" ? 0.ToString() : HUnitID)}, {(HSeOrderBillQty == "" ? 0.ToString() : HSeOrderBillQty)}," +
                             $" 0, {(HSplitQty == "" ? 0.ToString() : HSplitQty)}, {(HDayPlanSumQty == "" ? 0.ToString() : HDayPlanSumQty)},'{HPlanBeginDate}'," +
                             $"'{HSeOrderBillNo}','{HICMOBillType}',{(HSourceStockInQty == "" ? 0.ToString() : HSourceStockInQty)},{(HLeftPlanQty == "" ? 0.ToString() : HLeftPlanQty)},'{HOrderLev}',getdate()," +
-                            $"{HMainSourceInterID},{HMainSourceEntryID})");
+                            $"{HMainSourceInterID},{HMainSourceEntryID},{HMainSourceInterID},{HMainSourceEntryID},{HPlanQty})");
+                    }
+                    else
+                    {
+                        var HMainSourceInterID = list[i]["婧愬崟涓诲唴鐮�"].ToString();
+                        var HMainSourceEntryID = list[i]["婧愬崟瀛愬唴鐮�"].ToString();
+                        var HICMOBillNo = list[i]["鐢熶骇璁㈠崟鍙�"].ToString();
+                        var HICMOEntrySEQ = list[i]["鐢熶骇璁㈠崟鏄庣粏琛屽彿"].ToString();
+                        var HSourceID = list[i]["HSourceID"].ToString();
+                        var HYX = list[i]["浼樺厛绾�"].ToString();
+
+                        if (HSourceID == "" || HSourceID == "0")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愪笉鑳戒负绌�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        var str = 0;
+                        if (!int.TryParse(HYX, out str))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = $"绗瑊i + 1}琛屼紭鍏堢骇:{HYX},璇疯緭鍏ユ暟瀛�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+
+                        ds = oCN.RunProcReturn($"select * from  Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
+                              $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain");
+
+                        if (ds.Tables[0].Rows.Count > 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愭湁閲嶅,璇蜂慨鏀�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+
+                        oCN.RunProc($"update Sc_WorkBillSortBillMain set HSourceID={(HSourceID == "" ? 0.ToString() : HSourceID)},HYX={HYX} where HInterID={list[i]["hmainid"].ToString()} and HBillNo='{list[i]["鍗曟嵁鍙�"].ToString()}'");
                     }
 
                     oCN.RunProc($"update Sc_WorkBillSortBillMain set HDayPlanSumQty={list[i]["鏃ヨ鍒掓暟閲忔�婚噺"].ToString()} where HInterID={(HInterID==0?int.Parse(list[i]["hmainid"].ToString()):HInterID)} and HBillNo='{(HBillNo==""?list[i]["鍗曟嵁鍙�"].ToString(): HBillNo)}'");
@@ -482,6 +524,14 @@
             /// 浠撳簱缂栫爜
             /// </summary>
             public string FStockNumber { get; set; }
+            /// <summary>
+            /// 鎵瑰彿
+            /// </summary>
+            public string HLOT { get; set; }
+            /// <summary>
+            /// id
+            /// </summary>
+            public string HInventoryFID { get; set; }
         }
         #endregion
 
@@ -645,6 +695,9 @@
             public string FStock { get; set; }
             //杞﹂棿
             public string FWorkShop { get; set; }
+            //鎵瑰彿
+            public string HLOT { get; set; }
+            public string HInventoryFID { get; set; }
 
         }
         #endregion
@@ -704,10 +757,11 @@
 
                 //鑾峰彇褰撳墠鍗虫椂搴撳瓨 搴撳瓨鏁伴噺+搴撳瓨缁勭粐+鐗╂枡+璐т富+浠撳簱   
                 ds = oCN.RunProcReturn(@" 
-select distinct isnull(a.FBASEQTY,0) FBASEQTY,b.FNumber,a.FOwnerTypeId,a.FOwnerId,c.FNUMBER as FOwnerNumber,a.FSTOCKID,d.FNUMBER as FStockNumber from 
+select distinct isnull(a.FBASEQTY,0) FBASEQTY,b.FNumber,a.FOwnerTypeId,a.FOwnerId,c.FNUMBER as FOwnerNumber,a.FSTOCKID,d.FNUMBER as FStockNumber ,a.FLOT HLOT,a.FID HInventoryFID 
+from 
 (
-select distinct a.HProdORGID FStockOrgId,T2.FMATERIALID,FNumber from SC_WORKBILLSORTBILLMAIN a
-join SC_WORKBILLSORTBILLSub b on a.HInterID = b.HInterID
+select distinct a.HProdORGID FStockOrgId,T2.FMATERIALID,FNumber from Sc_WorkBillSortBillMain a
+join Sc_WorkBillSortBillSub b on a.HInterID = b.HInterID
 join AIS20210811135644..T_PRD_PPBOM T1 on a.HICMOInterID_Sec = t1.FMoId and a.HICMOEntryID_Sec = t1.FMOENTRYID
 LEFT JOIN  AIS20210811135644..T_PRD_PPBOMENTRY T2 on T1.FID = t2.FID
 join  AIS20210811135644..T_BD_MATERIAL T3 on T2.FMATERIALID = T3.FMATERIALID
@@ -738,7 +792,7 @@
  from 
 (
 select sum(HSourceStockInQty)FCXStockInQty,HICMOEntryID_Sec FPRDMOENTYID from SC_WORKBILLSORTBILLMAIN a
---where a.HInterID IN ({0})
+where a.HInterID IN ({0})
 group by HICMOEntryID_Sec 
 ) a
 join  AIS20210811135644..T_PRD_PPBOM T1  on a.FPRDMOENTYID = t1.FMOENTRYID
@@ -922,7 +976,9 @@
                                             FComPlete = jskcQty >= need ? "榻愬" : "鏈綈濂�",
                                             FPlanDate = item.HMasterDate, // 鏃ヨ鍒掓棩鏈�
                                             FStock = Inventory.FSTOCKID,//浠撳簱
-                                            FWorkShop = _item.HWorkShopID //杞﹂棿
+                                            FWorkShop = _item.HWorkShopID, //杞﹂棿
+                                            HLOT = Inventory.HLOT, //鎵瑰彿
+                                            HInventoryFID = Inventory.HInventoryFID //id
                                         });
                                         //鎵e噺鎬诲簱瀛樻暟閲�
                                         jskcQty = jskcQty >= fCompleteCount ? jskcQty - fCompleteCount : 0;
@@ -1001,6 +1057,8 @@
                 insertDT.Columns.Add("FWORKSHOPID", typeof(long));
                 insertDT.Columns.Add("FSTOCKID", typeof(long));
                 insertDT.Columns.Add("FOCCUPYPICKEDCOUNT", typeof(decimal));
+                insertDT.Columns.Add("HLOT", typeof(long));
+                insertDT.Columns.Add("HInventoryFID", typeof(string));
                 int jdtmmm = 1;
                 ds = oCN.RunProcReturn("select max(HInterID)FID FROM  JIT_MOMaterReadysBill", "JIT_MOMaterReadysBill");
                 int maxFid = int.Parse(ds.Tables[0].Rows[0][0].ToString() == "" ? "0" : ds.Tables[0].Rows[0][0].ToString());
@@ -1033,6 +1091,8 @@
                     dr["FWORKSHOPID"] = item.FWorkShop == null ? "0" : item.FWorkShop;
                     dr["FSTOCKID"] = item.FStock == null ? "0" : item.FStock;
                     dr["FOCCUPYPICKEDCOUNT"] = item.FOccupyPickedCount;
+                    dr["HLOT"] = item.HLOT == null? "0" : item.HLOT;
+                    dr["HInventoryFID"] = item.HInventoryFID == null ? "0" : item.HInventoryFID;
                     insertDT.Rows.Add(dr);
                     jdtmmm++;
                 }
@@ -1048,12 +1108,14 @@
                             ", HICMOEntryID, HMaterID, HStockORGID, HStockQty, HLeftQty" +
                             ", HProdORGID, HUnitDosage, HSumPlanQty, HICMOBillNo, HOwnerID" +
                             ", HOwnerTypeID, HPlanDate, HComplete, HLackQty, HOccupyQty" +
-                            ", HCompleteQty1, HErpClsID, HWorkShopID, HWHID, HOccupyPickedQTY,HMainICMOBillNo)values" +
+                            ", HCompleteQty1, HErpClsID, HWorkShopID, HWHID, HOccupyPickedQTY,HMainICMOBillNo" +
+                            ",HLOT,HInventoryFID)values" +
                              $"({item["FID"].ToString()}, 1, {item["FHMAINICMOINTERIDR"].ToString()}, {item["FHMAINICMOENTRYID"].ToString()}, {item["FHICMOINTERID"].ToString()}" +
                              $", {item["FHICMOENTRYID"].ToString()}, {item["FHMATERID"].ToString()}, {item["FHSTOCKORGID"].ToString()}, {item["FHSTOCKQTY"].ToString()}, {item["FHLEFTQTY"].ToString()}" +
                              $" , {item["FHPRDORGID"].ToString()}, {item["FUNITDOSAGE"].ToString()}, {item["FSUMPLANCOUNT"].ToString()}, '{item["FPRDBILLNO"].ToString()}', {item["FOWNERID"].ToString()}" +
                              $", '{item["FOWNERTYPEID"].ToString()}', '{item["FPLANDATE"].ToString()}','{item["FCOMPLETE"].ToString()}', {item["FLACKCOUNT"].ToString()}, {item["FOCCUPYCOUNT"].ToString()}" +
-                             $", {item["FCOMPLETECOUNT1"].ToString()}, {item["FERPCLSID"].ToString()}, {item["FWORKSHOPID"].ToString()}, {item["FSTOCKID"].ToString()}, {item["FOCCUPYPICKEDCOUNT"].ToString()}, '{item["HMainICMOBillNo"].ToString()}')");
+                             $", {item["FCOMPLETECOUNT1"].ToString()}, {item["FERPCLSID"].ToString()}, {item["FWORKSHOPID"].ToString()}, {item["FSTOCKID"].ToString()}, {item["FOCCUPYPICKEDCOUNT"].ToString()}, '{item["HMainICMOBillNo"].ToString()}'" +
+                             $",{item["HLOT"].ToString()},'{item["HInventoryFID"].ToString()}')");
                 }
                 LogService.Write("鎵归噺鎻掑叆鍒版暟鎹簱鐢ㄦ椂锛�" + sw.Elapsed);
                 //鎵ц瀹屾垚鍚� 鏇存柊鏃ヨ鍒掑伐鍗曠姸鎬�
@@ -1097,15 +1159,17 @@
         #region 鐢熶骇鏃ヨ鍒掑钩鍙� 閿佸畾
         [Route("JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHLockedDay")]
         [HttpGet]
-        public object JIT_DayPlanPlatFormBillHLockedDay(string sWhere, int HLockedDay)
+        public object JIT_DayPlanPlatFormBillHLockedDay(int HLockedDay,int HWorkShopID)
         {
             try
             {
-                if (sWhere != null && sWhere != "")
-                {
-                    oCN.RunProc("update Sc_WorkBillSortBillSub set HLockedSub=1" +
-                    $" where HInterID in ({sWhere}) and HMasterDate between  DATEADD(day, -1, getdate()) and DATEADD(day,{(HLockedDay - 1)},getdate()) ");
-                }
+                oCN.RunProc("update b set HLockedSub=0 from Sc_WorkBillSortBillMain a join Sc_WorkBillSortBillSub b on a.HInterID = b.HInterID " +
+              $" where a.HWorkShopID={HWorkShopID}");
+
+                oCN.RunProc("update b set HLockedSub=1 from Sc_WorkBillSortBillMain a join Sc_WorkBillSortBillSub b on a.HInterID = b.HInterID " +
+                $" where  HMasterDate between  DATEADD(day, -1, getdate()) " +
+                $"and DATEADD(day,{(HLockedDay - 1)},getdate())  and a.HWorkShopID={HWorkShopID}");
+
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
@@ -1126,15 +1190,13 @@
         #region 鐢熶骇鏃ヨ鍒掑钩鍙� 瑙i攣
         [Route("JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHUnlockDay")]
         [HttpGet]
-        public object JIT_DayPlanPlatFormBillHUnlockDay(string sWhere, int HLockedDay)
+        public object JIT_DayPlanPlatFormBillHUnlockDay(int HWorkShopID)
         {
             try
             {
-                if (sWhere != null && sWhere != "")
-                {
-                    oCN.RunProc("update Sc_WorkBillSortBillSub set HLockedSub=0" +
-                    $" where HInterID in ({sWhere}) and HMasterDate between  DATEADD(day, -1, getdate()) and DATEADD(day,{(HLockedDay - 1)},getdate()) ");
-                }
+                oCN.RunProc("update b set HLockedSub=0 from Sc_WorkBillSortBillMain a join Sc_WorkBillSortBillSub b on a.HInterID = b.HInterID " +
+              $" where a.HWorkShopID={HWorkShopID}");
+
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
@@ -1159,10 +1221,23 @@
         {
             try
             {
-
+                DataSet dt = new DataSet();
                 oCN.RunProc("exec h_p_ICMOBillList_PrimarySubTable");
                 ds = oCN.RunProcReturn($"select * from  ##ICMOBillList where 婧愬崟涓诲唴鐮� in({hmainid}) and  婧愬崟瀛愬唴鐮� in({HEntryID})", "##ICMOBillList");
 
+                for (int i = 0; i < ds.Tables[0].Rows.Count; 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");
+                    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.data = null;
+                        return objJsonResult;
+                    }
+                }
+              
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
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 ef1f8d4..aaa2eef 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"
@@ -257,6 +257,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 HWorkShopID = list[i]["HWorkShopID"].ToString();
                         var HSourceID = list[i]["HSourceID"].ToString();
                         var HYX = list[i]["浼樺厛绾�"].ToString();
@@ -291,13 +292,13 @@
                             "HICMOEntrySEQ,HWorkShopID,HSourceID, HYX, HEmpID," +
                             " HMaterID, HMaterName, HMaterModel, HUnitID, HBatchNo," +
                             " HSeOrderBillQty, HPlanQty, HCompleteQty,HPreparatDate," +
-                            "HMainSourceInterID,HMainSourceEntryID)values" +
+                            "HMainSourceInterID,HMainSourceEntryID,HProdORGID,HICMOInterID_Sec,HICMOEntryID_Sec)values" +
                             $"({HInterID},'{HBillNo}',{DateTime.Now.Year},{DateTime.Now.Month},'{BillType}'," +
                             $"'{BillType}',GETDATE(),1,'{user}','{HDate}','{HICMOBillNo}','{HOrderType}'," +
                             $"{(HICMOEntrySEQ == "" ? 0.ToString() : HICMOEntrySEQ)},{(HWorkShopID == "" ? 0.ToString() : HWorkShopID)},{(HSourceID == "" ? 0.ToString() : HSourceID)}, {(HYX == "" ? 0.ToString() : HYX)}, {(HEmpID == "" ? 0.ToString() : HEmpID)}," +
                             $" {(HMaterID == "" ? 0.ToString() : HMaterID)}, '{HMaterName}', '{HMaterModel}', {(HUnitID == "" ? 0.ToString() : HUnitID)}, '{HBatchNo}'," +
                             $" {(HSeOrderBillQty == "" ? 0.ToString() : HSeOrderBillQty)}, {(HPlanQty == "" ? 0.ToString() : HPlanQty)}, {(HCompleteQty == "" ? 0.ToString() : HCompleteQty)},getdate()," +
-                            $" {HMainSourceInterID},{HMainSourceEntryID})");
+                            $" {HMainSourceInterID},{HMainSourceEntryID},{HProdORGID}, {HMainSourceInterID},{HMainSourceEntryID})");
                     }
 
                     int SumDay = 31; //鍔ㄦ�佷袱鏈堜箣宸� DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days;
diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_ICMOSortBillController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_ICMOSortBillController.cs"
index bc482f6..7e0c476 100644
--- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_ICMOSortBillController.cs"
+++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_ICMOSortBillController.cs"
@@ -60,7 +60,44 @@
         {
             try
             {
-                oCN.RunProc("exec h_p_Sc_SetICMOStatus_ReadyMater " + HSourceID.ToString() + "," + HICMOInterID.ToString() + ",'" + HDate.ToShortDateString() + "'," + HStatus.ToString() + ",'" + user + "'");
+                oCN.RunProc("exec h_p_Sc_SetICMOStatus_ReadyMater " + HSourceID.ToString() + "," + HICMOInterID.ToString() + ",'" + HDate.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'," + HStatus.ToString() + ",'" + user + "'");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐢熶骇鏃ヨ鍒� 杞﹂棿鎵ц纭  鎾ら攢杞﹂棿鎵ц纭
+        [Route("JIT_ICMOSortBill/JIT_ICMOSortBillWorkShopTure")]
+        [HttpGet]
+        public object JIT_ICMOSortBillWorkShopTure(string HSourceID, string HICMOInterID, DateTime HDate, int HStatus, string user)
+        {
+            try
+            {
+                ds = oCN.RunProcReturn($"select * from Sc_ICMOBillStatus_Tmp_Extend where HSourceID = {HSourceID} and HSourceInterID = {HICMOInterID} and HDate = '{HDate.ToString("yyyy-MM-dd HH:mm:ss.fff")}' ", "Sc_ICMOBillStatus_Tmp_Extend");
+
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "浠撳簱鏈‘璁�,涓嶈兘杩涜杞﹂棿纭锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.RunProc("exec h_p_Sc_SetICMOStatus_ReadyStart " + HSourceID.ToString() + "," + HICMOInterID.ToString() + ",'" + HDate.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'," + HStatus.ToString() + ",'" + user + "'");
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index cfeba12..044fdd8 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -1380,6 +1380,104 @@
         }
 
         /// <summary>
+        /// 鑾峰彇鐗╂枡鍒楄〃
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Web/GetMaterList_Json")]
+        [HttpGet]
+        public object GetMaterList_Json(string sWhere)
+        {
+            DataSet ds;
+            //sWhere = " Where HStopFlag=0  and HEndFlag=1";
+            //sWhere = " Where HStopFlag=0  and HEndFlag=1  and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
+            if (sWhere != "")
+            {
+                sWhere = " and ( HNumber like '%" + sWhere + "%' or HName like '%" + sWhere + "%' ) ";
+            }
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                ds = oCN.RunProcReturn("Select HItemID,HNumber 鐗╂枡浠g爜,HName 鐗╂枡,HModel 瑙勬牸鍨嬪彿 from Gy_Material where HStopflag=0 " + sWhere + " Order by HItemID ", "Gy_Material");
+                if (ds == null || ds.Tables[0].Rows.Count <= 0)
+                {
+                    objjson.code = "0";
+                    objjson.count = 0;
+                    objjson.Message = "鑾峰彇澶辫触";
+                    objjson.data = null;
+                    return objjson;
+                }
+                else
+                {
+                    objjson.code = "0";
+                    objjson.count = 1;
+                    objjson.Message = "鑾峰彇鎴愬姛!";
+                    objjson.data = ds.Tables[0];
+                    return objjson;
+                }
+            }
+            catch (Exception e)
+            {
+
+                objjson.code = "0";
+                objjson.count = 0;
+                objjson.Message = "鑾峰彇澶辫触" + e.ToString();
+                objjson.data = null;
+                return objjson;
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇妯″叿鍒楄〃
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Web/GetRelationList_Json")]
+        [HttpGet]
+        public object GetRelationList_Json(string sWhere)
+        {
+            DataSet ds;
+            //sWhere = " Where HStopFlag=0  and HEndFlag=1";
+            //sWhere = " Where HStopFlag=0  and HEndFlag=1  and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
+            if (sWhere != "")
+            {
+                sWhere = " and ( HNumber like '%" + sWhere + "%' or HName like '%" + sWhere + "%' ) ";
+            }
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                ds = oCN.RunProcReturn("Select HItemID,HNumber 妯″叿浠g爜,HName 妯″叿,HModel 瑙勬牸鍨嬪彿 from h_v_Gy_Mould where HStopflag=0 " + sWhere + " Order by HItemID ", "h_v_Gy_Mould");
+                if (ds == null || ds.Tables[0].Rows.Count <= 0)
+                {
+                    objjson.code = "0";
+                    objjson.count = 0;
+                    objjson.Message = "鑾峰彇澶辫触";
+                    objjson.data = null;
+                    return objjson;
+                }
+                else
+                {
+                    objjson.code = "0";
+                    objjson.count = 1;
+                    objjson.Message = "鑾峰彇鎴愬姛!";
+                    objjson.data = ds.Tables[0];
+                    return objjson;
+                }
+            }
+            catch (Exception e)
+            {
+
+                objjson.code = "0";
+                objjson.count = 0;
+                objjson.Message = "鑾峰彇澶辫触" + e.ToString();
+                objjson.data = null;
+                return objjson;
+            }
+        }
+
+        /// <summary>
         /// 鑾峰彇褰撳墠鏁版嵁搴撳悕
         /// </summary>
         /// <returns></returns>
@@ -3538,6 +3636,38 @@
             }
         }
         #endregion
+
+        /// <summary>
+        /// 鑾峰彇娴佹按鍙峰垪琛�
+        /// </summary>
+        /// <param name="HInterID"></param>
+        /// <returns></returns>
+        [Route("Web/GetProcNoList")]
+        [HttpGet]
+        public object GetProcNoList(int HInterID,string sWhere)
+        {
+            List<object> columnNameList = new List<object>();
+            try
+            {
+                ds = oCN.RunProcReturn("exec h_p_Sc_ProcNoList '" + HInterID + "','" + sWhere + "'", "h_p_Sc_ProcNoList");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+                objJsonResult.list = columnNameList;
+            }
+            return objJsonResult;
+        }
+
     }
 
 }
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_PurchaseWallclothBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_PurchaseWallclothBillController.cs"
index ef6426d..470e095 100644
--- "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_PurchaseWallclothBillController.cs"
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_PurchaseWallclothBillController.cs"
@@ -225,14 +225,6 @@
         {
             try
             {
-                if (!DBUtility.ClsPub.Security_Log("Pay_PurchaseWallclothBill_Drop", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
                 oCN.BeginTran();
                 oCN.RunProc("Delete From Pay_PurchaseWallclothBillMain where HInterID = " + HInterID);
                 oCN.RunProc("Delete From Pay_PurchaseWallclothBillSub where HInterID = " + HInterID);
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index 0842f66..2733854 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -1794,6 +1794,42 @@
         }
 
         /// <summary>
+        /// 鐢ㄦ埛-鐢ㄦ埛鍏崇郴淇℃伅琛ㄧ殑json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Models.Gy_UserUser> getObjectByJson_Gy_UserUser(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Models.Gy_UserUser> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.Gy_UserUser>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
+        /// 鐢ㄦ埛鐗╂枡鍏崇郴淇℃伅琛ㄧ殑json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Models.Gy_UserMater> getObjectByJson_Gy_UserMater(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Models.Gy_UserMater> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.Gy_UserMater>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
+        /// 鐢ㄦ埛瀹㈡埛鍏崇郴淇℃伅琛ㄧ殑json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Models.Gy_UserCustomer> getObjectByJson_Gy_UserCustomer(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Models.Gy_UserCustomer> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.Gy_UserCustomer>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
         /// 鐢ㄦ埛缁勭粐鍏崇郴淇℃伅琛ㄧ殑json
         /// </summary>
         /// <param name="jsonString"></param>
@@ -1842,6 +1878,18 @@
         }
 
         /// <summary>
+        /// 鐢ㄦ埛鑱屽憳鍏崇郴淇℃伅琛ㄧ殑json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Models.Employee> getObjectByJson_Employee(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Models.Employee> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.Employee>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
         /// 鍏憡鍒楄〃涓昏〃鐨刯son
         /// </summary>
         /// <param name="jsonString"></param>
diff --git a/WebAPI/Models/ClsGy_MateMould.cs b/WebAPI/Models/ClsGy_MateMould.cs
new file mode 100644
index 0000000..daf1f1c
--- /dev/null
+++ b/WebAPI/Models/ClsGy_MateMould.cs
@@ -0,0 +1,23 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class ClsGy_MateMould
+    {
+        public long HMaterIDCol { get; set; }
+        public long HRelationIDCol { get; set; }
+        public long HUnitIDCol { get; set; }
+
+        public DateTime HBeginDateCol { get; set; }
+
+        public DateTime HEndDateCol { get; set; }
+
+        public string HMaker { get; set; }
+
+        public string HRemarkCol { get; set; }
+        public long HItemID { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs b/WebAPI/Models/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs
index 3126a6b..c8c90af 100644
--- a/WebAPI/Models/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs
+++ b/WebAPI/Models/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs
@@ -64,7 +64,7 @@
      
 
         public Int64 HMaterID;  //物料内码(gy_material)
-
+        public int HOrgID; //组织ID
 
     }
 }
diff --git a/WebAPI/Models/Employee.cs b/WebAPI/Models/Employee.cs
new file mode 100644
index 0000000..fdf9889
--- /dev/null
+++ b/WebAPI/Models/Employee.cs
@@ -0,0 +1,30 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class Employee
+    {
+        public long HItemID { get; set; }
+        public string HNumber { get; set; }
+        public string HName { get; set; }
+        public string HShortNumber { get; set; }
+        public string HRemark { get; set; }
+        public string HUseFlag { get; set; }
+        public long HParentID { get; set; }
+        public string HBarCode { get; set; }
+        public long HSecManagerID { get; set; }
+        public long HCreateOrgID { get; set; }
+        public long HUseOrgID { get; set; }
+        public string HHelpCode { get; set; }
+        public string HCreator { get; set; }
+        public bool HStopflag { get; set; }
+        public Int64 HDeptID { get; set; }
+        public string HDeptName { get; set; }
+        public string HUpDater { get; set; }
+        public string HChecker { get; set; }
+        public string HDeleteMan { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/Gy_UserCustomer.cs b/WebAPI/Models/Gy_UserCustomer.cs
new file mode 100644
index 0000000..a1abffa
--- /dev/null
+++ b/WebAPI/Models/Gy_UserCustomer.cs
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class Gy_UserCustomer
+    {
+        public int HCusID { get; set; }
+        public string HCustomerNumber { get; set; }
+        public string HCustomerName { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/Gy_UserMater.cs b/WebAPI/Models/Gy_UserMater.cs
new file mode 100644
index 0000000..0accfa1
--- /dev/null
+++ b/WebAPI/Models/Gy_UserMater.cs
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class Gy_UserMater
+    {
+        public int HMaterID { get; set; }
+        public string HMaterNumber { get; set; }
+        public string HMaterName { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/Gy_UserUser.cs b/WebAPI/Models/Gy_UserUser.cs
new file mode 100644
index 0000000..35daf64
--- /dev/null
+++ b/WebAPI/Models/Gy_UserUser.cs
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class Gy_UserUser
+    {
+        public int HUserID2 { get; set; }
+        public string HUserNumber2 { get; set; }
+        public string HUserName2 { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/StationBill.cs b/WebAPI/Models/StationBill.cs
index 5d5a72a..79db468 100644
--- a/WebAPI/Models/StationBill.cs
+++ b/WebAPI/Models/StationBill.cs
@@ -33,7 +33,7 @@
         public double HMoney { get; set; }
         public string HRemark { get; set; }
         public double HTaxRate { get; set; }
-        public long HProcNo { get; set; }
+        public string HProcNo { get; set; }
         public string HOrderProcNO { get; set; }
         public long HWWWorkOrderInterID { get; set; }
         public long HWWWorkOrderEntryID { get; set; }
@@ -72,6 +72,6 @@
         public long HProcPlanEntryID { get; set; }
         public string eventType { get; set; }
         public long HMainInterID { get; set; }
-
+        public long HPRDOrgID { get; set; }
     }
 }
\ No newline at end of file
diff --git "a/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Process.cs" "b/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Process.cs"
index fc6d065..a7dc37b 100644
--- "a/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Process.cs"
+++ "b/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Process.cs"
@@ -38,5 +38,11 @@
         public string HBarCodeForBase { get; set; }
         
         public long HWorkCenterID { get; set; }
+        public long HBadWHID { get; set; }
+        public long HWasterWHID { get; set; }
+        public long HBadCountDevelopWHID { get; set; }
+        public long HWWBadWHID { get; set; }
+        public long HWWWasterWHID { get; set; }
+        public long HWHID { get; set; }
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Service/YqnQbService.cs b/WebAPI/Service/YqnQbService.cs
index 24ed380..cfa77d4 100644
--- a/WebAPI/Service/YqnQbService.cs
+++ b/WebAPI/Service/YqnQbService.cs
@@ -158,6 +158,78 @@
             return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
         }
         /// <summary>
+        /// 鑾峰彇涓嶈壇浠撳簱鍒楄〃
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        public static ApiResult<DataSet> GetBadWHList(string sWhere)
+        {
+            var dataSet = GetBadWH(sWhere);
+            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
+                return new ApiResult<DataSet> { code = -1, msg = "鏈煡璇㈠埌涓嶈壇浠撳簱" };
+            return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
+        }
+        /// <summary>
+        /// 鑾峰彇鎶ュ簾浠撳簱鍒楄〃
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        public static ApiResult<DataSet> GetWasterWHList(string sWhere)
+        {
+            var dataSet = GetWasterWH(sWhere);
+            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
+                return new ApiResult<DataSet> { code = -1, msg = "鏈煡璇㈠埌鎶ュ簾浠撳簱" };
+            return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
+        }
+        /// <summary>
+        /// 鑾峰彇鐮斿彂涓嶈壇鍝佷粨搴撳垪琛�
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        public static ApiResult<DataSet> GetBadCountDevelopWHList(string sWhere)
+        {
+            var dataSet = GetBadCountDevelopWH(sWhere);
+            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
+                return new ApiResult<DataSet> { code = -1, msg = "鏈煡璇㈠埌鐮斿彂涓嶈壇鍝佷粨搴�" };
+            return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
+        }
+        /// <summary>
+        /// 鑾峰彇濮斿涓嶈壇浠撳簱鍒楄〃
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        public static ApiResult<DataSet> GetWWBadWHList(string sWhere)
+        {
+            var dataSet = GetWWBadWH(sWhere);
+            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
+                return new ApiResult<DataSet> { code = -1, msg = "鏈煡璇㈠埌濮斿涓嶈壇浠撳簱" };
+            return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
+        }
+        /// <summary>
+        /// 鑾峰彇濮斿鎶ュ簾浠撳簱鍒楄〃
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        public static ApiResult<DataSet> GetWWWasterWHList(string sWhere)
+        {
+            var dataSet = GetWWWasterWH(sWhere);
+            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
+                return new ApiResult<DataSet> { code = -1, msg = "鏈煡璇㈠埌濮斿鎶ュ簾浠撳簱" };
+            return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
+        }
+        /// <summary>
+        /// 鑾峰彇鑹搧浠撳簱鍒楄〃
+        /// </summary>
+        /// <param name="sWhere"></param>
+        /// <returns></returns>
+        public static ApiResult<DataSet> GetWHList(string sWhere)
+        {
+            var dataSet = GetWH(sWhere);
+            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
+                return new ApiResult<DataSet> { code = -1, msg = "鏈煡璇㈠埌鑹搧浠撳簱" };
+            return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
+        }
+        /// <summary>
         /// 鑾峰彇娴佽浆鍗″垪琛�
         /// </summary>
         /// <param name="sWhere"></param>
@@ -239,7 +311,7 @@
             if (list?.Count == 0)
                 return new ApiResult<List<M_Process>> { code = -1, msg = "鏌ヨ涓虹┖" };
             return new ApiResult<List<M_Process>> { code = 0, msg = "鏌ヨ鎴愬姛", data = list, count = pageCount };
-        }
+        }        
         /// <summary>
         /// 鍒犻櫎涓�鏉″伐搴�
         /// </summary>
@@ -260,6 +332,48 @@
             var dataSet = oCN.RunProcReturn(sql, "h_v_MES_StationOutBillList");
             return dataSet;
         }
+        public static DataSet GetBadWH(string sWhere)
+        {
+            var sql = "Select * from h_v_Sc_GetBadWH Where 1=1 " + sWhere;
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            var dataSet = oCN.RunProcReturn(sql, "h_v_Sc_GetBadWH");
+            return dataSet;
+        }
+        public static DataSet GetWasterWH(string sWhere)
+        {
+            var sql = "Select * from h_v_Sc_GetWasterWH Where 1=1 " + sWhere;
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            var dataSet = oCN.RunProcReturn(sql, "h_v_Sc_GetWasterWH");
+            return dataSet;
+        }
+        public static DataSet GetBadCountDevelopWH(string sWhere)
+        {
+            var sql = "Select * from h_v_Sc_GetBadCountDevelopWH Where 1=1 " + sWhere;
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            var dataSet = oCN.RunProcReturn(sql, "h_v_Sc_GetBadCountDevelopWH");
+            return dataSet;
+        }
+        public static DataSet GetWWBadWH(string sWhere)
+        {
+            var sql = "Select * from h_v_Sc_GetWWBadWH Where 1=1 " + sWhere;
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            var dataSet = oCN.RunProcReturn(sql, "h_v_Sc_GetWWBadWH");
+            return dataSet;
+        }
+        public static DataSet GetWWWasterWH(string sWhere)
+        {
+            var sql = "Select * from h_v_Sc_GetWWWasterWH Where 1=1 " + sWhere;
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            var dataSet = oCN.RunProcReturn(sql, "h_v_Sc_GetWWWasterWH");
+            return dataSet;
+        }
+        public static DataSet GetWH(string sWhere)
+        {
+            var sql = "Select * from h_v_Sc_GetWH Where 1=1 " + sWhere;
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            var dataSet = oCN.RunProcReturn(sql, "h_v_Sc_GetWH");
+            return dataSet;
+        }
         public static DataSet GetStationInBill(string strWhere)
         {
             var sql = "Select top 5000 * from h_v_MES_StationInBillList Where 1=1 " + strWhere;
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index dd0a2ec..d6a79a9 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -321,6 +321,9 @@
     <Compile Include="App_Start\WebApiConfig.cs" />
     <Compile Include="Controllers\BaseSet\Gy_BarCodeBillController.cs" />
     <Compile Include="Controllers\BaseSet\Gy_RoutingGroupController.cs" />
+    <Compile Include="Controllers\BaseSet\Gy_TechnologyController.cs" />
+    <Compile Include="Controllers\BaseSet\Gy_TechnologyParUnitController.cs" />
+    <Compile Include="Controllers\BaseSet\Gy_TechParamByProcController.cs" />
     <Compile Include="Controllers\BaseSet\Pay_PeriodInfoSetController.cs" />
     <Compile Include="Controllers\BaseSet\Gy_OrderBackInfoController.cs" />
     <Compile Include="Controllers\BaseSet\Gy_OrderLevController.cs" />
@@ -373,12 +376,15 @@
     <Compile Include="Controllers\CJGL\Cj_ComplementGoodsBillController.cs" />
     <Compile Include="Controllers\CJGL\Cj_NoPassProcController.cs" />
     <Compile Include="Controllers\CJGL\Cj_SendGoodsBillController.cs" />
+    <Compile Include="Controllers\CJGL\Mes_OrderProcFlowAllReportController.cs" />
     <Compile Include="Controllers\CJGL\ProductionPlanReportController.cs" />
     <Compile Include="Controllers\CJGL\Sc_ProcessExchangeBillController.cs" />
     <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_WorkBillAutoSortBillMainController.cs" />
+    <Compile Include="Controllers\Gy_MateMouldController.cs" />
+    <Compile Include="Controllers\Pay_ReportController.cs" />
     <Compile Include="Controllers\SCGL\鏃ヨ鍒掔鐞哱DataHelper.cs" />
     <Compile Include="Controllers\SCGL\鏃ヨ鍒掔鐞哱JIT_Cg_PODemandPlanBillController.cs" />
     <Compile Include="Controllers\SCGL\Sc_CallGoodsBackRequestBillController.cs" />
@@ -550,8 +556,13 @@
     <Compile Include="HttpClient.cs" />
     <Compile Include="InvokeHelper.cs" />
     <Compile Include="Log.cs" />
+    <Compile Include="Models\ClsGy_MateMould.cs" />
     <Compile Include="Models\ClsSc_AssemblyBillMain.cs" />
     <Compile Include="Models\ClsSc_AssemblyBillSub.cs" />
+    <Compile Include="Models\Employee.cs" />
+    <Compile Include="Models\Gy_UserCustomer.cs" />
+    <Compile Include="Models\Gy_UserMater.cs" />
+    <Compile Include="Models\Gy_UserUser.cs" />
     <Compile Include="Models\JIT_Cg_PODemandPlanBillMain.cs" />
     <Compile Include="Models\JIT_Cg_PODemandPlanBillSub.cs" />
     <Compile Include="Models\Cg_PODemandPlanConfigBillSub.cs" />
@@ -581,6 +592,9 @@
     <Compile Include="Models\Sc_WorkBillSortBillSub.cs" />
     <Compile Include="Models\Sc_WorkDemandPlanBillMain.cs" />
     <Compile Include="Models\Sc_WorkDemandPlanBillSub.cs" />
+    <Compile Include="Models\TechnologyParameter.cs" />
+    <Compile Include="Models\TechnologyParameterUnit.cs" />
+    <Compile Include="Models\TechParamByProc.cs" />
     <Compile Include="Models\鍏跺畠\ReciveBill_FastModel.cs" />
     <Compile Include="Models\鍔ㄦ�佸垪\OptionListModel.cs" />
     <Compile Include="Models\鍩虹璧勬枡\Gy_ClassTimePrj.cs" />
@@ -839,6 +853,7 @@
     <Folder Include="Views\Cj_SendGoodsBill\" />
     <Folder Include="Views\Gy_EquipType\" />
     <Folder Include="Views\Gy_ICBomBill\" />
+    <Folder Include="Views\Gy_MateMould\" />
     <Folder Include="Views\Gy_RoutingGroup\" />
     <Folder Include="Views\Gy_WorkStation\" />
     <Folder Include="Views\JIT_DayPlanPlatFormBill\" />
@@ -851,7 +866,9 @@
     <Folder Include="Views\KF_PonderationBill\" />
     <Folder Include="Views\kf_StepFoldinBill\" />
     <Folder Include="Views\Kf_StepFoldOutBill\" />
+    <Folder Include="Views\Mes_OrderProcFlowAllReport\" />
     <Folder Include="Views\MoveStockBill\" />
+    <Folder Include="Views\Pay_Report\" />
     <Folder Include="Views\ProductionPlanReport\" />
     <Folder Include="Views\ProductionReturnBill\" />
     <Folder Include="Views\QC_Management\" />
diff --git a/WebAPI/WebAPI.csproj.user b/WebAPI/WebAPI.csproj.user
index 16d95e2..b5bf336 100644
--- a/WebAPI/WebAPI.csproj.user
+++ b/WebAPI/WebAPI.csproj.user
@@ -19,8 +19,8 @@
     <IISExpressUseClassicPipelineMode />
     <UseGlobalApplicationHostFile />
     <ProjectView>ShowAllFiles</ProjectView>
-    <Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
-    <Controller_SelectedScaffolderCategoryPath>root/Common/Web API</Controller_SelectedScaffolderCategoryPath>
+    <Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
+    <Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
   </PropertyGroup>
   <ProjectExtensions>
     <VisualStudio>

--
Gitblit v1.9.1