From 598b30271d6cf3a01621310e55296c1f61f0baf7 Mon Sep 17 00:00:00 2001
From: WYB <908761037@qq.com>
Date: 星期五, 09 四月 2021 22:11:41 +0800
Subject: [PATCH] PDA工序汇报单保存逻辑实现以及普通工序汇报单保存逻辑编写

---
 WebAPI/DLL/ClsSc_ProcessReport.cs                   |  445 ++++++++++++++++++++++
 WebAPI/ListModels.cs                                |    7 
 WebAPI/Models/Sc_ProcessPlanViewModel.cs            |    3 
 WebAPI/Models/Sc_ProcessSendWorkViewModel.cs        |  286 ++++++++++++++
 WebAPI/Controllers/Sc_ProcessMangementController.cs |  228 +++++++++++
 WebAPI/Properties/PublishProfiles/API.pubxml.user   |    6 
 WebAPI/WebAPI.csproj                                |    2 
 WebAPI/Models/Sc_ProcessReportViewModel.cs          |  170 +++++++-
 8 files changed, 1,116 insertions(+), 31 deletions(-)

diff --git a/WebAPI/Controllers/Sc_ProcessMangementController.cs b/WebAPI/Controllers/Sc_ProcessMangementController.cs
index b2b315a..5867b53 100644
--- a/WebAPI/Controllers/Sc_ProcessMangementController.cs
+++ b/WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -458,25 +458,50 @@
             ListModels oListModels = new ListModels();
             try
             {
-                DAL.ClsSc_ProcessReport ReportModel = new DAL.ClsSc_ProcessReport();
+                WebAPI.DLL.ClsSc_ProcessReport ReportModel = new WebAPI.DLL.ClsSc_ProcessReport();
                 List<WebAPI.Models.Sc_ProcessReportViewModel> ls = new List<WebAPI.Models.Sc_ProcessReportViewModel>();
                 ls = oListModels.getObjectByJson_Report(msg1);
                 int i = 0;
-                Model.ClsSc_ProcessReportMain ReportMain = new Model.ClsSc_ProcessReportMain();
-                Model.ClsSc_ProcessReportSub ReportSub = new Model.ClsSc_ProcessReportSub();
+              
                 foreach (Models.Sc_ProcessReportViewModel ItemView in ls)
                 {
                     i++;
+                    Model.ClsSc_ProcessReportMain ReportMain = new Model.ClsSc_ProcessReportMain();
+                    Model.ClsSc_ProcessReportSub ReportSub = new Model.ClsSc_ProcessReportSub();
                     //宸ュ簭姹囨姤鍗曚富琛ㄤ繚瀛�
                     ReportMain.HBillType = "3714";
                     ReportMain.HBillNo = ItemView.HBillNo;
                     ReportMain.HMakeDate=DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                     ReportMain.HYear=DBUtility.ClsPub.isLong(DateTime.Now.Year);
                     ReportMain.HDate = DateTime.Now;
-                    ReportMain.HInterID = ItemView.HInterID;
                     ReportMain.HMaker = ItemView.HEmp;
                     ReportMain.HCloseType = false;
                     ReportMain.HPlanQty = (double)ItemView.HQty;
+                    ReportMain.HMainSourceInterID = ItemView.HInterID;
+                    ReportMain.HInterID =0;
+                    ReportMain.HPeriod = 1;
+                    ReportMain.HBillSubType = "3714";
+                    ReportMain.HBillStatus = 0;
+                    ReportMain.HCheckItemNowID = 0;
+                    ReportMain.HCheckItemNextID = 0;
+                    ReportMain.HICMOInterID= (long)ItemView.HICMOInterID;
+                    ReportMain.HICMOBillNo=ItemView.HICMOBillNo;
+                    ReportMain.HDeptID = (long)ItemView.HDeptID;
+                    ReportMain.HDeptNumber =ItemView.HDeptNumber;
+                    ReportMain.HGroupID = (long)ItemView.HGroupID;
+                    ReportMain.HGroupNumber = ItemView.HGroupNumber;
+                    ReportMain.HMaterID = (long)ItemView.HMaterID;
+                    ReportMain.HMaterNumber = ItemView.HMaterNumber;
+                    ReportMain.HUnitID = ItemView.HUnitID;
+                    ReportMain.HUnitNumber = ItemView.HUnitNumber;
+                    ReportMain.HInStockQty = 0;
+                    ReportMain.HSumTimes = 0;
+                    ReportMain.HExplanation = "";
+                    ReportMain.HInnerBillNo = "";
+                    ReportMain.HSupID = 0;
+                   
+
+
                     //淇濆瓨鍒版眹鎶ュ崟涓昏〃
                     ReportModel.omodel = ReportMain;
 
@@ -491,6 +516,64 @@
                     ReportSub.HCloseType = false;
                     ReportSub.HSourceBillType = "3712";
                     ReportSub.HQty = (double)ItemView.HQty;
+                    ReportSub.HProcID = ItemView.HProcID;
+                    ReportSub.HProcNumber = ItemView.HProcNumber;
+                    ReportSub.HOutPrice =0;
+                    ReportSub.HOutMoney = 0;
+                    ReportSub.HSourceID = (long)ItemView.HSourceID;
+                    ReportSub.HEmpNumber = "";
+                    ReportSub.HRelBeginDate = DateTime.Now;
+                    ReportSub.HRelEndDate = DateTime.Now;
+                    ReportSub.HTimes =3;
+                    ReportSub.HSeOrderInterID = 0;
+                    ReportSub.HSeOrderEntryID =0;
+                    ReportSub.HSeOrderBillNo = "";
+                    ReportSub.HProcPlanInterID = 0;
+                    ReportSub.HProcPlanBillNo = "";
+                    ReportSub.HSourceInterID = 0;
+                    ReportSub.HSourceBillNo = "";
+                    ReportSub.HRelationQty = 0;
+                    ReportSub.HRelationMoney = 0;
+                    ReportSub.HMaterID = (long)ItemView.HMaterID;
+                    ReportSub.HMaterNumber = ItemView.HMaterNumber;
+                    ReportSub.HCheckQty =0;
+                    ReportSub.HBadCount =0;
+                    ReportSub.HWasterQty =0;
+                    ReportSub.HWasterQty2 =0;
+                    ReportSub.HPrice =0;
+                    ReportSub.HMoney =0;
+                    ReportSub.HProcPlanInterID =0;
+                    ReportSub.HProcPlanEntryID =0;
+                    ReportSub.HProcPlanBillNo ="";
+                    ReportSub.HSourceEntryID =0;
+                    ReportSub.HSourceBillType ="";
+                    ReportSub.HRelationQty =0;
+                    ReportSub.HRelationMoney =0;
+                    ReportSub.HBadPrirce =0;
+                    ReportSub.HBadMoney =0;
+                    ReportSub.HWasterPrice =0;
+                    ReportSub.HWasterMoney =0;
+                    ReportSub.HQualityRate =0;
+                    ReportSub.HSecUnitQty1 =0;
+                    ReportSub.HSecUnitRate1=0;
+                    ReportSub.HSecUnitQty2=0;
+                    ReportSub.HSecUnitRate2=0;
+                    ReportSub.HUsingQty=0;
+                    ReportSub.HSelfBadCount=0;
+                    ReportSub.HPreBadCount=0;
+                    ReportSub.HPayMentQty=0;
+                    ReportSub.HOtherDeduct=0;
+                    ReportSub.HRelPay=0;
+                    ReportSub.HOtherItem1="";
+                    ReportSub.HOtherItem2="";
+                    ReportSub.HOtherItem3="";
+                    ReportSub.HOtherItem4="";
+                    ReportSub.HOtherItem5="";
+                    ReportSub.HPackType="";
+                    ReportSub.HCheckEmpID=0;
+                    ReportSub.HWeight=0;
+                    ReportSub.HBatchNo="";
+                   
                     //淇濆瓨鍒版眹鎶ュ崟瀛愯〃
                     ReportModel.DetailColl.Add(ReportSub);
                 }
@@ -559,7 +642,142 @@
             return model;
         }
 
