From 54c3139ff45224901d522c25ffe9bf04f3eea837 Mon Sep 17 00:00:00 2001
From: ch <37327@LLOOCCY>
Date: 星期一, 19 七月 2021 08:54:25 +0800
Subject: [PATCH] nothing

---
 WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user |    6 
 WebAPI/DLL/ClsSc_MESStopWorkBill.cs                         |   62 -
 WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs |   52 +
 WebAPI/Controllers/WebAPIController.cs                      |    9 
 WebAPI/Models/ClsSc_MESBeginWorkBillMain.cs                 |   34 +
 WebAPI/Controllers/CJGL/Cj_StationInBillController.cs       |  211 +++----
 WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs    |  259 +++++++++
 WebAPI/Models/ClsSc_MESStopWorkBillMain.cs                  |   41 +
 WebAPI/DLL/ClsSc_MESBeginWorkBill.cs                        |   59 -
 WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs      |   95 +++
 WebAPI/Controllers/SCGL/Sc_MESStopWorkBillController.cs     |   98 +++
 WebAPI/ListModels.cs                                        |   35 +
 WebAPI/Models/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs            |   70 ++
 WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs               |  183 ++++++
 WebAPI/Models/ClsSc_MESEndWorkBillMain.cs                   |   44 +
 WebAPI/Models/ClsSc_MESEndWorkBillSub.cs                    |   11 
 WebAPI/DLL/ClsSc_MESEndWorkBill.cs                          |  121 ---
 WebAPI/WebAPI.csproj                                        |    8 
 WebAPI/Controllers/ReportPlatFormController.cs              |  149 +++++
 WebAPI/Models/ClsSc_MESStopWorkBillSub.cs                   |   11 
 WebAPI/Models/ClsSc_MESBeginWorkBillSub.cs                  |   11 
 21 files changed, 1,200 insertions(+), 369 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
index c461134..752f464 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
@@ -21,131 +21,6 @@
         DataSet ds1;
 
 
-        ///// <summary>
-        ///// test
-        /////鍙傛暟锛歴tring sql銆�
-        /////杩斿洖鍊硷細object銆�
-        ///// </summary>
-        //[Route("Cj_StationInBill/AddBill")]
-        //[HttpPost]
-        //public object AddBill([FromBody] JObject oMain)
-        //{
-        //    var _value = oMain["oMain"].ToString();
-        //    string msg1 = _value.ToString();
-        //    try
-        //    {
-        //        //濮斿宸ュ簭鍙戝嚭鍙嶅簭鍒楀寲
-        //        msg1 = "[" + msg1.ToString() + "]";
-        //        List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg1);
-        //        string BillType = "3790";
-        //        long HInterID = list[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
-        //        string HBillNo = list[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿
-        //        int HBillStatus = 0;
-        //        string HMaker = list[0].HMaker;//鍒跺崟浜�
-        //        int HYear = 2021;
-        //        long HPeriod = 1;
-        //        string HRemark = list[0].HRemark;//澶囨敞
-        //        long HICMOInterID = list[0].HICMOInterID;//浠诲姟鍗旾D
-        //        string HICMOBillNo = list[0].HICMOBillNo;//浠诲姟鍗�
-        //        int HProcPlanInterID = 0;
-        //        int HProcPlanEntryID = 0;
-        //        string HProcPlanBillNo = "";
-        //        int HProcExchInterID = 0;
-        //        int HProcExchEntryID = 0;
-        //        string HProcExchBillNo = list[0].HProcExchBillNo;//娴佽浆鍗�
-        //        long HMaterID = list[0].HMaterID;//浜у搧ID
-        //        long HProcID = list[0].HProcID;//褰撳墠宸ュ簭
-        //        double HICMOQty = list[0].HICMOQty;//浠诲姟鍗曟暟閲�
-        //        double HPlanQty = list[0].HPlanQty;//娴佽浆鍗℃暟閲�
-        //        long HSourceID = list[0].HSourceID;//鐢熶骇璧勬簮ID
-        //        long HGroupID = list[0].HGroupID;//鐝粍ID
-        //        long HDeptID = 0;
-        //        long HEmpID = list[0].HEmpID;//鎺ユ敹浜篒D
-        //        string HBarCode = list[0].HBarCode;//鏉″舰鐮�
-        //        string HAddr = "";
-        //        string HBarCodeMaker = "";
-        //        long HSupID = 0;
-        //        double HQty = list[0].HQty;//鎺ユ敹鏁伴噺
-        //        double HPrice = 0;
-        //        double HMoney = 0;
-        //        double HPieceQty = list[0].HPieceQty;//鎺ユ敹浠舵暟
-        //        string HSourceName = list[0].HSourceName;//鐢熶骇璧勬簮鍚嶇О
-        //        long HCenterID = list[0].HCenterID;//宸ヤ綔涓績ID
-        //        long HProcNo = list[0].HProcNo;//娴佹按鍙�
-        //        string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙�
-
-        //        ListModels oListModels = new ListModels();
-
-        //        DAL.ClsSc_StationInBill BillNew = new DAL.ClsSc_StationInBill();
-
-        //        BillNew.omodel.HInterID = HInterID;
-        //        BillNew.omodel.HYear = HYear;
-        //        BillNew.omodel.HPeriod = HPeriod;
-        //        BillNew.omodel.HBillNo = HBillNo;
-        //        BillNew.omodel.HICMOBillNo = HICMOBillNo;
-        //        BillNew.omodel.HICMOInterID = HICMOInterID;
-        //        BillNew.omodel.HProcExchInterID = HProcExchInterID;
-        //        BillNew.omodel.HProcExchEntryID = HProcExchEntryID;
-        //        BillNew.omodel.HProcExchBillNo = HProcExchBillNo;
-        //        BillNew.omodel.HProcID = HProcID;
-        //        BillNew.omodel.HMaterID = HMaterID;
-        //        BillNew.omodel.HStationInTime = DateTime.Now;
-        //        BillNew.omodel.HEmpID = HEmpID;
-        //        BillNew.omodel.HSourceID = HSourceID;
-        //        BillNew.omodel.HGroupID = HGroupID;
-        //        BillNew.omodel.HICMOQty = HICMOQty;
-        //        BillNew.omodel.HPlanQty = HPlanQty;
-        //        BillNew.omodel.HQty = HQty;
-        //        BillNew.omodel.HPieceQty = HPieceQty;
-        //        BillNew.omodel.HSourceName = HSourceName;
-        //        BillNew.omodel.HCenterID = HCenterID;
-        //        BillNew.omodel.HBillStatus = HBillStatus;
-        //        BillNew.omodel.HMaker = HMaker;
-        //        BillNew.omodel.HRemark = HRemark;
-        //        BillNew.omodel.HProcPlanInterID = HProcPlanInterID;
-        //        BillNew.omodel.HProcPlanEntryID = HProcPlanEntryID;
-        //        BillNew.omodel.HProcPlanBillNo = HProcPlanBillNo;
-        //        BillNew.omodel.HDeptID = HDeptID;
-        //        BillNew.omodel.HBarCode = HBarCode;
-        //        BillNew.omodel.HAddr = HAddr;
-        //        BillNew.omodel.HBarCodeMaker = HBarCodeMaker;
-        //        BillNew.omodel.HSupID = HSupID;
-        //        BillNew.omodel.HPrice = HPrice;
-        //        BillNew.omodel.HMoney = HMoney;
-
-        //        BillNew.omodel.HProcNo = HProcNo;
-        //        BillNew.omodel.HOrderProcNO = HOrderProcNO;
-        //        bool bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
-
-        //        //鎻愮ず
-        //        if (bResult == true)
-        //        {
-        //            objJsonResult.code = "1";
-        //            objJsonResult.count = 1;
-        //            objJsonResult.Message = "鍗曟嵁瀛樼洏瀹屾瘯!鍗曟嵁鍙�:" + HBillNo.Trim();
-        //            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;
-        //    }
-        //}
-
-
         /// <summary>
         /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
         ///鍙傛暟锛歴tring sql銆�
@@ -485,9 +360,9 @@
         ///鍙傛暟锛歴tring sql銆�
         ///杩斿洖鍊硷細object銆�
         /// </summary>
-        [Route("Cj_StationInBill/list")]
+        [Route("Cj_StationInBill/get_Display")]
         [HttpGet]
-        public object list(string sWhere)
+        public object get_Display(string sWhere)
         {
             try
             {
@@ -505,7 +380,7 @@
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "false锛�";
+                    objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
@@ -513,7 +388,7 @@
                 {
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
-                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
                     objJsonResult.data = ds.Tables[0];
                     return objJsonResult;
                 }
@@ -522,7 +397,7 @@
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + e.ToString();
                 objJsonResult.data = null;
                 return objJsonResult;
             }
@@ -567,7 +442,83 @@
             }
         }
 
