From f5b17648645b4bddfd64c471158f2c8f8b172083 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期二, 16 四月 2024 10:48:47 +0800
Subject: [PATCH] 1

---
 DAL/质检管理/ClsQC_NoPassProdConclusionBill.cs                   |  304 +++++
 Model/Model.csproj                                           |    4 
 WebAPI/Models/ClsKf_ICStockBillMain.cs                       |    2 
 WarM/条码打印/Gy_BarCodeBill.cs                                  |   62 
 WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs  |  342 +++++
 Model/采购管理/ClsCg_POOrderBillSub.cs                           |    1 
 WebAPI/Web.config                                            |    4 
 WebAPI/Models/ClsGy_Material_Model.cs                        |   10 
 Model/仓库管理/ClsSc_ProductionReturnBillSub.cs                  |   35 
 DAL/仓库管理/ClsSc_ProductionReturnBill.cs                       |  722 ++++++++++++
 WebAPI/Controllers/SCGL/Sc_ProductionReturnBillController.cs |  810 ++++++++------
 WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs        |   14 
 WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs        |    9 
 Model/采购管理/ClsCg_POInStockBillMain.cs                        |    2 
 WebAPI/Controllers/BLL/Xt_UserController.cs                  |    6 
 WebAPI/Controllers/WebAPIController.cs                       |   49 
 WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs          |   15 
 WebAPI/Models/Gy_User.cs                                     |    1 
 Model/采购管理/ClsCg_POOrderBillMain.cs                          |    2 
 Model/仓库管理/ClsSc_ProductionReturnBillMain.cs                 |   24 
 WebAPI/Models/ClsOA_ErrMsgBackBillMain.cs                    |    2 
 WebAPI/ListModels.cs                                         |   12 
 Model/质检管理/ClsQC_NoPassProdConclusionBillMain.cs             |   30 
 DAL/DAL.csproj                                               |    2 
 Model/质检管理/ClsQC_NoPassProdConclusionBillSub.cs              |   11 
 WebAPI/Controllers/Sc_ProcessMangementController.cs          |  855 +++++++++++++++
 WebAPI/DLL/ClsOA_ErrMsgBackBill.cs                           |    6 
 WebAPI/Models/ClsKf_ICStockBillSub.cs                        |    1 
 WebAPI/DLL/ClsGy_Material_Ctl.cs                             |   13 
 29 files changed, 2,940 insertions(+), 410 deletions(-)

diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj
index b84d126..ed1f279 100644
--- a/DAL/DAL.csproj
+++ b/DAL/DAL.csproj
@@ -90,6 +90,7 @@
     <Compile Include="MES\ClsSc_MESMaterToSourceBill .cs" />
     <Compile Include="浜轰簨绠$悊\ClsHR_EmpFosterBill.cs" />
     <Compile Include="浜轰簨绠$悊\ClsHR_EmpUpChangeBill.cs" />
+    <Compile Include="浠撳簱绠$悊\ClsSc_ProductionReturnBill.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_StepFoldInBill.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_StepFoldOutBill.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_SellOutBillForLayUI.cs" />
@@ -644,6 +645,7 @@
     <Compile Include="绯荤粺鍏敤\ClsXt_SystemParameter_Ctl.cs" />
     <Compile Include="绯荤粺鍏敤\ClsXt_BillSubType_Ctl.cs" />
     <Compile Include="璁″垝绠$悊\ClsGy_MaterialTechParamBillMain.cs" />
+    <Compile Include="璐ㄦ绠$悊\ClsQC_NoPassProdConclusionBill.cs" />
     <Compile Include="璐ㄦ绠$悊\ClsQC_NoPassProdDisposeCheckBill.cs" />
     <Compile Include="璐ㄦ绠$悊\ClsQC_NoPassProdDisposeBill.cs" />
     <Compile Include="璐ㄦ绠$悊\ClsQC_NoPassProdRequestBill.cs" />