+        /// <summary>
+        /// 淇濆瓨宸ュ簭姹囨姤鍗曚俊鎭�
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("SaveProcessReportList")]
+        [HttpPost]
+        public object SaveProcessReportList([FromBody] JObject msg) 
+        {
+            var _value = msg["msg"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+            
+            ListModels oListModels = new ListModels();
+            try
+            {
+                WebAPI.DLL.ClsSc_ProcessReport ReportModel = new WebAPI.DLL.ClsSc_ProcessReport();
+                List<Model.ClsSc_ProcessReportMain> lsmain = new List<Model.ClsSc_ProcessReportMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Reportlist(msg2);
+                foreach (Model.ClsSc_ProcessReportMain oItem in lsmain)
+                {
+                    //oItem.HMaker = "";
+                    //UserName = oItem.HMaker;
+                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                    oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));
+                    oItem.HBillType = "3714";
+                    //oItem.HExRate = 1;
+                    oItem.HMainSourceInterID = oItem.HInterID;
+                    oItem.HInterID = 0;
+                    //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
+                    if (DBUtility.ClsPub.isStrNull(oItem.HPlanQty) == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊~鍐欐淳宸ユ暟閲忥紝鏃犳硶淇濆瓨锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    ReportModel.omodel = oItem;
+                }
 
-        //
+                //琛ㄤ綋鏁版嵁
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg3 = msg3.Substring(1, msg3.Length - 2);
+                msg3 = msg3.Replace("\\", "");
+                msg3 = msg3.Replace("\n", "");  //\n
+                //msg2 = msg2.Replace("'", "鈥�");
+                //List<Model.ClsCg_POInStockBillSub> ls = new List<Model.ClsCg_POInStockBillSub>();
+                //ls = oListModels.getObjectByJson_POInStockSub(msg3);
+                //int i = 0;
+                //foreach (Model.ClsCg_POInStockBillSub oItemSub in ls)
+                //{
+                //    i++;
+                //    if (oItemSub.HQty <= 0)
+                //    {
+                //        objJsonResult.code = "0";
+                //        objJsonResult.count = 0;
+                //        objJsonResult.Message = "淇濆瓨澶辫触锛佺" + i.ToString() + "琛屾暟閲忎笉澶т簬0鏃犳硶淇濆瓨锛�";
+                //        objJsonResult.data = 1;
+                //        return objJsonResult;
+                //    }
+                //    if (oItemSub.HQty > oItemSub.HRQty)
+                //    {
+                //        objJsonResult.code = "0";
+                //        objJsonResult.count = 0;
+                //        objJsonResult.Message = "淇濆瓨澶辫触锛佺" + i.ToString() + "琛屾暟閲忎笉鑳藉ぇ浜庢湭鍏宠仈鏁伴噺锛�";
+                //        objJsonResult.data = 1;
+                //        return objJsonResult;
+                //    }
+                //    if (DBUtility.ClsPub.isStrNull(oItemSub.HBatChNo) == "")
+                //    {
+                //        objJsonResult.code = "0";
+                //        objJsonResult.count = 0;
+                //        objJsonResult.Message = "淇濆瓨澶辫触锛佺" + i.ToString() + "琛屾湭濉啓鎵瑰彿锛�";
+                //        objJsonResult.data = 1;
+                //        return objJsonResult;
+                //    }
+
+                //    oItemSub.HEntryID = i;
+                //    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                //    oItemSub.HRemark = "";
+                //    oItemSub.HCloseMan = "";
+                //    oItemSub.HCloseType = false;
+                //    oBill.DetailColl.Add(oItemSub);
+
+                //}
+                ////淇濆瓨鍓嶅垽鏂�(鍗曟嵁鍙烽噸澶嶏紝绗斿綍椤圭洰)
+                ////淇濆瓨
+                ////淇濆瓨瀹屾瘯鍚庡鐞�
+                //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;
+            }
+        }
+
+
+     
     }
 }
