From b88e886227a7ecceb48ded35603daf6940e9c504 Mon Sep 17 00:00:00 2001
From: YL <YL@LAPTOP-SE03PLUR>
Date: 星期四, 17 六月 2021 17:35:29 +0800
Subject: [PATCH]  生产管理:增加 生产汇报单 编辑模块(新增,修改,删除功能)及列表

---
 WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs      |  266 ++++++++++++++++
 WebAPI/ListModels.cs                                        |   12 
 WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user |    6 
 WebAPI/DLL/ClsSc_MESEndWorkBill.cs                          |  519 ++++++++++++++++++++++++++++++++
 WebAPI/WebAPI.csproj                                        |    2 
 WebAPI/Controllers/PublicPageMethodController.cs            |  114 +++++++
 6 files changed, 916 insertions(+), 3 deletions(-)

diff --git a/WebAPI/Controllers/PublicPageMethodController.cs b/WebAPI/Controllers/PublicPageMethodController.cs
index 86bc81c..f0267b8 100644
--- a/WebAPI/Controllers/PublicPageMethodController.cs
+++ b/WebAPI/Controllers/PublicPageMethodController.cs
@@ -1271,5 +1271,119 @@
 
         #endregion
 
+        #region 閫夋嫨璧勬簮鍩虹璧勬枡
+
+        #region 鏉′欢鏌ヨ璧勬簮鍒楄〃
+        [Route("PublicPageMethod/SourceList")]
+        [HttpGet]
+        public object SourceList(string sWhere)
+        {
+            try
+            {
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Gy_Source where HStopflag=0 Order by HItemID", "Gy_Source");
+                }
+                else
+                {
+                    string sql1 = "Select HItemID,HParentID,HNumber,HName from Gy_Source where 1 = 1 ";
+                    string sql = sql1 + sWhere;
+                    ds = oCN.RunProcReturn(sql, "h_v_IF_Group");
+                }
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "false锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region  鏍规嵁鏍戝瀷id鏌ユ壘璧勬簮鍒楄〃   
+        [Route("Gy_MaintenanceMode/SourceCX")]
+        [HttpGet]
+        public object SourceCX(long HInterID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.Gy_Source WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.Gy_Source AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "Gy_Source");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "false锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鏍戝瀷鍒楄〃鐝粍鍒楄〃鏁版嵁    
+        [Route("Gy_MaintenanceMode/SourceLoadTree")]
+        [HttpGet]
+        public object SourceLoadTree(string sWhere)
+        {
+            SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN();
+            //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList");
+
+            ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from Gy_Source", "Gy_Source");
+            if (ds == null || ds.Tables[0].Rows.Count == 0)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "false锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            else
+            {
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #endregion
+
     }
 }
diff --git a/WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs
new file mode 100644
index 0000000..37528b1
--- /dev/null
+++ b/WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs
@@ -0,0 +1,266 @@
+锘縰sing Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Web.Http;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers.SCGL
+{
+    public class Sc_MESEndWorkBillController : ApiController
+    {
+        private json objJsonResult = new json();
+        public DataSet ds = new DataSet();
+        public WebServer webserver = new WebServer();
+
+        #region 瀹屽伐鍗�
+
+        #region 瀹屽伐鍗曞垪琛�
+
+        [Route("Sc_MESEndWorkBill/GetMESEndWorkBill")]
+        [HttpGet]
+        public object GetMESEndWorkBill(string sWhere)
+        {
+            try
+            {
+
+                ds = Sc_GetMESEndWorkBill(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_GetMESEndWorkBill(string sWhere)
+        {
+            if (sWhere == null || sWhere.Equals(""))
+            {
+                return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MESEndWorkBillList_NEW ", "h_v_Sc_MESEndWorkBillList_NEW");
+            }
+            else
+            {
+                string sql1 = "select * from h_v_Sc_MESEndWorkBillList_NEW where 1 = 1 ";
+                string sql = sql1 + sWhere;
+                return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MESEndWorkBillList_NEW");
+            }
+
+        }
+
+        #endregion
+
+        #region[瀹屽伐鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁]
+        [Route("Sc_MESEndWorkBill/Sc_MESEndWorkBillListCheckDetai")]
+        [HttpGet]
+        public ApiResult<DataSet> Sc_MESEndWorkBillListCheckDetai(string HID)
+        {
+            if (string.IsNullOrEmpty(HID))
+                return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" };
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
+            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MESEndWorkBillList_NEW  where hmainid= " + HID + " ", "h_v_Sc_MESEndWorkBillList_NEW");
+            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
+                return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄥ畬宸ュ崟鍙�" };
+
+            return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
+        }
+        #endregion
+
+        #region 瀹屽伐鍗曚繚瀛�/缂栬緫
+        /// <summary>
+        /// 瀹屽伐鍗�
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Sc_MESEndWorkBill/SaveGetMESEndWorkBillList")]
+        [HttpPost]
+        public object SaveGetMESEndWorkBillList([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<Model.ClsSc_MESEndWorkBillMain> lsmain = new List<Model.ClsSc_MESEndWorkBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_MESEndWorkBillMain(msg2);
+                foreach (Model.ClsSc_MESEndWorkBillMain oItem in lsmain)
+                {
+                    //oItem.HMaker = "";
+                    UserName = oItem.HMaker;  //鍒跺崟浜�
+                    oItem.HBillType = "3788";
+                    oItem.HBillSubType = "3788";
+                    //oItem.HBillNo = "";    //鍗曟嵁鍙�
+                    //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --鏃ユ湡
+                    //oItem.HInnerBillNo = "";  //  --鍐呴儴鍗曟嵁鍙�
+                    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"))); //鎵弿鏃ユ湡锛堝勾-鏈�-鏃�-鏃�-鍒�-绉掞級
+                    //oItem.HEquipID = 0;    //璁惧ID(Gy_EquipMent)
+                    //oItem.HPeriod = 0;
+                    //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));  //  --缁翠慨鏃ユ湡
+                    //oItem.HCheckResult = "";     //楠屾敹缁撹--(姝e父锛屽紓甯�)
+                    //oItem.HEmpID = 0;           //楠屾敹浜�(Gy_Employee)
+                    //oItem.HManagerID = 0;      //璐熻矗浜�(Gy_Employee)
+                    //oItem.HDeptID = 0;        //楠屾敹閮ㄩ棬(Gy_Department)
+                    //oItem.HExplanation = "";  //鎽樿(鏁呴殰鎻忚堪)  
+                    //oItem.HRemark = "";       //澶囨敞
+
+                    //oItem.HMainSourceInterID = oItem.HInterID;
+
+                    //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
+                    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
+
+        #region [瀹屽伐鍗曞垹闄ゅ姛鑳絔
+        /// <summary>
+        /// 瀹屽伐鍗曞垹闄ゅ姛鑳�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Sc_MESEndWorkBill/DeltetMESEndWorkBill")]
+        [HttpGet]
+        public object DeltetMESEndWorkBill(string HInterID)
+        {
+            //缂栬緫鏉冮檺
+            //if (!DBUtility.ClsPub.Security_Log("Sc_MESEndWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName))
+            //{
+            //    objJsonResult.code = "0";
+            //    objJsonResult.count = 0;
+            //    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+            //    objJsonResult.data = null;
+            //    return objJsonResult;
+            //}
+
+
+            Int64 lngBillKey = 0;
+            lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+            if (lngBillKey == 0)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            DLL.ClsSc_MESEndWorkBill oBill = new DLL.ClsSc_MESEndWorkBill();
+            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
+            {
+                if (oBill.omodel.HBillStatus > 1)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (oBill.omodel.HChecker != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                if (IsDete)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            else
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍗曟嵁鏈壘鍒�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #endregion
+    }
+}
diff --git a/WebAPI/DLL/ClsSc_MESEndWorkBill.cs b/WebAPI/DLL/ClsSc_MESEndWorkBill.cs
new file mode 100644
index 0000000..ae7b46c
--- /dev/null
+++ b/WebAPI/DLL/ClsSc_MESEndWorkBill.cs
@@ -0,0 +1,519 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data;
+
+namespace WebAPI.DLL
+{
+    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 ClsSc_MESEndWorkBill()
+        {
+            base.MvarItemKeySub = "Sc_MESEndWorkBillSub";
+            base.MvarItemKeySub2 = "";
+            base.MvarItemKeySub3 = "";
+            base.MvarItemKeySub4 = "";
+            base.MvarItemKey="Sc_MESEndWorkBillMain";
+            base.MvarReportTitle="瀹屽伐鍗�";
+            base.BillType="3788";
+            base.HBillSubType = "3788";
+
+        }
+
+        #region 鍥哄畾浠g爜
+
+        ~ClsSc_MESEndWorkBill()
+        {
+            DetailColl = null;
+        }
+       
+        #endregion   鑷畾涔夋柟娉�
+        //淇敼鍗曟嵁
+        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //
+                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 + "'" +  //鍥哄畾璧嬪��===============
+                ",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());
+                //鍒犻櫎鍏宠仈
+                DeleteRelation(ref sReturn, lngBillKey);
+                //鍒犻櫎瀛愯〃
+                DeleteBillSub(lngBillKey);
+                //鎻掑叆瀛愯〃
+                omodel.HInterID = lngBillKey;
+                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;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        //鏂板鍗曟嵁
+        public override bool AddBill(ref string sReturn)
+        {
+            try
+            {
+                //寰楀埌mainid
+                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+                oCn.BeginTran();
+                //涓昏〃
+                oCn.RunProc("Insert Into Sc_MESEndWorkBillMain " +
+                "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
+                ",HYear,HPeriod,HRemark" +
+                ",HICMOInterID,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"+
+                ") " +
+                " 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.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.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;
+            }
+            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_MESEndWorkBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_MESEndWorkBillMain");
+                if(Ds.Tables[0].Rows.Count==0)
+                {
+                    sReturn = "鍗曟嵁鏈壘鍒帮紒";
+                    return false;
+                }
+                //鍥哄畾璧嬪��===========================================
+                omodel.HInterID =DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
+                omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
+                omodel.HDate =DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]);
+                omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
+                omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
+                omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]);
+                omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]);
+                omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]);
+                omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim();
+                omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]);
+                omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
+                omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]);
+                omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim();
+                omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim();
+                omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim();
+                omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim();
+                omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim();
+                omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim();
+                omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim();
+                omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim();
+                omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
+                omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
+                omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
+                omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
+                //========================================================
+                ////==
+                //omodel.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWHID"]);
+                //omodel.HSCWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSCWHID"]);
+                //omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]);
+                //omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]);
+                //omodel.HMangerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMangerID"]);
+                omodel.HICMOInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOInterID"]);
+                omodel.HICMOBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HICMOBillNo"]);
+                omodel.HProcPlanInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcPlanInterID"]);
+                omodel.HProcPlanEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcPlanEntryID"]);
+                omodel.HProcPlanBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcPlanBillNo"]);
+                omodel.HProcExchInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcExchInterID"]);
+                omodel.HProcExchEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcExchEntryID"]);
+                omodel.HProcExchBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcExchBillNo"]);
+                omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]);
+                omodel.HProcID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcID"]);
+                omodel.HICMOQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOQty"]);
+                omodel.HPlanQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPlanQty"]);
+                omodel.HEndWorkTime = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HEndWorkTime"]);
+                omodel.HSourceID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceID"]);
+                omodel.HGroupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HGroupID"]);
+                omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]);
+                omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]);
+                omodel.HQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HQty"]);
+                omodel.HBadCount = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBadCount"]);
+                omodel.HWasterQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWasterQty"]);
+                omodel.HWasterQty2 = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWasterQty2"]);
+                omodel.HSelfBadCount = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSelfBadCount"]);
+                omodel.HPieceQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPieceQty"]);
+                omodel.HReportType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HReportType"]);
+                omodel.HBarCode = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCode"]);
+                omodel.HAddr = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HAddr"]);
+                omodel.HBarCodeMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCodeMaker"]);
+                omodel.HBarCodeMakeDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HBarCodeMakeDate"]);
+                //omodel.HRedBlueFlag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HRedBlueFlag"]);
+                //
+                
+                //寰幆
+                DataSet DsSub ;
+                DsSub = oCn.RunProcReturn("Select * from Sc_MESEndWorkBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MESEndWorkBillSub");
+                DetailColl.Clear();//娓呯┖
+                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
+                {
+                    Model.ClsSc_MESEndWorkBillSub oSub = new Model.ClsSc_MESEndWorkBillSub();
+                    // 鍥哄畾璧嬪��===============================================
+                    //oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
+                    //oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
+                    //oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBillNo_bak"]);
+                    ////oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
+                    //oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]);
+                    //oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]);
+                    //oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]);
+                    //oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim();
+                    //oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]);
+                    //oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]);
+                    //oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim();
+                    //oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim();
+                    //oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]);
+                    //oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]);                 
+                    ////===================================================
+                    //oSub.HDotCheckItemID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HDotCheckItemID"]);
+                    //oSub.HDotCheckItem = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDotCheckItem"]);
+                    //oSub.HDotCheckPart = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDotCheckPart"]);
+                    //oSub.HClaim = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HClaim"]);
+                    //oSub.HManagerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HManagerID"]);
+                    //oSub.HWorkerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWorkerID"]);
+                    //oSub.HWorkerNumber = DsSub.Tables[0].Rows[i]["HWorkerNumber"].ToString().Trim();
+                    //oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]);
+                    //oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]);
+                    //oSub.HPropertyID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPropertyID"]);
+                    //oSub.HSecUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSecUnitID"]);
+                    //oSub.HSecUnitRate = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSecUnitRate"]);
+                    //oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]);
+                    //oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]);
+                    //oSub.HQtyMust = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQtyMust"]);
+                    //oSub.HQty = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQty"]);
+                    //oSub.HPrice = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPrice"]);
+                    //oSub.HMoney = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMoney"]);
+                    //oSub.HDesignLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDesignLife"]);
+                    //oSub.HLeaveLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HLeaveLife"]);
+                    //oSub.HUseLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HUseLife"]);
+                    //oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]);
+                    //oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]);
+                    //oSub.HSCWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCWHID"]);
+                    //oSub.HSCSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCSPID"]);
+                    //oSub.HSPGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPGroupID"]);
+
+                    //oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]);
+                    //oSub.HBadCount = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HBadCount"]);
+                    //oSub.HWasterQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWasterQty"]);
+                    //oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]);
+                    //oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]);
+                    //oSub.HSeOrderBillNo = DsSub.Tables[0].Rows[i]["HSeOrderBillNo"].ToString().Trim();
+                    
+                    DetailColl.Add(oSub);
+                }
+                //DataSet DsSub2;
+                //DsSub2 = oCn.RunProcReturn("Select * from Sc_MESEndWorkBillSub_Item Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MESEndWorkBillSub_Item");
+                //DetailColl1.Clear();//娓呯┖
+                //for (int i = 0; i < DsSub2.Tables[0].Rows.Count; i++)
+                //{
+                //    Model.ClsSc_MESEndWorkBillSub_Item oSub2 = new Model.ClsSc_MESEndWorkBillSub_Item();
+                //    // 鍥哄畾璧嬪��===============================================
+                //    oSub2.HInterID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HInterID"]);
+                //    oSub2.HEntryID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HEntryID"]);
+                //    oSub2.HBillNo_bak = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HBillNo_bak"]);
+                //    oSub2.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HCloseMan"]);
+                //    oSub2.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub2.Tables[0].Rows[i]["HEntryCloseDate"]);
+                //    oSub2.HCloseType = DBUtility.ClsPub.isBool(DsSub2.Tables[0].Rows[i]["HCloseType"]);
+                //    oSub2.HRemark = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HRemark"]);
+                //    oSub2.HSourceInterID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HSourceInterID"]);
+                //    oSub2.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HSourceEntryID"]);
+                //    oSub2.HSourceBillType = DsSub2.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim();
+                //    oSub2.HSourceBillNo = DsSub2.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim();
+                //    oSub2.HRelationQty = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[i]["HRelationQty"]);
+                //    oSub2.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[i]["HRelationMoney"]);
+                //    //===================================================
+                //    //oSub.HWorkerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWorkerID"]);
+                //    //oSub.HWorkerNumber = DsSub.Tables[0].Rows[i]["HWorkerNumber"].ToString().Trim();
+                //    //oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]);
+                //    //oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]);
+                //    //oSub.HPropertyID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPropertyID"]);
+                //    //oSub.HSecUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSecUnitID"]);
+                //    //oSub.HSecUnitRate = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSecUnitRate"]);
+                //    //oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]);
+                //    //oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]);
+                //    //oSub.HQtyMust = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQtyMust"]);
+                //    //oSub.HQty = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQty"]);
+                //    //oSub.HPrice = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPrice"]);
+                //    //oSub.HMoney = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMoney"]);
+                //    //oSub.HDesignLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDesignLife"]);
+                //    //oSub.HLeaveLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HLeaveLife"]);
+                //    //oSub.HUseLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HUseLife"]);
+                //    //oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]);
+                //    //oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]);
+                //    //oSub.HSCWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCWHID"]);
+                //    //oSub.HSCSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCSPID"]);
+                //    //oSub.HSPGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPGroupID"]);
+                //    oSub2.HMaintainItemID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HMaintainItemID"]);
+                //    oSub2.HMaintainItem = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HMaintainItem"]);
+                //    oSub2.HMaintainPart = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HMaintainPart"]);
+                //    oSub2.HClaim = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HClaim"]);
+                //    oSub2.HManagerID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HManagerID"]);
+                //    //oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]);
+                //    //oSub.HBadCount = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HBadCount"]);
+                //    //oSub.HWasterQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWasterQty"]);
+                //    //oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]);
+                //    //oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]);
+                //    //oSub.HSeOrderBillNo = DsSub.Tables[0].Rows[i]["HSeOrderBillNo"].ToString().Trim();
+
+                //    DetailColl1.Add(oSub2);
+                //}
+                sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+        }
+
+        //瀹℃牳
+        public bool CheckBill(Int64 lngBillKey, ref string sReturn)
+        {
+
+            try
+            {
+                string HChecker = DBUtility.ClsPub.CurUserName;
+                string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
+                oCn.RunProc(" Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString());
+                //鐢熸垚璋冩嫧鍗�
+                //寰楀埌璋冩嫧鍗� mainid 鍗曟嵁鍙�
+                //long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo);
+                //string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//寰楀埌鏂板崟鍙�
+                //oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'");
+                //
+                sReturn = "";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+        }
+
+
+
+
+        
+    }
+}
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index 4e22484..014e419 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -989,5 +989,17 @@
             List<Model.ClsSc_ICMOReportBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_ICMOReportBillSub>>(jsonString);
             return list;
         }