diff --git "a/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/ClsSc_ProductionReturnBill.cs" "b/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/ClsSc_ProductionReturnBill.cs"
new file mode 100644
index 0000000..b64b847
--- /dev/null
+++ "b/DAL/\344\273\223\345\272\223\347\256\241\347\220\206/ClsSc_ProductionReturnBill.cs"
@@ -0,0 +1,722 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data;
+
+namespace DAL
+{
+    public class ClsSc_ProductionReturnBill : DBUtility.ClsXt_BaseBill
+    {
+        public Model.ClsSc_ProductionReturnBillMain omodel = new Model.ClsSc_ProductionReturnBillMain();
+        public List<Model.ClsKf_ProductInBillSub> DetailColl = new List<Model.ClsKf_ProductInBillSub>();
+
+        public ClsSc_ProductionReturnBill()
+        {
+            base.MvarItemKeyForWeb = "h_v_Kf_ProductInBillMain_ForWeb";
+            base.MvarItemKeySubForWeb = "h_v_Kf_ProductInBillSub_ForWeb";
+            base.MvarItemKeySub = "Kf_ICStockBillSub";
+            base.MvarItemKeySub2 = "";
+            base.MvarItemKeySub3 = "";
+            base.MvarItemKeySub4 = "";
+            base.MvarItemKey = "Kf_ICStockBillMain";
+            base.MvarReportTitle = "浜у搧閫�搴撳崟";
+            base.BillType = "1245";
+            base.HBillSubType = "1245";
+
+        }
+
+        #region 鍥哄畾浠g爜
+
+        ~ClsSc_ProductionReturnBill()
+        {
+            DetailColl = null;
+        }
+
+        #endregion   鑷畾涔夋柟娉�
+        //淇敼鍗曟嵁
+        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //
+                oCn.BeginTran();
+                //鏇存柊涓昏〃
+                oCn.RunProc("UpDate Kf_ICStockBillMain set  " +
+                " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
+                ",HDate='" + omodel.HDate + "'" +
+                ",HYear='" + omodel.HYear.ToString() + "'" +
+                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
+                ",HRemark='" + omodel.HRemark + "'" +
+                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
+                ",HUpDateDate=getdate()" +
+                    //========================================
+                ",HSupID=" + omodel.HSupID.ToString() +
+                ",HWHID=" + omodel.HWHID.ToString() +
+                ",HSCWHID=" + omodel.HSCWHID.ToString() +
+                ",HEmpID=" + omodel.HEmpID.ToString() +
+                ",HManagerID=" + omodel.HManagerID.ToString() +
+                ",HSecManagerID=" + omodel.HSecManagerID.ToString() +
+                ",HKeeperID=" + omodel.HKeeperID.ToString() +
+                ",HDeptID=" + omodel.HDeptID.ToString() +
+                ",HExplanation='" + omodel.HExplanation + "'" +
+                ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
+                ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
+                " where HInterID=" + lngBillKey.ToString());
+                //鍒犻櫎鍏宠仈
+                DeleteRelation(ref sReturn, lngBillKey);
+                //鍒犻櫎瀛愯〃
+                DeleteBillSub(lngBillKey);
+                //鎻掑叆瀛愯〃
+                omodel.HInterID = lngBillKey;
+                foreach (Model.ClsKf_ProductInBillSub oSub in DetailColl)
+                {
+                    oCn.RunProc("Insert into Kf_ICStockBillSub " +
+                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
+                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+                      ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
+                      ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" +
+                      ",HEngineNum,HUnderPanNum,HLeaveFactCard" +
+                      ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
+                      ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
+                      ") values("
+                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
+                      "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() +
+                      ",'" + oSub.HEngineNum + "','" + oSub.HUnderPanNum + "','" + oSub.HLeaveFactCard + "'" +
+                      "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" +
+                      "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
+                      ") ");
+                }
+                //
+                //foreach (Model.ClsKf_ProductInBillSub oSub in DetailColl)
+                //{
+                //    Ds = oCn.RunProcReturn("exec h_p_Kf_ProductInBill_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 Kf_ICStockBillMain   " +
+                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
+                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
+                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
+                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
+                ") " +
+                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
+                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
+                ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() +
+                ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
+                ") ");
+                //鎻掑叆瀛愯〃
+                foreach (Model.ClsKf_ProductInBillSub oSub in DetailColl)
+                {
+                    oCn.RunProc("Insert into Kf_ICStockBillSub " +
+                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
+                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+                      ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
+                      ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" +
+                      ",HEngineNum,HUnderPanNum,HLeaveFactCard" +
+                      ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
+                      ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
+                      ") values("
+                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
+                      "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() +
+                      ",'" + oSub.HEngineNum + "','" + oSub.HUnderPanNum + "','" + oSub.HLeaveFactCard + "'" +
+                      "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" +
+                      "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
+                      ") ");
+                }
+                //
+                //foreach (Model.ClsKf_ProductInBillSub oSub in DetailColl)
+                //{
+                //    Ds = oCn.RunProcReturn("exec h_p_Kf_ProductInBill_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 Kf_ICStockBillMain Where HInterID=" + lngBillKey.ToString(), "Kf_ICStockBillMain");
+                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 = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
+                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.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]);
+                omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].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.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.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
+                omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
+                omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]);
+                omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
+                omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
+                //========================================================
+                omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]);
+                omodel.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWHID"]);
+                omodel.HSCWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSCWHID"]);
+                omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]);
+                omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]);
+                omodel.HSecManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSecManagerID"]);
+                omodel.HKeeperID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HKeeperID"]);
+                omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]);
+                omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]);
+                omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]);
+                omodel.HRedBlueFlag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HRedBlueFlag"]);
+                //
+
+                //寰幆
+                DataSet DsSub;
+                DsSub = oCn.RunProcReturn("Select * from Kf_ICStockBillSub Where HInterID=" + lngBillKey.ToString(), "Kf_ICStockBillSub");
+                DetailColl.Clear();//娓呯┖
+                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
+                {
+                    Model.ClsKf_ProductInBillSub oSub = new Model.ClsKf_ProductInBillSub();
+                    // 鍥哄畾璧嬪��===============================================
+                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
+                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
+                    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.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]);
+                    oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]);
+                    oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]);
+                    oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim();
+                    //===================================================
+                    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.isSingle(DsSub.Tables[0].Rows[i]["HSecUnitRate"]);
+                    oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]);
+                    oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]);
+                    oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]);
+                    oSub.HPrice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HPrice"]);
+                    oSub.HMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HMoney"]);
+                    oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]);
+                    oSub.HSCWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCWHID"]);
+                    oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]);
+                    oSub.HSCSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCSPID"]);
+                    oSub.HSPGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPGroupID"]);
+                    oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]);
+                    oSub.HEngineNum = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HEngineNum"]);
+                    oSub.HUnderPanNum = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HUnderPanNum"]);
+                    oSub.HLeaveFactCard = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HLeaveFactCard"]);
+                    oSub.HPOOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPOOrderInterID"]);
+                    oSub.HPOOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPOOrderEntryID"]);
+                    oSub.HPOOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HPOOrderBillNo"]);
+                    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"]);
+                    DetailColl.Add(oSub);
+                }
+                sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+        }
+
+        public bool CheckStockQty(long HMaterID, long HWhID, string sBatchNo)
+        {
+            try
+            {
+                //鏌ヨ涓昏〃
+                DataSet Ds;
+                Ds = oCn.RunProcReturn("Select 鍗虫椂搴撳瓨 from h_v_KF_ICInventoryList Where HMaterID=" + HMaterID.ToString() + " and HWHID=" + HWhID.ToString() + " and 鎵规='" + sBatchNo + "'", "h_v_KF_ICInventoryList");
+                if (Ds.Tables[0].Rows.Count == 0)
+                {
+                    return false;
+                }
+                //鍒ゆ柇鏄惁璐熷簱瀛樻垨0搴撳瓨
+                if (DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0][0]) <= 0)
+                {
+                    return false;
+                }
+                return true;
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
+
+
+        //鏉$爜鎵弿璁板綍,鏂板鍒颁骇鍝佸叆搴�   (婧愬崟锛氱敓浜т换鍔″崟)
+        public bool AddBill_PDA(ref string sReturn)
+        {
+            try
+            {
+                //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                string s = "";
+                int sYear = 0;
+                int sPeriod = 0;
+                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                {
+                    sReturn = s;
+                    return false;
+                }
+                omodel.HYear = sYear;
+                omodel.HPeriod = sPeriod;
+
+                DataSet Ds;
+                oCn.BeginTran();
+                //鍒犻櫎涓昏〃
+                oCn.RunProc("Delete From Kf_ICStockBillMain  where HInterID=" + omodel.HInterID.ToString());
+                //鎻掑叆瀛愯〃
+                oCn.RunProc("EXEC h_p_Kf_ProductInBillSub_Insert " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'");
+                //鎻掑叆涓昏〃
+                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
+                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
+                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
+                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
+                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
+                ") " +
+                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "',convert(varchar(10),getdate(),120),'" + omodel.HMainSourceBillType + "'" +
+                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',convert(varchar(10),getdate(),120)" +
+                ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() +
+                ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
+                ") ");
+                //鏇存柊鍏宠仈鏁伴噺
+                oCn.RunProc("exec h_p_Sc_UpDateICMORelation_Add " + omodel.HInterID.ToString());
+                //瀹℃牳鍗曟嵁
+                oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + omodel.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120),HBillStatus=2 where HInterID= " + omodel.HInterID.ToString());
+
+                //鐢熸垚K3鍗曟嵁
+                //鏂板瀛愯〃銆佷富琛�
+                oCn.RunProc("exec h_p_IFK3_ToERP_ProdInBill_Insert " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillerID.ToString());
+                //鍥炲~鍏宠仈鏁伴噺
+                oCn.RunProc("exec h_p_IFK3_ToERP_ProdInBill_UpdateBillRelateData " + omodel.HInterID.ToString());
+                //瀹℃牳鍗曟嵁
+                oCn.RunProc("exec h_p_IFK3_ToERP_ProdInBill_Check " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
+                //鏇存柊搴撳瓨
+                oCn.RunProc("exec h_p_IFK3_ToERP_ProdInBill_UpdateStock " + omodel.HInterID.ToString());
+                oCn.RunProc("exec h_p_IFK3_ToERP_ProdInBill_UpdateOrderStock " + omodel.HInterID.ToString());
+
+                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+
+        //鏉$爜鎵弿璁板綍,鏂板鍒颁骇鍝佸叆搴� (绾㈠瓧)
+        public bool AddBill_PDA_Red(ref string sReturn)
+        {
+            try
+            {
+                //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                string s = "";
+                int sYear = 0;
+                int sPeriod = 0;
+                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                {
+                    sReturn = s;
+                    return false;
+                }
+                omodel.HYear = sYear;
+                omodel.HPeriod = sPeriod;
+
+                DataSet Ds;
+                oCn.BeginTran();
+                //鍒犻櫎涓昏〃
+                oCn.RunProc("Delete From Kf_ICStockBillMain  where HInterID=" + omodel.HInterID.ToString());
+                //鎻掑叆瀛愯〃
+                oCn.RunProc("EXEC h_p_Kf_ProductInBillSub_Red_Insert " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'");
+                //鎻掑叆涓昏〃
+                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
+                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
+                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
+                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
+                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
+                ") " +
+                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "',convert(varchar(10),getdate(),120),'" + omodel.HMainSourceBillType + "'" +
+                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',convert(varchar(10),getdate(),120)" +
+                ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() +
+                ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
+                ") ");
+                //鏇存柊鍏宠仈鏁伴噺
+                oCn.RunProc("exec h_p_Cg_UpDateProductInRelation_Red_Add " + omodel.HInterID.ToString());
+                //瀹℃牳鍗曟嵁
+                oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + omodel.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120),HBillStatus=2 where HInterID= " + omodel.HInterID.ToString());
+                //鍒ゆ柇鏉$爜搴撳瓨鏄惁寮傚父锛堣礋搴撳瓨銆佸簱瀛樺ぇ浜庢潯鐮佸垵濮嬪寲锛�
+                Ds = oCn.RunProcReturn("EXEC h_p_KF_ICInventoryBarCodeQtyCtrl  " + omodel.HInterID.ToString(), "h_p_KF_ICInventoryBarCodeQtyCtrl");
+
+                if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 1)
+                {
+
+                }
+                else
+                {
+                    sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]);
+                    oCn.RollBack();
+                    return false;
+                }
+                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+
+
+        public bool AddBill_StationOut_Bad(string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain,ref string sErrMsg)
+        {  
+            //涓婁紶鍓嶅繀濉」鍒ゆ柇
+           
+            try
+            { 
+                DataSet Ds;
+                if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                {
+                }
+                else
+                {
+                    oCn.BeginTran();
+                }
+                //鐢熸垚鍑哄叆搴撳崟鎹�
+                //鎻掑叆瀛愯〃
+                DataSet DS2 = oCn.RunProcReturn("EXEC h_p_Kf_ProductInBillSub_Insert_StationOutBad " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + sHSourceType + "'", "h_p_Kf_ProductInBillSub_Insert_StationOutBad");
+                if (DS2 == null || DS2.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "鍒ゆ柇鍐欏叆瀛愯〃鐘舵�佸け璐ワ紝鏈煡閿欒锛�";
+                    if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                    {
+                    }
+                    else
+                    {
+                        oCn.RollBack();
+                    }
+                    return false;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isStrNull(DS2.Tables[0].Rows[0][0]) != "OK")
+                    {
+                        sErrMsg = "鍗曟嵁鍙凤細" + omodel.HBillNo + "锛屽啓鍏ュ瓙琛ㄥけ璐ワ紒";
+                        return false;
+                    }
+                }
+                        //鎻掑叆涓昏〃
+                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
+                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
+                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
+                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
+                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
+                ") " +
+                " values('1202','1202'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "',convert(varchar(10),getdate(),120),'" + omodel.HMainSourceBillType + "'" +
+                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',convert(varchar(10),getdate(),120)" +
+                ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() +
+                ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
+                ") ");
+
+                //鏂板K3瀛愯〃銆佷富琛�
+                oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_Insert_New " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillerID.ToString() + ",'" + sHSourceType + "'");
+
+                //鏇存柊鍏宠仈鏁伴噺
+                if (sHSourceType == "3710")         //鐢熶骇浠诲姟鍗�
+                {
+                    oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOToProductIn_Add " + omodel.HInterID.ToString());
+                    //鍥炲~K3鍏宠仈鏁伴噺
+                    oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateBillRelateData_ICMO_New " + omodel.HInterID.ToString());
+                }
+                else    //鏃犳簮鍗�
+                {
+                    //鍥炲~K3鍏宠仈鏁伴噺
+                    oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateBillRelateData_New " + omodel.HInterID.ToString());
+                }
+
+                //鍒ゆ柇搴撳瓨鏇存柊鎺у埗鐘舵�侊紙0涓哄鏍告敼鍙樺簱瀛橈紝1涓轰繚瀛樻敼鍙樺簱瀛橈級
+                DataSet DS = oCn.RunProcReturn("exec h_p_IFK3_SaveUpdateStock ", "h_p_IFK3_SaveUpdateStock");
+                if (DS == null || DS.Tables[1].Rows.Count == 0)
+                {
+                    sErrMsg = "鍒ゆ柇搴撳瓨鏇存柊鎺у埗鐘舵�侊紝鏈煡閿欒锛�";
+                    if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                    {
+                    }
+                    else
+                    {
+                        oCn.RollBack();
+                    }
+                    return false;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(DS.Tables[1].Rows[0][0]) == 1)
+                    {
+                        //鏇存柊K3搴撳瓨
+                        oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateStock_New " + omodel.HInterID.ToString());
+                        oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateOrderStock_New " + omodel.HInterID.ToString());
+                        //瀹℃牳鍗曟嵁
+                        if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                        {
+                            //瀹℃牳鍗曟嵁
+                            oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + omodel.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + omodel.HInterID.ToString());
+
+                            //瀹℃牳K3鍗曟嵁
+                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_Check_New " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
+                        }
+                    }
+                    else
+                    {
+                        //瀹℃牳鍗曟嵁
+                        if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                        {
+                            //瀹℃牳鍗曟嵁
+                            oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + omodel.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + omodel.HInterID.ToString());
+
+                            //瀹℃牳K3鍗曟嵁
+                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_Check_New " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
+                            //鏇存柊K3搴撳瓨
+                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateStock_New " + omodel.HInterID.ToString());
+                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateOrderStock_New " + omodel.HInterID.ToString());
+                        }
+                    }
+                }
+
+                sErrMsg = "鏂板鍗曟嵁鎴愬姛锛�";
+                if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                {
+                }
+                else
+                {
+                    oCn.Commit();
+                }
+                return true;
+            }
+            catch (Exception e)
+            {
+                sErrMsg = "鐢熸垚浜у搧鍏ュ簱鍗曞け璐ワ紒" + e.Message;
+                if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                {
+                }
+                else
+                {
+                    oCn.RollBack();
+                }
+                return false;
+            }
+        }
+
+
+        //鏈亾宸ュ簭鍑虹珯姹囨姤鍗曞垪琛�   鍏ュ簱鍔熻兘璋冪敤
+        public bool AddBill_StationOut_LastProc(string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
+        {
+            try
+            {
+                DataSet Ds;
+                if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                {
+                }
+                else
+                {
+                    oCn.BeginTran();
+                }
+                //鐢熸垚鍑哄叆搴撳崟鎹�
+                //鎻掑叆瀛愯〃
+                DataSet DS2 = oCn.RunProcReturn("EXEC h_p_Kf_ProductInBillSub_Insert_StationOutLastProc " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + sHSourceType + "'", "h_p_Kf_ProductInBillSub_Insert_StationOutLastProc");
+                if (DS2 == null || DS2.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "鍒ゆ柇鍐欏叆瀛愯〃鐘舵�佸け璐ワ紝鏈煡閿欒锛�";
+                    if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                    {
+                    }
+                    else
+                    {
+                        oCn.RollBack();
+                    }
+                    return false;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isStrNull(DS2.Tables[0].Rows[0][0]) != "OK")
+                    {
+                        sErrMsg = "鍗曟嵁鍙凤細" + omodel.HBillNo + "锛屽啓鍏ュ瓙琛ㄥけ璐ワ紒";
+                        return false;
+                    }
+                }
+                //鎻掑叆涓昏〃
+                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
+                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
+                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
+                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
+                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
+                ") " +
+                " values('1202','1202'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "',convert(varchar(10),getdate(),120),'" + omodel.HMainSourceBillType + "'" +
+                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',convert(varchar(10),getdate(),120)" +
+                ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() +
+                ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
+                ") ");
+
+                //鏂板K3瀛愯〃銆佷富琛�
+                oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_Insert_New " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillerID.ToString() + ",'" + sHSourceType + "'");
+
+                //鏇存柊鍏宠仈鏁伴噺
+                if (sHSourceType == "3710")         //鐢熶骇浠诲姟鍗�
+                {
+                    oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOToProductIn_Add " + omodel.HInterID.ToString());
+                    //鍥炲~K3鍏宠仈鏁伴噺
+                    oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateBillRelateData_ICMO_New " + omodel.HInterID.ToString());
+                }
+                else    //鏃犳簮鍗�
+                {
+                    //鍥炲~K3鍏宠仈鏁伴噺
+                    oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateBillRelateData_New " + omodel.HInterID.ToString());
+                }
+
+                //鍒ゆ柇搴撳瓨鏇存柊鎺у埗鐘舵�侊紙0涓哄鏍告敼鍙樺簱瀛橈紝1涓轰繚瀛樻敼鍙樺簱瀛橈級
+                DataSet DS = oCn.RunProcReturn("exec h_p_IFK3_SaveUpdateStock ", "h_p_IFK3_SaveUpdateStock");
+                if (DS == null || DS.Tables[1].Rows.Count == 0)
+                {
+                    sErrMsg = "鍒ゆ柇搴撳瓨鏇存柊鎺у埗鐘舵�侊紝鏈煡閿欒锛�";
+                    if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                    {
+                    }
+                    else
+                    {
+                        oCn.RollBack();
+                    }
+                    return false;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(DS.Tables[1].Rows[0][0]) == 1)
+                    {
+                        //鏇存柊K3搴撳瓨
+                        oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateStock_New " + omodel.HInterID.ToString());
+                        oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateOrderStock_New " + omodel.HInterID.ToString());
+                        //瀹℃牳鍗曟嵁
+                        if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                        {
+                            //瀹℃牳鍗曟嵁
+                            oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + omodel.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + omodel.HInterID.ToString());
+
+                            //瀹℃牳K3鍗曟嵁
+                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_Check_New " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
+                        }
+                    }
+                    else
+                    {
+                        //瀹℃牳鍗曟嵁
+                        if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                        {
+                            //瀹℃牳鍗曟嵁
+                            oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + omodel.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + omodel.HInterID.ToString());
+
+                            //瀹℃牳K3鍗曟嵁
+                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_Check_New " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
+                            //鏇存柊K3搴撳瓨
+                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateStock_New " + omodel.HInterID.ToString());
+                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateOrderStock_New " + omodel.HInterID.ToString());
+                        }
+                    }
+                }
+
+                sErrMsg = "鏂板鍗曟嵁鎴愬姛锛�";
+                if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                {
+                }
+                else
+                {
+                    oCn.Commit();
+                }
+                return true;
+            }
+            catch (Exception e)
+            {
+                sErrMsg = "鐢熸垚浜у搧鍏ュ簱鍗曞け璐ワ紒" + e.Message;
+                if (oSystemParameterMain.WMS_CampanyName == "鏉窞鏅鸿" || oSystemParameterMain.WMS_CampanyName == "鏉窞鏂帿灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                {
+                }
+                else
+                {
+                    oCn.RollBack();
+                }
+                return false;
+            }
+        }
+
+
+
+    }
+}
diff --git "a/DAL/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_NoPassProdConclusionBill.cs" "b/DAL/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_NoPassProdConclusionBill.cs"
new file mode 100644
index 0000000..2587bf0
--- /dev/null
+++ "b/DAL/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_NoPassProdConclusionBill.cs"
@@ -0,0 +1,304 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data;
+
+namespace DAL
+{
+    public class ClsQC_NoPassProdConclusionBill : DBUtility.ClsXt_BaseBill
+    {
+        public Model.ClsQC_NoPassProdConclusionBillMain omodel = new Model.ClsQC_NoPassProdConclusionBillMain();
+        public List<Model.ClsQC_NoPassProdConclusionBillSub> DetailColl = new List<Model.ClsQC_NoPassProdConclusionBillSub>();
+
+
+        public ClsQC_NoPassProdConclusionBill()
+        {
+            base.MvarItemKeySub = "QC_NoPassProdConclusionBillSub";
+            base.MvarItemKeySub2 = "";
+            base.MvarItemKeySub3 = "";
+            base.MvarItemKeySub4 = "";
+            base.MvarItemKey = "QC_NoPassProdConclusionBillMain";
+            base.MvarReportTitle = "涓嶅悎鏍艰瘎瀹″鐞嗗崟";
+            base.BillType = "7513";
+            base.HBillSubType = "7513";
+
+        }
+
+        #region 鍥哄畾浠g爜
+
+        ~ClsQC_NoPassProdConclusionBill()
+        {
+            DetailColl = null;
+        }
+
+        #endregion   鑷畾涔夋柟娉�
+        //淇敼鍗曟嵁
+        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_QC_NoPassProdConclusionBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_QC_NoPassProdConclusionBill_BeforeSaveCtrl");
+                if (ds == null)
+                {
+                    sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    return false;
+                }
+                //=========================================================
+
+                //
+                oCn.BeginTran();
+                //鏇存柊涓昏〃
+                oCn.RunProc("UpDate QC_NoPassProdConclusionBillMain set  " +
+                " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
+                ",HDate='" + omodel.HDate + "'" +
+                ",HYear='" + omodel.HYear.ToString() + "'" +
+                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
+                ",HRemark='" + omodel.HRemark + "'" +
+                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
+                ",HUpDateDate=getdate()" +
+                ",HMainSourceInterID='" + omodel.HMainSourceInterID.ToString() + "'" +
+                 ",HMainSourceEntryID='" + omodel.HMainSourceEntryID.ToString() + "'" +
+                ",HMainSourceBillNo='" + omodel.HMainSourceBillNo + "'" +
+                ",HMainSourceBillType='" + omodel.HMainSourceBillType + "'" +
+                //========================================
+                ",HDisposeDeptID='" + omodel.HDisposeDeptID.ToString() + "'" +
+                ",HDeptID='" + omodel.HDeptID.ToString() + "'" +
+                 ",HProcID='" + omodel.HProcID.ToString() + "'" +
+                 ",HCheckerResult='" + omodel.HCheckerResult + "'" +
+                 ",HBadTypeID='" + omodel.HBadTypeID.ToString() +
+                 "',HBadReasonID='" + omodel.HBadReasonID.ToString() +
+                 "',HDisposeNote='" + omodel.HDisposeNote + "'" +
+                 ",HSendMan='" + omodel.HSendMan + "'" +
+                 ",HReceiveMan='" + omodel.HReceiveMan + "'" +
+                 ",HCopyMan='" + omodel.HCopyMan + "'" +
+
+                " where HInterID=" + lngBillKey.ToString());
+                //鍒犻櫎鍏宠仈
+                DeleteRelation(ref sReturn, lngBillKey);
+                //鍒犻櫎瀛愯〃
+                DeleteBillSub(lngBillKey);
+
+                //=========================淇濆瓨鍚庢帶鍒�  
+                DataSet ds2 = oCn.RunProcReturn("Exec h_p_QC_NoPassProdConclusionBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_QC_NoPassProdConclusionBill_AfterSaveCtrl");
+                if (ds2 == null)
+                {
+                    sReturn = "淇濆瓨鍚庢帶鍒跺垽鏂け璐ワ紒";
+                    oCn.RollBack();
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触2锛�" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
+                    oCn.RollBack();
+                    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();
+
+
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_QC_NoPassProdConclusionBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_QC_NoPassProdConclusionBill_BeforeSaveCtrl");
+                if (ds == null)
+                {
+                    sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    return false;
+                }
+                //=========================================================
+
+                string sql = "";
+
+                sql = "Insert Into QC_NoPassProdConclusionBillMain" +
+                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HYear,HPeriod,HRemark,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType," +
+                "HSendMan,HReceiveMan,HCopyMan,HDeptID,HProcID,HDisposeDeptID,HBadTypeID,HBadReasonID,HCheckerResult,HDisposeNote) " +
+                " values(" +
+                "'" + this.BillType +
+                "','" + this.HBillSubType +
+                "'," + omodel.HInterID.ToString() +
+                ",'" + omodel.HBillNo +
+                "','" + omodel.HDate +
+                "'," + omodel.HYear +
+                "," + omodel.HPeriod +
+                ",'" + omodel.HRemark +
+                "','" + omodel.HMaker +
+                "',getdate()" +
+                ",'" + omodel.HMainSourceInterID +
+                "','" + omodel.HMainSourceEntryID +
+                "','" + omodel.HMainSourceBillNo +
+                "','" + omodel.HMainSourceBillType +
+
+                "','" + omodel.HSendMan +
+                "','" + omodel.HReceiveMan +
+                "','" + omodel.HCopyMan +
+                "','" + omodel.HDeptID.ToString() +
+                "','" + omodel.HProcID.ToString() +
+               
+                "','" + omodel.HDisposeDeptID.ToString() +
+                "','" + omodel.HBadTypeID.ToString() +
+                "','" + omodel.HBadReasonID.ToString() +
+                 "','" + omodel.HCheckerResult +
+                "','" + omodel.HDisposeNote +
+
+                "') ";
+                //涓昏〃
+                oCn.RunProc(sql);
+
+                //=========================淇濆瓨鍚庢帶鍒�  
+                DataSet ds2 = oCn.RunProcReturn("Exec h_p_QC_NoPassProdConclusionBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_QC_NoPassProdConclusionBill_AfterSaveCtrl");
+                if (ds2 == null)
+                {
+                    sReturn = "淇濆瓨鍚庢帶鍒跺垽鏂け璐ワ紒";
+                    oCn.RollBack();
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+                {
+                    sReturn = "淇濆瓨澶辫触2锛�" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
+                    oCn.RollBack();
+                    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 QC_NoPassProdConclusionBillMain Where HInterID=" + lngBillKey.ToString(), "QC_NoPassProdConclusionBillMain");
+                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 = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
+                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.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]);
+                omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].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.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.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
+                omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
+                omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]);
+                omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
+                omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
+                //========================================================                
+                //omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]);                
+                //omodel.HContext = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HContext"]);                
+                //omodel.HDescription = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDescription"]);
+                //omodel.HSendMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSendMan"]);
+                //omodel.HReceiveMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HReceiveMan"]);
+                //omodel.HCopyMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCopyMan"]);
+                //omodel.HLevel = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLevel"]);
+                //omodel.HReTransmitMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HReTransmitMan"]);
+                //omodel.HBillTypeName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillTypeName"]);
+                //omodel.HPlanBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HPlanBillNo"]);
+                //omodel.HMaterName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterName"]);
+                //omodel.HMaterModel = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterModel"]);
+                //omodel.HSendType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSendType"]);
+                //omodel.HHasten = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HHasten"]);
+                //omodel.HQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HQty"]);   
+                //
+
+                //寰幆
+                DataSet DsSub;
+                DsSub = oCn.RunProcReturn("Select * from QC_NoPassProdConclusionBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "QC_NoPassProdConclusionBillSub");
+                DetailColl.Clear();//娓呯┖
+                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
+                {
+                    Model.ClsQC_NoPassProdConclusionBillSub oSub = new Model.ClsQC_NoPassProdConclusionBillSub();
+                    // 鍥哄畾璧嬪��===============================================
+                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
+                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
+                    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.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]);
+                    oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]);
+                    oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]);
+                    oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim();
+                    //===================================================
+                    //oSub.HDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HDate"]);
+                    //oSub.HSendStatus = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSendStatus"]);
+                    //oSub.HSendMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSendMan"]);
+                    //oSub.HDescription = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDescription"]);
+
+                    DetailColl.Add(oSub);
+                }
+
+                sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+        }
+
+
+    }
+
+}
diff --git a/Model/Model.csproj b/Model/Model.csproj
index cd69042..0617fae 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -239,6 +239,8 @@
     <Compile Include="浠撳簱绠$悊\ClsKf_MateOutRequestBillSub.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKF_ChangeBoxBillMain.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKF_ChangeBoxBillSub.cs" />
+    <Compile Include="浠撳簱绠$悊\ClsSc_ProductionReturnBillSub.cs" />
+    <Compile Include="浠撳簱绠$悊\ClsSc_ProductionReturnBillMain.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_StepFoldInBillMain.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_StepFoldInBillSub.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_StepFoldOutBillSub.cs" />
@@ -638,6 +640,8 @@
     <Compile Include="绯荤粺鍏敤\ClsXt_SystemParameter_Model.cs" />
     <Compile Include="璁″垝绠$悊\ClsGy_MaterialTechParamBillSub.cs" />
     <Compile Include="璁″垝绠$悊\ClsGy_MaterialTechParamBillMain.cs" />
+    <Compile Include="璐ㄦ绠$悊\ClsQC_NoPassProdConclusionBillMain.cs" />
+    <Compile Include="璐ㄦ绠$悊\ClsQC_NoPassProdConclusionBillSub.cs" />
     <Compile Include="璐ㄦ绠$悊\ClsQC_NoPassProdDisposeCheckBillMain.cs" />
     <Compile Include="璐ㄦ绠$悊\ClsQC_NoPassProdDisposeBillMain.cs" />
     <Compile Include="璐ㄦ绠$悊\ClsQC_NoPassProdDisposeCheckBillSub.cs" />