\ No newline at end of file
diff --git a/WebAPI/DLL/ClsSc_ProcessReport.cs b/WebAPI/DLL/ClsSc_ProcessReport.cs
new file mode 100644
index 0000000..c0eb34a
--- /dev/null
+++ b/WebAPI/DLL/ClsSc_ProcessReport.cs
@@ -0,0 +1,445 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data;
+
+namespace WebAPI.DLL
+{
+    public  class ClsSc_ProcessReport:DBUtility.ClsXt_BaseBill
+    {
+        public Model.ClsSc_ProcessReportMain omodel = new Model.ClsSc_ProcessReportMain();
+        public List<Model.ClsSc_ProcessReportSub> DetailColl = new List<Model.ClsSc_ProcessReportSub>();
+
+        public ClsSc_ProcessReport()
+        {
+            base.MvarItemKeySub = "Sc_ProcessReportSub";
+            base.MvarItemKeySub2 = "";
+            base.MvarItemKeySub3 = "";
+            base.MvarItemKeySub4 = "";
+            base.MvarItemKey="Sc_ProcessReportMain";
+            base.MvarReportTitle="宸ュ簭姹囨姤鍗�";
+            base.BillType="3714"; 
+        }
+
+        #region 鍥哄畾浠g爜
+
+        ~ClsSc_ProcessReport()
+        {
+            DetailColl = null;
+        }
+       
+        #endregion   鑷畾涔夋柟娉�
+        //淇敼鍗曟嵁
+        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //
+                oCn.BeginTran();
+                //鏇存柊涓昏〃
+                oCn.RunProc("UpDate Sc_ProcessReportMain set  " +
+                " HYear=" + omodel.HYear.ToString() +
+                ",HPeriod=" + omodel.HPeriod.ToString() +
+                ",HDate='" + omodel.HDate.ToShortDateString() + "'" +
+                ",HBillStatus=" + omodel.HBillStatus.ToString() +
+                ",HCheckItemNowID=" + omodel.HCheckItemNowID.ToString() +
+                ",HCheckItemNextID=" + omodel.HCheckItemNextID.ToString() +
+                ",HICMOInterID=" + omodel.HICMOInterID.ToString() +
+                ",HICMOBillNo='" + omodel.HICMOBillNo + "'" +
+                ",HMarker='" + omodel.HMarker + "'" +
+                ",HSupID=" + omodel.HSupID.ToString() +
+                ",HDeptID=" + omodel.HDeptID.ToString() +
+                ",HDeptNumber='" + omodel.HDeptNumber + "'" +
+                ",HGroupID=" + omodel.HGroupID.ToString() +
+                ",HGroupNumber='" + omodel.HGroupNumber + "'" +
+                ",HMaterID=" + omodel.HMaterID.ToString() +
+                ",HMaterNumber='" + omodel.HMaterNumber + "'" + 
+                ",HUnitID=" + omodel.HUnitID.ToString() +
+                ",HUnitNumber='" + omodel.HUnitNumber + "'" + 
+                ",HPlanQty=" + omodel.HPlanQty.ToString() +
+                ",HInStockQty=" + omodel.HInStockQty.ToString() +
+                ",HSumTimes=" + omodel.HSumTimes.ToString() +
+                ",HExplanation='" + omodel.HExplanation + "'" +
+                ",HRemark='" + omodel.HRemark + "'" +
+                ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
+                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
+                ",HUpDateDate=getdate()" +
+                " where HInterID=" + lngBillKey.ToString());
+                //鍒犻櫎鍏宠仈
+                DeleteRelation(ref sReturn, lngBillKey);
+                //鍒犻櫎瀛愯〃
+                DeleteBillSub(lngBillKey);
+                //鎻掑叆瀛愯〃
+                omodel.HInterID = lngBillKey;
+                foreach (Model.ClsSc_ProcessReportSub oSub in DetailColl)
+                {
+                    oCn.RunProc("Insert into Sc_ProcessReportSub " +
+                  " (HInterID,HEntryID,HProcID,HProcNumber,HEmpID" +
+                  ",HMaterID,HMaterNumber,HOutPrice,HOutMoney" +
+                  ",HEmpNumber,HSourceID,HRelBeginDate,HRelEndDate,HTimes" +
+                  ",HQty,HCheckQty,HBadCount,HWasterQty,HWasterQty2" +
+                  ",HPrice,HMoney,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo" +
+                  ",HICMOInterID,HICMOBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
+                  ",HCloseMan,HCloseType,HRemark" +
+                  ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+                  ",HBadPrirce,HBadMoney,HWasterPrice,HWasterMoney,HQualityRate," +
+                  "HSecUnitQty1,HSecUnitRate1,HSecUnitQty2,HSecUnitRate2,HUsingQty," +
+                  "HSelfBadCount,HPreBadCount,HPayMentQty,HOtherDeduct,HRelPay," +
+                  "HOtherItem1,HOtherItem2,HOtherItem3,HOtherItem4,HOtherItem5," +
+                  "HPackType,HCheckEmpID,HBatchNo" +
+                  ") values("
+                  + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HProcID.ToString() + ",'" + oSub.HProcNumber + "'," + oSub.HEmpID.ToString() +
+                  "," + oSub.HMaterID.ToString() + ",'" + oSub.HMaterNumber + "'," + oSub.HOutPrice.ToString() + "," + oSub.HOutMoney.ToString() + 
+                  ",'" + oSub.HEmpNumber + "'," + oSub.HSourceID.ToString() + ",'" + oSub.HRelBeginDate.ToShortDateString() + "','" + oSub.HRelEndDate.ToShortDateString() + "'," + oSub.HTimes.ToString() +
+                  "," + oSub.HQty.ToString() + "," + oSub.HCheckQty.ToString() + "," + oSub.HBadCount.ToString() + "," + oSub.HWasterQty.ToString() +"," + oSub.HWasterQty2.ToString() +
+                  "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HProcPlanInterID.ToString() + "," + oSub.HProcPlanEntryID.ToString() + ",'" + oSub.HProcPlanBillNo + "'" +
+                  "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
+                  ",'" + oSub.HCloseMan + "'," + 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.HBadPrirce.ToString() + "," + oSub.HBadMoney.ToString() + "," + oSub.HWasterPrice.ToString() + "," + oSub.HWasterMoney.ToString() + "," + oSub.HQualityRate.ToString() +
+                  "," + oSub.HSecUnitQty1.ToString() + "," + oSub.HSecUnitRate1.ToString() + "," + oSub.HSecUnitQty2.ToString() + "," + oSub.HSecUnitRate2.ToString() + "," + oSub.HUsingQty.ToString() +
+                  "," + oSub.HSelfBadCount.ToString() + "," + oSub.HPreBadCount.ToString() + "," + oSub.HPayMentQty.ToString() + "," + oSub.HOtherDeduct.ToString() + "," + oSub.HRelPay.ToString() +
+                  ",'" + oSub.HOtherItem1.ToString() + "','" + oSub.HOtherItem2.ToString() + "','" + oSub.HOtherItem3.ToString() + "','" + oSub.HOtherItem4.ToString() + "','" + oSub.HOtherItem5.ToString() +
+                  "','" + oSub.HPackType.ToString() + "'," + oSub.HCheckEmpID.ToString() + ",'" + oSub.HBatchNo + "'" + 
+                  ") ");
+                }
+                //鏇存柊鍏宠仈鏁伴噺
+                AddNewRelation(ref sReturn, omodel.HInterID);
+                //
+                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_ProcessReportMain   " +
+                "(HYear,HPeriod,HBillType,HBillSubType,HInterID" +
+                ",HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID" +
+                ",HICMOInterID,HICMOBillNo ,HDeptID ,HDeptNumber,HGroupID" +
+                ",HGroupNumber,HMaterID,HMaterNumber,HUnitID,HUnitNumber" +
+                ",HPlanQty,HInStockQty,HSumTimes,HExplanation,HRemark" +
+                ",HInnerBillNo,HMaker,HMakeDate,HSupID,HMarker" +
+                ") " +
+                " values(" + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + this.BillType +"','"+ omodel.HBillSubType + "'," + omodel.HInterID.ToString() +
+                ",'" + omodel.HDate.ToShortDateString() + "','" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + "," + omodel.HCheckItemNowID.ToString() + "," + omodel.HCheckItemNextID.ToString() +
+                "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HDeptID.ToString() + ",'" + omodel.HDeptNumber + "'," + omodel.HGroupID.ToString() +
+                ",'" + omodel.HGroupNumber + "'," + omodel.HMaterID.ToString() + ",'" + omodel.HMaterNumber + "'," + omodel.HUnitID.ToString() + ",'" + omodel.HUnitNumber + "'" +
+                ", " + omodel.HPlanQty.ToString() + "," + omodel.HInStockQty.ToString() + "," + omodel.HSumTimes.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HRemark + "'" +
+                ",'" + omodel.HInnerBillNo  + "','" + DBUtility.ClsPub.CurUserName + "',getdate()," + omodel.HSupID.ToString() + ",'" + omodel.HMarker + "'" +
+                ") ");
+                //鎻掑叆瀛愯〃
+                foreach (Model.ClsSc_ProcessReportSub oSub in DetailColl)
+                {
+                    oCn.RunProc("Insert into Sc_ProcessReportSub " +
+                  " (HInterID,HEntryID,HProcID,HProcNumber,HEmpID" +
+                  ",HMaterID,HMaterNumber,HOutPrice,HOutMoney" +
+                  ",HEmpNumber,HSourceID,HRelBeginDate,HRelEndDate,HTimes" +
+                  ",HQty,HCheckQty,HBadCount,HWasterQty,HWasterQty2" +
+                  ",HPrice,HMoney,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo" +
+                  ",HICMOInterID,HICMOBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
+                  ",HCloseMan,HCloseType,HRemark" +
+                  ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+                  ",HBadPrirce,HBadMoney,HWasterPrice,HWasterMoney,HQualityRate,"+
+                  "HSecUnitQty1,HSecUnitRate1,HSecUnitQty2,HSecUnitRate2,HUsingQty,"+
+                  "HSelfBadCount,HPreBadCount,HPayMentQty,HOtherDeduct,HRelPay,"+
+                  "HOtherItem1,HOtherItem2,HOtherItem3,HOtherItem4,HOtherItem5,"+
+                  "HPackType,HCheckEmpID,HWeight,HBatchNo" +
+                  ") values("
+                  + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HProcID.ToString() + ",'" + oSub.HProcNumber + "'," + oSub.HEmpID.ToString() +
+                  "," + oSub.HMaterID.ToString() + ",'" + oSub.HMaterNumber + "'," + oSub.HOutPrice.ToString() + "," + oSub.HOutMoney.ToString() + 
+                  ",'" + oSub.HEmpNumber + "'," + oSub.HSourceID.ToString() + ",'" + oSub.HRelBeginDate.ToShortDateString() + "','" + oSub.HRelEndDate.ToShortDateString() + "'," + oSub.HTimes.ToString() +
+                  "," + oSub.HQty.ToString() + "," + oSub.HCheckQty.ToString() + "," + oSub.HBadCount.ToString() + "," + oSub.HWasterQty.ToString() + "," + oSub.HWasterQty2.ToString() +
+                  "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HProcPlanInterID.ToString() + "," + oSub.HProcPlanEntryID.ToString() + ",'" + oSub.HProcPlanBillNo + "'" +
+                  "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
+                  ",'" + oSub.HCloseMan + "'," + 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.HBadPrirce.ToString() + "," + oSub.HBadMoney.ToString() + "," + oSub.HWasterPrice.ToString() + "," + oSub.HWasterMoney.ToString() + "," + oSub.HQualityRate.ToString() +
+                  "," + oSub.HSecUnitQty1.ToString() + "," + oSub.HSecUnitRate1.ToString() + "," + oSub.HSecUnitQty2.ToString() + "," + oSub.HSecUnitRate2.ToString() + "," + oSub.HUsingQty.ToString() +
+                  "," + oSub.HSelfBadCount.ToString() + "," + oSub.HPreBadCount.ToString() + "," + oSub.HPayMentQty.ToString() + "," + oSub.HOtherDeduct.ToString() + "," + oSub.HRelPay.ToString() +
+                  ",'" + oSub.HOtherItem1.ToString() + "','" + oSub.HOtherItem2.ToString() + "','" + oSub.HOtherItem3.ToString() + "','" + oSub.HOtherItem4.ToString() + "','" + oSub.HOtherItem5.ToString() +
+                  "','" + oSub.HPackType.ToString() + "'," + oSub.HCheckEmpID.ToString() + "," + oSub.HWeight.ToString() + ",'" + oSub.HBatchNo + "'" +
+                  ") ");
+                }
+                //鏇存柊鍏宠仈鏁伴噺
+                AddNewRelation(ref sReturn, omodel.HInterID);
+                //鍥炲~ 鐢熶骇鐘舵�佽〃  鏃ヨ鍒�  涓� 宸插畬宸� 鐘舵��
+                oCn.RunProc("exec h_p_Sc_UpDateICMOBillQualityStatus " + omodel.HICMOStatusInterID.ToString() + ",3");
+                //榛樿鍙樹负 鐢宠妫�楠岀姸鎬�
+                oCn.RunProc("exec h_p_Sc_UpDateProcessReportStatus " + omodel.HInterID.ToString() + ",15");
+                //
+                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_ProcessReportMain Where HInterID=" + lngBillKey.ToString(), "Sc_ProcessReportMain");
+                if(Ds.Tables[0].Rows.Count==0)
+                {
+                    sReturn = "鍗曟嵁鏈壘鍒帮紒";
+                    return false;
+                }
+                //璧嬪��
+                omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
+                omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
+                omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
+                omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]);
+                omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
+                omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]);
+                omodel.HBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]);
+                omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]);
+                omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]);
+                omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]);
+                //
+                omodel.HICMOInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOInterID"]);
+                omodel.HICMOBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HICMOBillNo"]);
+                omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]);
+                omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]);
+                omodel.HDeptNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeptNumber"]);
+                omodel.HGroupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HGroupID"]);
+                omodel.HGroupNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HGroupNumber"]);
+                omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]);
+                omodel.HMaterNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterNumber"]);
+                omodel.HUnitID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HUnitID"]);
+                omodel.HUnitNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUnitNumber"]);
+                omodel.HPlanQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPlanQty"]);
+                omodel.HInStockQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HInStockQty"]);
+                omodel.HSumTimes = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HSumTimes"]);
+                omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]);
+                omodel.HRemark = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
+                omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]);
+                omodel.HMarker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMarker"]);
+                //
+                 omodel.HBacker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBacker"]);
+                omodel.HBackDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackDate"]);
+                omodel.HChecker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HChecker"]);
+                omodel.HCheckDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckDate"]);
+                omodel.HMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaker"]);
+                omodel.HMakeDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMakeDate"]);
+                omodel.HUpDater = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDater"]);
+                omodel.HUpDateDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDateDate"]);
+                omodel.HCloseMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseMan"]);
+                omodel.HCloseDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseDate"]);
+                omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]);
+                omodel.HDeleteMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteMan"]);
+                omodel.HDeleteDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteDate"]);
+                //寰幆
+                DataSet DsSub ;
+                DsSub = oCn.RunProcReturn("Select * from Sc_ProcessReportSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_ProcessReportSub");
+                DetailColl.Clear();//娓呯┖
+                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
+                {
+                    Model.ClsSc_ProcessReportSub oSub = new Model.ClsSc_ProcessReportSub();
+                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
+                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
+                    //
+                    oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]);
+                    oSub.HMaterNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMaterNumber"]);
+                    oSub.HProcID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcID"]);
+                    oSub.HProcNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HProcNumber"]);
+                    oSub.HEmpID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEmpID"]);
+                    oSub.HEmpNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HEmpNumber"]);
+                    oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]);
+                    oSub.HRelBeginDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HRelBeginDate"]);
+                    oSub.HRelEndDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HRelEndDate"]);
+                    oSub.HTimes = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HTimes"]);
+                    oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]);
+                    oSub.HCheckQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HCheckQty"]);
+                    oSub.HBadCount = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HBadCount"]);
+                    oSub.HWasterQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HWasterQty"]);
+                    oSub.HWasterQty2 = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HWasterQty2"]);
+                    oSub.HPrice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HPrice"]);
+                    oSub.HMoney = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HMoney"]);
+                    oSub.HOutMoney = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HOutMoney"]);
+                    oSub.HOutPrice = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HOutPrice"]);
+                    //addnew
+                    oSub.HBadPrirce = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HBadPrirce"]);
+                    oSub.HBadMoney = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HBadMoney"]);
+                    oSub.HWasterPrice = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HWasterPrice"]);
+                    oSub.HWasterMoney = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HWasterMoney"]);
+                    oSub.HQualityRate = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HQualityRate"]);
+
+                    oSub.HSecUnitQty1 = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HSecUnitQty1"]);
+                    oSub.HSecUnitRate1 = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HSecUnitRate1"]);
+                    oSub.HSecUnitQty2 = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HSecUnitQty2"]);
+                    oSub.HSecUnitRate2 = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HSecUnitRate2"]);
+                    oSub.HUsingQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HUsingQty"]);
+                    oSub.HSelfBadCount = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HSelfBadCount"]);
+                    oSub.HPreBadCount = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HPreBadCount"]);
+
+                    oSub.HPayMentQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HPayMentQty"]);
+                    oSub.HOtherDeduct = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HOtherDeduct"]);
+                    oSub.HRelPay = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HRelPay"]);
+                    oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]);
+
+                    oSub.HOtherItem1 = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HOtherItem1"]);
+                    oSub.HOtherItem2 = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HOtherItem2"]);
+                    oSub.HOtherItem3 = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HOtherItem3"]);
+                    oSub.HOtherItem4 = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HOtherItem4"]);
+                    oSub.HOtherItem5 = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HOtherItem5"]);
+                    oSub.HPackType = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HPackType"]);
+                    oSub.HCheckEmpID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HCheckEmpID"]);
+
+                    //
+                    oSub.HProcPlanInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcPlanInterID"]);
+                    oSub.HProcPlanEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcPlanEntryID"]);
+                    oSub.HProcPlanBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HProcPlanBillNo"]);
+                    oSub.HICMOInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HICMOInterID"]);
+                    oSub.HICMOBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HICMOBillNo"]);
+                    oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]);
+                    oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]);
+                    oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSeOrderBillNo"]);
+                    //
+                    oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]);
+                    oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]);
+                    oSub.HRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HRemark"]);
+                    oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]);
+                    oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]);
+                    oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillNo"]);
+                    oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillType"]);
+                    oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]);
+                    oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]);
+                    DetailColl.Add(oSub);
+                }
+                sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+        }
+
+        //瀹℃牳
+        public bool CheckBill(Int64 lngBillKey, ref string sReturn)
+        {
+            DataSet oDs = new DataSet();
+            string sBillName = "";
+            sReturn = "";
+            try
+            {
+                string HChecker = DBUtility.ClsPub.CurUserName;
+                string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
+                //
+                oDs = oCn.RunProcReturn("select * from Sc_ProcessReportSub where HInterID=" + lngBillKey.ToString(), "Sc_ProcessReportSub");
+                if (oDs == null || oDs.Tables[0].Rows.Count == 0)
+                {
+                    return false;
+                }
+                for (int i = 0; i <= oDs.Tables[0].Rows.Count - 1; i++)
+                {
+                    long ProdMoveInterID = DBUtility.ClsPub.CreateBillID("3771", ref DBUtility.ClsPub.sExeReturnInfo);
+                    string ProdMoveBillNo = DBUtility.ClsPub.CreateBillCode("3771", ref DBUtility.ClsPub.sExeReturnInfo, true);
+                    //oCn.RunProc("exec h_p_Sc_ProcProdMoveBill_Add " + lngBillKey.ToString() + "," + DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[i]["HEntryID"]).ToString() + "," + ProdMoveInterID.ToString() + ",'" + ProdMoveBillNo + "','" + HChecker + "'");
+                    sBillName = sBillName + ProdMoveBillNo + ",";
+                }
+                oCn.RunProc(" Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString());
+
+                sReturn = sBillName;
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+
+        }
+
+        //鍒犻櫎鍏宠仈
+        public override void DeleteRelation(ref string sReturn, Int64 lngBillKey)
+        {
+            //澧炲姞
+            try
+            {
+                if (omodel.HMainSourceBillType == "宸ュ簭璁″垝鍗�")
+                {
+                    oCn.RunProc("exec h_p_Sc_UpDateProcessPlanRelation_Del " + lngBillKey.ToString());
+                }
+                else
+                {
+                    oCn.RunProc("exec h_p_Sc_UpDateICMOBillStatusRelation_Del " + lngBillKey.ToString());
+                }
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
+
+        //鏂板鍏宠仈
+        public override void AddNewRelation(ref string sReturn, Int64 lngBillKey)
+        {
+            //澧炲姞
+            try
+            {
+                if (omodel.HMainSourceBillType == "宸ュ簭璁″垝鍗�")
+                {
+                    oCn.RunProc("exec h_p_Sc_UpDateProcessPlanRelation_Add " + lngBillKey.ToString());
+                }
+                else
+                {
+                    oCn.RunProc("exec h_p_Sc_UpDateICMOBillStatusRelation_Add " + lngBillKey.ToString());
+                }
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
+
+        public bool CheckStatus(long HMainID, long HSubID, ref string sReturn)
+        {
+            DataSet oDs = new DataSet();
+            oDs = oCn.RunProcReturn("exec h_p_Sc_CheckProcessReportStatus " + HMainID.ToString() + "," + HSubID.ToString(), "h_p_Sc_CheckProcessReportStatus");
+            if (oDs == null || oDs.Tables[0].Rows.Count == 0)
+            {
+                sReturn = "鏈煡璇㈠埌璁板綍锛�";
+                return false;
+            }
+            if (DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0][0]) != 99)
+            {
+                sReturn = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0][1]);
+                return false;
+            }
+            else
+            {
+                sReturn = "姝e父";
+                return true;
+            }
+        }
+
+
+        //
+    }
+
+}
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index 12ece20..a3f1463 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -162,5 +162,12 @@
             List<WebAPI.Models.Sc_ProcessReportViewModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<WebAPI.Models.Sc_ProcessReportViewModel>>(jsonString);
             return list;
         }