+
+        /// <summary>
+        /// 澶勭悊鏂板鐢熶骇瀹屽伐鍗曠殑json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsSc_MESEndWorkBillMain> getObjectByJson_Gy_MESEndWorkBillMain(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsSc_MESEndWorkBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MESEndWorkBillMain>>(jsonString);
+            return list;
+        }
     }
 } 
\ No newline at end of file
diff --git a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
index 910766f..991a78c 100644
--- a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
+++ b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -153,10 +153,10 @@
       <publishTime>11/24/2014 11:18:48</publishTime>
     </File>
     <File Include="bin/WebAPI.dll">
-      <publishTime>06/16/2021 20:33:27</publishTime>
+      <publishTime>06/17/2021 16:00:39</publishTime>
     </File>
     <File Include="bin/WebAPI.pdb">
-      <publishTime>06/16/2021 20:33:27</publishTime>
+      <publishTime>06/17/2021 16:00:39</publishTime>
     </File>
     <File Include="bin/WebGrease.dll">
       <publishTime>07/17/2013 17:03:52</publishTime>
@@ -324,7 +324,7 @@
       <publishTime>05/25/2021 14:18:16</publishTime>
     </File>
     <File Include="Web.config">
-      <publishTime>06/16/2021 20:33:32</publishTime>
+      <publishTime>06/17/2021 16:00:45</publishTime>
     </File>
   </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index aa5e5c3..7448561 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -358,6 +358,7 @@
     <Compile Include="Controllers\SBGL\Sb_EquipDotCheckPlanBillController.cs" />
     <Compile Include="Controllers\Sb_CheckEqpRepairWorkBillController.cs" />
     <Compile Include="Controllers\SCGL\Sc_MaterToSourceBillController.cs" />
+    <Compile Include="Controllers\SCGL\Sc_MESEndWorkBillController.cs" />
     <Compile Include="Controllers\SCGL\Sc_MESStopWorkBillController.cs" />
     <Compile Include="Controllers\SCGL\Sc_MESBeginWorkBillController.cs" />
     <Compile Include="Controllers\SCGL\QC_LastPieceCheckBillController.cs" />
@@ -385,6 +386,7 @@
     <Compile Include="DLL\ClsSb_EquipRepairCheckBill.cs" />
     <Compile Include="DLL\ClsSb_EquipRepairWorkBill.cs" />
     <Compile Include="DLL\ClsSc_ICMOReportBill.cs" />
+    <Compile Include="DLL\ClsSc_MESEndWorkBill.cs" />
     <Compile Include="DLL\ClsSc_MouldLifeChangeBill.cs" />
     <Compile Include="DLL\ClsSc_MouldProdBackBill.cs" />
     <Compile Include="DLL\ClsSc_MouldProdOutBill.cs" />

--
Gitblit v1.9.1