diff --git "a/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsSc_ProductionReturnBillMain.cs" "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsSc_ProductionReturnBillMain.cs"
new file mode 100644
index 0000000..072e591
--- /dev/null
+++ "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsSc_ProductionReturnBillMain.cs"
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsSc_ProductionReturnBillMain : DBUtility.ClsXt_BaseBillMain
+    {
+        public string HDateForWeb;
+        public Int64 HSupID;//   int        		--供应商
+        public Int64 HWHID;//    int         		--仓库
+        public Int64 HSCWHID;//  int           		--调出仓库   
+        public Int64 HEmpID;//    int        		--业务员
+        public Int64 HManagerID;//   int    		--负责人
+        public Int64 HSecManagerID;//  int   		--验收
+        public Int64 HKeeperID;//   int     		--保管员
+        public Int64 HDeptID;//     int     		--部门    
+        public Int64 HCurID;//     int     		--币别   
+        public Single HExRate;//    money      			--汇率  (选择完币别带出)
+        public string HExplanation;//   varchar(200)    	--摘要
+        public string HInnerBillNo;//  varchar(50)     	--内部单据号
+        public bool HRedBlueFlag;//  bit    		--红蓝单
+    }
+}
diff --git "a/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsSc_ProductionReturnBillSub.cs" "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsSc_ProductionReturnBillSub.cs"
new file mode 100644
index 0000000..da77919
--- /dev/null
+++ "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsSc_ProductionReturnBillSub.cs"
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsSc_ProductionReturnBillSub : DBUtility.ClsXt_BaseBillSub
+    { 
+        public Int64 HMaterID;//     int   			--物料ID
+        public Int64 HPropertyID;//  int    			--辅助属性
+        public Int64 HSecUnitID;//   int    			--辅助计量单位
+        public Single HSecUnitRate;//   	money			--换算率 	
+        public Int64 HUnitID;//    int      			--计量单位
+        public double HQtyMust;//   dec(18,8)       		--应收数量
+        public double HQty;//        dec(18,8)      		--实收数量
+        public double HPrice;//     dec(18,8)       		--单价
+        public double HMoney;//     dec(18,8)      		--金额
+        public Int64 HWHID;//      int      			--收料仓库
+        public Int64 HSCWHID;//    int         			--调出仓库ID 
+        public Int64 HSPID;//		int			--仓位ID		 
+        public Int64 HSCSPID;//		int 			--调出仓位ID	
+        public Int64 HSPGroupID;//	int			--仓位组ID(仓库选择完自动带出)
+        public string HBatchNo;//	varchar(50)		--批次
+        public string HEngineNum;//	varchar(50)		--发动机号
+        public string HUnderPanNum;//	varchar(50)		--地盘号
+        public string HLeaveFactCard;//	varchar(50)		--出厂证
+        public Int64 HPOOrderInterID;//  int      		--采购订单主内码
+        public Int64 HPOOrderEntryID;//    int    		--采购订单子内码
+        public string HPOOrderBillNo;//    varchar(50)     	--采购订单号
+        public Int64 HSeOrderInterID;//   int     		--销售订单主内码
+        public Int64 HSeOrderEntryID;//	  int			--销售订单子内码
+        public string HSeOrderBillNo;//	varchar(50)		--销售订单号
+
+    }
+}
diff --git "a/Model/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_NoPassProdConclusionBillMain.cs" "b/Model/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_NoPassProdConclusionBillMain.cs"
new file mode 100644
index 0000000..5578aa6
--- /dev/null
+++ "b/Model/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_NoPassProdConclusionBillMain.cs"
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsQC_NoPassProdConclusionBillMain : DBUtility.ClsXt_BaseBillMain
+    {
+        public int HDeptID;     // 责任部门  
+
+        public int HDisposeDeptID;     // 处理部门  
+
+        public int HProcID;     // 责任工序  
+
+
+        public string HCheckerResult;  // 判定结论
+
+        public int HBadTypeID;     // 不良类型  (Gy_BadType)
+
+        public int HBadReasonID;  //不良原因(Gy_BadReason)  
+
+        public string HDisposeNote;     // 处理意见详情
+
+        public string HSendMan;  // 发送人(gy_czygl)  
+      
+        public string HReceiveMan;    // 接收人(gy_czygl)  
+      
+        public string HCopyMan;   // 抄送(gy_czygl)  
+    }
+}
diff --git "a/Model/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_NoPassProdConclusionBillSub.cs" "b/Model/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_NoPassProdConclusionBillSub.cs"
new file mode 100644
index 0000000..05f5b77
--- /dev/null
+++ "b/Model/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_NoPassProdConclusionBillSub.cs"
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsQC_NoPassProdConclusionBillSub : DBUtility.ClsXt_BaseBillSub
+    {
+      
+    }
+}
diff --git "a/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POInStockBillMain.cs" "b/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POInStockBillMain.cs"
index fadb032..0804333 100644
--- "a/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POInStockBillMain.cs"
+++ "b/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POInStockBillMain.cs"
@@ -11,12 +11,14 @@
         public Int64 HSupDealerID;//      int     			--经销商
         public Int64 HCurID;//    int      			--币别 (Gy_Currency)
         public Int64 HWHID;//      int     --仓库
+        public Int64 HProjectID;//      int   项目
         public Single HExRate;//    money      			--汇率  (选择完币别带出)
         public Int64 HEmpID;//     int       			--业务员  (Gy_Employee)
         public Int64 HManagerID;//  int     			--主管	(Gy_Employee)
         public Int64 HDeptID;//     int     			--部门	(Gy_Employee)
         public string HExplanation;//  varchar(200)     		--摘要 
         public string HInnerBillNo;//  varchar(50)     		--内部单据号
+        public string HInvoiceBillNo;//  varchar(50)     		--发票编号
 
 
         public Int64 HInterID;
diff --git "a/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillMain.cs" "b/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillMain.cs"
index b942ea2..9ecfced 100644
--- "a/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillMain.cs"
+++ "b/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillMain.cs"
@@ -38,6 +38,8 @@
         public string HERPBillType;
         public Int64 HPURCHASEORGID;
         public Int64 HOrgID;
+        public Int64 HWHID;
+        public Int64 HProjectID;
 
         public Int64 HPURCHASERGROUPID;	//采购组
         public Int64 HPROVIDERID;	//供货方
diff --git "a/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillSub.cs" "b/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillSub.cs"
index 4a6602f..063fee8 100644
--- "a/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillSub.cs"
+++ "b/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillSub.cs"
@@ -79,6 +79,7 @@
         public Int64 HVAT;//增值税
         public Int64 HSELLERWITHHOLDING;//卖方代扣代缴
         public Int64 HBUYERWITHHOLDING;//买方代扣代缴
+        public Int64 HWHID;//仓库
         public string HMATERIALDESC; //物料说明
     }
 }
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
index fba07be..72fb226 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
@@ -438,6 +438,16 @@
                 PrintQtyCtl = oSystemParameter.omodel.BarCode_PrintQtyCtl;
                 UpdatePrintQtyCtl = oSystemParameter.omodel.BarCode_UpdatePrintQtyCtl;
             }
+            //绯荤粺鍙傛暟锛屾湁婧愬崟鐢熸垚鏉$爜锛岀敓鎴愭潯鐮佹暟閲忓彲鍚﹁秴婧愬崟鏁伴噺鎺у埗锛圢涓轰笉鍙秴婧愬崟鏁伴噺锛�
+            if (SourceQtyCtl == "N")
+            {
+                //绯荤粺鍙傛暟涓轰笉鍙秴婧愬崟鏁伴噺鏃讹紝鍐嶆鍒ゆ柇鐢ㄦ埛鏉冮檺鏄惁鍙秴婧愬崟鏁伴噺
+                //鍒ゆ柇鏉冮檺
+                if (ClsPub.Security_Log(ModRightNameSourceQty, 3, false, ClsPub.CurUserName))
+                {
+                    SourceQtyCtl = "Y";
+                }
+            }
 
             cmbHWorksNumber.Items.Clear();
             if (CampanyName == "椋為緳") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�
@@ -591,16 +601,6 @@
         //鍗曟嵁瀹屾暣鎬у垽鏂�          鏈畬鎴�
         private bool Sub_AllowSave()
         {
-            //绯荤粺鍙傛暟锛屾湁婧愬崟鐢熸垚鏉$爜锛岀敓鎴愭潯鐮佹暟閲忓彲鍚﹁秴婧愬崟鏁伴噺鎺у埗锛圢涓轰笉鍙秴婧愬崟鏁伴噺锛�
-            if (SourceQtyCtl=="N")
-            {
-                //绯荤粺鍙傛暟涓轰笉鍙秴婧愬崟鏁伴噺鏃讹紝鍐嶆鍒ゆ柇鐢ㄦ埛鏉冮檺鏄惁鍙秴婧愬崟鏁伴噺
-                //鍒ゆ柇鏉冮檺
-                if (ClsPub.Security_Log(ModRightNameSourceQty, 3, false, ClsPub.CurUserName))
-                {
-                    SourceQtyCtl = "Y";
-                }
-            }
             //鏄庣粏琛ㄦ槸鍚︿负闆惰
             bool b = false;
             for (int i = 0; i < grdMain.RowCount; i++)
@@ -2244,7 +2244,17 @@
 
             if (cmbSourceBillType.Text.Trim() == "鐢熶骇璁㈠崟")
             {
-                string sWhere = " and HOrgID =" + HOrgID.ToString();
+                string sWhere = "";
+                //绯荤粺鍙傛暟锛岀敓鎴愭潯鐮佹暟閲忓彲鍚﹁秴婧愬崟鏁伴噺鎺у埗锛圢涓轰笉鍙秴婧愬崟鏁伴噺锛�
+                if (SourceQtyCtl == "N")
+                {
+                    sWhere = " and HOrgID =" + HOrgID.ToString() + " and 浠诲姟鏁伴噺>0";
+                }
+                else
+                {
+                    sWhere = " and HOrgID =" + HOrgID.ToString();
+                }
+
                 DAL.Cls_S_IFCLD_ICMOList oIFCLD_ICMOList = new DAL.Cls_S_IFCLD_ICMOList();
                 if (oIFCLD_ICMOList.Refresh(sWhere))  //閫夋嫨鍘熷崟
                 {
@@ -2398,7 +2408,8 @@
                     grdMain.Rows.Add();
                     grdMain.Rows[i].Cells[HTagCol].Value = "*";
                     //寰楀埌淇℃伅
-                    Ds = oCn.RunProcReturn("select * from h_v_IFCLD_ICMOList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IFCLD_ICMOList");
+                    Ds = oCn.RunProcReturn("exec h_p_Gy_BarCodeBill_ICMOBillList " + oSelectRow.BillMainID.ToString() + "," + oSelectRow.BillSubID.ToString() + ",'" + SourceQtyCtl + "'", "h_p_Gy_BarCodeBill_ICMOBillList");
+                    //Ds = oCn.RunProcReturn("select * from h_v_IFCLD_ICMOList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IFCLD_ICMOList");
                     //鍐欏叆淇℃伅
                     Sub_WriteInForm(Ds.Tables[0], i);
                 }
@@ -3481,15 +3492,32 @@
                 if (cmbSourceBillType.Text.Trim() == "鐢熶骇璁㈠崟")
                 {
                     DAL.Cls_S_IFCLD_ICMOList oIFCLD_ICMOList = new DAL.Cls_S_IFCLD_ICMOList();
-                    if (oIFCLD_ICMOList.RefreshBySourceBillNo(" Where 鍗曟嵁鍙� like '%" + txtHSourceBillNo.Text + "' and HOrgID =" + sHOrgID.ToString()))  //閫夋嫨鍘熷崟
+                    //绯荤粺鍙傛暟锛岀敓鎴愭潯鐮佹暟閲忓彲鍚﹁秴婧愬崟鏁伴噺鎺у埗锛圢涓轰笉鍙秴婧愬崟鏁伴噺锛�
+                    if (SourceQtyCtl == "N")
                     {
-                        FillSelectData(oIFCLD_ICMOList.oBillSelectColl);
-                        txtHSourceBillNo.Text = "";
+                        if (oIFCLD_ICMOList.RefreshBySourceBillNo(" Where 鍗曟嵁鍙� like '%" + txtHSourceBillNo.Text + "' and HOrgID =" + sHOrgID.ToString() + " and 浠诲姟鏁伴噺>0"))  //閫夋嫨鍘熷崟
+                        {
+                            FillSelectData(oIFCLD_ICMOList.oBillSelectColl);
+                            txtHSourceBillNo.Text = "";
+                        }
+                        else
+                        {
+                            MessageBox.Show("鏈煡璇㈠埌浠诲姟鏁版嵁锛岃纭鎵�閫夌粍缁囥�佹簮鍗曠被鍨嬩笌婧愬崟鍗曞彿鏄惁姝g‘锛�");
+                            return;
+                        }
                     }
                     else
                     {
-                        MessageBox.Show("鏈煡璇㈠埌浠诲姟鏁版嵁锛岃纭鎵�閫夌粍缁囥�佹簮鍗曠被鍨嬩笌婧愬崟鍗曞彿鏄惁姝g‘锛�");
-                        return;
+                        if (oIFCLD_ICMOList.RefreshBySourceBillNo(" Where 鍗曟嵁鍙� like '%" + txtHSourceBillNo.Text + "' and HOrgID =" + sHOrgID.ToString()))  //閫夋嫨鍘熷崟
+                        {
+                            FillSelectData(oIFCLD_ICMOList.oBillSelectColl);
+                            txtHSourceBillNo.Text = "";
+                        }
+                        else
+                        {
+                            MessageBox.Show("鏈煡璇㈠埌浠诲姟鏁版嵁锛岃纭鎵�閫夌粍缁囥�佹簮鍗曠被鍨嬩笌婧愬崟鍗曞彿鏄惁姝g‘锛�");
+                            return;
+                        }
                     }
                 }
                 else if (cmbSourceBillType.Text.Trim() == "鐢熶骇姹囨姤鍗�")
diff --git a/WebAPI/Controllers/BLL/Xt_UserController.cs b/WebAPI/Controllers/BLL/Xt_UserController.cs
index 44ada4e..08c0326 100644
--- a/WebAPI/Controllers/BLL/Xt_UserController.cs
+++ b/WebAPI/Controllers/BLL/Xt_UserController.cs
@@ -206,14 +206,14 @@
                     ",HWhID,HWHName,HSupID,HSupName " +
                     ",HSCWHID,HSCWHName " +
                     ",HCloudUserName,HCloudUserPsd,HUSEORGID,HProcID" +
-                    ",HGroupID,HSourceID) " +
+                    ",HGroupID,HSourceID,HCheckEmpID) " +
                     "values ('" + lsmain[0].Czybm.ToString() + "','" + lsmain[0].Czymc.ToString() + "','" + ClsPub.StrToPsd(lsmain[0].Czmm.ToString()) + "','" + lsmain[0].Explain.ToString() + "','" + lsmain[0].HEmpID.ToString() + "',"+ lsmain[0].HK3UserID.ToString() + "" +
                     ","+ lsmain[0].HKeeperID.ToString() + ",'"+ lsmain[0].HKeeper.ToString() + "',"+ lsmain[0].HSecManagerID.ToString() + ",'"+ lsmain[0].HSecManager.ToString() + "'" +
                     "," + lsmain[0].HSellManID.ToString() + ",'" + lsmain[0].HSellMan.ToString() + "'," + lsmain[0].HDeptID.ToString() + ",'" + lsmain[0].HDept.ToString() + "'" +
                     "," + lsmain[0].HWhID.ToString() + ",'" + lsmain[0].HWHName.ToString() + "'," + lsmain[0].HSupID.ToString() + ",'" + lsmain[0].HSupName.ToString() + "'" +
                     "," + lsmain[0].HSCWHID.ToString() + ",'" + lsmain[0].HSCWHName.ToString() + "'" + 
                     ",'" + lsmain[0].HCloudUserName.ToString() + "','" + lsmain[0].HCloudUserPsd.ToString() + "',"+ lsmain[0].HOrgID.ToString() + "," + lsmain[0].HProcID.ToString() + "" +
-                    ","+ lsmain[0].HGroupID.ToString() + ","+ lsmain[0].HSourceID.ToString() + ")");
+                    ","+ lsmain[0].HGroupID.ToString() + ","+ lsmain[0].HSourceID.ToString() + "," + lsmain[0].HCheckEmpID.ToString() + ")");
 
                     //鏂板鍚庢煡璇�  纭繚鏁版嵁娣诲姞鎴愬姛
                     ds = oCN.RunProcReturn("Select * from  Gy_Czygl where Czybm='" + lsmain[0].Czybm.ToString() + "'", "Gy_Czygl");
@@ -256,6 +256,7 @@
                         ",HDeptID=" + lsmain[0].HDeptID.ToString() +
                         ",HDept='" + lsmain[0].HDept.ToString() + "'" +
                         ",HWhID=" + lsmain[0].HWhID.ToString() +
+                        ",HCheckEmpID=" + lsmain[0].HCheckEmpID.ToString() +
                         ",HWHName='" + lsmain[0].HWHName.ToString() + "'" +
                         ",HSCWHID=" + lsmain[0].HSCWHID.ToString() +
                         ",HSCWHName='" + lsmain[0].HSCWHName.ToString() + "'" +
@@ -283,6 +284,7 @@
                            ",HSellMan='" + lsmain[0].HSellMan.ToString() + "'" +
                            ",HDeptID=" + lsmain[0].HDeptID.ToString() +
                            ",HDept='" + lsmain[0].HDept.ToString() + "'" +
+                           ",HCheckEmpID=" + lsmain[0].HCheckEmpID.ToString() +
                            ",HWhID=" + lsmain[0].HWhID.ToString() +
                            ",HWHName='" + lsmain[0].HWHName.ToString() + "'" +
                            ",HSCWHID=" + lsmain[0].HSCWHID.ToString() +
diff --git a/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs b/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
index 1a7e20b..7a44c8f 100644
--- a/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
+++ b/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
@@ -446,10 +446,12 @@
                 Single HExRate = mainList[0].HExRate;//姹囩巼
                 long HManagerID = mainList[0].HManagerID;//涓荤
                 long HWHID = mainList[0].HWHID;//浠撳簱