+
+        public List<Model.ClsSc_ProcessReportMain> getObjectByJson_Reportlist(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsSc_ProcessReportMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_ProcessReportMain>>(jsonString);
+            return list;
+        }
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Models/Sc_ProcessPlanViewModel.cs b/WebAPI/Models/Sc_ProcessPlanViewModel.cs
index c9612b7..ae64f70 100644
--- a/WebAPI/Models/Sc_ProcessPlanViewModel.cs
+++ b/WebAPI/Models/Sc_ProcessPlanViewModel.cs
@@ -5,6 +5,9 @@
 
 namespace WebAPI.Models
 {
+    /// <summary>
+    /// 宸ュ簭璁″垝鍗曡鍥炬ā鍨�
+    /// </summary>
     public class Sc_ProcessPlanViewModel
     {
         public Int64? hmainid;  //      [hmainid], 
diff --git a/WebAPI/Models/Sc_ProcessReportViewModel.cs b/WebAPI/Models/Sc_ProcessReportViewModel.cs
index abf3f06..6a38cf7 100644
--- a/WebAPI/Models/Sc_ProcessReportViewModel.cs
+++ b/WebAPI/Models/Sc_ProcessReportViewModel.cs
@@ -5,32 +5,156 @@
 
 namespace WebAPI.Models
 {
+    /// <summary>
+    /// 宸ュ簭姹囨姤鍗曟ā鍨�
+    /// </summary>
     public class Sc_ProcessReportViewModel
     {
+        /// <summary>
+        /// 鏉″舰鐮佺紪鐮�
+        /// </summary>
+        public string HBarCode; 
 
-        public string HBarCode; //鏉″舰鐮佺紪鐮�
-        public string HSendWorkBillNo; //娲惧伐鍗曟嵁鍙�
-        public string HBillNo;//姹囨姤鍗曟嵁鍙�
-        public Int64 HInterID; //涓婚敭id
-        public string HProcNo; //宸ュ簭鍙�
-        public string HProcName; //宸ュ簭鍚嶇О
-        public Int64 HProcID; //宸ュ簭id
-        public string HProc;//
-        public string HMaterModel;//瑙勬牸鍨嬪彿
-        public Int64? HEmpID; //鍒涘缓浜篿d
-        public decimal HQty; //鏁伴噺
-        public string HSource; //鐢熶骇璧勬簮
-        public Int64?  HSourceID; //鐢熶骇璧勬簮id
-        public string HGroup; //鐝粍
-        public Int64? HGroupID;//鐝粍id
-        public string HICMOBillNo;//浠诲姟鍗曞彿
-        public DateTime? HReportTime; //鍒涘缓鏃堕棿
-        public Int64? HMaterID;//浜у搧id
-        public string HMaterName;//浜у搧鍚嶇О
-        public decimal HICMOQty;//
-        public Int64? HICMOInterID;//浠诲姟鍗昳d
-        public Int64? HDeptID;//閮ㄩ棬id
-        public string HEmp;//鍒涘缓浜�
+        /// <summary>
+        /// 娲惧伐鍗曟嵁鍙�
+        /// </summary>
+        public string HSendWorkBillNo; 
+
+        /// <summary>
+        /// 姹囨姤鍗曟嵁鍙�
+        /// </summary>
+        public string HBillNo;
+
+        /// <summary>
+        /// 涓婚敭id
+        /// </summary>
+        public Int64 HInterID; 
+
+        /// <summary>
+        /// 宸ュ簭鍙�
+        /// </summary>
+        public string HProcNo; 
+
+        /// <summary>
+        /// 宸ュ簭鍚嶇О
+        /// </summary>
+        public string HProcName; 
+
+        /// <summary>
+        /// 宸ュ簭id
+        /// </summary>
+        public Int64 HProcID; 
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string HProc;
+
+        /// <summary>
+        /// 瑙勬牸鍨嬪彿
+        /// </summary>
+        public string HMaterModel;
+
+        /// <summary>
+        /// 鍒涘缓浜篿d
+        /// </summary>
+        public Int64? HEmpID; 
+
+        /// <summary>
+        /// 鏁伴噺
+        /// </summary>
+        public decimal HQty; 
+
+        /// <summary>
+        /// 鐢熶骇璧勬簮
+        /// </summary>
+        public string HSource; 
+
+        /// <summary>
+        /// 鐢熶骇璧勬簮id
+        /// </summary>
+        public Int64?  HSourceID; 
+
+        /// <summary>
+        /// 鐝粍
+        /// </summary>
+        public string HGroup; 
+
+        /// <summary>
+        /// 鐝粍id
+        /// </summary>
+        public Int64? HGroupID;
+
+        /// <summary>
+        /// 鐝粍浠g爜
+        /// </summary>
+        public string HGroupNumber;
+
+        /// <summary>
+        /// 浠诲姟鍗曞彿
+        /// </summary>
+        public string HICMOBillNo;
+
+        /// <summary>
+        /// 鍒涘缓鏃堕棿
+        /// </summary>
+        public DateTime? HReportTime; 
+
+        /// <summary>
+        /// 浜у搧id
+        /// </summary>
+        public Int64? HMaterID;
+
+        /// <summary>
+        /// 浜у搧鍚嶇О
+        /// </summary>
+        public string HMaterName;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public decimal HICMOQty;
+
+        /// <summary>
+        /// 浠诲姟鍗昳d
+        /// </summary>
+        public Int64? HICMOInterID;
+
+        /// <summary>
+        /// 閮ㄩ棬id
+        /// </summary>
+        public Int64? HDeptID;
+
+        /// <summary>
+        /// 閮ㄩ棬浠g爜
+        /// </summary>
+        public string HDeptNumber;
+
+        /// <summary>
+        /// 鍒涘缓浜�
+        /// </summary>
+        public string HEmp;
+
+        /// <summary>
+        /// 鍗曚綅id
+        /// </summary>
+        public Int64 HUnitID;
+
+        /// <summary>
+        /// 璁¢噺鍗曚綅浠g爜
+        /// </summary>
+        public string HUnitNumber;
+
+        /// <summary>
+        /// 浜у搧浠g爜
+        /// </summary>
+        public string HMaterNumber;
+
+        /// <summary>
+        /// 宸ュ簭浠g爜
+        /// </summary>
+        public string HProcNumber;
+
        
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Models/Sc_ProcessSendWorkViewModel.cs b/WebAPI/Models/Sc_ProcessSendWorkViewModel.cs
new file mode 100644
index 0000000..e731a4c
--- /dev/null
+++ b/WebAPI/Models/Sc_ProcessSendWorkViewModel.cs
@@ -0,0 +1,286 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    /// <summary>
+    /// 宸ュ簭娲惧伐鍗曡鍥炬ā鍨�
+    /// </summary>
+    public class Sc_ProcessSendWorkViewModel
+    {
+       
+        /// <summary>
+        /// 
+        /// </summary>
+        public Int64? hmainid { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public DateTime? 鏃ユ湡 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 鍗曟嵁鍙� { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public Int64? HDeptID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 閮ㄩ棬浠g爜 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 閮ㄩ棬 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public Int64? HMaterID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 鐗╂枡浠g爜 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 鐗╂枡鍚嶇О { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 瑙勬牸鍨嬪彿 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public Int64? HUnitID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 璁¢噺鍗曚綅浠g爜 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 璁¢噺鍗曚綅 { get; set; }
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public Int64? HprocID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 宸ュ簭浠g爜 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 宸ュ簭 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public Int64? HGroupID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 鐝粍浠g爜 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 鐝粍鍚嶇О { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public Int64? HSourceID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 璧勬簮浠g爜 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 鐢熶骇璧勬簮 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public Int64? HWorkerID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 鑱屽憳浠g爜 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 鑱屽憳 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public Int64? hsubid { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public decimal? 鏁伴噺 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public DateTime? 璁″垝寮�宸ユ棩鏈� { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public DateTime? 璁″垝瀹屽伐鏃ユ湡 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public decimal? 璁″垝宸ユ椂 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 琛ㄤ綋澶囨敞 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public Int64? HICMOInterID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 鐢熶骇浠诲姟鍗曞彿 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public Int64? HSeOrderInterID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 閿�鍞鍗曞彿 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 琛ㄥご澶囨敞 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 鍒跺崟浜� { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public DateTime? 鍒跺崟鏃ユ湡 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 瀹℃牳浜� { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public DateTime? 瀹℃牳鏃ユ湡 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 淇敼浜� { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public DateTime? 淇敼鏃ユ湡 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 鍏抽棴浜� { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public DateTime? 鍏抽棴鏃ユ湡 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 浣滃簾浜� { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public DateTime? 浣滃簾鏃ユ湡 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public Int64? 婧愬崟涓诲唴鐮� { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public Int64? 婧愬崟瀛愬唴鐮� { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 婧愬崟鍗曞彿 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 婧愬崟绫诲瀷 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string 琛屽叧闂汉 { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string HBillType { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public Int64? HQtyDecimal { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public Int64? HPriceDecimal { get; set; }
+
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Properties/PublishProfiles/API.pubxml.user b/WebAPI/Properties/PublishProfiles/API.pubxml.user
index eb094ce..32d8a61 100644
--- a/WebAPI/Properties/PublishProfiles/API.pubxml.user
+++ b/WebAPI/Properties/PublishProfiles/API.pubxml.user
@@ -163,10 +163,10 @@
       <publishTime>11/24/2014 11:18:48</publishTime>
     </File>
     <File Include="bin/WebAPI.dll">
-      <publishTime>04/08/2021 15:31:05</publishTime>
+      <publishTime>04/09/2021 19:13:23</publishTime>
     </File>
     <File Include="bin/WebAPI.pdb">
-      <publishTime>04/08/2021 15:31:05</publishTime>
+      <publishTime>04/09/2021 19:13:23</publishTime>
     </File>
     <File Include="bin/WebAPI.XmlSerializers.dll">
       <publishTime>02/04/2021 21:35:21</publishTime>
@@ -340,7 +340,7 @@
       <publishTime>03/26/2021 14:35:48</publishTime>
     </File>
     <File Include="Web.config">
-      <publishTime>04/08/2021 15:31:28</publishTime>
+      <publishTime>04/09/2021 19:13:32</publishTime>
     </File>
   </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index f5ee9d5..373275c 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -338,6 +338,7 @@
     <Compile Include="Dapper\SqlHelper.cs" />
     <Compile Include="Dapper\SqlPools.cs" />
     <Compile Include="DbUntil\DataFormatUntil.cs" />
+    <Compile Include="DLL\ClsSc_ProcessReport.cs" />
     <Compile Include="Models\ApiConfig.cs" />
     <Compile Include="Models\ApiResult.cs" />
     <Compile Include="Models\DocumentsView.cs" />
@@ -348,6 +349,7 @@
     <Compile Include="Models\M_Process.cs" />
     <Compile Include="Models\Sc_ProcessPlanViewModel.cs" />
     <Compile Include="Models\Sc_ProcessReportViewModel.cs" />
+    <Compile Include="Models\Sc_ProcessSendWorkViewModel.cs" />
     <Compile Include="Models\StationEntrustInBill.cs" />
     <Compile Include="Models\StationOutBillView.cs" />
     <Compile Include="Properties\Resources.Designer.cs">

--
Gitblit v1.9.1