+        #region [瀹℃牳]
+        [Route("Cj_StationInBill/set_CheckBill")]
+        [HttpGet]
+        public object set_CheckBill(int HInterID,string CurUserName)
+        {
+            try
+            {
+                string ModRightNameCheck = "MES_StationInBill_Check";
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true,CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                Int64 lngBillKey = 0;
+                lngBillKey = HInterID;
+                if (lngBillKey == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓�0锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                DAL.ClsSc_StationInBill oBill = new DAL.ClsSc_StationInBill();
+                //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    if (oBill.omodel.HChecker.Trim() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //瀹℃牳
+                if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "瀹℃牳鎴愬姛!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "瀹℃牳澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
 
 
         //
diff --git a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
index b32a5e5..65cd472 100644
--- a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
+++ b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
@@ -255,9 +255,9 @@
         /// </summary>
         /// <param name="hmainid">鐢熶骇浠诲姟鍗旾D</param>
         /// <returns>object</returns>
-        [Route("Sc_ProcessExchangeBill/GetICMOBillDetail")]
+        [Route("Sc_ProcessExchangeBill/GetICMOBillList")]
         [HttpGet]
-        public object GetICMOBillDetail(int hmainid,int OrganizationID)
+        public object GetICMOBillList(int hmainid,int OrganizationID)
         {
             try
             {
@@ -269,7 +269,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                ds = oCN.RunProcReturn("select * from h_v_Sc_ICMOBillListDetail where hmainid=" + hmainid + " and HSTOCKINORGID="+ OrganizationID, "h_v_Sc_ICMOBillListDetail");
+                ds = oCN.RunProcReturn("select * from h_v_Sc_ICMOBillListDetail where hmainid=" + hmainid, "h_v_Sc_ICMOBillListDetail");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -297,6 +297,52 @@
             }
         }
 
+        /// <summary>
+        /// 杩斿洖鐢熶骇浠诲姟鍗曟槑缁嗚
+        /// </summary>
+        /// <param name="hmainid">鐢熶骇浠诲姟鍗旾D</param>
+        /// <returns>object</returns>
+        [Route("Sc_ProcessExchangeBill/GetICMOBillDetail")]
+        [HttpGet]
+        public object GetICMOBillDetail(int hmainid, int OrganizationID)
+        {
+            try
+            {
+                if (hmainid == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鐢熶骇浠诲姟鍗旾D涓�0锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                ds = oCN.RunProcReturn("select * from h_v_S_Sc_ICMOBillList where hmainid=" + hmainid, "h_v_S_Sc_ICMOBillList");
+                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;
+            }
+        }
 
         //
     }
diff --git a/WebAPI/Controllers/ReportPlatFormController.cs b/WebAPI/Controllers/ReportPlatFormController.cs
index 0a289e3..5817b98 100644
--- a/WebAPI/Controllers/ReportPlatFormController.cs
+++ b/WebAPI/Controllers/ReportPlatFormController.cs
@@ -16,6 +16,47 @@
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         DataSet ds;
 
+
+        #region 鎶ュ伐骞冲彴鏍规嵁璐d换浜虹瓫閫夊姞杞借祫婧愬垪琛�
+        [Route("ReportPlatForm/SearchGetLineBindBillList")]
+        [HttpGet]
+        public object SearchGetLineBindBillList(string HUserName)
+        {
+            try
+            {
+                //鏍规嵁閫夋嫨璧勬簮ID鑾峰彇褰撳墠鐢熶骇宸ュ崟銆佽矗浠讳汉
+                ds = oCN.RunProcReturn("exec h_p_JIT_GetSourceInfoByUser " + HUserName + "", "h_p_JIT_GetSourceInfoByUser");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鑾峰彇璧勬簮缁戝畾鏁版嵁鎴愬姛锛�";
+                    objJsonResult.data = ds;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏆傛棤璧勬簮缁戝畾锛�";
+                    objJsonResult.data = ds;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+
+            }
+            return objJsonResult;
+        }
+        #endregion
+
         #region 鎶ュ伐骞冲彴璧勬簮淇濆瓨
         /// <summary>
         /// 鎶ュ伐骞冲彴璧勬簮淇濆瓨
@@ -23,24 +64,34 @@
         /// <param name="msg"></param>
         /// <returns></returns>
         [Route("ReportPlatForm/SaveGetLineBindBillList")]
-        [HttpPost]
-        public object SaveGetLineBindBillList(string HUserName,string HSourceID,string HSourceName,string HManagerID,string HManagerName,string HGroupID,string HGroupName,string HCreateDate,string HRemark)
+        [HttpGet]
+        public object SaveGetLineBindBillList(string HUserName, string HSourceID, string HSourceName, string HManagerID, string HManagerName, string HGroupID, string HGroupName, string HCreateDate, string HRemark)
         {
-            
+
             try
             {
+                ds = oCN.RunProcReturn("select * from Gy_SourceRelationSet where HSourceID='" + HSourceID + "'", "Gy_SourceRelationSet");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鐢熶骇璧勬簮宸插瓨鍦紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
                 oCN.BeginTran();
                 //鍐欏叆浜х嚎缁戝畾
-                string sql = string.Format(@"insert into Gy_SourceRelationSet (HSourceID,HUserName,HGroupID,HManagerID,HRemark,HCreateDate,HCreator,HNowFlag) 
-                                           values('"+HSourceID+"','"+HUserName+"','"+HGroupID+"','"+HManagerID+"','"+HRemark+"','"+DateTime.Parse(HCreateDate).ToShortDateString()+ "','"+HUserName+"','1')");
+                string sql = string.Format(@"insert into Gy_SourceRelationSet (HSourceID,HUserName,HGroupID,HManagerID,HRemark,HCreateDate,HCreator,HNowFlag,HCheckManID) 
+                                           values('" + HSourceID + "','" + HUserName + "','" + HGroupID + "','" + HManagerID + "','" + HRemark + "','" + DateTime.Parse(HCreateDate).ToShortDateString() + "','" + HUserName + "','0','')");
                 oCN.RunProc(sql);
-
                 oCN.Commit();
+
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                objJsonResult.data = 1;
+                objJsonResult.data = null;
             }
             catch (Exception e)
             {
@@ -48,11 +99,91 @@
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
-                objJsonResult.data = 1;
-                
+                objJsonResult.data = null;
+
             }
             return objJsonResult;
         }
         #endregion
+
+        #region  鎶ュ伐骞冲彴鏍规嵁閫変腑鐨勮祫婧怚D甯﹀嚭宸ュ崟鍒楄〃淇℃伅锛屽綋鍓嶇姸鎬佷俊鎭�
+        [Route("ReportPlatForm/SearchGetWorkBillList")]
+        [HttpGet]
+        public object SearchGetWorkBillList(string HSourceID)
+        {
+            try
+            {
+                oCN.BeginTran();
+                //鏇存柊鍒囨崲鐘舵�佸��
+                string sql = string.Format(@"update Gy_SourceRelationSet set HNowFlag='1' where HSourceID='" + HSourceID + "'");
+                string sql1 = string.Format(@"update Gy_SourceRelationSet set HNowFlag='0' where HSourceID<>'" + HSourceID + "'");
+                oCN.RunProc(sql);
+                oCN.RunProc(sql1);
+                oCN.Commit();
+
+                //鏍规嵁閫夋嫨璧勬簮ID鑾峰彇褰撳墠鐢熶骇宸ュ崟銆佽矗浠讳汉
+                ds = oCN.RunProcReturn("exec h_p_JIT_GetWorkBillListInfoBySource " + HSourceID + "", "h_p_JIT_GetWorkBillListInfoBySource");
+                if (ds.Tables.Count > 0)
+                {
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+                    objJsonResult.data = ds;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "姝よ祫婧愭殏鏃犲伐鍗曞垪琛ㄦ暟鎹紒";
+                    objJsonResult.data = ds;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region 鎶ュ伐骞冲彴鍒犻櫎璧勬簮鍒楄〃
+        [Route("ReportPlatForm/DeleteGetLineBindBillList")]
+        [HttpGet]
+        public object DeleteGetLineBindBillList(string HSourceID)
+        {
+            try
+            {
+                oCN.BeginTran();
+                //鏇存柊鍒囨崲鐘舵�佸��
+                string sql = string.Format(@"delete Gy_SourceRelationSet  where HSourceID='" + HSourceID + "'");
+                oCN.RunProc(sql);
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎璧勬簮鎴愬姛锛�";
+                objJsonResult.data = ds;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+
+            }
+            return objJsonResult;
+        }
+        #endregion
+
     }
 }
diff --git a/WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs
index de78d43..2fa0023 100644
--- a/WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs
@@ -15,6 +15,7 @@
         private json objJsonResult = new json();
         public DataSet ds = new DataSet();
         public WebServer webserver = new WebServer();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
 
         #region 寮�宸ュ崟
 
@@ -100,11 +101,11 @@
             try
             {
                 DLL.ClsSc_MESBeginWorkBill oBill = new DLL.ClsSc_MESBeginWorkBill();
-                List<Model.ClsSc_MESBeginWorkBillMain> lsmain = new List<Model.ClsSc_MESBeginWorkBillMain>();
+                List<Models.ClsSc_MESBeginWorkBillMain> lsmain = new List<Models.ClsSc_MESBeginWorkBillMain>();
                 msg2 = msg2.Replace("\\", "");
                 msg2 = msg2.Replace("\n", "");  //\n
                 lsmain = oListModels.getObjectByJson_Gy_MESBeginWorkBillMain(msg2);
-                foreach (Model.ClsSc_MESBeginWorkBillMain oItem in lsmain)
+                foreach (Models.ClsSc_MESBeginWorkBillMain oItem in lsmain)
                 {
                     //oItem.HMaker = "";
                     UserName = oItem.HMaker;  //鍒跺崟浜�
@@ -262,5 +263,259 @@
         #endregion
 
         #endregion
+
+
+        #region  鎶ュ伐骞冲彴寮�宸ュ崟寮圭獥鏌ユ壘鏁版嵁
+        [Route("Sc_MESBeginWorkBill/GetMESBeginWorkFrom")]
+        [HttpGet]
+        public object GetMESBeginWorkFrom(string HSourceInterID,string HSourceEntryID,string HSourceBillNo,string HSourceBillType)
+        {
+            try
+            {
+                //鏍规嵁閫夋嫨璧勬簮ID鑾峰彇褰撳墠鐢熶骇宸ュ崟銆佽矗浠讳汉
+                ds = oCN.RunProcReturn("exec h_p_JIT_GetInfoByICMOStatusInterID @HSourceInterID=" + HSourceInterID + ",@HSourceEntryID="+ HSourceEntryID + ",@HSourceBillNo='"+ HSourceBillNo + "',@HSourceBillType='"+ HSourceBillType + "'", "h_p_JIT_GetInfoByICMOStatusInterID");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鑾峰彇璧勬簮缁戝畾鏁版嵁鎴愬姛锛�";
+                    objJsonResult.data = ds;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏆傛棤璧勬簮缁戝畾锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region 鎶ュ伐骞冲彴寮�宸ュ崟淇濆瓨/缂栬緫
+        /// <summary>
+        /// 寮�宸ュ崟
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Sc_MESBeginWorkBill/SaveGetMESBeginWorkFrom")]
+        [HttpPost]
+        public object SaveGetMESBeginWorkFrom([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();
+
+
+
+
+            ListModels oListModels = new ListModels();
+            try
+            {
+                DLL.ClsSc_MESBeginWorkBill oBill = new DLL.ClsSc_MESBeginWorkBill();
+                List<Models.ClsSc_MESBeginWorkBillMain> lsmain = new List<Models.ClsSc_MESBeginWorkBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_MESBeginWorkFrom(msg2);
+                foreach (Models.ClsSc_MESBeginWorkBillMain oItem in lsmain)
+                {
+                    oItem.HBillType = "3787";
+                    oItem.HBillSubType = "3787";
+                    oItem.HBillStatus = 1;   //鍗曟嵁鐘舵�侊紙1鏈锛�2瀹℃牳閫氳繃锛�3鍏抽棴锛�4浣滃簾锛�5瀹℃牳閫�鍥�,6瀹℃牳涓�,7宸查槄锛�8宸插洖澶嶏紝9缁撴锛�10楠岃瘉,11涓嬭揪锛�12寮�宸�,13鐢宠瀹℃壒,15鐢宠妫�楠岋紝16 鍒ゅ畾鍚堟牸锛�17鍒ゅ畾涓嶅悎鏍硷級     
+                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+                    oItem.HBarCodeMakeDate = Convert.ToDateTime(DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"))); //鎵弿鏃ユ湡锛堝勾-鏈�-鏃�-鏃�-鍒�-绉掞級
+                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oBill.omodel = oItem;
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (oBill.omodel.HInterID == 0)
+                {
+                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else
+                {
+                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                if (bResult)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message;
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
+        #region  鎶ュ伐骞冲彴鎶ユ鐢宠鍒楄〃(浜ч噺姹囨姤鍒楄〃)
+        [Route("Sc_MESBeginWorkBill/GetMESProductReportBillList")]
+        [HttpGet]
+        public object GetMESProductReportBillList(string sWhere)
+        {
+            try
+            {
+
+                ds = Sc_GetMESProductReportBillList(sWhere);
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        public static DataSet Sc_GetMESProductReportBillList(string sWhere)
+        {         
+                string sql = string.Format(@"select a.HBillNo,a.HDate,a.HBillType,a.HMaterID,m.HNumber HMaterCode,m.HName HMaterName,m.HModel HMaterSpec 
+                                   ,a.HSourceID,s.HNumber HSourceCode,s.HName HSourceName,a.HGroupID,g.HNumber HGroupCode,g.HName HGroupName
+                                   ,a.HWorkManID,e.HName HWorkManName,a.HMaker,a.HMakeDate, a.HReportType  
+                                   ,a.HQty,a.HICMOBillNo,a.HICMOInterID,a.HICMOEntryID 
+                                   ,a.HSourceInterID,a.HSourceEntryID,a.HSourceBillNo, a.HSourceBillType
+                                   from Sc_ICMOBillWorkQtyStatus_Tmp a 
+                                   left join Gy_Material m on a.HMaterID=m.hitemid
+                                   left join Gy_Source s on a.HSourceID=s.HItemID
+                                   left join Gy_Group g on a.HGroupID=g.HItemID
+                                   left join Gy_Employee e on a.HWorkManID=e.HItemID "+sWhere+"");
+                return new SQLHelper.ClsCN().RunProcReturn(sql, "Sc_ICMOBillWorkQtyStatus_Tmp");
+        }
+        #endregion
+
+        #region 鎶ュ伐骞冲彴浜ч噺姹囨姤淇濆瓨/缂栬緫
+        /// <summary>
+        /// 寮�宸ュ崟
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Sc_MESBeginWorkBill/SaveGetMESProductReportFrom")]
+        [HttpPost]
+        public object SaveGetMESProductReportFrom([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();
+
+
+
+
+            ListModels oListModels = new ListModels();
+            try
+            {
+                DLL.ClsSc_ICMOBillWorkQtyStatus_Tmp oBill = new DLL.ClsSc_ICMOBillWorkQtyStatus_Tmp();
+                List<Models.ClsSc_ICMOBillWorkQtyStatus_Tmp> lsmain = new List<Models.ClsSc_ICMOBillWorkQtyStatus_Tmp>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_MESProductReportFrom(msg2);
+                foreach (Models.ClsSc_ICMOBillWorkQtyStatus_Tmp oItem in lsmain)
+                {
+                    oItem.HBillType = "3724";
+                    oItem.HBillSubType = "3724";
+                    oItem.HReportType = 3;//锛�1鏉$爜鎵弿锛�2鏈哄櫒姹囨姤锛�3鎵嬪伐褰曞叆锛�
+                    oItem.HBillStatus = 1;   //鍗曟嵁鐘舵�侊紙1鏈锛�2瀹℃牳閫氳繃锛�3鍏抽棴锛�4浣滃簾锛�5瀹℃牳閫�鍥�,6瀹℃牳涓�,7宸查槄锛�8宸插洖澶嶏紝9缁撴锛�10楠岃瘉,11涓嬭揪锛�12寮�宸�,13鐢宠瀹℃壒,15鐢宠妫�楠岋紝16 鍒ゅ畾鍚堟牸锛�17鍒ゅ畾涓嶅悎鏍硷級     
+                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oBill.omodel = oItem;
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (oBill.omodel.HInterID == 0)
+                {
+                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else
+                {
+                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                if (bResult)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message;
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        
+
     }
 }
diff --git a/WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs
index 37528b1..83d27ab 100644
--- a/WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs
@@ -100,11 +100,11 @@
             try
             {
                 DLL.ClsSc_MESEndWorkBill oBill = new DLL.ClsSc_MESEndWorkBill();
-                List<Model.ClsSc_MESEndWorkBillMain> lsmain = new List<Model.ClsSc_MESEndWorkBillMain>();
+                List<Models.ClsSc_MESEndWorkBillMain> lsmain = new List<Models.ClsSc_MESEndWorkBillMain>();
                 msg2 = msg2.Replace("\\", "");
                 msg2 = msg2.Replace("\n", "");  //\n
                 lsmain = oListModels.getObjectByJson_Gy_MESEndWorkBillMain(msg2);
-                foreach (Model.ClsSc_MESEndWorkBillMain oItem in lsmain)
+                foreach (Models.ClsSc_MESEndWorkBillMain oItem in lsmain)
                 {
                     //oItem.HMaker = "";
                     UserName = oItem.HMaker;  //鍒跺崟浜�
@@ -262,5 +262,96 @@
         #endregion
 
         #endregion
+
+
+
+        #region 鎶ュ伐骞冲彴瀹屽伐鍗曚繚瀛�/缂栬緫
+        /// <summary>
+        /// 寮�宸ュ崟
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Sc_MESEndWorkBill/SaveGetMESEndFrom")]
+        [HttpPost]
+        public object SaveGetMESEndFrom([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 UserName = "";
+            ListModels oListModels = new ListModels();
+            try
+            {
+                DLL.ClsSc_MESEndWorkBill oBill = new DLL.ClsSc_MESEndWorkBill();
+                List<Models.ClsSc_MESEndWorkBillMain> lsmain = new List<Models.ClsSc_MESEndWorkBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_MESEndWorkBillMain(msg2);
+                foreach (Models.ClsSc_MESEndWorkBillMain oItem in lsmain)
+                {
+                    //oItem.HMaker = "";
+                    UserName = oItem.HMaker;  //鍒跺崟浜�
+                    oItem.HBillType = "3788";
+                    oItem.HBillSubType = "3788";
+                    oItem.HReportType = "3";//锛�1鏉$爜鎵弿锛�2鏈哄櫒姹囨姤锛�3鎵嬪伐褰曞叆锛�
+                    oItem.HBillStatus = 1;   //鍗曟嵁鐘舵�侊紙1鏈锛�2瀹℃牳閫氳繃锛�3鍏抽棴锛�4浣滃簾锛�5瀹℃牳閫�鍥�,6瀹℃牳涓�,7宸查槄锛�8宸插洖澶嶏紝9缁撴锛�10楠岃瘉,11涓嬭揪锛�12寮�宸�,13鐢宠瀹℃壒,15鐢宠妫�楠岋紝16 鍒ゅ畾鍚堟牸锛�17鍒ゅ畾涓嶅悎鏍硷級     
+                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+                    oItem.HBarCodeMakeDate = Convert.ToDateTime(DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"))); //鎵弿鏃ユ湡锛堝勾-鏈�-鏃�-鏃�-鍒�-绉掞級
+                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oBill.omodel = oItem;
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (oBill.omodel.HInterID == 0)
+                {
+                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else
+                {
+                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                if (bResult)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
diff --git a/WebAPI/Controllers/SCGL/Sc_MESStopWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESStopWorkBillController.cs
index d896931..54a6949 100644
--- a/WebAPI/Controllers/SCGL/Sc_MESStopWorkBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_MESStopWorkBillController.cs
@@ -94,11 +94,11 @@
             try
             {
                 DLL.ClsSc_MESStopWorkBill oBill = new DLL.ClsSc_MESStopWorkBill();
-                List<Model.ClsSc_MESStopWorkBillMain> lsmain = new List<Model.ClsSc_MESStopWorkBillMain>();
+                List<Models.ClsSc_MESStopWorkBillMain> lsmain = new List<Models.ClsSc_MESStopWorkBillMain>();
                 msg2 = msg2.Replace("\\", "");
                 msg2 = msg2.Replace("\n", "");  //\n
                 lsmain = oListModels.getObjectByJson_Gy_MESStopWorkBillMain(msg2);
-                foreach (Model.ClsSc_MESStopWorkBillMain oItem in lsmain)
+                foreach (Models.ClsSc_MESStopWorkBillMain oItem in lsmain)
                 {
                     //oItem.HMaker = "";
                     UserName = oItem.HMaker;  //鍒跺崟浜�
@@ -255,8 +255,98 @@
         }
 
         #endregion
-        
+
         #endregion
-        //
+
+
+
+        #region 鎶ュ伐骞冲彴鍋滃伐鍗曚繚瀛�/缂栬緫
+        /// <summary>
+        /// 寮�宸ュ崟
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Sc_MESStopWorkBill/SaveGetMESStopFrom")]
+        [HttpPost]
+        public object SaveGetMESStopFrom([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 UserName = "";
+            ListModels oListModels = new ListModels();
+            try
+            {
+                DLL.ClsSc_MESStopWorkBill oBill = new DLL.ClsSc_MESStopWorkBill();
+                List<Models.ClsSc_MESStopWorkBillMain> lsmain = new List<Models.ClsSc_MESStopWorkBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_MESStopWorkBillMain(msg2);
+                foreach (Models.ClsSc_MESStopWorkBillMain oItem in lsmain)
+                {
+                    //oItem.HMaker = "";
+                    UserName = oItem.HMaker;  //鍒跺崟浜�
+                    oItem.HBillType = "3789";
+                    oItem.HBillSubType = "3789";
+                    oItem.HReportType = "3";//锛�1鏉$爜鎵弿锛�2鏈哄櫒姹囨姤锛�3鎵嬪伐褰曞叆锛�
+                    oItem.HBillStatus = 1;   //鍗曟嵁鐘舵�侊紙1鏈锛�2瀹℃牳閫氳繃锛�3鍏抽棴锛�4浣滃簾锛�5瀹℃牳閫�鍥�,6瀹℃牳涓�,7宸查槄锛�8宸插洖澶嶏紝9缁撴锛�10楠岃瘉,11涓嬭揪锛�12寮�宸�,13鐢宠瀹℃壒,15鐢宠妫�楠岋紝16 鍒ゅ畾鍚堟牸锛�17鍒ゅ畾涓嶅悎鏍硷級     
+                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+                    oItem.HBarCodeMakeDate = Convert.ToDateTime(DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"))); //鎵弿鏃ユ湡锛堝勾-鏈�-鏃�-鏃�-鍒�-绉掞級
+                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oBill.omodel = oItem;
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (oBill.omodel.HInterID == 0)
+                {
+                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else
+                {
+                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                if (bResult)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index 9cfbcaf..cca193c 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -1790,20 +1790,19 @@
         {
             if (ICMOBill != "")
             {
-                sWhere = "where 1=1 and 鐢熶骇璁㈠崟鍙� like '%" + ICMOBill + "%' and HSTOCKINORGID=" + OrganizationID;
+                sWhere = " where 1=1 and 鍗曟嵁鍙� like '%" + ICMOBill + "%' ";
             }
             try
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select * from h_v_S_Sc_ICMOBillList where HSTOCKINORGID=" + OrganizationID, "h_v_S_Sc_ICMOBillList");
+                    ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where 1=1 and isnull(瀹℃牳浜�,'')<>'' and isnull(鍏抽棴浜�,'')='' and isnull(琛屽叧闂汉,'')=''  order by 鍗曟嵁鍙� desc,hsubid ", "h_v_IF_ICMOBillList");
                 }
                 else
                 {
-                    string sql1 = "select * from h_v_S_Sc_ICMOBillList ";
-                    string sql = sql1 + sWhere;
-                    ds = oCN.RunProcReturn(sql, "h_v_S_Sc_ICMOBillList");
+                    string sql = "select * from h_v_IF_ICMOBillList "+ sWhere+ " and isnull(瀹℃牳浜�,'')<>'' and isnull(鍏抽棴浜�,'')='' and isnull(琛屽叧闂汉,'')=''  order by 鍗曟嵁鍙� desc,hsubid ";
+                    ds = oCN.RunProcReturn(sql, "h_v_IF_ICMOBillList");
                 }
                 if (ds == null || ds.Tables[0].Rows.Count <= 0)
                 {
diff --git a/WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs b/WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs
new file mode 100644
index 0000000..b0d1ae8
--- /dev/null
+++ b/WebAPI/DLL/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs
@@ -0,0 +1,183 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data;
+
+namespace WebAPI.DLL
+{
+    public class ClsSc_ICMOBillWorkQtyStatus_Tmp : DBUtility.ClsXt_BaseBill 
+    {
+        //生产产量状态临时表
+        public Models.ClsSc_ICMOBillWorkQtyStatus_Tmp omodel = new Models.ClsSc_ICMOBillWorkQtyStatus_Tmp(); 
+
+        public ClsSc_ICMOBillWorkQtyStatus_Tmp()
+        {
+            base.MvarItemKeySub = "";
+            base.MvarItemKeySub2 = "";
+            base.MvarItemKeySub3 = "";
+            base.MvarItemKeySub4 = "";
+            base.MvarItemKey="Sc_ICMOBillWorkQtyStatus_Tmp";
+            base.MvarReportTitle="生产产量状态临时表";
+            base.BillType = "3724"; 
+        }
+
+        #region 固定代码
+
+        ~ClsSc_ICMOBillWorkQtyStatus_Tmp()
+        { 
+        }
+       
+        #endregion   自定义方法
+        //修改单据
+        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //
+                oCn.BeginTran();
+                //更新主表
+                oCn.RunProc("UpDate Sc_ICMOBillWorkQtyStatus_Tmp set  " +
+                "HSourceID=" + omodel.HSourceID.ToString() +
+                ",HReportType=" + omodel.HReportType.ToString() +
+                ",HPieceQty=" + omodel.HPieceQty.ToString() +
+                ",HQty=" + omodel.HQty.ToString() +
+                ",HBarCode='" + omodel.HBarCode + "'" +
+                ",HAddr='" + omodel.HAddr + "'" +
+                ",HSourceInterID=" + omodel.HSourceInterID.ToString() +
+                ",HSourceEntryID=" + omodel.HSourceEntryID.ToString() +
+                ",HSourceBillNo='" + omodel.HSourceBillNo + "'" +
+                ",HSplitNO='" + omodel.HSplitNO + "'" +
+                ",HSourceBillType='" + omodel.HSourceBillType + "'" +
+                ",HRelationInterID=" + omodel.HRelationInterID.ToString() +
+                ",HRelationEntryID=" + omodel.HRelationEntryID.ToString() +
+                ",HRelationBillNo='" + omodel.HRelationBillNo + "'" +
+                ",HReportEntryID=" + omodel.HReportEntryID.ToString() +
+                " where HInterID=" + lngBillKey.ToString());
+                //删除关联
+                DeleteRelation(ref sReturn, lngBillKey);
+                
+                sReturn = "修改单据成功!";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        //新增单据
+        public override bool AddBill(ref string sReturn)
+        {
+            try
+            {
+                //得到mainid
+                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                //若MAINDI重复则重新获取
+                oCn.BeginTran();
+                //主表
+                oCn.RunProc("Insert Into Sc_ICMOBillWorkQtyStatus_Tmp   " +
+                "(HInterID,HBillType,HSourceID,HReportType,HPieceQty" +
+                ",HQty,HBarCode,HAddr,HMaker,HMakeDate" +
+                ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSplitNO,HSourceBillType" +
+                ",HRelationInterID,HRelationEntryID,HRelationBillNo,HReportEntryID" +
+                ") " +
+                " values(" + omodel.HInterID.ToString() + ",'" + BillType + "'," + omodel.HSourceID.ToString() + "," + omodel.HReportType.ToString() + "," + omodel.HPieceQty.ToString() +
+                "," + omodel.HQty.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + DBUtility.ClsPub.CurUserName + "','" + DBUtility.ClsPub.GetServerDate(-1) + "'" +
+                "," + omodel.HSourceInterID.ToString() + "," + omodel.HSourceEntryID.ToString() + ",'" + omodel.HSourceBillNo + "','" + omodel.HSplitNO + "','" + omodel.HSourceBillType + "'" +
+                "," + omodel.HRelationInterID.ToString() + "," + omodel.HRelationEntryID.ToString() + ",'" + omodel.HRelationBillNo + "'," + omodel.HReportEntryID.ToString() + 
+                ") ");
+                 
+                sReturn = "新增单据成功!";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        //显示单据
+        public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //查询主表
+                DataSet Ds ;
+                Ds = oCn.RunProcReturn("Select * from Sc_ICMOBillWorkQtyStatus_Tmp Where HInterID=" + lngBillKey.ToString(), "Sc_ICMOBillWorkQtyStatus_Tmp");
+                if(Ds.Tables[0].Rows.Count==0)
+                {
+                    sReturn = "单据未找到!";
+                    return false;
+                }
+                //赋值
+                omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
+                omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
+                omodel.HSourceID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceID"]);
+                omodel.HReportType = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HReportType"]);
+                omodel.HPieceQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPieceQty"]);
+                omodel.HQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HQty"]);
+                omodel.HBarCode = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCode"]);
+                omodel.HAddr = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HAddr"]);
+                omodel.HMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaker"]);
+                omodel.HMakeDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HMakeDate"]);
+                omodel.HSourceInterID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HSourceInterID"]);
+                omodel.HSourceEntryID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HSourceEntryID"]);
+                omodel.HSourceBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceBillNo"]);
+                omodel.HSplitNO = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSplitNO"]);
+                omodel.HSourceBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceBillType"]);
+                omodel.HRelationInterID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HRelationInterID"]);
+                omodel.HRelationEntryID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HRelationEntryID"]);
+                omodel.HRelationBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRelationBillNo"]);
+                omodel.HReportEntryID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HReportEntryID"]);
+                
+                 
+                sReturn = "显示单据成功!";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+        }
+
+
+        //判断是否完工
+        public bool IsEnded(long HInterID, ref string sReturn)
+        {
+            try
+            {
+                DataSet DS;
+                DS = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_WMSQty " + HInterID.ToString(), "Sc_ICMOReportBillSub_WMS");
+                if (DS.Tables[0].Rows.Count == 0)
+                {
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBool"]) != "")
+                {
+                    sReturn = "已完工!";
+                    return true;
+                }
+                else
+                {
+                    sReturn = "未完工!";
+                    return false;
+                }
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+        }
+
+
+
+       
+    } 
+
+}
diff --git a/WebAPI/DLL/ClsSc_MESBeginWorkBill.cs b/WebAPI/DLL/ClsSc_MESBeginWorkBill.cs
index d01c8f2..84737bf 100644
--- a/WebAPI/DLL/ClsSc_MESBeginWorkBill.cs
+++ b/WebAPI/DLL/ClsSc_MESBeginWorkBill.cs
@@ -7,8 +7,8 @@
 {
     public  class ClsSc_MESBeginWorkBill:DBUtility.ClsXt_BaseBill
     {
-        public Model.ClsSc_MESBeginWorkBillMain omodel = new Model.ClsSc_MESBeginWorkBillMain();
-        public List<Model.ClsSc_MESBeginWorkBillSub> DetailColl = new List<Model.ClsSc_MESBeginWorkBillSub>();
+        public Models.ClsSc_MESBeginWorkBillMain omodel = new Models.ClsSc_MESBeginWorkBillMain();
+        public List<Models.ClsSc_MESBeginWorkBillSub> DetailColl = new List<Models.ClsSc_MESBeginWorkBillSub>();
         //public List<Model.ClsSc_MESBeginWorkBillSub_Item> DetailColl1 = new List<Model.ClsSc_MESBeginWorkBillSub_Item>();
         public ClsSc_MESBeginWorkBill()
         {
@@ -93,7 +93,7 @@
                 DeleteBillSub(lngBillKey);
                 //鎻掑叆瀛愯〃
                 omodel.HInterID = lngBillKey;
-                foreach (Model.ClsSc_MESBeginWorkBillSub oSub in DetailColl)
+                foreach (Models.ClsSc_MESBeginWorkBillSub oSub in DetailColl)
                 {
                     //oCn.RunProc("Insert into Sc_MESBeginWorkBillSub " +
                     //  " (HInterID,HBillNo_bak,HEntryID,HCloseMan" +
@@ -159,60 +159,21 @@
                 oCn.RunProc("Insert Into Sc_MESBeginWorkBillMain " +
                 "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
                 ",HYear,HPeriod,HRemark" +
-                ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
+                ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
                 ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HBeginWorkTime,HSourceID" +
                 ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
+                ",HSourceInterID_Main,HSourceEntryID_Main,HSourceBillNo_Main,HSourceBillType_Main" +
                 ") " +
                 " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",getdate(),'" + DBUtility.ClsPub.CurUserName + "',getdate()" +
                 "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" +
-                "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() +
+                "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOEntryID + "','" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() +
                 ",'" + omodel.HProcExchBillNo + "'," + omodel.HMaterID.ToString() + "," + omodel.HProcID.ToString() + "," + omodel.HICMOQty.ToString() + "," + omodel.HPlanQty.ToString() + ",getdate()," + omodel.HSourceID.ToString() +
+                ",'" + omodel.HMainSourceInterID.ToString() + "'," + omodel.HMainSourceEntryID.ToString() + "," + omodel.HMainSourceBillNo.ToString() + "," + omodel.HMainSourceBillType.ToString() +
                 "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBarCodeMaker + "',getdate()" +
               ") ");
-                //鎻掑叆瀛愯〃
-                foreach (Model.ClsSc_MESBeginWorkBillSub oSub in DetailColl)
-                {
-                    //oCn.RunProc("Insert into Sc_MESBeginWorkBillSub " +
-                    //  " (HInterID,HBillNo_bak,HEntryID,HCloseMan" +
-                    //  ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" +
-                    //  ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                    //  ",HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim,HManagerID" +
 
-                    //  ") values("
-                    //  + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'" +
-                    //  ",getdate()," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'," + oSub.HSourceInterID.ToString() +
-                    //  "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
-                    //  "," + oSub.HDotCheckItemID.ToString() + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'," + oSub.HManagerID.ToString() +
-                    //  ") ");
-                }
-                //foreach (Model.ClsSc_MESBeginWorkBillSub_Item oSub2 in DetailColl1)
-                //{
-                //    oCn.RunProc("Insert into Sc_MESBeginWorkBillSub_Item " +
-                //      " (HInterID,HBillNo_bak,HEntryID,HCloseMan" +
-                //      ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" +
-                //      ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                //      ",HMaintainItemID,HMaintainItem,HMaintainPart,HClaim,HManagerID" +
-
-                //      ") values("
-                //      + omodel.HInterID.ToString() + ",'" + oSub2.HBillNo_bak + "'," + oSub2.HEntryID.ToString() + ",'" + oSub2.HCloseMan + "'" +
-                //      ",getdate()," + Convert.ToString(oSub2.HCloseType ? 1 : 0) + ",'" + oSub2.HRemark + "'," + oSub2.HSourceInterID.ToString() +
-                //      "," + oSub2.HSourceEntryID.ToString() + ",'" + oSub2.HSourceBillNo + "','" + oSub2.HSourceBillType + "'," + oSub2.HRelationQty.ToString() + "," + oSub2.HRelationMoney.ToString() +
-                //      "," + oSub2.HMaintainItemID.ToString() + ",'" + oSub2.HMaintainItem + "','" + oSub2.HMaintainPart + "','" + oSub2.HClaim + "'," + oSub2.HManagerID.ToString() +
-                //      ") ");
-                //}
-                //
-                //foreach (Model.ClsSc_MESBeginWorkBillSub oSub in DetailColl)
-                //{
-                //    Ds = oCn.RunProcReturn("exec h_p_Sc_MESBeginWorkBill_Qty " + oSub.HICMOInterID, "");
-                //    if (Ds.Tables[0].Rows.Count == 0)
-                //        return;
-                //    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
-                //    {
-                //        sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨";
-                //        return false;
-                //    }
-                //}
-                //
+                //鏍规嵁寮�宸ュ崟鍐呯爜 璁剧疆 鐢熶骇鐘舵�佽〃 寮�宸ョ姸鎬�(鍏堟妸 鏈祫婧愬叏閮ㄥ伐鍗� 璁剧疆涓洪潪寮�宸ョ姸鎬侊紝鍐嶈缃湰鍗曞搴斿緱婧愬崟 涓哄紑宸ョ姸鎬�)
+                oCn.RunProcReturn("exec h_p_JIT_MESBeginWorkBill_BeginWork " + omodel.HInterID + "", "h_p_JIT_MESBeginWorkBill_BeginWork");
                 sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
                 return true;
@@ -300,7 +261,7 @@
                 DetailColl.Clear();//娓呯┖
                 for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                 {
-                    Model.ClsSc_MESBeginWorkBillSub oSub = new Model.ClsSc_MESBeginWorkBillSub();
+                    Models.ClsSc_MESBeginWorkBillSub oSub = new Models.ClsSc_MESBeginWorkBillSub();
                     // 鍥哄畾璧嬪��===============================================
                     //oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
                     //oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
diff --git a/WebAPI/DLL/ClsSc_MESEndWorkBill.cs b/WebAPI/DLL/ClsSc_MESEndWorkBill.cs
index ae7b46c..df4f15a 100644
--- a/WebAPI/DLL/ClsSc_MESEndWorkBill.cs
+++ b/WebAPI/DLL/ClsSc_MESEndWorkBill.cs
@@ -7,9 +7,9 @@
 {
     public  class ClsSc_MESEndWorkBill:DBUtility.ClsXt_BaseBill
     {
-        public Model.ClsSc_MESEndWorkBillMain omodel = new Model.ClsSc_MESEndWorkBillMain();
-        public List<Model.ClsSc_MESEndWorkBillSub> DetailColl = new List<Model.ClsSc_MESEndWorkBillSub>();
-        //public List<Model.ClsSc_MESEndWorkBillSub_Item> DetailColl1 = new List<Model.ClsSc_MESEndWorkBillSub_Item>();
+        public Models.ClsSc_MESEndWorkBillMain omodel = new Models.ClsSc_MESEndWorkBillMain();
+        public List<Models.ClsSc_MESEndWorkBillSub> DetailColl = new List<Models.ClsSc_MESEndWorkBillSub>();
+        //public List<Models.ClsSc_MESEndWorkBillSub_Item> DetailColl1 = new List<Models.ClsSc_MESEndWorkBillSub_Item>();
         public ClsSc_MESEndWorkBill()
         {
             base.MvarItemKeySub = "Sc_MESEndWorkBillSub";
@@ -38,59 +38,6 @@
             {
                 //
                 oCn.BeginTran();
-                string sql = string.Format(@"UpDate Sc_MESEndWorkBillMain set  " +
-                " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
-                ",HDate='" + omodel.HDate + "'" +
-                ",HYear='" + omodel.HYear.ToString() + "'" +
-                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
-                ",HBillStatus='" + omodel.HBillStatus + "'" +
-                ",HRemark='" + omodel.HRemark + "'" +
-                //",HBacker='"+omodel.HBacker+"'"+
-                //",HBackDate='" + omodel.HBackDate + "'" +
-                //",HBackRemark='"+omodel.HBackRemark+"'"+
-                //",HChecker='" + omodel.HChecker + "'" +
-                //",HCheckDate='" + omodel.HCheckDate + "'" +
-                //",HMaker='" + omodel.HMaker + "'" +
-                //",HMakeDate='" + omodel.HMakeDate + "'" +
-                ",HUpDater='" + omodel.HMaker + "'" +
-                ",HUpDateDate=getdate()" +
-                //",HCloseMan='" + omodel.HCloseMan + "'" +
-                //",HCloseDate='" + omodel.HCloseDate + "'" +
-                //",HCloseType="+omodel.HCloseType.ToString()+
-                //",HDeleteMan='" + omodel.HDeleteMan + "'" +
-                //",HDeleteDate='" + omodel.HDeleteDate + "'" +
-                ",HPrintQty=" + omodel.HPrintQty.ToString() +
-                //========================================
-                //",HSupID=" + omodel.HSupID.ToString() +
-                //",HEmpID=" + omodel.HEmpID.ToString() +
-                ",HICMOInterID=" + omodel.HICMOInterID.ToString() +
-                ",HICMOBillNo='" + omodel.HICMOBillNo + "'" +
-                ",HProcPlanInterID=" + omodel.HProcPlanInterID.ToString() +
-                ",HProcPlanEntryID=" + omodel.HProcPlanEntryID.ToString() +
-                ",HProcPlanBillNo='" + omodel.HProcPlanBillNo + "'" +
-                ",HProcExchInterID=" + omodel.HProcExchInterID.ToString() +
-                ",HProcExchEntryID=" + omodel.HProcExchEntryID.ToString() +
-                ",HProcExchBillNo='" + omodel.HProcExchBillNo + "'" +
-                ",HMaterID=" + omodel.HMaterID.ToString() +
-                ",HProcID=" + omodel.HProcID.ToString() +
-                ",HICMOQty=" + omodel.HICMOQty.ToString() +
-                ",HPlanQty=" + omodel.HPlanQty.ToString() +
-                ",HEndWorkTime='" + omodel.HEndWorkTime + "'" +
-                ",HSourceID=" + omodel.HSourceID.ToString() +
-                ",HGroupID=" + omodel.HGroupID.ToString() +
-                ",HDeptID=" + omodel.HDeptID.ToString() +
-                ",HEmpID=" + omodel.HEmpID.ToString() +
-                ",HQty=" + omodel.HQty.ToString() +
-                ",HBadCount=" + omodel.HBadCount.ToString() +
-                ",HWasterQty=" + omodel.HWasterQty.ToString() +
-                ",HWasterQty2=" + omodel.HWasterQty2.ToString() +
-                ",HSelfBadCount=" + omodel.HSelfBadCount.ToString() +
-                ",HPieceQty=" + omodel.HPieceQty.ToString() +
-                ",HReportType='" + omodel.HReportType + "'" +
-                ",HBarCode='" + omodel.HBarCode + "'" +
-                ",HAddr='" + omodel.HAddr + "'" +
-                ",HBarCodeMaker='" + omodel.HBarCodeMaker + "'" +
-                ",HBarCodeMakeDate='" + omodel.HBarCodeMakeDate + "' where HInterID=" + lngBillKey.ToString()+"");
                 //鏇存柊涓昏〃
                 oCn.RunProc("UpDate Sc_MESEndWorkBillMain set  " +
                 " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
@@ -106,7 +53,7 @@
                 //",HCheckDate='" + omodel.HCheckDate + "'" +
                 //",HMaker='" + omodel.HMaker + "'" +
                 //",HMakeDate='" + omodel.HMakeDate + "'" +
-                ",HUpDater='" + omodel.HMaker + "'" +
+                ",HUpDater='" + omodel.HUpDater + "'" +
                 ",HUpDateDate=getdate()" +
                 //",HCloseMan='" + omodel.HCloseMan + "'" +
                 //",HCloseDate='" + omodel.HCloseDate + "'" +
@@ -152,7 +99,7 @@
                 DeleteBillSub(lngBillKey);
                 //鎻掑叆瀛愯〃
                 omodel.HInterID = lngBillKey;
-                foreach (Model.ClsSc_MESEndWorkBillSub oSub in DetailColl)
+                foreach (Models.ClsSc_MESEndWorkBillSub oSub in DetailColl)
                 {
                     //oCn.RunProc("Insert into Sc_MESEndWorkBillSub " +
                     //  " (HInterID,HBillNo_bak,HEntryID,HCloseMan" +
@@ -218,62 +165,24 @@
                 oCn.RunProc("Insert Into Sc_MESEndWorkBillMain " +
                 "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
                 ",HYear,HPeriod,HRemark" +
-                ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
+                ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
                 ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HEndWorkTime,HSourceID" +
                 ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
-                ",HQty,HBadCount,HWasterQty,HWasterQty2,HSelfBadCount,HPieceQty"+
+                ",HSourceInterID_Main,HSourceEntryID_Main,HSourceBillNo_Main,HSourceBillType_Main" +
+                ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
+                ",HQty,HBadCount,HWasterQty,HWasterQty2,HSelfBadCount,HPieceQty" +
                 ") " +
                 " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",getdate(),'" + omodel.HMaker + "',getdate()" +
                 "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" +
-                "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() +
+                "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOEntryID + "','" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() +
                 ",'" + omodel.HProcExchBillNo + "'," + omodel.HMaterID.ToString() + "," + omodel.HProcID.ToString() + "," + omodel.HICMOQty.ToString() + "," + omodel.HPlanQty.ToString() + ",getdate()," + omodel.HSourceID.ToString() +
                 "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBarCodeMaker + "',getdate()" +
+                "," + omodel.HSourceInterID_Main.ToString() + "," + omodel.HSourceEntryID_Main.ToString() + "," + omodel.HSourceBillNo_Main.ToString() + ",'" + omodel.HSourceBillType_Main + "'" +
+                "," + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + "," + omodel.HMainSourceBillNo.ToString() + ",'" + omodel.HMainSourceBillType + "'" +
                 "," + omodel.HQty.ToString() + "," + omodel.HBadCount.ToString() + "," + omodel.HWasterQty.ToString() + "," + omodel.HWasterQty2.ToString() + "," + omodel.HSelfBadCount.ToString() + "," + omodel.HPieceQty.ToString() +
                 ") ");
-                //鎻掑叆瀛愯〃
-                foreach (Model.ClsSc_MESEndWorkBillSub oSub in DetailColl)
-                {
-                    //oCn.RunProc("Insert into Sc_MESEndWorkBillSub " +
-                    //  " (HInterID,HBillNo_bak,HEntryID,HCloseMan" +
-                    //  ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" +
-                    //  ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                    //  ",HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim,HManagerID" +
-
-                    //  ") values("
-                    //  + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'" +
-                    //  ",getdate()," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'," + oSub.HSourceInterID.ToString() +
-                    //  "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
-                    //  "," + oSub.HDotCheckItemID.ToString() + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'," + oSub.HManagerID.ToString() +
-                    //  ") ");
-                }
-                //foreach (Model.ClsSc_MESEndWorkBillSub_Item oSub2 in DetailColl1)
-                //{
-                //    oCn.RunProc("Insert into Sc_MESEndWorkBillSub_Item " +
-                //      " (HInterID,HBillNo_bak,HEntryID,HCloseMan" +
-                //      ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" +
-                //      ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                //      ",HMaintainItemID,HMaintainItem,HMaintainPart,HClaim,HManagerID" +
-
-                //      ") values("
-                //      + omodel.HInterID.ToString() + ",'" + oSub2.HBillNo_bak + "'," + oSub2.HEntryID.ToString() + ",'" + oSub2.HCloseMan + "'" +
-                //      ",getdate()," + Convert.ToString(oSub2.HCloseType ? 1 : 0) + ",'" + oSub2.HRemark + "'," + oSub2.HSourceInterID.ToString() +
-                //      "," + oSub2.HSourceEntryID.ToString() + ",'" + oSub2.HSourceBillNo + "','" + oSub2.HSourceBillType + "'," + oSub2.HRelationQty.ToString() + "," + oSub2.HRelationMoney.ToString() +
-                //      "," + oSub2.HMaintainItemID.ToString() + ",'" + oSub2.HMaintainItem + "','" + oSub2.HMaintainPart + "','" + oSub2.HClaim + "'," + oSub2.HManagerID.ToString() +
-                //      ") ");
-                //}
-                //
-                //foreach (Model.ClsSc_MESEndWorkBillSub oSub in DetailColl)
-                //{
-                //    Ds = oCn.RunProcReturn("exec h_p_Sc_MESEndWorkBill_Qty " + oSub.HICMOInterID, "");
-                //    if (Ds.Tables[0].Rows.Count == 0)
-                //        return;
-                //    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
-                //    {
-                //        sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨";
-                //        return false;
-                //    }
-                //}
-                //
+               
+               
                 sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
                 return true;
@@ -367,7 +276,7 @@
                 DetailColl.Clear();//娓呯┖
                 for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                 {
-                    Model.ClsSc_MESEndWorkBillSub oSub = new Model.ClsSc_MESEndWorkBillSub();
+                    Models.ClsSc_MESEndWorkBillSub oSub = new Models.ClsSc_MESEndWorkBillSub();
                     // 鍥哄畾璧嬪��===============================================
                     //oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
                     //oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
diff --git a/WebAPI/DLL/ClsSc_MESStopWorkBill.cs b/WebAPI/DLL/ClsSc_MESStopWorkBill.cs
index 68ea31e..9e06f75 100644
--- a/WebAPI/DLL/ClsSc_MESStopWorkBill.cs
+++ b/WebAPI/DLL/ClsSc_MESStopWorkBill.cs
@@ -7,9 +7,9 @@
 {
     public  class ClsSc_MESStopWorkBill:DBUtility.ClsXt_BaseBill
     {
-        public Model.ClsSc_MESStopWorkBillMain omodel = new Model.ClsSc_MESStopWorkBillMain();
-        public List<Model.ClsSc_MESStopWorkBillSub> DetailColl = new List<Model.ClsSc_MESStopWorkBillSub>();
-        //public List<Model.ClsSc_MESStopWorkBillSub_Item> DetailColl1 = new List<Model.ClsSc_MESStopWorkBillSub_Item>();
+        public Models.ClsSc_MESStopWorkBillMain omodel = new Models.ClsSc_MESStopWorkBillMain();
+        public List<Models.ClsSc_MESStopWorkBillSub> DetailColl = new List<Models.ClsSc_MESStopWorkBillSub>();
+        //public List<Models.ClsSc_MESStopWorkBillSub_Item> DetailColl1 = new List<Models.ClsSc_MESStopWorkBillSub_Item>();
         public ClsSc_MESStopWorkBill()
         {
             base.MvarItemKeySub = "Sc_MESStopWorkBillSub";
@@ -95,7 +95,7 @@
                 DeleteBillSub(lngBillKey);
                 //鎻掑叆瀛愯〃
                 omodel.HInterID = lngBillKey;
-                foreach (Model.ClsSc_MESStopWorkBillSub oSub in DetailColl)
+                foreach (Models.ClsSc_MESStopWorkBillSub oSub in DetailColl)
                 {
                     //oCn.RunProc("Insert into Sc_MESStopWorkBillSub " +
                     //  " (HInterID,HBillNo_bak,HEntryID,HCloseMan" +
@@ -161,60 +161,22 @@
                 oCn.RunProc("Insert Into Sc_MESStopWorkBillMain " +
                 "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
                 ",HYear,HPeriod,HRemark" +
-                ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
+                ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
                 ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStopBeginWorkTime,HStopEndWorkTime,HSourceID" +
                 ",HGroupID,HDeptID,HEmpID,HStopReason,HReportType,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
+                ",HSourceInterID_Main,HSourceEntryID_Main,HSourceBillNo_Main,HSourceBillType_Main" +
+                ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
                 ") " +
                 " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",getdate(),'" + omodel.HMaker + "',getdate()" +
                 "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" +
-                "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() +
+                "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOEntryID + "','" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() +
                 ",'" + omodel.HProcExchBillNo + "'," + omodel.HMaterID.ToString() + "," + omodel.HProcID.ToString() + "," + omodel.HICMOQty.ToString() + "," + omodel.HPlanQty.ToString() + ",getdate(),'" + omodel.HStopEndWorkTime.ToShortDateString() + "'," + omodel.HSourceID.ToString() +
                 "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HStopReason + "','" + omodel.HReportType + "','" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBarCodeMaker + "',getdate()" +
+                "," + omodel.HSourceInterID_Main.ToString() + "," + omodel.HSourceEntryID_Main.ToString() + "," + omodel.HSourceBillNo_Main.ToString() + ",'" + omodel.HSourceBillType_Main + "'" +
+                "," + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + "," + omodel.HMainSourceBillNo.ToString() + ",'" + omodel.HMainSourceBillType + "'" +
                 ") ");
                 //鎻掑叆瀛愯〃
-                foreach (Model.ClsSc_MESStopWorkBillSub oSub in DetailColl)
-                {
-                    //oCn.RunProc("Insert into Sc_MESStopWorkBillSub " +
-                    //  " (HInterID,HBillNo_bak,HEntryID,HCloseMan" +
-                    //  ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" +
-                    //  ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                    //  ",HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim,HManagerID" +
-
-                    //  ") values("
-                    //  + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'" +
-                    //  ",getdate()," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'," + oSub.HSourceInterID.ToString() +
-                    //  "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
-                    //  "," + oSub.HDotCheckItemID.ToString() + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'," + oSub.HManagerID.ToString() +
-                    //  ") ");
-                }
-                //foreach (Model.ClsSc_MESStopWorkBillSub_Item oSub2 in DetailColl1)
-                //{
-                //    oCn.RunProc("Insert into Sc_MESStopWorkBillSub_Item " +
-                //      " (HInterID,HBillNo_bak,HEntryID,HCloseMan" +
-                //      ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" +
-                //      ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                //      ",HMaintainItemID,HMaintainItem,HMaintainPart,HClaim,HManagerID" +
-
-                //      ") values("
-                //      + omodel.HInterID.ToString() + ",'" + oSub2.HBillNo_bak + "'," + oSub2.HEntryID.ToString() + ",'" + oSub2.HCloseMan + "'" +
-                //      ",getdate()," + Convert.ToString(oSub2.HCloseType ? 1 : 0) + ",'" + oSub2.HRemark + "'," + oSub2.HSourceInterID.ToString() +
-                //      "," + oSub2.HSourceEntryID.ToString() + ",'" + oSub2.HSourceBillNo + "','" + oSub2.HSourceBillType + "'," + oSub2.HRelationQty.ToString() + "," + oSub2.HRelationMoney.ToString() +
-                //      "," + oSub2.HMaintainItemID.ToString() + ",'" + oSub2.HMaintainItem + "','" + oSub2.HMaintainPart + "','" + oSub2.HClaim + "'," + oSub2.HManagerID.ToString() +
-                //      ") ");
-                //}
-                //
-                //foreach (Model.ClsSc_MESStopWorkBillSub oSub in DetailColl)
-                //{
-                //    Ds = oCn.RunProcReturn("exec h_p_Sc_MESStopWorkBill_Qty " + oSub.HICMOInterID, "");
-                //    if (Ds.Tables[0].Rows.Count == 0)
-                //        return;
-                //    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
-                //    {
-                //        sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨";
-                //        return false;
-                //    }
-                //}
-                //
+               
                 sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
                 return true;
@@ -304,7 +266,7 @@
                 DetailColl.Clear();//娓呯┖
                 for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                 {
-                    Model.ClsSc_MESStopWorkBillSub oSub = new Model.ClsSc_MESStopWorkBillSub();
+                    Models.ClsSc_MESStopWorkBillSub oSub = new Models.ClsSc_MESStopWorkBillSub();
                     // 鍥哄畾璧嬪��===============================================
                     //oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
                     //oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index 2e50628..d765f8e 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -1022,10 +1022,10 @@
         /// </summary>
         /// <param name="jsonString"></param>
         /// <returns></returns>
-        public List<Model.ClsSc_MESBeginWorkBillMain> getObjectByJson_Gy_MESBeginWorkBillMain(string jsonString)
+        public List<Models.ClsSc_MESBeginWorkBillMain> getObjectByJson_Gy_MESBeginWorkBillMain(string jsonString)
         {
             jsonString = "[" + jsonString.ToString() + "]";
-            List<Model.ClsSc_MESBeginWorkBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MESBeginWorkBillMain>>(jsonString);
+            List<Models.ClsSc_MESBeginWorkBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSc_MESBeginWorkBillMain>>(jsonString);
             return list;
         }
 
@@ -1034,10 +1034,10 @@
         /// </summary>
         /// <param name="jsonString"></param>
         /// <returns></returns>
-        public List<Model.ClsSc_MESEndWorkBillMain> getObjectByJson_Gy_MESEndWorkBillMain(string jsonString)
+        public List<Models.ClsSc_MESEndWorkBillMain> getObjectByJson_Gy_MESEndWorkBillMain(string jsonString)
         {
             jsonString = "[" + jsonString.ToString() + "]";
-            List<Model.ClsSc_MESEndWorkBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MESEndWorkBillMain>>(jsonString);
+            List<Models.ClsSc_MESEndWorkBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSc_MESEndWorkBillMain>>(jsonString);
             return list;
         }
 
@@ -1046,10 +1046,10 @@
         /// </summary>
         /// <param name="jsonString"></param>
         /// <returns></returns>
-        public List<Model.ClsSc_MESStopWorkBillMain> getObjectByJson_Gy_MESStopWorkBillMain(string jsonString)
+        public List<Models.ClsSc_MESStopWorkBillMain> getObjectByJson_Gy_MESStopWorkBillMain(string jsonString)
         {
             jsonString = "[" + jsonString.ToString() + "]";
-            List<Model.ClsSc_MESStopWorkBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MESStopWorkBillMain>>(jsonString);
+            List<Models.ClsSc_MESStopWorkBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSc_MESStopWorkBillMain>>(jsonString);
             return list;
         }
 
@@ -1205,5 +1205,28 @@
             return list;
         }
 
+        /// <summary>
+        /// 鎶ュ伐骞冲彴寮�宸ュ崟涓昏〃json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Models.ClsSc_MESBeginWorkBillMain> getObjectByJson_Gy_MESBeginWorkFrom(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Models.ClsSc_MESBeginWorkBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSc_MESBeginWorkBillMain>>(jsonString);
+            return list;
+        }
+    
+        /// <summary>
+        /// 鎶ュ伐骞冲彴浜ч噺姹囨姤涓昏〃json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Models.ClsSc_ICMOBillWorkQtyStatus_Tmp> getObjectByJson_Gy_MESProductReportFrom(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Models.ClsSc_ICMOBillWorkQtyStatus_Tmp> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSc_ICMOBillWorkQtyStatus_Tmp>>(jsonString);
+            return list;
+        }
     }
 } 
\ No newline at end of file
diff --git a/WebAPI/Models/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs b/WebAPI/Models/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs
new file mode 100644
index 0000000..9fe2f36
--- /dev/null
+++ b/WebAPI/Models/ClsSc_ICMOBillWorkQtyStatus_Tmp.cs
@@ -0,0 +1,70 @@
+using DBUtility;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WebAPI.Models
+{
+    public class ClsSc_ICMOBillWorkQtyStatus_Tmp
+    {
+        //生产产量状态临时表;
+        public Int64 HInterID;//  	int		//主表  (生产状态表ID)
+        public Int64 HEntryID;//   	int(自增列)    //自增列
+        public string HBillType;// 	varchar(10)	// 单据类型
+        public DateTime HDate;// 	datetime	//日期(yyyy-MM-dd hh:mm:ss)
+        public string HBillSubType;
+        public string HBillNo;       //单据号
+        public string HRemark;       //备注
+        public string HBacker;      //退回人
+        public DateTime HBackDate;   //退回时间
+        public string HBackRemark;   //退回原因
+        public string HChecker;      //审核人
+        public DateTime HCheckDate;   //审核日期
+        public string HMaker;   //制单人
+        public DateTime HMakeDate; //制单日期
+        public string HUpDater;//修改人
+        public DateTime HUpDateDate; //修改日期
+        public string HCloseMan; //关闭人
+        public DateTime HCloseDate;//关闭日期
+        public bool HCloseType;   //关闭类型
+        public string HDeleteMan;// 作废人
+        public DateTime HDeleteDate; //作废日期
+        public string HSplitNO;//派工单
+        public int HICMOInterID; //生产订单主ID
+        public int HICMOEntryID;//生产订单子ID
+        public string HICMOBillNo;//生产订单号
+        public int HProcExchInterID;//工序流转卡内码
+        public int HProcExchEntryID;//工序流转卡子内码
+        public string HProcExchBillNo;//工序流转卡号
+        public int HSourceInterID;//源单主内码
+        public int HSourceEntryID;//源单子内码
+        public string HSourceBillNo;//源单单号
+        public string HSourceBillType;//源单类型
+        public int HRelationInterID;//关联单主内码
+        public int HRelationEntryID;//关联单子内码
+        public string HRelationBillNo;//关联单号
+        public int HReportEntryID; //汇报单子内码
+
+        public Int64 HBillStatus;  //单据状态
+
+        public Int64 HSourceID;// 	int	//生产资源ID	New
+        public Int64 HReportType;// 	int	//汇报类型(1条码扫描,2机器汇报,3手工录入)
+        public Int64 HPieceQty;// 	int 	//件数
+        public double HPlanQty; // 		dec(18,8)	//计划数量
+        public double HQty;// 		dec(18,8)	//数量
+        public double HBadQty;// 		dec(18,8)	//不良数量
+        public double HWasterQty;//   dec(18,8)	//报废数量
+        public string HBarCode;//   	varchar(50)	//条形码
+        public string HAddr;// 		 varchar(20)	//机器地址
+        public int HProcID;//   	   int	//工序ID
+        public int HGroupID;//   	   int	//班组ID
+        public int HWorkManID;//   	   int	//操作员
+        public DateTime HWorkBeginDate;// 	datetime	//开工时间(yyyy-MM-dd hh:mm:ss)
+        public DateTime HWorkReportDate;// 	datetime	//报工时间(yyyy-MM-dd hh:mm:ss)
+     
+
+        public Int64 HMaterID;  //物料内码(gy_material)
+
+
+    }
+}
diff --git a/WebAPI/Models/ClsSc_MESBeginWorkBillMain.cs b/WebAPI/Models/ClsSc_MESBeginWorkBillMain.cs
new file mode 100644
index 0000000..9f20bb2
--- /dev/null
+++ b/WebAPI/Models/ClsSc_MESBeginWorkBillMain.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WebAPI.Models
+{
+    public class ClsSc_MESBeginWorkBillMain : DBUtility.ClsXt_BaseBillMain
+    {
+        public Int64 HPrintQty;
+        public Int64 HICMOInterID;
+        public Int64 HICMOEntryID;
+        public String HICMOBillNo;
+        public Int64 HProcPlanInterID;
+        public Int64 HProcPlanEntryID;
+        public String HProcPlanBillNo;
+        public Int64 HProcExchInterID;
+        public Int64 HProcExchEntryID;
+        public String HProcExchBillNo;
+        public Int64 HMaterID;
+        public Int64 HProcID;
+        public Int64 HICMOQty;
+        public Int64 HPlanQty;
+        public DateTime HBeginWorkTime;
+        public Int64 HSourceID;
+        public Int64 HGroupID;
+        public Int64 HDeptID;
+        public Int64 HEmpID;
+        public String HReportType;
+        public String HBarCode;
+        public String HAddr;
+        public String HBarCodeMaker;
+        public DateTime HBarCodeMakeDate;
+    }
+}
diff --git a/WebAPI/Models/ClsSc_MESBeginWorkBillSub.cs b/WebAPI/Models/ClsSc_MESBeginWorkBillSub.cs
new file mode 100644
index 0000000..bb6d829
--- /dev/null
+++ b/WebAPI/Models/ClsSc_MESBeginWorkBillSub.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WebAPI.Models
+{
+    public class ClsSc_MESBeginWorkBillSub : DBUtility.ClsXt_BaseBillSub
+    { 
+        
+    }
+}
diff --git a/WebAPI/Models/ClsSc_MESEndWorkBillMain.cs b/WebAPI/Models/ClsSc_MESEndWorkBillMain.cs
new file mode 100644
index 0000000..b3bf558
--- /dev/null
+++ b/WebAPI/Models/ClsSc_MESEndWorkBillMain.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WebAPI.Models
+{
+    public class ClsSc_MESEndWorkBillMain : DBUtility.ClsXt_BaseBillMain
+    {
+        public Int64 HPrintQty;
+        public Int64 HICMOInterID;
+        public Int64 HICMOEntryID;
+        public String HICMOBillNo;
+        public Int64 HProcPlanInterID;
+        public Int64 HProcPlanEntryID;
+        public String HProcPlanBillNo;
+        public Int64 HProcExchInterID;
+        public Int64 HProcExchEntryID;
+        public String HProcExchBillNo;
+        public Int64 HMaterID;
+        public Int64 HProcID;
+        public Int64 HICMOQty;
+        public Int64 HPlanQty;
+        public DateTime HEndWorkTime;
+        public Int64 HSourceID;
+        public Int64 HGroupID;
+        public Int64 HDeptID;
+        public Int64 HEmpID;
+        public Int64 HQty;
+        public Int64 HBadCount;
+        public Int64 HWasterQty;
+        public Int64 HWasterQty2;
+        public Int64 HSelfBadCount;
+        public Int64 HPieceQty;
+        public String HReportType;
+        public String HBarCode;
+        public String HAddr;
+        public String HBarCodeMaker;
+        public DateTime HBarCodeMakeDate;
+        public int HSourceInterID_Main;
+        public int HSourceEntryID_Main;
+        public string HSourceBillNo_Main;
+        public string HSourceBillType_Main;
+    }
+}
diff --git a/WebAPI/Models/ClsSc_MESEndWorkBillSub.cs b/WebAPI/Models/ClsSc_MESEndWorkBillSub.cs
new file mode 100644
index 0000000..720988f
--- /dev/null
+++ b/WebAPI/Models/ClsSc_MESEndWorkBillSub.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WebAPI.Models
+{
+    public class ClsSc_MESEndWorkBillSub : DBUtility.ClsXt_BaseBillSub
+    { 
+        
+    }
+}
diff --git a/WebAPI/Models/ClsSc_MESStopWorkBillMain.cs b/WebAPI/Models/ClsSc_MESStopWorkBillMain.cs
new file mode 100644
index 0000000..fa99a17
--- /dev/null
+++ b/WebAPI/Models/ClsSc_MESStopWorkBillMain.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WebAPI.Models
+{
+    public class ClsSc_MESStopWorkBillMain : DBUtility.ClsXt_BaseBillMain
+    {
+        public Int64 HPrintQty;
+        public Int64 HICMOInterID;
+        public Int64 HICMOEntryID;
+        public String HICMOBillNo;
+        public Int64 HProcPlanInterID;
+        public Int64 HProcPlanEntryID;
+        public String HProcPlanBillNo;
+        public Int64 HProcExchInterID;
+        public Int64 HProcExchEntryID;
+        public String HProcExchBillNo;
+        public Int64 HMaterID;
+        public Int64 HProcID;
+        public Int64 HICMOQty;
+        public Int64 HPlanQty;
+        public DateTime HStopBeginWorkTime;
+        public DateTime HStopEndWorkTime;
+        public Int64 HSourceID;
+        public Int64 HGroupID;
+        public Int64 HDeptID;
+        public Int64 HEmpID;
+        public String HStopReason;
+        public String HReportType;
+        public String HBarCode;
+        public String HAddr;
+        public String HBarCodeMaker;
+        public DateTime HBarCodeMakeDate;
+
+        public int HSourceInterID_Main;
+        public int HSourceEntryID_Main;
+        public string HSourceBillNo_Main;
+        public string HSourceBillType_Main;
+    }
+}
diff --git a/WebAPI/Models/ClsSc_MESStopWorkBillSub.cs b/WebAPI/Models/ClsSc_MESStopWorkBillSub.cs
new file mode 100644
index 0000000..0541a25
--- /dev/null
+++ b/WebAPI/Models/ClsSc_MESStopWorkBillSub.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WebAPI.Models
+{
+    public class ClsSc_MESStopWorkBillSub: DBUtility.ClsXt_BaseBillSub
+    { 
+        
+    }
+}
diff --git a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
index f9c64e9..f0345c1 100644
--- a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
+++ b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -162,10 +162,10 @@
       <publishTime>11/24/2014 11:18:48</publishTime>
     </File>
     <File Include="bin/WebAPI.dll">
-      <publishTime>07/16/2021 13:44:30</publishTime>
+      <publishTime>07/16/2021 16:50:37</publishTime>
     </File>
     <File Include="bin/WebAPI.pdb">
-      <publishTime>07/16/2021 13:44:30</publishTime>
+      <publishTime>07/16/2021 16:50:37</publishTime>
     </File>
     <File Include="bin/WebGrease.dll">
       <publishTime>07/17/2013 17:03:52</publishTime>
@@ -336,7 +336,7 @@
       <publishTime>07/14/2021 15:45:15</publishTime>
     </File>
     <File Include="Web.config">
-      <publishTime>07/16/2021 13:44:41</publishTime>
+      <publishTime>07/16/2021 16:50:44</publishTime>
     </File>
   </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index 787fc50..f5ae349 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -399,6 +399,7 @@
     <Compile Include="DLL\ClsSb_EquipMaintainBill.cs" />
     <Compile Include="DLL\ClsSb_EquipRepairCheckBill.cs" />
     <Compile Include="DLL\ClsSb_EquipRepairWorkBill.cs" />
+    <Compile Include="DLL\ClsSc_ICMOBillWorkQtyStatus_Tmp.cs" />
     <Compile Include="DLL\ClsSc_ICMOReportBill.cs" />
     <Compile Include="DLL\ClsSc_MESBeginWorkBill.cs" />
     <Compile Include="DLL\ClsSc_MESEndWorkBill.cs" />
@@ -425,6 +426,13 @@
     <Compile Include="Models\ClsSb_EquipMaintainBillSub.cs" />
     <Compile Include="Models\ClsSb_EquipRepairWorkBillMain.cs" />
     <Compile Include="Models\ClsSb_EquipRepairWorkBillSub.cs" />
+    <Compile Include="Models\ClsSc_ICMOBillWorkQtyStatus_Tmp.cs" />
+    <Compile Include="Models\ClsSc_MESBeginWorkBillMain.cs" />
+    <Compile Include="Models\ClsSc_MESBeginWorkBillSub.cs" />
+    <Compile Include="Models\ClsSc_MESEndWorkBillMain.cs" />
+    <Compile Include="Models\ClsSc_MESEndWorkBillSub.cs" />
+    <Compile Include="Models\ClsSc_MESStopWorkBillMain.cs" />
+    <Compile Include="Models\ClsSc_MESStopWorkBillSub.cs" />
     <Compile Include="Models\ClsSc_MouldScrapOutBillMain.cs">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Compile>

--
Gitblit v1.9.1