+                long HProjectID = mainList[0].HProjectID;//椤圭洰
                 string HMaker = user;//鍒跺崟浜�
                 string HAddress = mainList[0].HAddress;//鍦板潃
                 string HExplanation = mainList[0].HExplanation;//鎽樿
                 string HInnerBillNo = mainList[0].HInnerBillNo;//鍐呴儴鍗曟嵁鍙� 
+                string HInvoiceBillNo = mainList[0].HInvoiceBillNo;//鍙戠エ缂栧彿 
 
                 List<ClsCg_POInStockBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBillMain>>(msg2);
                 DateTime dt = DateTime.Now;
@@ -512,13 +514,14 @@
 	                    ,HMaker,HMakeDate,HOWNERTYPEID,HOWNERID
 	                    ,HERPInterID,HERPBillType,HPURCHASEORGID,HSTOCKORGID,HREQUIREORGID
 	                    ,HSTOCKGROUPID,HSENDBILLNO,HLADBILLNO,HPURDEPTID,HPURGROUPID,HSUPPLYID
-	                    ,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HSUPPLYADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID,HCurID,HExRate,HAddress,HWHID,HInnerBillNo)
+	                    ,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HSUPPLYADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID,HCurID,HExRate,HAddress,HWHID,HInnerBillNo
+                        ,HProjectID,HInvoiceBillNo)
                         values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1103 + "','" +
                     HBillSubType + "','" + HDate + "','" + HBillNo + "'," + HBillStatus + "," + HSupID +
                     "," + HManagerID + "," + HEmpID + "," + HDeptID + ",'" + HRemark + "','" + HMaker +
                     "',getdate()" + ",'" + HOWNERTYPEID + "'," + HOWNERID + "," + HERPInterID + ",'" + HERPBillType + "'," + HPURCHASEORGID + "," + HSTOCKORGID + "," + HREQUIREORGID + "," +
                     HSTOCKGROUPID + ",'" + HSENDBILLNO + "','" + HLADBILLNO + "'," + HPURDEPTID + "," + HPURGROUPID + "," + HSUPPLYID + "," +
-                    HSETTLEID + "," + HCHARGEID + ",'" + HBUSINESSTYPE + "','" + HSUPPLYADDRESS + "'," + HCORRESPONDORGID + "," + HPROVIDERCONTACTID + "," + HCurID + "," + HExRate + ",'" + HAddress + "'," + HWHID + ",'" + HInnerBillNo + "')";
+                    HSETTLEID + "," + HCHARGEID + ",'" + HBUSINESSTYPE + "','" + HSUPPLYADDRESS + "'," + HCORRESPONDORGID + "," + HPROVIDERCONTACTID + "," + HCurID + "," + HExRate + ",'" + HAddress + "'," + HWHID + ",'" + HInnerBillNo + "',"+ HProjectID + ",'"+ HInvoiceBillNo + "')";
                    
                     oCN.RunProc(sql);
 
@@ -529,7 +532,7 @@
                                 "HRemark='" + HRemark + "', HUpDater ='" + HMaker + "', HUpDateDate=getdate()" +
                                  ",HSupID=" + HSupID + ",HCurID=" + HCurID
                                  + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID
-                                 + ",HAddress='" + HAddress + "',HInnerBillNo='" + HInnerBillNo + "' where HInterID=" + HInterID;
+                                 + ",HAddress='" + HAddress + "',HInnerBillNo='" + HInnerBillNo + "',HProjectID="+ HProjectID + ",HInvoiceBillNo='"+ HInvoiceBillNo + "' where HInterID=" + HInterID;
 
                     oCN.RunProc(sql);
 
diff --git a/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs b/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
index b7eee2a..2ec6874 100644
--- a/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
+++ b/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
@@ -745,6 +745,8 @@
                 string HAddress = mainList[0].HAddress;//鍦板潃
                 string HExplanation = mainList[0].HExplanation;//鎽樿
                 string HInnerBillNo = mainList[0].HInnerBillNo;//鍐呴儴鍗曟嵁鍙� 
+                long HWHID = mainList[0].HWHID;//浠撳簱 
+                long HProjectID = mainList[0].HProjectID;//浠撳簱 
 
                 List<ClsCg_POOrderBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POOrderBillMain>>(msg2);
                 DateTime dt = DateTime.Now;
@@ -814,13 +816,15 @@
 	                    ,HExRate,HEmpID,HManagerID,HDeptID,HExplanation,HRemark,HInnerBillNo
 	                    ,HMaker,HMakeDate
 	                    ,HERPInterID,HERPBillType,HPURCHASEORGID
-                        ,HPURCHASERGROUPID,HPROVIDERID,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HPROVIDERADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID)
+                        ,HPURCHASERGROUPID,HPROVIDERID,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HPROVIDERADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID
+                        ,HWHID,HProjectID)
                         values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1102 + "','" +
                     1102 + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + HAddress +
                     "'," + HSSID + ",'" + HSSDate + "'," + HPSStyleID + "," + HSupID + "," + HCurID +
                     "," + HExRate + "," + HEmpID + "," + HManagerID + "," + HDeptID + ",'" + HExplanation + "','" + HRemark + "','" + HInnerBillNo + "','" + HMaker + "',getdate()" + "," + HERPInterID + ",'" + HERPBillType + "'," + HPURCHASEORGID + "," + HPURCHASERGROUPID + ","
                     + HPROVIDERID + "," + HSETTLEID + "," + HCHARGEID + ",'" + HBUSINESSTYPE + "','" + HPROVIDERADDRESS + "',"
-                    + HCORRESPONDORGID + "," + HPROVIDERCONTACTID + ")");
+                    + HCORRESPONDORGID + "," + HPROVIDERCONTACTID + ","
+                    + HWHID+","+ HProjectID + ")");
                 }
                 else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                 { //淇敼
@@ -828,7 +832,7 @@
                                 "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
                                  ",HSSID=" + HSSID + ",HPSStyleID=" + HPSStyleID + ",HSupID=" + HSupID + ",HCurID=" + HCurID
                                  + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID
-                                 + ",HAddress='" + HAddress + "',HSSDate='" + HSSDate + "' where HInterID=" + HInterID);
+                                 + ",HAddress='" + HAddress + "',HSSDate='" + HSSDate + "',HWHID="+ HWHID + ",HProjectID="+ HProjectID + " where HInterID=" + HInterID);
 
                     //鍒犻櫎瀛愯〃
                     oCN.RunProc("delete from Cg_POOrderBillSub where HInterID='" + HInterID + "'");
@@ -878,6 +882,7 @@
             string HMTONo = DetailColl2[0].HMTONo == null ? "''" : DetailColl2[0].HMTONo;
             long HERPInterID = DetailColl2[0].HERPInterID == null ? 0 : DetailColl2[0].HERPInterID;
             long HERPEntryID = DetailColl2[0].HERPEntryID == null ? 0 : DetailColl2[0].HERPEntryID;
+            long HWHID = DetailColl2[0].HWHID == null ? 0 : DetailColl2[0].HWHID;
 
             string HSeOrderBillNo = DetailColl2[0].HSeOrderBillNo == null ? "''" : DetailColl2[0].HSeOrderBillNo;
             string HRemark = DetailColl2[0].HRemark == null ? "''" : DetailColl2[0].HRemark;
@@ -978,10 +983,10 @@
                 ,HSEQ,HRECEIVEDEPTID,HSUPPLIERLOT,HBOMID,HSTOCKUNITID,HBASEUNITID,HBFLOWID,HGIVEAWAY,HROWTYPE,HBASEUNITQTY,HSTOCKBASEQTY
                 ,HREQTRACENO,HTAXNETPRICE,HPRICECOEFFICIENT,HTAXCOMBINATION,HPRICEUNITID,HPRICELISTENTRY,HPAYORGID,HSETTLEMODEID,HSETTLECURRID
                 ,HEXCHANGETYPEID,HPAYCONDITIONID,HEXCHANGERATE,HLOCALCURRID,HISINCLUDEDTAX,HISPRICEEXCLUDETAX,HTAXRATEID,HCOSTPERCENT,HCOSTAMOUNT
-                ,HVAT,HSELLERWITHHOLDING,HBUYERWITHHOLDING,HMATERIALDESC) 
+                ,HVAT,HSELLERWITHHOLDING,HBUYERWITHHOLDING,HMATERIALDESC,HWHID) 
                  values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{(oSub.HQty == null ? 0 : oSub.HQty)}
                 ,{oSub.HPrice},{oSub.HTaxPrice},{oSub.HDiscountRate},{oSub.HRelTaxPrice},{oSub.HMoney},{oSub.HTaxRate},{oSub.HTaxMoney},{oSub.HlineTotal},{oSub.HlineTotalBB},'{oSub.HDate}',{oSub.HInStockQty},{oSub.HInvoiceQty},{HSeOrderBillNo},{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{HRemark}',{HSourceInterID},{HSourceEntryID},{HSourceBillNo},{HSourceBillType},{HRelationQty},{HBackRelationQty},{HPropertyID},{HBatChNo},
-                  {HAuxPropID},{HMTONo},{HERPInterID},{HERPEntryID},{HSTOCKORGID},{HSEQ},{HRECEIVEDEPTID},'{HSUPPLIERLOT}',{HBOMID},{HSTOCKUNITID},{HBASEUNITID},'{HBFLOWID}',{HGIVEAWAY},{HROWTYPE},{HBASEUNITQTY},{HSTOCKBASEQTY},'{HREQTRACENO}',{HTAXNETPRICE},{HPRICECOEFFICIENT},{HTAXCOMBINATION},{HPRICEUNITID},{HPRICELISTENTRY},{HPAYORGID},{HSETTLEMODEID},{HSETTLECURRID},{HEXCHANGETYPEID},{HPAYCONDITIONID},{HEXCHANGERATE},{HLOCALCURRID},{HISINCLUDEDTAX},{HISPRICEEXCLUDETAX},{HTAXRATEID},{HCOSTPERCENT},{HCOSTAMOUNT},{HVAT},{HSELLERWITHHOLDING},{HBUYERWITHHOLDING},'{HMATERIALDESC}')");
+                  {HAuxPropID},{HMTONo},{HERPInterID},{HERPEntryID},{HSTOCKORGID},{HSEQ},{HRECEIVEDEPTID},'{HSUPPLIERLOT}',{HBOMID},{HSTOCKUNITID},{HBASEUNITID},'{HBFLOWID}',{HGIVEAWAY},{HROWTYPE},{HBASEUNITQTY},{HSTOCKBASEQTY},'{HREQTRACENO}',{HTAXNETPRICE},{HPRICECOEFFICIENT},{HTAXCOMBINATION},{HPRICEUNITID},{HPRICELISTENTRY},{HPAYORGID},{HSETTLEMODEID},{HSETTLECURRID},{HEXCHANGETYPEID},{HPAYCONDITIONID},{HEXCHANGERATE},{HLOCALCURRID},{HISINCLUDEDTAX},{HISPRICEEXCLUDETAX},{HTAXRATEID},{HCOSTPERCENT},{HCOSTAMOUNT},{HVAT},{HSELLERWITHHOLDING},{HBUYERWITHHOLDING},'{HMATERIALDESC}',{HWHID})");
             }
 
             //淇濆瓨鍚庢帶鍒�=========================================              
diff --git a/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs b/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs
index 4de8cc1..d20ec39 100644
--- a/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs
+++ b/WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs
@@ -148,10 +148,12 @@
                 long HSCWHID = mainList[0].HSCWHID;//璋冨嚭浠撳簱
                 long HSecManagerID = mainList[0].HSecManagerID;//楠屾敹
                 long HKeeperID = mainList[0].HKeeperID;//淇濈鍛�
+                long HProjectID = mainList[0].HProjectID;//椤圭洰
 
 
 
        
+                string HInvoiceBillNo = mainList[0].HInvoiceBillNo;//鍙戠エ缂栧彿 
                 string HExplanation = mainList[0].HExplanation;//鎽樿
                 string HInnerBillNo = mainList[0].HInnerBillNo;//鍐呴儴鍗曟嵁鍙� 
 
@@ -198,12 +200,12 @@
                     String sql =$@"Insert Into Kf_ICStockBillMain 
                         (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus
 	                    ,HAddress,HSupID,HCurID,HWHID,HEmpID,HManagerID,HSecManagerID,HKeeperID,HDeptID,HExplanation,HRemark
-                        ,HInnerBillNo,HSTOCKORGID,HOWNERID,HMaker,HMakeDate)
+                        ,HInnerBillNo,HSTOCKORGID,HOWNERID,HMaker,HMakeDate,HProjectID,HInvoiceBillNo)
                         values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1201 + "','" +
                     HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + HAddress +
                     "'," + HSupID + "," + HCurID + "," + HWHID + "," + HEmpID + "," + HManagerID + "," + 
                     HSecManagerID + ","+ HKeeperID +"," + HDeptID + ",'" + HExplanation + "','" + HRemark
-                    + "','" + HInnerBillNo + "'," + HSTOCKORGID + "," + HOWNERID + ",'" + HMaker + "',getdate()" +")";
+                    + "','" + HInnerBillNo + "'," + HSTOCKORGID + "," + HOWNERID + ",'" + HMaker + "',getdate(),"+ HProjectID + ",'"+ HInvoiceBillNo + "')";
 
                     oCN.RunProc(sql);
                 }
@@ -213,7 +215,7 @@
                                 "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
                                  ",HSupID=" + HSupID + ",HCurID=" + HCurID + ",HSecManagerID=" + HSecManagerID + ", HSTOCKORGID=" + HSTOCKORGID + ",HKeeperID=" + HKeeperID + ",HWHID = " + HWHID
                                  + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID + ",HOWNERID=" + HOWNERID
-                                 + ",HAddress='" + HAddress + "',HInnerBillNo='" + HInnerBillNo + "' where HInterID=" + HInterID;
+                                 + ",HAddress='" + HAddress + "',HInnerBillNo='" + HInnerBillNo + "',HProjectID="+ HProjectID + ",HInvoiceBillNo='"+ HInvoiceBillNo + "' where HInterID=" + HInterID;
 
                     oCN.RunProc(sql);
                     //鍒犻櫎瀛愯〃
@@ -329,13 +331,15 @@
 	            ,HMoney,HOrderPrice,HWHID,HSPID,HRelationQty,HBatchNo
                 ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType
                 ,HPOOrderInterID,HPOOrderEntryID ,HPOOrderBillNo
-                ,HPropertyID,HSecUnitID,HSecUnitRate,HPlanMode,HRemark,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo)  
+                ,HPropertyID,HSecUnitID,HSecUnitRate,HPlanMode,HRemark,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo
+                ,HTaxRate,HTaxPrice,HlineTotal)  
                  values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID}
                 ,{oSub.HQtyMust},{(oSub.HQty == null ? 0 : oSub.HQty)},{oSub.HPrice},{oSub.HMoney},{oSub.HOrderPrice},{oSub.HWHID},{oSub.HSPID},{oSub.HRelationQty}
                 ,'{oSub.HBatchNo}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}'
                 ,{oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},'{oSub.HPOOrderBillNo}'
                 ,{(oSub.HPropertyID == null ? 0 : oSub.HPropertyID)},{(oSub.HSecUnitID == null ? 0 : oSub.HSecUnitID)},{(oSub.HSecUnitRate == null ? 0 : oSub.HSecUnitRate)}
-                ,{(oSub.HPlanMode == null ? 0 : oSub.HPlanMode)},'{oSub.HRemark}',{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{oSub.HSeOrderBillNo}')";
+                ,{(oSub.HPlanMode == null ? 0 : oSub.HPlanMode)},'{oSub.HRemark}',{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{oSub.HSeOrderBillNo}'
+                ,{(oSub.HTaxRate == null ? 0 : oSub.HTaxRate)},{(oSub.HTaxPrice == null ? 0 : oSub.HTaxPrice)},{(oSub.HlineTotal == null ? 0 : oSub.HlineTotal)})";
 
                 //string sReturn = "";
                 //ds = oCN.RunProcReturn("exec h_p_Cg_POInStockBillMain " + oSub.HQty + ", '" +oSub.HSourceInterID + "', '" + oSub.HSourceEntryID + "','" + user+" '", "h_p_Cg_POInStockBillMain");
diff --git a/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
index 1f7991f..351bd0e 100644
--- a/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
@@ -172,9 +172,8 @@
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
-                if (oBill.omodel.HInterID == 0)
+                if (refSav == "Add")
                 {
-
                     bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     if (bResult)
                     {
@@ -423,7 +422,7 @@
                 objJsonResult.data = null;
                 return objJsonResult;
             }
-        }
+        }               
 
         public static DataSet Get_TransFerBillList(string sWhere)
         {
@@ -440,6 +439,63 @@
             return new SQLHelper.ClsCN().RunProcReturn(sql, "OA_ErrMsgBackBillMain");
         }
 
+        #endregion
+
+        #region 寮傚父鍙嶉鍒楄〃PDA
+        [Route("Sc_MESTransFerWorkBill/Get_TransFerBillList_PDA")]
+        [HttpGet]
+        public object Get_TransFerBillList_PDA(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackBill_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    string sql = "select * from h_v_OA_ErrMsgBackBillList_PDA order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackBillList_PDA");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_OA_ErrMsgBackBillList_PDA where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackBillList_PDA");
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
         #endregion
 
         #region 寮傚父鍙嶉鍒楄〃缂栬緫鑾峰彇鏁版嵁
@@ -751,7 +807,7 @@
 
         [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackList")]
         [HttpGet]
-        public object Get_OA_ErrMsgBackList(string HInterID,string HEntryID, string user,int num)
+        public object Get_OA_ErrMsgBackList(string HInterID,string HEntryID, string user,Int64 num)
         {
             try
             {
@@ -766,22 +822,46 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                if (num == 1)       //寮傚父鍙嶉鍗�
+                string sql = "";
+                string HViewName = "";
+                switch (num)
                 {
-                    string sql = "select * from h_v_OA_ErrMsgBackBillList where HInterID = '" + HInterID + "' and HEntryID = '" + HEntryID + "'";
-                    ds = oCN.RunProcReturn(sql, "p_v_OA_ErrMsgBackBillList");
+                    case 1: //寮傚父鍙嶉鍗�
+                        sql = "select * from h_v_OA_ErrMsgBackBillList where HInterID = '" + HInterID + "' and HEntryID = '" + HEntryID + "'";
+                        HViewName = "h_v_OA_ErrMsgBackBillList";
+                        break;
+                    case 2://寮傚父鍙嶉鎺ユ敹鍗�
+                        sql = "select * from h_v_OA_ErrMsgBackReceiveBillMainList  where hmainid = '" + HInterID + "'";
+                        HViewName = "h_v_OA_ErrMsgBackReceiveBillMainList";
+                        break;
+                    case 3://寮傚父鍙嶉澶勭悊鍗�
+                        sql = "select * from h_v_OA_ErrMsgBackHandleBillMainList   where hmainid = '" + HInterID + "'";
+                        HViewName = "h_v_OA_ErrMsgBackHandleBillMainList";
+                        break;
+                    case 10: //寮傚父鍙嶉鍗昉DA
+                        sql = "select * from h_v_OA_ErrMsgBackBillList_PDA where HInterID = '" + HInterID + "' and HEntryID = '" + HEntryID + "'";
+                        HViewName = "h_v_OA_ErrMsgBackBillList_PDA";
+                        break;
+                    case 11://寮傚父鍙嶉鎺ユ敹鍗昉DA
+                        sql = "select * from h_v_OA_ErrMsgBackReceiveBillList_PDA  where hmainid = '" + HInterID + "'";
+                        HViewName = "h_v_OA_ErrMsgBackReceiveBillList_PDA";
+                        break;
+                    case 12://寮傚父鍙嶉澶勭悊鍗昉DA
+                        sql = "select * from h_v_OA_ErrMsgBackHandleBillList_PDA   where hmainid = '" + HInterID + "'";
+                        HViewName = "h_v_OA_ErrMsgBackHandleBillList_PDA";
+                        break;
                 }
-                else if (num==2)    //寮傚父鍙嶉鎺ユ敹鍗�
+                if(sql == "")
                 {
-                    string sql = "select * from h_v_OA_ErrMsgBackReceiveBillMainList  where hmainid = '" + HInterID + "'";
-                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillMainList");
-                }
-                else if (num == 3)    //寮傚父鍙嶉澶勭悊鍗�
-                {
-                    string sql = "select * from h_v_OA_ErrMsgBackHandleBillMainList   where hmainid = '" + HInterID + "'";
-                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackHandleBillMainList ");
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岄�掑叆婧愬崟绫诲瀷num涓嶆纭紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
                 }
 
+                ds = oCN.RunProcReturn(sql, HViewName);
+               
                 //娣诲姞鍒楀悕
                 foreach (DataColumn col in ds.Tables[0].Columns)
                 {
@@ -1030,6 +1110,64 @@
                     string sql1 = "select * from h_v_OA_ErrMsgBackReceiveBillMainList where 1 = 1 ";
                     string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
                     ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillMainList");
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 寮傚父鍙嶉鎺ユ敹鍗曞垪琛≒DA
+
+        [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackReceiveBillList_PDA")]
+        [HttpGet]
+        public object Get_OA_ErrMsgBackReceiveBillList_PDA(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackReceiveBillMain_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    string sql = "select * from h_v_OA_ErrMsgBackReceiveBillList_PDA order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillList_PDA");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_OA_ErrMsgBackReceiveBillList_PDA where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillList_PDA");
                 }
 
                 //娣诲姞鍒楀悕
@@ -1916,6 +2054,64 @@
         }
         #endregion
 
+        #region 寮傚父鍙嶉绛惧埌鍗曞垪琛≒DA
+
+        [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackSignBillList_PDA")]
+        [HttpGet]
+        public object Get_OA_ErrMsgBackSignBillList_PDA(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackSignBillMain_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    string sql = "select * from h_v_OA_ErrMsgBackSignBillList_PDA order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackSignBillList_PDA");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_OA_ErrMsgBackSignBillList_PDA where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackSignBillList_PDA");
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 寮傚父鍙嶉绛惧埌鍗� 鍒犻櫎
         /// <summary>
         ///鍙傛暟锛歴tring HInterID銆�
@@ -2773,6 +2969,64 @@
             }
         }
         #endregion
+        #region 寮傚父鍙嶉澶勭悊鍗曞垪琛≒DA
+
+        [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackHandleBillList_PDA")]
+        [HttpGet]
+        public object Get_OA_ErrMsgBackHandleBillList_PDA(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackHandleBillMain_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    string sql = "select * from h_v_OA_ErrMsgBackHandleBillList_PDA order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackHandleBillList_PDA");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_OA_ErrMsgBackHandleBillList_PDA where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackHandleBillList_PDA");
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
 
         #region 寮傚父鍙嶉澶勭悊鍗� 鍒犻櫎
 
@@ -3629,6 +3883,64 @@
         }
         #endregion
 
+        #region 寮傚父鍙嶉楠屾敹鍗曞垪琛≒DA
+
+        [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackCheckBillList_PDA")]
+        [HttpGet]
+        public object Get_OA_ErrMsgBackCheckBillList_PDA(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackCheckBillMain_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    string sql = "select * from h_v_OA_ErrMsgBackCheckBillList_PDA order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackCheckBillList_PDA");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_OA_ErrMsgBackCheckBillList_PDA where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackCheckBillList_PDA");
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 寮傚父鍙嶉楠屾敹鍗� 鍒犻櫎
 
         [Route("Sc_MESTransFerWorkBill/DeleteOA_ErrMsgBackCheckBill")]
diff --git a/WebAPI/Controllers/SCGL/Sc_ProductionReturnBillController.cs b/WebAPI/Controllers/SCGL/Sc_ProductionReturnBillController.cs
index 14c744a..d3c6bff 100644
--- a/WebAPI/Controllers/SCGL/Sc_ProductionReturnBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_ProductionReturnBillController.cs
@@ -6,6 +6,8 @@
 using Pub_Class;
 using System.Web.Http;
 using WebAPI.Models;
+using Model;
+using Newtonsoft.Json.Linq;
 
 namespace WebAPI.Controllers.SCGL
 {
@@ -15,11 +17,53 @@
         private json objJsonResult = new json();
         public DataSet ds = new DataSet();
         public WebServer webserver = new WebServer();
-        public DAL.ClsCg_POInStockBill BillOld = new DAL.ClsCg_POInStockBill();
+        //public DAL.ClsCg_POInStockBill BillOld = new DAL.ClsCg_POInStockBill();
+        public DAL.ClsSc_ProductionReturnBill BillOld = new DAL.ClsSc_ProductionReturnBill();
+
         public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
 
+        #region 鐢熶骇閫�搴撳崟 鏌ユ壘璁板綍鍔熻兘
+        /// <summary>
+        /// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Sc_ProductionReturnBill/cx")]
+        [HttpGet]
+        public object cx(long HInterID)
+        {
+            try
+            {
 
+                ds = oCN.RunProcReturn("select * from h_v_IF_ProductionReturnList where hmainid=" + HInterID, "h_v_IF_ProductionReturnList");
+                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
 
         /// <summary>
         /// 鐢熶骇閫�搴撳崟鍒楄〃
@@ -163,298 +207,298 @@
         }
         #endregion
 
-        //#region 鐢熶骇鍏ュ簱鍗�  淇濆瓨/缂栬緫鍔熻兘
-        //[Route("Kf_ProductInBill/ProductInBillEdit")]
-        //[HttpPost]
-        //public object ProductInBillEdit([FromBody] JObject sMainSub)
-        //{
-        //    try
-        //    {
-        //        var _value = sMainSub["sMainSub"].ToString();
-        //        string msg1 = _value.ToString();
-        //        oCN.BeginTran();
-        //        //淇濆瓨涓昏〃
-        //        objJsonResult = AddBillMain(msg1);
-        //        if (objJsonResult.code == "0")
-        //        {
-        //            oCN.RollBack();
-        //            objJsonResult.code = "0";
-        //            objJsonResult.count = 0;
-        //            objJsonResult.Message = objJsonResult.Message;
-        //            objJsonResult.data = null;
-        //            return objJsonResult;
-        //        }
-        //        oCN.Commit();
-        //        objJsonResult.code = "1";
-        //        objJsonResult.count = 1;
-        //        objJsonResult.Message = "鍗曟嵁淇濆瓨鎴愬姛锛�";
-        //        objJsonResult.data = null;
-        //        return objJsonResult;
+        #region 鐢熶骇閫�搴撳崟  淇濆瓨/缂栬緫鍔熻兘
+        [Route("Sc_ProductionReturnBill/ProductionReturnBillEdit")]
+        [HttpPost]
+        public object ProductionReturnBillEdit([FromBody] JObject sMainSub)
+        {
+            try
+            {
+                var _value = sMainSub["sMainSub"].ToString();
+                string msg1 = _value.ToString();
+                oCN.BeginTran();
+                //淇濆瓨涓昏〃
+                objJsonResult = AddBillMain(msg1);
+                if (objJsonResult.code == "0")
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = objJsonResult.Message;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍗曟嵁淇濆瓨鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
 
-        //    }
-        //    catch (Exception e)
-        //    {
-        //        oCN.RollBack();
-        //        objJsonResult.code = "0";
-        //        objJsonResult.count = 0;
-        //        objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
-        //        objJsonResult.data = null;
-        //        return objJsonResult;
-        //    }
-        //}
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
 
-        //public json AddBillMain(string msg1)
-        //{
-        //    string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
-        //    string msg2 = sArray[0].ToString(); //涓昏〃鏁版嵁
-        //    string msg3 = sArray[1].ToString(); //瀛愯〃鏁版嵁
-        //    int OperationType = int.Parse(sArray[2].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 3淇敼
-        //    string user = sArray[3].ToString();
-        //    string msg_allVal = sArray[4].ToString(); //涓昏〃+瀛愯〃鎵�鏈夋暟鎹�
+        public json AddBillMain(string msg1)
+        {
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString(); //涓昏〃鏁版嵁
+            string msg3 = sArray[1].ToString(); //瀛愯〃鏁版嵁
+            int OperationType = int.Parse(sArray[2].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 3淇敼
+            string user = sArray[3].ToString();
+            string msg_allVal = sArray[4].ToString(); //涓昏〃+瀛愯〃鎵�鏈夋暟鎹�
 
-        //    try
-        //    {
-        //        msg2 = "[" + msg2.ToString() + "]";
-        //        List<ClsKf_ProductInBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsKf_ProductInBillMain>>(msg2);
+            try
+            {
+                msg2 = "[" + msg2.ToString() + "]";
+                List<ClsSc_ProductionReturnBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_ProductionReturnBillMain>>(msg2);
 
-        //        long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
-        //        string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿
-        //        long HPRDORGID = mainList[0].HPRDORGID;//缁勭粐
-        //        DateTime HDate = mainList[0].HDate;//鏃ユ湡
-        //        string HRemark = mainList[0].HRemark;//澶囨敞
-        //        long HSupID = mainList[0].HSupID;//渚涘簲鍟�
-        //        long HEmpID = mainList[0].HEmpID;//涓氬姟鍛�
-        //        long HDeptID = mainList[0].HDeptID;//閮ㄩ棬
-        //        long HSecManagerID = mainList[0].HSecManagerID;//楠屾敹鍛�
-        //        long HKeeperID = mainList[0].HKeeperID;//淇濈鍛�
-        //        long HCurID = mainList[0].HCurID;//甯佸埆
-        //        Single HExRate = mainList[0].HExRate;//姹囩巼
-        //        long HManagerID = mainList[0].HManagerID;//涓荤
-        //        long HWHID = mainList[0].HWHID;//浠撳簱
-        //        string HMaker = user;//鍒跺崟浜�
-        //        string HExplanation = mainList[0].HExplanation;//鎽樿
-        //        string HInnerBillNo = mainList[0].HInnerBillNo;//鍐呴儴鍗曟嵁鍙� 
+                long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
+                string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿
+                long HPRDORGID = mainList[0].HPRDORGID;//缁勭粐
+                DateTime HDate = mainList[0].HDate;//鏃ユ湡
+                string HRemark = mainList[0].HRemark;//澶囨敞
+                long HSupID = mainList[0].HSupID;//渚涘簲鍟�
+                long HEmpID = mainList[0].HEmpID;//涓氬姟鍛�
+                long HDeptID = mainList[0].HDeptID;//閮ㄩ棬
+                long HSecManagerID = mainList[0].HSecManagerID;//楠屾敹鍛�
+                long HKeeperID = mainList[0].HKeeperID;//淇濈鍛�
+                long HCurID = mainList[0].HCurID;//甯佸埆
+                Single HExRate = mainList[0].HExRate;//姹囩巼
+                long HManagerID = mainList[0].HManagerID;//涓荤
+                long HWHID = mainList[0].HWHID;//浠撳簱
+                string HMaker = user;//鍒跺崟浜�
+                string HExplanation = mainList[0].HExplanation;//鎽樿
+                string HInnerBillNo = mainList[0].HInnerBillNo;//鍐呴儴鍗曟嵁鍙� 
 
-        //        List<ClsCg_POInStockBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBillMain>>(msg2);
-        //        DateTime dt = DateTime.Now;
-        //        long HCORRESPONDORGID = mainList2[0].HOrgID;
-        //        long HYear = mainList2[0].HYear == null ? 0 : mainList2[0].HYear;
-        //        long HPeriod = mainList2[0].HPeriod == null ? 0 : mainList2[0].HPeriod;
-        //        string HBillType = mainList2[0].HBillType == null ? "''" : mainList2[0].HBillType;
-        //        string HBillSubType = mainList2[0].HBillSubType == null ? "''" : mainList2[0].HBillSubType;
-        //        long HBillStatus = mainList2[0].HBillStatus == null ? 0 : mainList2[0].HBillStatus;
-        //        string HMakeDate = mainList2[0].HMakeDate == null ? "''" : mainList2[0].HMakeDate;
-        //        string HChecker = mainList2[0].HChecker == null ? "''" : mainList2[0].HChecker;
-        //        string HCheckDate = mainList2[0].HCheckDate == null ? "''" : mainList2[0].HCheckDate;
-        //        string HOWNERTYPEID = mainList2[0].HOWNERTYPEID == null ? "''" : mainList2[0].HOWNERTYPEID;
-        //        long HOWNERID = mainList2[0].HOWNERID == null ? 0 : mainList2[0].HOWNERID;
-        //        long HERPInterID = mainList2[0].HERPInterID == null ? 0 : mainList2[0].HERPInterID;
-        //        string HERPBillType = mainList2[0].HERPBillType == null ? "''" : mainList2[0].HERPBillType;
-        //        long HPURCHASEORGID = mainList2[0].HPURCHASEORGID == null ? 0 : mainList2[0].HPURCHASEORGID;
-        //        long HSTOCKORGID = mainList2[0].HSTOCKORGID == null ? 0 : mainList2[0].HSTOCKORGID;
-        //        long HREQUIREORGID = mainList2[0].HREQUIREORGID == null ? 0 : mainList2[0].HREQUIREORGID;
-        //        long HSTOCKGROUPID = mainList2[0].HSTOCKGROUPID == null ? 0 : mainList2[0].HSTOCKGROUPID;
-        //        string HSENDBILLNO = mainList2[0].HSENDBILLNO == null ? "''" : mainList2[0].HSENDBILLNO;
-        //        string HLADBILLNO = mainList2[0].HLADBILLNO == null ? "''" : mainList2[0].HLADBILLNO;
-        //        long HPURDEPTID = mainList2[0].HPURDEPTID == null ? 0 : mainList2[0].HPURDEPTID;
-        //        long HPURGROUPID = mainList2[0].HPURGROUPID == null ? 0 : mainList2[0].HPURGROUPID;
-        //        long HSUPPLYID = mainList2[0].HSUPPLYID == null ? 0 : mainList2[0].HSUPPLYID;
-        //        long HSETTLEID = mainList2[0].HSETTLEID == null ? 0 : mainList2[0].HSETTLEID;
-        //        long HCHARGEID = mainList2[0].HCHARGEID == null ? 0 : mainList2[0].HCHARGEID;
-        //        string HBUSINESSTYPE = mainList2[0].HBUSINESSTYPE == null ? "''" : mainList2[0].HBUSINESSTYPE;
-        //        string HSUPPLYADDRESS = mainList2[0].HSUPPLYADDRESS == null ? "''" : mainList2[0].HSUPPLYADDRESS;
-        //        long HPROVIDERCONTACTID = mainList2[0].HPROVIDERCONTACTID == null ? 0 : mainList2[0].HPROVIDERCONTACTID;
+                List<ClsCg_POInStockBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBillMain>>(msg2);
+                DateTime dt = DateTime.Now;
+                long HCORRESPONDORGID = mainList2[0].HOrgID;
+                long HYear = mainList2[0].HYear == null ? 0 : mainList2[0].HYear;
+                long HPeriod = mainList2[0].HPeriod == null ? 0 : mainList2[0].HPeriod;
+                string HBillType = mainList2[0].HBillType == null ? "''" : mainList2[0].HBillType;
+                string HBillSubType = mainList2[0].HBillSubType == null ? "''" : mainList2[0].HBillSubType;
+                long HBillStatus = mainList2[0].HBillStatus == null ? 0 : mainList2[0].HBillStatus;
+                string HMakeDate = mainList2[0].HMakeDate == null ? "''" : mainList2[0].HMakeDate;
+                string HChecker = mainList2[0].HChecker == null ? "''" : mainList2[0].HChecker;
+                string HCheckDate = mainList2[0].HCheckDate == null ? "''" : mainList2[0].HCheckDate;
+                string HOWNERTYPEID = mainList2[0].HOWNERTYPEID == null ? "''" : mainList2[0].HOWNERTYPEID;
+                long HOWNERID = mainList2[0].HOWNERID == null ? 0 : mainList2[0].HOWNERID;
+                long HERPInterID = mainList2[0].HERPInterID == null ? 0 : mainList2[0].HERPInterID;
+                string HERPBillType = mainList2[0].HERPBillType == null ? "''" : mainList2[0].HERPBillType;
+                long HPURCHASEORGID = mainList2[0].HPURCHASEORGID == null ? 0 : mainList2[0].HPURCHASEORGID;
+                long HSTOCKORGID = mainList2[0].HSTOCKORGID == null ? 0 : mainList2[0].HSTOCKORGID;
+                long HREQUIREORGID = mainList2[0].HREQUIREORGID == null ? 0 : mainList2[0].HREQUIREORGID;
+                long HSTOCKGROUPID = mainList2[0].HSTOCKGROUPID == null ? 0 : mainList2[0].HSTOCKGROUPID;
+                string HSENDBILLNO = mainList2[0].HSENDBILLNO == null ? "''" : mainList2[0].HSENDBILLNO;
+                string HLADBILLNO = mainList2[0].HLADBILLNO == null ? "''" : mainList2[0].HLADBILLNO;
+                long HPURDEPTID = mainList2[0].HPURDEPTID == null ? 0 : mainList2[0].HPURDEPTID;
+                long HPURGROUPID = mainList2[0].HPURGROUPID == null ? 0 : mainList2[0].HPURGROUPID;
+                long HSUPPLYID = mainList2[0].HSUPPLYID == null ? 0 : mainList2[0].HSUPPLYID;
+                long HSETTLEID = mainList2[0].HSETTLEID == null ? 0 : mainList2[0].HSETTLEID;
+                long HCHARGEID = mainList2[0].HCHARGEID == null ? 0 : mainList2[0].HCHARGEID;
+                string HBUSINESSTYPE = mainList2[0].HBUSINESSTYPE == null ? "''" : mainList2[0].HBUSINESSTYPE;
+                string HSUPPLYADDRESS = mainList2[0].HSUPPLYADDRESS == null ? "''" : mainList2[0].HSUPPLYADDRESS;
+                long HPROVIDERCONTACTID = mainList2[0].HPROVIDERCONTACTID == null ? 0 : mainList2[0].HPROVIDERCONTACTID;
 
-        //        ds = oCN.RunProcReturn("select * from h_v_IF_ProductInBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_ProductInBillList");
-        //        if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0)//鏂板
-        //        {
+                ds = oCN.RunProcReturn("select * from h_v_IF_ProductionReturnList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_ProductionReturnList");
+                if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0)//鏂板
+                {
 
-        //            //淇濆瓨鍓嶆帶鍒�=========================================
-        //            ds = oCN.RunProcReturn("exec h_p_Kf_ProductInBill_BeforeSaveCtrl " + HInterID, "h_p_Kf_ProductInBill_BeforeSaveCtrl");
+                    //淇濆瓨鍓嶆帶鍒�=========================================
+                    ds = oCN.RunProcReturn("exec h_p_Sc_ProductionReturnBill_BeforeSaveCtrl " + HInterID, "h_p_Sc_ProductionReturnBill_BeforeSaveCtrl");
 
-        //            if (ds == null || ds.Tables[0].Rows.Count == 0)
-        //            {
-        //                objJsonResult.code = "0";
-        //                objJsonResult.count = 0;
-        //                objJsonResult.Message = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
-        //                objJsonResult.data = null;
-        //                return objJsonResult;
-        //            }
-        //            if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
-        //            {
-        //                objJsonResult.code = "0";
-        //                objJsonResult.count = 0;
-        //                objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
-        //                objJsonResult.data = null;
-        //                return objJsonResult;
-        //            }
-        //            //=========================================================
-        //            //涓昏〃
-        //            string sql = $@"Insert Into Kf_ICStockBillMain    
-        //                (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate
-	       //             ,HBillNo,HBillStatus,HSupID,HManagerID,HEmpID,HDeptID,HSecManagerID,HKeeperID,HRemark,HMaker,HMakeDate,HCurID,HExRate,HWHID,HInnerBillNo,HExplanation )
-        //                values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1202 + "','" +
-        //            HBillSubType + "','" + HDate + "','" + HBillNo + "'," + HBillStatus + "," + HSupID +
-        //            "," + HManagerID + "," + HEmpID + "," + HDeptID + "," + HSecManagerID + "," + HKeeperID + ",'" + HRemark + "','" + HMaker +
-        //            "',getdate()" + "," + HCurID + "," + HExRate + "," + HWHID + ",'" + HInnerBillNo + "','" + HExplanation + "')";
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //=========================================================
+                    //涓昏〃
+                    string sql = $@"Insert Into Kf_ICStockBillMain    
+                        (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate
+	                    ,HBillNo,HBillStatus,HSupID,HManagerID,HEmpID,HDeptID,HSecManagerID,HKeeperID,HRemark,HMaker,HMakeDate,HCurID,HExRate,HWHID,HInnerBillNo,HExplanation )
+                        values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1245 + "','" +
+                    HBillSubType + "','" + HDate + "','" + HBillNo + "'," + HBillStatus + "," + HSupID +
+                    "," + HManagerID + "," + HEmpID + "," + HDeptID + "," + HSecManagerID + "," + HKeeperID + ",'" + HRemark + "','" + HMaker +
+                    "',getdate()" + "," + HCurID + "," + HExRate + "," + HWHID + ",'" + HInnerBillNo + "','" + HExplanation + "')";
 
-        //            oCN.RunProc(sql);
+                    oCN.RunProc(sql);
 
-        //        }
-        //        else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
-        //        { //淇敼
-        //            string sql = $@"update Kf_ICStockBillMain  set " +
-        //                        "HRemark='" + HRemark + "', HUpDater ='" + HMaker + "', HUpDateDate=getdate()" +
-        //                         ",HSupID=" + HSupID + ",HCurID=" + HCurID
-        //                         + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID
-        //                         + ",HInnerBillNo='" + HInnerBillNo + "' where HInterID=" + HInterID;
+                }
+                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
+                { //淇敼
+                    string sql = $@"update Kf_ICStockBillMain  set " +
+                                "HRemark='" + HRemark + "', HUpDater ='" + HMaker + "', HUpDateDate=getdate()" +
+                                 ",HSupID=" + HSupID + ",HCurID=" + HCurID
+                                 + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID
+                                 + ",HInnerBillNo='" + HInnerBillNo + "' where HInterID=" + HInterID;
 
-        //            oCN.RunProc(sql);
+                    oCN.RunProc(sql);
 
 
-        //            //鍒犻櫎瀛愯〃
-        //            oCN.RunProc("delete from Kf_ICStockBillSub where HInterID='" + HInterID + "'");
-        //        }
-        //        //淇濆瓨瀛愯〃
-        //        objJsonResult = AddBillSub(msg3, HInterID, OperationType, user);
+                    //鍒犻櫎瀛愯〃
+                    oCN.RunProc("delete from Kf_ICStockBillSub where HInterID='" + HInterID + "'");
+                }
+                //淇濆瓨瀛愯〃
+                objJsonResult = AddBillSub(msg3, HInterID, OperationType, user);
 
-        //        //鐢熶骇鍏ュ簱鍗曟柊澧炲洖濉敓浜ц鍗曞叧鑱旀暟閲�
-        //        oCN.RunProc("exec h_p_Kf_UpDateRelation_ProductInToICMO_Add " + HInterID);
+                //鐢熶骇閫�搴撳崟鏂板鍥炲~鐢熶骇璁㈠崟鍏宠仈鏁伴噺
+                oCN.RunProc("exec h_p_Sc_UpDateRelation_ProductionReturnToICMO_Add " + HInterID);
 
-        //        //鐢熶骇鍏ュ簱鍗曟柊澧炲洖濉敓浜ф眹鎶ュ崟鍏宠仈鏁伴噺
-        //        oCN.RunProc("exec h_p_Kf_UpDateRelation_ProductInToICMOReport_Add " + HInterID);
+                //鐢熶骇閫�搴撳崟鏂板鍥炲~鐢熶骇姹囨姤鍗曞叧鑱旀暟閲�
+                oCN.RunProc("exec h_p_Sc_UpDateRelation_ProductionReturnToICMOReport_Add " + HInterID);
 
-        //        if (objJsonResult.code == "0")
-        //        {
-        //            objJsonResult.code = "0";
-        //            objJsonResult.count = 0;
-        //            objJsonResult.Message = objJsonResult.Message;
-        //            objJsonResult.data = null;
-        //            return objJsonResult;
-        //        }
+                if (objJsonResult.code == "0")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = objJsonResult.Message;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
-        //        objJsonResult.code = "1";
-        //        objJsonResult.count = 1;
-        //        objJsonResult.Message = null;
-        //        objJsonResult.data = null;
-        //        return objJsonResult;
-        //    }
-        //    catch (Exception e)
-        //    {
-        //        objJsonResult.code = "0";
-        //        objJsonResult.count = 0;
-        //        objJsonResult.Message = "Exception锛�" + e.ToString();
-        //        objJsonResult.data = null;
-        //        return objJsonResult;
-        //    }
-        //}
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = null;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
 
-        //public json AddBillSub(string msg3, long HInterID, int OperationType, string user)
-        //{
-        //    List<ClsKf_ProductInBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsKf_ProductInBillSub>>(msg3);
+        public json AddBillSub(string msg3, long HInterID, int OperationType, string user)
+        {
+            List<ClsSc_ProductionReturnBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_ProductionReturnBillSub>>(msg3);
 
-        //    List<ClsKf_ProductInBillSub> DetailColl2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsKf_ProductInBillSub>>(msg3);
+            List<ClsSc_ProductionReturnBillSub> DetailColl2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_ProductionReturnBillSub>>(msg3);
 
 
-        //    //long HSPID = DetailColl2[0].HSPID == null ? 0 : DetailColl2[0].HSPID;
-        //    long HSourceInterID = DetailColl2[0].HSourceInterID == null ? 0 : DetailColl2[0].HSourceInterID;
-        //    long HSourceEntryID = DetailColl2[0].HSourceEntryID == null ? 0 : DetailColl2[0].HSourceEntryID;
-        //    string HSourceBillNo = DetailColl2[0].HSourceBillNo == null ? "''" : DetailColl2[0].HSourceBillNo;
-        //    string HSourceBillType = DetailColl2[0].HSourceBillType == null ? "''" : DetailColl2[0].HSourceBillType;
-        //    string HRemark = DetailColl2[0].HRemark == null ? "''" : DetailColl2[0].HRemark;
-        //    string HPOOrderBillNo = DetailColl2[0].HPOOrderBillNo == null ? "''" : DetailColl2[0].HPOOrderBillNo;
+            //long HSPID = DetailColl2[0].HSPID == null ? 0 : DetailColl2[0].HSPID;
+            long HSourceInterID = DetailColl2[0].HSourceInterID == null ? 0 : DetailColl2[0].HSourceInterID;
+            long HSourceEntryID = DetailColl2[0].HSourceEntryID == null ? 0 : DetailColl2[0].HSourceEntryID;
+            string HSourceBillNo = DetailColl2[0].HSourceBillNo == null ? "''" : DetailColl2[0].HSourceBillNo;
+            string HSourceBillType = DetailColl2[0].HSourceBillType == null ? "''" : DetailColl2[0].HSourceBillType;
+            string HRemark = DetailColl2[0].HRemark == null ? "''" : DetailColl2[0].HRemark;
+            string HPOOrderBillNo = DetailColl2[0].HPOOrderBillNo == null ? "''" : DetailColl2[0].HPOOrderBillNo;
 
-        //    int i = 0;
-        //    foreach (ClsKf_ProductInBillSub oSub in DetailColl)
-        //    {
-        //        i++;
-        //        if (oSub.HQty <= 0 || oSub.HQty == null)
-        //        {
-        //            objJsonResult.code = "0";
-        //            objJsonResult.count = 0;
-        //            objJsonResult.Message = "绗�" + i + "琛岋紝鏁伴噺涓嶈兘涓�0鎴栬�呭皬浜�0";
-        //            objJsonResult.data = null;
-        //            return objJsonResult;
-        //        }
+            int i = 0;
+            foreach (ClsSc_ProductionReturnBillSub oSub in DetailColl)
+            {
+                i++;
+                if (oSub.HQty <= 0 || oSub.HQty == null)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "绗�" + i + "琛岋紝鏁伴噺涓嶈兘涓�0鎴栬�呭皬浜�0";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
-        //        if (oSub.HMaterID == 0)
-        //        {
-        //            objJsonResult.code = "0";
-        //            objJsonResult.count = 0;
-        //            objJsonResult.Message = "绗�" + i + "琛岋紝鐗╂枡涓嶈兘涓虹┖";
-        //            objJsonResult.data = null;
-        //            return objJsonResult;
-        //        }
+                if (oSub.HMaterID == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "绗�" + i + "琛岋紝鐗╂枡涓嶈兘涓虹┖";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
-        //        //if (oSub.HSourceID == 0)
-        //        //{
-        //        //    objJsonResult.code = "0";
-        //        //    objJsonResult.count = 0;
-        //        //    objJsonResult.Message = "绗�" + i + "琛岋紝鐢熶骇璧勬簮涓嶈兘涓虹┖";
-        //        //    objJsonResult.data = null;
-        //        //    return objJsonResult;
-        //        //}
+                //if (oSub.HSourceID == 0)
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "绗�" + i + "琛岋紝鐢熶骇璧勬簮涓嶈兘涓虹┖";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
 
-        //        if (oSub.HUnitID == 0)
-        //        {
-        //            objJsonResult.code = "0";
-        //            objJsonResult.count = 0;
-        //            objJsonResult.Message = "绗�" + i + "琛岋紝璁¢噺鍗曚綅涓嶈兘涓虹┖";
-        //            objJsonResult.data = null;
-        //            return objJsonResult;
-        //        }
+                if (oSub.HUnitID == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "绗�" + i + "琛岋紝璁¢噺鍗曚綅涓嶈兘涓虹┖";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
-        //        DataSet Cs;
-        //        Int64 NewHEntryID = 1;
-        //        Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Kf_ICStockBillSub", "Kf_ICStockBillSub");
-        //        if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0)
-        //        {
-        //            NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
-        //            NewHEntryID += 1;
-        //        }
+                DataSet Cs;
+                Int64 NewHEntryID = 1;
+                Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Kf_ICStockBillSub", "Kf_ICStockBillSub");
+                if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0)
+                {
+                    NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
+                    NewHEntryID += 1;
+                }
 
 
-        //        oCN.RunProc($@"Insert into Kf_ICStockBillSub 
-        //        (HInterID,HEntryID,HMaterID,HUnitID,HQtyMust,HQty,HPrice
-	       //     ,HMoney,HWHID,HSPID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HPOOrderInterID
-        //        ,HPOOrderEntryID,HPOORderBillNo,HSecUnitID,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HRelationQty,HSecUnitRate,HPropertyID) 
-        //         values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{(oSub.HQtyMust == null ? 0 : oSub.HQtyMust)},{(oSub.HQty == null ? 0 : oSub.HQty)}
-        //        ,{oSub.HPrice},{oSub.HMoney},{oSub.HWHID},{oSub.HSPID},'{HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{HSourceBillNo}',{HSourceBillType},
-        //        {oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},'{HPOOrderBillNo}',{oSub.HSecUnitID},{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{oSub.HSeOrderBillNo}',{oSub.HRelationQty},{oSub.HSecUnitRate},{oSub.HSecUnitRate})");
+                oCN.RunProc($@"Insert into Kf_ICStockBillSub 
+                (HInterID,HEntryID,HMaterID,HUnitID,HQtyMust,HQty,HPrice
+	            ,HMoney,HWHID,HSPID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HPOOrderInterID
+                ,HPOOrderEntryID,HPOORderBillNo,HSecUnitID,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HRelationQty,HSecUnitRate,HPropertyID) 
+                 values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{(oSub.HQtyMust == null ? 0 : oSub.HQtyMust)},{(oSub.HQty == null ? 0 : oSub.HQty)}
+                ,{oSub.HPrice},{oSub.HMoney},{oSub.HWHID},{oSub.HSPID},'{HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{HSourceBillNo}',{HSourceBillType},
+                {oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},'{HPOOrderBillNo}',{oSub.HSecUnitID},{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{oSub.HSeOrderBillNo}',{oSub.HRelationQty},{oSub.HSecUnitRate},{oSub.HSecUnitRate})");
 
-        //    }
-        //    //淇濆瓨鍚庢帶鍒�=========================================              
-        //    ds = oCN.RunProcReturn("exec h_p_Kf_ProductInBill_AfterSaveCtrl " + HInterID, "h_p_Kf_ProductInBill_AfterSaveCtrl");
+            }
+            //淇濆瓨鍚庢帶鍒�=========================================              
+            ds = oCN.RunProcReturn("exec h_p_Sc_ProductionReturnBill_AfterSaveCtrl " + HInterID, "h_p_Sc_ProductionReturnBill_AfterSaveCtrl");
 
-        //    if (ds == null || ds.Tables[0].Rows.Count == 0)
-        //    {
-        //        objJsonResult.code = "0";
-        //        objJsonResult.count = 0;
-        //        objJsonResult.Message = "淇濆瓨鍚庡垽鏂け璐ワ紒";
-        //        objJsonResult.data = null;
-        //        return objJsonResult;
-        //    }
-        //    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
-        //    {
-        //        objJsonResult.code = "0";
-        //        objJsonResult.count = 0;
-        //        objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
-        //        objJsonResult.data = null;
-        //        return objJsonResult;
-        //    }
-        //    //=========================================================
+            if (ds == null || ds.Tables[0].Rows.Count == 0)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨鍚庡垽鏂け璐ワ紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            //=========================================================
 
-        //    objJsonResult.code = "1";
-        //    objJsonResult.count = 1;
-        //    objJsonResult.Message = null;
-        //    objJsonResult.data = null;
-        //    return objJsonResult;
-        //}
-        //#endregion
+            objJsonResult.code = "1";
+            objJsonResult.count = 1;
+            objJsonResult.Message = null;
+            objJsonResult.data = null;
+            return objJsonResult;
+        }
+        #endregion
+
 
         #region 鐢熶骇閫�搴撳崟 瀹℃牳/鍙嶅鏍�
         /// <summary>
-        /// 
         /// </summary>
         /// <param name="HInterID">鍗曟嵁ID</param>
         /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
@@ -462,67 +506,58 @@
         /// <returns></returns>
         [Route("Sc_ProductionReturn/AuditSc_ProductionReturn")]
         [HttpGet]
-        public object AuditSc_ProductionReturn(string HInterID, int Type, string user)
+        public object AuditSc_ProductionReturn(int HInterID, int IsAudit, string CurUserName)
         {
+            string ModRightNameCheck = "Kf_ProductionReturnBill_Check";
+            DBUtility.ClsPub.CurUserName = CurUserName;
             try
             {
-                //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Sc_ProductionReturn_Check", 1, false, user))
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愬鏍�!";
+                    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //HInterID鏁版嵁鍒ゆ柇
+                if (HInterID <= 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID灏忎簬0锛�";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
 
-                if (string.IsNullOrWhiteSpace(HInterID))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "HInterID涓虹┖锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
 
-                ClsPub.CurUserName = user;
-                BillOld.MvarItemKey = "Kf_ICStockBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+                DAL.ClsSc_ProductionReturnBill oBill = new DAL.ClsSc_ProductionReturnBill();                              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
 
-                //Type 1 瀹℃牳  2  鍙嶅鏍�
-                if (Type == 1)
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
                 {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
-                    DataSet ds;
-                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
-                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
-                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    if (oBill.omodel.HCloseMan.Trim() != "")
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
-                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
+                        objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�";
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
-                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    if (oBill.omodel.HDeleteMan.Trim() != "")
                     {
-                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                    {
+                        if (oBill.omodel.HChecker.Trim() != "")
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
@@ -530,42 +565,10 @@
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
-                        //瀹℃牳鍗曟嵁
-                        if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 1;
-                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
                     }
-                }
-                else
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍�
-                    DataSet ds;
-                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
-                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
-                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
                     {
-                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘杩涜鍙嶅鏍革紒";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍙嶅鏍革紒";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        if (oBill.omodel.HChecker.Trim() == "")
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
@@ -573,32 +576,109 @@
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
-                        //鍙嶅鏍稿崟鎹�
-                        if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 1;
-                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
                     }
                 }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
-                oCN.Commit();//鎻愪氦浜嬪姟
 
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎵ц鎴愬姛锛�";
-                objJsonResult.data = null;
-                return objJsonResult; ;
+                //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣�
+                if (IsAudit == 0) //瀹℃牳鎻愪氦
+                {
 
+                    //瀹℃牳鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_Sc_ProductionReturnBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_ProductionReturnBill_BeforeCheckCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //==================================================================================      
+
+                    //瀹℃牳鎻愪氦
+                    if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Sc_ProductionReturnBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳鎴愬姛";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                if (IsAudit == 1) //鍙嶅鏍告彁浜�
+                {
+                    //鍙嶅鏍稿墠鎺у埗=========================================
+                    DataSet ds = oCN.RunProcReturn("Exec h_p_Sc_ProductionReturnBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Sc_ProductionReturnBill_BeforeUnCheckCtrl");
+                    if (ds == null)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + "鍙嶅鏍稿墠鍒ゆ柇澶辫触锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //=========================================================
+
+                    //鍙嶅鏍告彁浜bandonCheck
+                    if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Sc_ProductionReturnBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                return objJsonResult;
             }
             catch (Exception e)
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString();
                 objJsonResult.data = null;
                 return objJsonResult;
             }
@@ -613,7 +693,7 @@
             try
             {
                 //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Sc_ProductionReturn_Close", 1, false, user))
+                if (!DBUtility.ClsPub.Security_Log("Kf_ProductionReturnBill_Close", 1, false, user))
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
@@ -752,8 +832,7 @@
         }
         #endregion
 
-
-        #region 閲囪喘鍏ュ簱鍗� 浣滃簾/鍙嶄綔搴熷姛鑳�
+        #region 鐢熶骇閫�搴撳崟 浣滃簾/鍙嶄綔搴熷姛鑳�
         [Route("Sc_ProductionReturn/DropSc_ProductionReturn")]
         [HttpGet]
         public object DropSc_ProductionReturn(string HInterID, int Type, string user)
@@ -761,7 +840,7 @@
             try
             {
                 //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Sc_ProductionReturn_Delete", 1, false, user))
+                if (!DBUtility.ClsPub.Security_Log("Kf_ProductionReturnBill_Delete", 1, false, user))
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
@@ -882,5 +961,28 @@
             }
         }
         #endregion
+
+
+        #region 鏍规嵁鐗╂枡鍐呯爜鑾峰彇鐗╂枡淇℃伅
+        [Route("Sc_ProductionReturnBill/getMaterialByMaterID")]
+        [HttpGet]
+        public ApiResult<DataTable> getMaterialByMaterID(Int64 HMaterID)
+        {
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
+            string sql = "select a.HItemID HMaterID,a.HNumber HMaterNumber,a.HName HMaterName,a.HMaterRuleType,a.HModel HMaterModel,a.HUnitID, b.HNumber HUnitNumber, b.HName HUnitName" +
+                " from Gy_Material AS a " +
+                " LEFT OUTER JOIN Gy_Unit AS b on a.HUnitID = b.HItemID " +
+                " where a.HItemID =" + HMaterID;
+
+            var dataSet = oCN.RunProcReturn(sql, "Gy_Material");
+
+
+            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
+                return new ApiResult<DataTable> { code = -1, msg = "涓嶅瓨鍦ㄨ鐗╂枡" };
+
+            return new ApiResult<DataTable> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet.Tables[0] };
+        }
+        #endregion
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/Sc_ProcessMangementController.cs b/WebAPI/Controllers/Sc_ProcessMangementController.cs
index a2c22ee..4756625 100644
--- a/WebAPI/Controllers/Sc_ProcessMangementController.cs
+++ b/WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -7562,5 +7562,860 @@
 
         #endregion
 
+        #region 涓嶈壇鍝佽瘎瀹$粨璁哄崟
+
+        #region 涓嶈壇鍝佽瘎瀹$粨璁哄崟 鏂板/缂栬緫      
+        [Route("Sc_ProcessMangement/SaveQC_NoPassProdConclusionBill")]
+        [HttpPost]
+        public object SaveQC_NoPassProdConclusionBill([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(); //瀛愯〃
+            string refSav = sArray[1].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+            string msg4 = sArray[2].ToString();//鐢ㄦ埛鍚�
+
+            DBUtility.ClsPub.CurUserName = msg4;
+
+            string UserName = "";
+            string s = "";
+            ListModels oListModels = new ListModels();
+            try
+            {
+                //缂栬緫鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("QC_NoPassProdConclusionBillMain_Edit", 1, false, msg4))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                // QC_NoPassProdConclusionBill
+                DAL.ClsQC_NoPassProdConclusionBill oBill = new DAL.ClsQC_NoPassProdConclusionBill();
+                List<Model.ClsQC_NoPassProdConclusionBillMain> lsmain = new List<Model.ClsQC_NoPassProdConclusionBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_QC_NoPassProdConclusionBill(msg2);
+                foreach (Model.ClsQC_NoPassProdConclusionBillMain oItem in lsmain)
+                {
+                    if (refSav == "Add")
+                    {
+                        //鍗曟嵁鍙锋槸鍚﹂噸澶�
+                        if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
+                    if (refSav == "Update")
+                    {
+                        if (oBill.ShowBill(oItem.HInterID, ref s) == false)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        //鍒ゆ柇鏄惁鍙紪杈�
+                        if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (oBill.omodel.HBillStatus > 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = s + "锛屼笉鍏佽淇敼";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
+                    UserName = oItem.HMaker;  //鍒跺崟浜�
+                    oItem.HBillType = "7513";
+                    oItem.HBillSubType = "7513";
+
+                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                    oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
+                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+
+                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oBill.omodel = oItem;
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庨獙鏀�
+                bool bResult;
+                if (refSav == "Add")
+                {
+
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else if (refSav == "Update")
+                {
+                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else
+                {
+                    bResult = false;
+                }
+                if (bResult)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 涓嶈壇鍝佽瘎瀹$粨璁哄崟 缂栬緫鍥炴樉鍒楄〃
+
+        [Route("Sc_ProcessMangement/Edit_QC_NoPassProdConclusionBill")]
+        [HttpGet]
+        public object Edit_QC_NoPassProdConclusionBill(string HID)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                string sql = "select * from h_v_QC_NoPassProdConclusionBillMain_Edit where hmainid='" + HID + "'";
+                ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdConclusionBillMain_Edit");
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 涓嶈壇鍝佽瘎瀹$粨璁哄崟 鍒楄〃
+
+        [Route("Sc_ProcessMangement/Get_QC_NoPassProdConclusionBillList")]
+        [HttpGet]
+        public object Get_QC_NoPassProdConclusionBillList(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdConclusionBillMain_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    string sql = "select * from h_v_QC_NoPassProdConclusionBillMainList order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdConclusionBillMainList");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_QC_NoPassProdConclusionBillMainList where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdConclusionBillMainList");
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 涓嶈壇鍝佽瘎瀹$粨璁哄崟 鍒犻櫎
+
+        [Route("Sc_ProcessMangement/DeleteQC_NoPassProdConclusionBill")]
+        [HttpGet]
+        public object DeleteQC_NoPassProdConclusionBill(string HInterID, string user)
+        {
+            try
+            {
+                string s = "";
+                DAL.ClsQC_NoPassProdConclusionBill BillOld = new DAL.ClsQC_NoPassProdConclusionBill();
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdConclusionBillMain_Delete", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (HInterID == null || HInterID.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                //鍒ゆ柇鏄惁鍙垹闄�
+                if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽鍒犻櫎锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                //鍒犻櫎鍓嶆帶鍒�=========================================      
+                string sql1 = "exec h_p_QC_NoPassProdConclusionBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdConclusionBill_BeforeDelCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //==================================================================================  
+
+
+
+                oCN.BeginTran();
+
+                oCN.RunProc("delete from QC_NoPassProdConclusionBillMain where HInterID = " + HInterID);
+                oCN.RunProc("delete from QC_NoPassProdConclusionBillSub where HInterID= " + HInterID);
+
+                //鍒犻櫎鍚庢帶鍒�==================================================================================      
+                string sql2 = "exec h_p_QC_NoPassProdConclusionBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                ds = oCN.RunProcReturn(sql2, "h_p_QC_NoPassProdConclusionBill_AfterDelCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    s = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s;
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    s = ds.Tables[0].Rows[0]["HRemark"].ToString();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + s;
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                //==============================================================================================
+
+                oCN.Commit();
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎鎴愬姛";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 涓嶈壇鍝佽瘎瀹$粨璁哄崟 瀹℃牳/鍙嶅鏍�
+        /// <summary>
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+        /// <param name="CurUserName">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Sc_ProcessMangement/AuditQC_NoPassProdConclusionBill")]
+        [HttpGet]
+        public object AuditQC_NoPassProdConclusionBill(int HInterID, int IsAudit, string CurUserName)
+        {
+            string ModRightNameCheck = "QC_NoPassProdConclusionBillMain_Check";
+            DBUtility.ClsPub.CurUserName = CurUserName;
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //HInterID鏁版嵁鍒ゆ柇
+                if (HInterID <= 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID灏忎簬0锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+                DAL.ClsQC_NoPassProdConclusionBill oBill = new DAL.ClsQC_NoPassProdConclusionBill();               //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+                {
+                    if (oBill.omodel.HCloseMan.Trim() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (oBill.omodel.HDeleteMan.Trim() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                    {
+                        if (oBill.omodel.HChecker.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                    {
+                        if (oBill.omodel.HChecker.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣�
+                if (IsAudit == 0) //瀹℃牳鎻愪氦
+                {
+                    oCN.BeginTran();
+
+                    //璁板綍杩斿洖淇℃伅
+                    string msg = "";
+
+
+                    //瀹℃牳鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_QC_NoPassProdConclusionBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdConclusionBill_BeforeCheckCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        oCN.RollBack();
+                        return objJsonResult;
+                    }
+
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        oCN.RollBack();
+                        return objJsonResult;
+                    }
+                    //==================================================================================      
+
+                    //瀹℃牳鎻愪氦
+                    if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_QC_NoPassProdConclusionBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        oCN.Commit();
+
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳鎴愬姛锛�" + msg;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        oCN.RollBack();
+
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                if (IsAudit == 1) //鍙嶅鏍告彁浜�
+                {
+
+                    //鍙嶅鏍稿墠鎺у埗=========================================        
+                    string sql1 = "exec h_p_QC_NoPassProdConclusionBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdConclusionBill_BeforeUnCheckCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+
+                    }
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //===========================================================          
+
+                    //鍙嶅鏍告彁浜bandonCheck
+                    if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_QC_NoPassProdConclusionBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 涓嶈壇鍝佽瘎瀹$粨璁哄崟 鍏抽棴/鍙嶅叧闂�
+        /// <summary>
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">鍏抽棴(0),鍙嶅叧闂�(1)</param>
+        /// <param name="CurUserName">鍏抽棴浜�</param>
+        /// <returns></returns>
+        [Route("Sc_ProcessMangement/CloseQC_NoPassProdConclusionBill")]
+        [HttpGet]
+        public object CloseQC_NoPassProdConclusionBill(int HInterID, int IsAudit, string CurUserName)
+        {
+            string ModRightNameCheck = "QC_NoPassProdConclusionBillMain_Close";
+            DBUtility.ClsPub.CurUserName = CurUserName;
+            try
+            {
+                //妫�鏌ユ潈闄�
+                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍏抽棴澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //HInterID鏁版嵁鍒ゆ柇
+                if (HInterID <= 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID灏忎簬0锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+                DAL.ClsQC_NoPassProdConclusionBill oBill = new DAL.ClsQC_NoPassProdConclusionBill();             //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+                {
+                    if (oBill.omodel.HDeleteMan.Trim() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (oBill.omodel.HChecker.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (IsAudit == 0)  //鍏抽棴鍒ゆ柇
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅叧闂垽鏂�
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸弽鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                //杩涜闇�瑕佽繘琛岀殑鍏抽棴/鍙嶅叧闂搷浣�
+                if (IsAudit == 0) //鍏抽棴鎻愪氦
+                {
+                    //鍏抽棴鎻愪氦
+                    if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍏抽棴鎴愬姛";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                if (IsAudit == 1) //鍙嶅叧闂彁浜�
+                {
+                    //鍙嶅叧闂彁浜�
+                    if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅叧闂垚鍔�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍏抽棴澶辫触鎴栬�呭弽鍏抽棴澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 涓嶈壇鍝佽瘎瀹$粨璁哄崟  浣滃簾/鍙嶄綔搴�
+        /// <summary>
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">浣滃簾(0),鍙嶄綔搴�(1)</param>
+        /// <param name="CurUserName">浣滃簾浜�</param>
+        /// <returns></returns>
+        [Route("Sc_ProcessMangement/DeleteQC_NoPassProdConclusionBill")]
+        [HttpGet]
+        public object DeleteQC_NoPassProdConclusionBill(int HInterID, int IsAudit, string CurUserName)
+        {
+            string ModRightNameCheck = "QC_NoPassProdConclusionBillMain_Drop";
+            DBUtility.ClsPub.CurUserName = CurUserName;
+            try
+            {
+                //妫�鏌ユ潈闄�
+                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "浣滃簾澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //HInterID鏁版嵁鍒ゆ柇
+                if (HInterID <= 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID灏忎簬0锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+                DAL.ClsQC_NoPassProdConclusionBill oBill = new DAL.ClsQC_NoPassProdConclusionBill();              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+                {
+                    if (oBill.omodel.HChecker.Trim() != "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (IsAudit == 0)  //浣滃簾鍒ゆ柇
+                    {
+                        if (oBill.omodel.HDeleteMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶄綔搴燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶄綔搴熷垽鏂�
+                    {
+                        if (oBill.omodel.HDeleteMan.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈綔搴�!涓嶉渶瑕佸弽浣滃簾锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                //杩涜闇�瑕佽繘琛岀殑浣滃簾/鍙嶄綔搴熸搷浣�
+                if (IsAudit == 0) //浣滃簾鎻愪氦
+                {
+                    //浣滃簾鎻愪氦
+                    if (oBill.Cancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "浣滃簾鎴愬姛";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                if (IsAudit == 1) //鍙嶅叧闂彁浜�
+                {
+                    //鍙嶅叧闂彁浜�
+                    if (oBill.AbandonCancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶄綔搴熸垚鍔�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "浣滃簾澶辫触鎴栬�呭弽浣滃簾澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #endregion
+
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index 18070fc..47dc70b 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -1281,6 +1281,55 @@
                 return objjson;
             }
         }
+
+
+        /// <summary>
+        /// 鑾峰彇鐢熶骇璧勬簮鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        [Route("Web/GetSouceList_Json")]
+        [HttpGet]
+        public object GetSouceList_Json(string HMaterID,string Value, Int64 HOrgID)
+        {
+            sWhere = " and HStopFlag=0 and HUSEORGID =" + HOrgID + "";
+            if (Value != "" && Value != null)
+            {
+                sWhere = sWhere + " and ( HNumber like '%" + Value + "%' or HName like '%" + Value + "%' or HUSEORGID like '%" + HOrgID + "%' ) ";
+            }
+            try
+            {
+                string sql = "EXEC h_p_Gy_SouceViewList " + HMaterID+",'"+ sWhere + "'";
+                ds = oCN.RunProcReturn(sql, "h_p_Gy_SouceViewList");
+
+                if (ds == null || ds.Tables[0].Rows.Count <= 0)
+                {
+                    objjson.code = "0";
+                    objjson.count = 0;
+                    objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo;
+                    objjson.data = null;
+                    return objjson;
+                }
+                else
+                {
+                    objjson.code = "0";
+                    objjson.count = 1;
+                    objjson.Message = "鑾峰彇鎴愬姛!";
+                    objjson.data = ds.Tables[0];
+                    return objjson;
+                }
+            }
+            catch (Exception ex)
+            {
+
+                objjson.code = "0";
+                objjson.count = 0;
+                objjson.Message = "鑾峰彇澶辫触" + ex.ToString();
+                objjson.data = null;
+                return objjson;
+            }
+        }
+
+
         /// <summary>
         /// 鑾峰彇鑱屽憳鍒楄〃
         /// </summary>
diff --git a/WebAPI/DLL/ClsGy_Material_Ctl.cs b/WebAPI/DLL/ClsGy_Material_Ctl.cs
index ea9aa33..af9c685 100644
--- a/WebAPI/DLL/ClsGy_Material_Ctl.cs
+++ b/WebAPI/DLL/ClsGy_Material_Ctl.cs
@@ -27,7 +27,7 @@
                     ",HSubjoin,HSubjoin2,HColor,HVersion,HEngName,HEngModel,HPropertyTypeID,HSPGroupID,HSPID,HMinPickQty,HUSEORGID,HERPItemID" +
                     ",HSALEUNITID,HSALEPRICEUNITID,HBASEUNITID,HSTOREUNITID,HCHECKINCOMING,HCHECKPRODUCT,HPERUNITSTANDHOUR" +
                     ",HSTDLABORPREPARETIME,HSTDMACHINEPREPARETIME,HWidth,HWeight,HColorRemark,HQCSchemeID_Fst,HQCSchemeID_Proc,HQCSchemeID_Patrol" +
-                    ",HMaterRuleType,HColorNo,HPieceMaxQty) " +
+                    ",HMaterRuleType,HColorNo,HPieceMaxQty,HCommonUseFlag,HAvgStockPrice,HFootPrice,HTaxCost,HNoTaxCost) " +
                     " Values('" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() +
                     ", " + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "'" +
                     ",'" + oModel.HModel + "'," + oModel.HUnitID.ToString() + "," + oModel.HMaterClsID.ToString() + "," + oModel.HMaterTypeID.ToString() + "," + oModel.HUnitGroupID.ToString() +
@@ -36,7 +36,7 @@
                     ", " + oModel.HKeepDays.ToString() + "," + oModel.HPlanPrice.ToString() + "," + oModel.HstdPrice.ToString() + "," + oModel.HQtyMin.ToString() + "," + oModel.HQtyMax.ToString() +
                     ",'" + oModel.HSubjoin + "','" + oModel.HSubjoin2 + "','" + oModel.HColor + "','" + oModel.HVersion + "','" + oModel.HEngName + "','" + oModel.HEngModel + "'," + oModel.HPropertyTypeID.ToString() + "," + oModel.HSPGroupID.ToString() + "," + oModel.HSPID.ToString() + "," + oModel.HMinPickQty.ToString() + "," + oModel.HUSEORGID + "," + oModel.HERPItemID + "," + oModel.HSALEUNITID + "," + oModel.HSALEPRICEUNITID + "," + oModel.HBASEUNITID + "," + oModel.HSTOREUNITID + "," + oModel.HCHECKINCOMING + "," + oModel.HCHECKPRODUCT + "," + oModel.HPERUNITSTANDHOUR + "," + oModel.HSTDLABORPREPARETIME + "," + oModel.HSTDMACHINEPREPARETIME + ","+ oModel.HWidth + "," + oModel.HWeight + ",'"+ oModel.HColorRemark + "'," + oModel.HQCSchemeID_Fst + ","
                        + oModel.HQCSchemeID_Proc + "," + oModel.HQCSchemeID_Patrol + "" +
-                       ",'"+ oModel.HMaterRuleType + "','"+ oModel.HColorNo + "','" + oModel.HPieceMaxQty.ToString() + "')", ref DBUtility.ClsPub.sExeReturnInfo);
+                       ",'"+ oModel.HMaterRuleType + "','"+ oModel.HColorNo + "','" + oModel.HPieceMaxQty.ToString() + "','" + oModel.HCommonUseFlag.ToString() + "','" + oModel.HAvgStockPrice.ToString() + "','" + oModel.HFootPrice.ToString() + "','" + oModel.HTaxCost.ToString() + "','" + oModel.HNoTaxCost.ToString() + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                 //淇敼涓婄骇涓洪潪鏈骇浠g爜
                 oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                 oCn.Commit();
@@ -65,14 +65,14 @@
                     ",HWhID,HRoutingID,HBomID,HSecUnitID,HSecUnitRate" +
                     ",HHighStock,HLowStock,HSafeStock,HOrderPrice,HSalePrice" +
                     ",HKeepDays,HPlanPrice,HstdPrice,HQtyMin,HQtyMax" +
-                    ",HSubjoin,HSubjoin2,HColor,HVersion,HEngName,HEngModel,HPropertyTypeID,HSPGroupID,HSPID,HMinPickQty,HCREATEORGID,HUSEORGID,HERPItemID,HBatchManager,HOldMaterNumber,HPieceMaxQty) " +
+                    ",HSubjoin,HSubjoin2,HColor,HVersion,HEngName,HEngModel,HPropertyTypeID,HSPGroupID,HSPID,HMinPickQty,HCREATEORGID,HUSEORGID,HERPItemID,HBatchManager,HOldMaterNumber,HPieceMaxQty,HCommonUseFlag,HAvgStockPrice,HFootPrice,HTaxCost,HNoTaxCost) " +
                     " Values('" + oModel.HItemID + "','" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() +
                     ", " + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "'" +
                     ",'" + oModel.HModel + "'," + oModel.HUnitID.ToString() + "," + oModel.HMaterClsID.ToString() + "," + oModel.HMaterTypeID.ToString() + "," + oModel.HUnitGroupID.ToString() +
                     ", " + oModel.HWhID.ToString() + "," + oModel.HRoutingID.ToString() + "," + oModel.HBomID.ToString() + "," + oModel.HSecUnitID.ToString() + "," + oModel.HSecUnitRate.ToString() +
                     ", " + oModel.HHighStock.ToString() + "," + oModel.HLowStock.ToString() + "," + oModel.HSafeStock.ToString() + "," + oModel.HOrderPrice.ToString() + ",'" + oModel.HSalePrice + "'" +
                     ", " + oModel.HKeepDays.ToString() + "," + oModel.HPlanPrice.ToString() + "," + oModel.HstdPrice.ToString() + "," + oModel.HQtyMin.ToString() + "," + oModel.HQtyMax.ToString() +
-                    ",'" + oModel.HSubjoin + "','" + oModel.HSubjoin2 + "','" + oModel.HColor + "','" + oModel.HVersion + "','" + oModel.HEngName + "','" + oModel.HEngModel + "'," + oModel.HPropertyTypeID.ToString() + "," + oModel.HSPGroupID.ToString() + "," + oModel.HSPID.ToString() + "," + oModel.HMinPickQty.ToString() + "," + oModel.HCREATEORGID + "," + oModel.HUSEORGID + "," + oModel.HERPItemID + "," + oModel.HBatchManager + ",'" + oModel.HOldMaterNumber + "','" + oModel.HPieceMaxQty.ToString() + "')", ref DBUtility.ClsPub.sExeReturnInfo);
+                    ",'" + oModel.HSubjoin + "','" + oModel.HSubjoin2 + "','" + oModel.HColor + "','" + oModel.HVersion + "','" + oModel.HEngName + "','" + oModel.HEngModel + "'," + oModel.HPropertyTypeID.ToString() + "," + oModel.HSPGroupID.ToString() + "," + oModel.HSPID.ToString() + "," + oModel.HMinPickQty.ToString() + "," + oModel.HCREATEORGID + "," + oModel.HUSEORGID + "," + oModel.HERPItemID + "," + oModel.HBatchManager + ",'" + oModel.HOldMaterNumber + "','" + oModel.HPieceMaxQty.ToString() + "','" + oModel.HCommonUseFlag.ToString() + "','" + oModel.HAvgStockPrice.ToString() + "','" + oModel.HFootPrice.ToString() + "','" + oModel.HTaxCost.ToString() + "','" + oModel.HNoTaxCost.ToString() + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                 sql = "set identity_insert gy_material off";
                 oCn.RunProc(sql);
                 //淇敼涓婄骇涓洪潪鏈骇浠g爜
@@ -149,6 +149,11 @@
                     ",HQCSchemeID_Proc= " + oModel.HQCSchemeID_Proc +
                     ",HQCSchemeID_Patrol= " + oModel.HQCSchemeID_Patrol +
                     ",HPieceMaxQty=" + oModel.HPieceMaxQty.ToString() +
+                    ",HCommonUseFlag=" + oModel.HCommonUseFlag.ToString() +
+                    ",HAvgStockPrice=" + oModel.HAvgStockPrice.ToString() +
+                    ",HFootPrice=" + oModel.HFootPrice.ToString() +
+                    ",HTaxCost=" + oModel.HTaxCost.ToString() +
+                    ",HNoTaxCost=" + oModel.HNoTaxCost.ToString() +
                     ",HSTDMACHINEPREPARETIME=" + oModel.HSTDMACHINEPREPARETIME.ToString() + "Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                 //淇敼瀛愰」鐩唬鐮�
                 oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
diff --git a/WebAPI/DLL/ClsOA_ErrMsgBackBill.cs b/WebAPI/DLL/ClsOA_ErrMsgBackBill.cs
index defb729..397b06f 100644
--- a/WebAPI/DLL/ClsOA_ErrMsgBackBill.cs
+++ b/WebAPI/DLL/ClsOA_ErrMsgBackBill.cs
@@ -127,7 +127,7 @@
             try
             {
                 //寰楀埌mainid
-                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                //omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
                 oCn.BeginTran();
                 //涓昏〃
@@ -137,7 +137,7 @@
                 ",HContext,HDeptID,HDescription,HSendMan,HReceiveMan" +
                 ",HCopyMan,HHasten,HLevel,HReTransmitMan,HBillTypeName"+
                 ",HPlanBillNo,HMaterName,HMaterModel,HQty,HSendType"+
-                ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRecDeptID,HMaterNumber" +
+                ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRecDeptID,HMaterNumber,HErrMsgBackTypeID" +
                 ") " +
                 " values('" + this.BillType + "','"  + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
                 "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
@@ -145,7 +145,7 @@
                 ",'" + omodel.HCopyMan + "'," + omodel.HHasten.ToString() + ",'" + omodel.HLevel + "','" + omodel.HReTransmitMan + "','" + omodel.HBillTypeName + "'" +
                 ",'" + omodel.HPlanBillNo + "','" + omodel.HMaterName + "','" + omodel.HMaterModel + "'," + omodel.HQty.ToString() + ",'" + omodel.HSendType + "'" +
                 ",'" + omodel.HMainSourceInterID + "','" + omodel.HMainSourceEntryID + "','" + omodel.HMainSourceBillNo + "','" + omodel.HMainSourceBillType + "'" +
-                "," + omodel.HRecDeptID + ",'" + omodel.HMaterNumber + "'" +
+                "," + omodel.HRecDeptID + ",'" + omodel.HMaterNumber + "'," + omodel.HErrMsgBackTypeID +
                 ") ");
                 //鎻掑叆瀛愯〃
                 //foreach (Models.ClsOA_ErrMsgBackBillSub oSub in DetailColl)
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index e6eaaf1..fbcfa0c 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -431,6 +431,18 @@
         }
 
         /// <summary>
+        /// 澶勭悊鏂板涓嶈壇鍝佽瘎瀹$粨璁哄崟琛ㄧ殑json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsQC_NoPassProdConclusionBillMain> getObjectByJson_QC_NoPassProdConclusionBill(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsQC_NoPassProdConclusionBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_NoPassProdConclusionBillMain>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
         /// 澶勭悊鏂板閮ㄩ棬鍩虹璧勬枡鐨凧SON
         /// </summary>
         /// <param name="jsonString"></param>
diff --git a/WebAPI/Models/ClsGy_Material_Model.cs b/WebAPI/Models/ClsGy_Material_Model.cs
index cb772e8..ad2b096 100644
--- a/WebAPI/Models/ClsGy_Material_Model.cs
+++ b/WebAPI/Models/ClsGy_Material_Model.cs
@@ -65,5 +65,15 @@
         public string HColorNo;//棰滆壊鑹插彿
         public double HPieceMaxQty; //鍗曚欢鏈�澶т笂闄�
 
+        public int HCommonUseFlag; // 鏄惁涓嶅父鐢ㄦ潗鏂�
+
+        public double HAvgStockPrice; // 鍔犳潈骞冲潎浠�
+
+        public double HFootPrice; // 缁撶畻浠�
+
+        public double HTaxCost; // 鍚◣鎴愭湰浠�
+
+        public double HNoTaxCost; // 涓嶅惈绋庢垚鏈环
+
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Models/ClsKf_ICStockBillMain.cs b/WebAPI/Models/ClsKf_ICStockBillMain.cs
index 6be84a8..ef8cdda 100644
--- a/WebAPI/Models/ClsKf_ICStockBillMain.cs
+++ b/WebAPI/Models/ClsKf_ICStockBillMain.cs
@@ -13,6 +13,7 @@
         public Int64 HManagerID;        //          int    	        --负责人(主管)
         public Int64 HSecManagerID;     //  		int   	        --验收
         public Int64 HKeeperID;         //  		int	            --保管员
+        public Int64 HProjectID;         //  		int	            --项目
         public Int64 HDeptID;           //			int         	--部门
         public Int64 HCurID;            //			int	            --币别( 界面上不需要显示,存0进去)
         public string HExplanation;     //		    varchar(200)	--摘要
@@ -49,6 +50,7 @@
         public string HOWNERTYPEID;     //		    varchar(100)	--货主类型
         public Int64 HOrgID; 
         public string HStockStyle;      //		    varchar(100)	--库存类型
+        public string HInvoiceBillNo;      //		    varchar(100)	--发票编号 
                                         //源单信息
         public string HSourceBillNo;
         public string HSourceBillType;
diff --git a/WebAPI/Models/ClsKf_ICStockBillSub.cs b/WebAPI/Models/ClsKf_ICStockBillSub.cs
index 70b14a0..5f5b621 100644
--- a/WebAPI/Models/ClsKf_ICStockBillSub.cs
+++ b/WebAPI/Models/ClsKf_ICStockBillSub.cs
@@ -74,6 +74,7 @@
         public Int64 HSourceInterID;
         public Int64 HSourceEntryID;
         public Int64 HAuxPropID;
+        public Int64 HlineTotal;
 
         public object HContainerNum { get; internal set; }
         public object HPVC { get; internal set; }
diff --git a/WebAPI/Models/ClsOA_ErrMsgBackBillMain.cs b/WebAPI/Models/ClsOA_ErrMsgBackBillMain.cs
index cb3b1a2..885dea0 100644
--- a/WebAPI/Models/ClsOA_ErrMsgBackBillMain.cs
+++ b/WebAPI/Models/ClsOA_ErrMsgBackBillMain.cs
@@ -25,5 +25,7 @@
 
         public string HMaterNumber;//	varchar(100)	物料编码      
         public Int64 HRecDeptID;//     int      --接收部门
+
+        public Int64 HErrMsgBackTypeID; //异常类型
     }
 }
diff --git a/WebAPI/Models/Gy_User.cs b/WebAPI/Models/Gy_User.cs
index aea038d..3c303a3 100644
--- a/WebAPI/Models/Gy_User.cs
+++ b/WebAPI/Models/Gy_User.cs
@@ -34,5 +34,6 @@
         public int HProcID;
         public int HGroupID;
         public int HSourceID;
+        public int HCheckEmpID;
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Web.config b/WebAPI/Web.config
index 674d84e..0eb305a 100644
--- a/WebAPI/Web.config
+++ b/WebAPI/Web.config
@@ -22,7 +22,7 @@
 		<!--<add key="FileIP" value="http://localhost:8082/LuBaoAPI"/>-->
 		<!--<add key="FileIP" value="http://localhost:8080/" />-->
 		<!--<add key="sUrl" value="http://183.129.128.86:9090/WEBS-WMSTest/WebService1.asmx"/>    -->
-		<add key="sUrl" value="http://192.168.63.53/WEBS-WMS/WebService1.asmx"/>   <!--棰滃彴寮忔満-->
+		<!--add key="sUrl" value="http://192.168.63.53/WEBS-WMS/WebService1.asmx"/>   棰滃彴寮忔満-->
 		<!--<add key="sUrl" value="http://60.190.4.42:9003/WebService/WebService1.asmx" /> 澶忓疂-->
 		<!--<add key="sUrl" value="http://60.190.4.42:9003/WebService/WebService1.asmx" /> -->
 		<!--<add key="sUrl" value="http://10.10.130.181/WEBS-WMS/WebService1.asmx"/>    鍗氭棩绉戞妧-->
@@ -34,7 +34,7 @@
 		<!--<add key="sUrl" value="http://192.168.80.90:9090/WEBS-WMS/WebService1.asmx"/>     瀹夌憺鏈嶅姟鍣�-->
 		<!--<add key="sUrl" value="http://47.96.97.237/WEBS-WMS/WebService1.asmx"/> -->	<!--娴嬭瘯鏈嶅姟鍣�-->
 		<!--<add key="sUrl" value="http://localhost:8082/WEBS/WebService1.asmx"/>    鏈湴-->
-		<!--<add key="sUrl" value="http://192.168.110.57:81/WEBS/WebService1.asmx"/>	闄堥洴闈欐湰鍦伴厤缃�-->
+		<add key="sUrl" value="http://192.168.110.57:81/WEBS/WebService1.asmx"/>	<!--闄堥洴闈欐湰鍦伴厤缃�-->
 		<!--<add key="sUrl" value="http://192.168.1.57:8082/WEBS-WMS/WebService1.asmx"/>涔濊彵-->
 
 		<add key="webpages:Version" value="3.0.0.0" />

--
Gitblit v1.9.1