From 222d269713f3c15fc8aefa7dbc419ce4ed8ba612 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期二, 05 三月 2024 09:35:54 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/XSGL/YS_ReceiveBillController.cs           |   45 
 DAL/ClsPM_ProjectBeginBillMain.cs                             |  291 +
 Model/计划管理/ClsGy_MaterialTechParamBillMain.cs                 |   19 
 WebAPI/WebAPI.csproj.user                                     |    2 
 DAL/ClsPM_ProjectMoneyBillMain.cs                             |   12 
 Model/仓库管理/ClsKf_MoveStockStepInBillScheme.cs                 |   30 
 WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs           |   54 
 WebAPI/Controllers/WebAPIController.cs                        |    4 
 WebAPI/Controllers/工资管理/Pay_OutApplyBillController.cs         | 1040 +++--
 WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs        |   80 
 WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs           |  216 +
 WebAPI/ListModels.cs                                          |   98 
 DAL/ClsGy_MaterialMouldBillMain.cs                            |  280 +
 WebAPI/Controllers/BaseSet/Gy_CustomerController.cs           |   34 
 Model/项目管理/ClsGy_MaterialMouldBillMain.cs                     |   17 
 DAL/DAL.csproj                                                |    4 
 Model/项目管理/ClsPM_ProjectBeginBillMain.cs                      |   29 
 Model/销售管理/ClsXs_SeOrderBillMain.cs                           |    1 
 WebAPI/WebAPI.csproj                                          |    4 
 Model/计划管理/ClsGy_MaterialTechParamBillSub.cs                  |   16 
 WebAPI/Web References/WebS/WebService1.wsdl                   |    2 
 WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user   |  122 
 WebAPI/Controllers/条码管理/WEBSController.cs                     |  181 +
 DAL/应收管理/ClsYS_ReceiveOtherBill.cs                            |   60 
 WebAPI/Controllers/XSGL/Xs_CusBalanceReportController.cs      |  149 
 Model/Model.csproj                                            |   12 
 Model/仓库管理/ClsKf_MoveStockStepOutBillScheme.cs                |   30 
 Model/应收管理/ClsYS_ReceiveOtherBillMain.cs                      |   13 
 WebAPI/Controllers/LMESController.cs                          |   24 
 Model/仓库管理/ClsKf_MoveStockStepInBillSub.cs                    |   30 
 DAL/计划管理/ClsGy_MaterialTechParamBillMain.cs                   |  284 +
 WebAPI/Web References/WebS/Reference.cs                       |   24 
 WebAPI/Web.config                                             |    4 
 WebAPI/Controllers/JHGL/Gy_MaterialTechParamBillController.cs |  536 +++
 DAL/销售管理/ClsXs_SeOrderBill.cs                                 |    5 
 WebAPI/Controllers/项目管理/工程项目/PM_ProjectBillController.cs      | 1294 +++++++
 Model/仓库管理/ClsKf_MoveStockStepOutBillMain.cs                  |    3 
 WebAPI/Controllers/工资管理/Pay_OverApplyBillController.cs        | 1037 +++--
 DBUtility/业务单据/ClsXt_BaseBill.cs                              |   79 
 WebAPI/Controllers/SCGL/Sc_ICMOChangeBillController.cs        |    6 
 Model/项目管理/ClsPM_ProjectEndBillSub.cs                         |   11 
 Model/ClsGy_MaterialMouldBillSub.cs                           |   14 
 Model/仓库管理/ClsKf_MoveStockStepInBillMain.cs                   |   24 
 WebAPI/Controllers/MJGL/Sc_MouldinventoryBillController.cs    |  536 +++
 Model/仓库管理/ClsKf_MoveStockBillMain.cs                         |    2 
 DAL/ClsPM_ProjectEndBillMain.cs                               |  293 +
 Model/项目管理/ClsPM_ProjectEndBillMain.cs                        |   29 
 WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs      |  907 +++++
 WebAPI/Controllers/工资管理/Pay_PayMentBillController.cs          | 1039 +++--
 Model/项目管理/ClsPM_ProjectBeginBillSub.cs                       |   11 
 WebAPI/Controllers/工资管理/Pay_DuSubsidyItemBillController.cs    | 1067 +++--
 51 files changed, 8,099 insertions(+), 2,005 deletions(-)

diff --git a/DAL/ClsGy_MaterialMouldBillMain.cs b/DAL/ClsGy_MaterialMouldBillMain.cs
new file mode 100644
index 0000000..0e61617
--- /dev/null
+++ b/DAL/ClsGy_MaterialMouldBillMain.cs
@@ -0,0 +1,280 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data;
+
+namespace DAL
+{
+    public  class ClsGy_MaterialMouldBillMain : DBUtility.ClsXt_BaseBill
+    {
+        public Model.ClsGy_MaterialMouldBillMain omodel = new Model.ClsGy_MaterialMouldBillMain();
+        public List<Model.ClsGy_MaterialMouldBillSub> DetailColl = new List<Model.ClsGy_MaterialMouldBillSub>();
+
+        public ClsGy_MaterialMouldBillMain()
+        {
+            base.MvarItemKeySub = "Gy_MaterialMouldBillSub";
+            base.MvarItemKeySub2 = "";
+            base.MvarItemKeySub3 = "";
+            base.MvarItemKeySub4 = "";
+            base.MvarItemKey= "Gy_MaterialMouldBillMain";
+            base.MvarReportTitle="浜у搧鍣ㄥ叿娓呭崟";
+            base.BillType="3333";
+            base.HBillSubType = "3333";
+
+        }
+
+        #region 鍥哄畾浠g爜
+        #region 鏃犲弬鏋勯�犲嚱鏁�
+        ~ClsGy_MaterialMouldBillMain()
+        {
+            DetailColl = null;
+        }
+        #endregion
+        #endregion
+
+        //#region 淇敼鍗曟嵁
+        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                oCn.BeginTran();
+                //鏇存柊涓昏〃
+                string mainSql = "update Gy_MaterialMouldBillMain set " +
+                    " HBillNo = '" + omodel.HBillNo +
+                    "', HDate = '" + omodel.HDate +
+                    "', HRemark = '" + omodel.HRemark +
+                    "', HUpDater = '" + omodel.HUpDater +
+                    "', HUpDateDate = getdate()" +
+                     //===============================================================
+                    
+                     ", HDeptID = '" + omodel.HDeptID +
+                    "', HEmpID = '" + omodel.HEmpID +
+                    "', HMaterID = '" + omodel.HMaterID +
+                    "', HWorkCenterID = '" + omodel.HWorkCenterID +
+                    "', HEquipID  = '" + omodel.HEquipID +
+                    "', HOrgID	  = '" + omodel.HOrgID +
+                    "' where HInterID = " + omodel.HInterID;
+
+                oCn.RunProc(mainSql);
+                //鍒犻櫎鍏宠仈
+                DeleteRelation(ref sReturn, lngBillKey);
+                //鍒犻櫎瀛愯〃
+                DeleteBillSub(lngBillKey);
+
+                //鎻掑叆瀛愯〃
+                omodel.HInterID = lngBillKey;
+                foreach (Model.ClsGy_MaterialMouldBillSub oSub in DetailColl)
+                {
+                    string subSql = "insert into Gy_MaterialMouldBillSub" +
+                            "" +
+                            "" +
+                            "" +
+                            "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+                            ",HMouldID,HQty,HMouldQty,HRate) " +
+                            " values(" +
+                            "" + omodel.HInterID.ToString() +
+                            "," + oSub.HEntryID.ToString() +
+                            "," + oSub.HSourceInterID +
+                            "," + oSub.HSourceEntryID +
+                            ",'" + oSub.HSourceBillNo +
+                            "','" + oSub.HSourceBillType +
+                            "','" + oSub.HMouldID +
+                            "'," + oSub.HQty +
+                            "," + oSub.HMouldQty +
+                            ",'" + oSub.HRate +
+                            "')";
+                    oCn.RunProc(subSql);
+                }
+
+                sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        //#endregion
+
+        #region  鏂板鍗曟嵁
+        public override bool AddBill(ref string sReturn)
+        {
+            try
+            {
+                DataSet ds;
+
+
+                oCn.BeginTran();
+
+                //妫�鏌ヤ富琛ㄥ唴鐮佹槸鍚﹂噸澶嶏紝鑻ラ噸澶嶅垯閲嶆柊鐢熸垚骞剁户缁鏌ワ紝鐩村埌涓嶅啀閲嶅
+                while (true)
+                {
+                    ds = oCn.RunProcReturn("select * from Gy_MaterialMouldBillMain where HInterID = " + omodel.HInterID, "Gy_MaterialMouldBillMain");
+                    if(ds!=null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                    }
+                    else
+                    {
+                        break;
+                    }
+                }
+
+                //鎻掑叆涓昏〃
+                string mainSql = "insert into Gy_MaterialMouldBillMain" +
+                    "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HRemark,HMaker,HMakeDate" +
+                    ",HDeptID,HEmpID,HMaterID,HWorkCenterID,HEquipID,HOrgID ) " +
+                    "values(" +
+                    "" + omodel.HYear.ToString() +
+                    "," + omodel.HPeriod.ToString() +
+                    ",'" + this.BillType +
+                    "','" + this.HBillSubType +
+                    "'," + omodel.HInterID +
+                    ",'" + omodel.HDate +
+                    "','" + omodel.HBillNo +
+                    "','" + omodel.HRemark +
+                    "','" + omodel.HMaker +
+                    "','" + omodel.HMakeDate +
+                    "'," + omodel.HDeptID +
+                    "," + omodel.HEmpID +
+                    ",'" + omodel.HMaterID +
+                    "','" + omodel.HWorkCenterID +
+                    "','" + omodel.HEquipID +
+                     "','" + omodel.HOrgID +
+                    "')";
+
+                oCn.RunProc(mainSql);
+
+                //鎻掑叆瀛愯〃
+                foreach (Model.ClsGy_MaterialMouldBillSub oSub in DetailColl)
+                {
+                    string subSql = "insert into Gy_MaterialMouldBillSub" +
+                           "" +
+                           "" +
+                           "" +
+                           "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+                           ",HMouldID,HQty,HMouldQty,HRate) " +
+                           " values(" +
+                           "" + omodel.HInterID.ToString() +
+                           "," + oSub.HEntryID.ToString() +
+                           "," + oSub.HSourceInterID +
+                           "," + oSub.HSourceEntryID +
+                           ",'" + oSub.HSourceBillNo +
+                           "','" + oSub.HSourceBillType +
+                           "','" + oSub.HMouldID +
+                           "'," + oSub.HQty +
+                           "," + oSub.HMouldQty +
+                           ",'" + oSub.HRate +
+                           "')";
+                    oCn.RunProc(subSql);
+                }
+                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        #endregion
+
+        #region 鏄剧ず鍗曟嵁
+        //public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
+        //{
+        //    try
+        //    {
+        //        //鏌ヨ涓昏〃
+        //        DataSet Ds ;
+        //        Ds = oCn.RunProcReturn("select * from PM_WorkReportWeekBillMain Where HInterID = " + lngBillKey.ToString(), "PM_WorkReportWeekBillMain");
+        //        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.HOrgID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HOrgID"]);
+        //        omodel.HWeek = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWeek"]);
+        //        omodel.HBeginDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBeginDate"]);
+        //        omodel.HEndDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HEndDate"]);
+        //        omodel.HPlanEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPlanEmpID"]);
+
+        //        //
+                
+        //        //寰幆
+        //        DataSet DsSub ;
+        //        DsSub = oCn.RunProcReturn("select * from PM_WorkTaskWeekBillSub where HInterID = " + lngBillKey.ToString() + "order by HEntryID", "PM_WorkTaskWeekBillSub");
+        //        DetailColl.Clear();//娓呯┖
+        //        for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
+        //        {
+        //            Model.ClsPM_WorkTaskWeekBillSub oSub = new Model.ClsPM_WorkTaskWeekBillSub();
+        //            // 鍥哄畾璧嬪��===============================================
+        //            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.HWeekDay = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWeekDay"]);
+        //            oSub.HSno = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSno"]);
+        //            oSub.HProjectID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProjectID"]);
+        //            oSub.HProjectStageID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProjectStageID"]);
+        //            oSub.HTaskNote = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HTaskNote"]);
+        //            oSub.HPlanTimes = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HPlanTimes"]);
+
+        //            DetailColl.Add(oSub);
+        //        }
+        //        sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�";
+        //        return true;
+        //    }
+        //    catch (Exception e)
+        //    {
+        //        sReturn = e.Message;
+        //        throw (e);
+        //    }
+        //}
+        #endregion
+
+    }
+
+}
diff --git a/DAL/ClsPM_ProjectBeginBillMain.cs b/DAL/ClsPM_ProjectBeginBillMain.cs
new file mode 100644
index 0000000..db1e496
--- /dev/null
+++ b/DAL/ClsPM_ProjectBeginBillMain.cs
@@ -0,0 +1,291 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data;
+
+namespace DAL
+{
+    public class ClsPM_ProjectBeginBillMain : DBUtility.ClsXt_BaseBill
+    {
+
+        public Model.ClsPM_ProjectBeginBillMain omodel = new Model.ClsPM_ProjectBeginBillMain();
+        public List<Model.ClsPM_ProjectBeginBillSub> DetailColl = new List<Model.ClsPM_ProjectBeginBillSub>();
+
+        public ClsPM_ProjectBeginBillMain()
+        {
+            base.MvarItemKeySub = "PM_ProjectBeginBillSub";
+            base.MvarItemKeySub2 = "";
+            base.MvarItemKeySub3 = "";
+            base.MvarItemKeySub4 = "";
+            base.MvarItemKey = "PM_ProjectBeginBillMain";
+            base.MvarReportTitle = "椤圭洰鍚姩鍗�";
+            base.BillType = "4760";
+            base.HBillSubType = "4760";
+
+        }
+
+        #region 鍥哄畾浠g爜
+        #region 鏃犲弬鏋勯�犲嚱鏁�
+        ~ClsPM_ProjectBeginBillMain()
+        {
+            DetailColl = null;
+        }
+        #endregion
+        #endregion
+
+        //#region 淇敼鍗曟嵁
+        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                
+                oCn.BeginTran();
+                //鏇存柊涓昏〃
+                string mainSql = "update PM_ProjectBeginBillMain set " +
+                    " HBillNo = '" + omodel.HBillNo +
+                     "', HRemark  = '" + omodel.HRemark +
+                     "', HProjectID  = '" + omodel.HProjectID +
+                    "', HProNumber   = '" + omodel.HProNumber +
+                    "', HProName  = '" + omodel.HProName +
+                    "', HCusID  = '" + omodel.HCusID +
+                     "', HPMTeamID  = '" + omodel.HPMTeamID +
+                    "', HPMEmpID = '" + omodel.HPMEmpID +
+                    "', HWorkEmpID  = '" + omodel.HWorkEmpID +
+                     "', HManagerID  = '" + omodel.HManagerID +
+                    "', HOrgID  ='" + omodel.HOrgID +
+                     "', HNote  ='" + omodel.HNote +
+                     "', HPlanBeginDate ='" + omodel.HPlanBeginDate +
+                     "', HPlanEndDate  ='" + omodel.HPlanEndDate +
+                     "', HSumMoney  ='" + omodel.HSumMoney +
+                     "', HProType  ='" + omodel.HProType +
+                     "', HMoney  ='" + omodel.HMoney +
+                     "', HConWorkDays  ='" + omodel.HConWorkDays +
+                     "', HUpDater = '" + omodel.HUpDater +
+                    "', HUpDateDate = getdate()" +
+                    //===============================================================
+
+                    " where HInterID = " + omodel.HInterID;
+                oCn.RunProc(mainSql);
+                //鍒犻櫎鍏宠仈
+                DeleteRelation(ref sReturn, lngBillKey);
+                //鍒犻櫎瀛愯〃
+                DeleteBillSub(lngBillKey);
+
+                ////鎻掑叆瀛愯〃
+                //omodel.HInterID = lngBillKey;
+                //foreach (Model.ClsPM_ProjectMoneyBillSub oSub in DetailColl)
+                //{
+                //    string subSql = "insert into PM_ProjectMoneyBillSub " +
+                //        "" +
+                //        "" +
+                //        "" +
+                //        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+                //        ",HProMoneyID,HQty,HPrice,HMoney) " +
+                //        " values(" +
+                //        "" + omodel.HInterID.ToString() +
+                //        "," + oSub.HEntryID.ToString() +
+                //        "," + oSub.HSourceInterID +
+                //        "," + oSub.HSourceEntryID +
+                //        ",'" + oSub.HSourceBillNo +
+                //        "','" + oSub.HSourceBillType +
+                //        "','" + oSub.HProMoneyID +
+                //        "'," + oSub.HQty +
+                //        "," + oSub.HPrice +
+                //        ",'" + oSub.HMoney +
+                //        "')";
+                //    oCn.RunProc(subSql);
+                //}
+
+
+                sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        //#endregion
+
+        #region  鏂板鍗曟嵁
+        public override bool AddBill(ref string sReturn)
+        {
+            try
+            {
+                DataSet ds;
+
+
+                oCn.BeginTran();
+
+                //妫�鏌ヤ富琛ㄥ唴鐮佹槸鍚﹂噸澶嶏紝鑻ラ噸澶嶅垯閲嶆柊鐢熸垚骞剁户缁鏌ワ紝鐩村埌涓嶅啀閲嶅
+                while (true)
+                {
+                    ds = oCn.RunProcReturn("select * from PM_ProjectBeginBillMain where HInterID = " + omodel.HInterID, "PM_ProjectBeginBillMain");
+                    if (ds != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                    }
+                    else
+                    {
+                        break;
+                    }
+                }
+                
+                //鎻掑叆涓昏〃
+                string mainSql = "insert into PM_ProjectBeginBillMain" +
+                    "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HRemark,HMaker,HMakeDate" +
+                    ",HProjectID,HProNumber,HProName,HCusID,HPMTeamID,HPMEmpID,HWorkEmpID,HManagerID,HOrgID,HNote,HPlanBeginDate,HPlanEndDate,HSumMoney,HProType,HMoney,HConWorkDays) " +
+                    "values(" +
+                    "" + (omodel.HYear.ToString() != "0" ? omodel.HYear.ToString() : DateTime.Now.Year.ToString()) +
+                    "," + omodel.HPeriod.ToString() +
+                    ",'" + this.BillType +
+                    "','" + this.HBillSubType +
+                    "'," + omodel.HInterID +
+                    ",'" + omodel.HDate +
+                    "','" + omodel.HBillNo +
+                    "','" + omodel.HRemark +
+                    "','" + omodel.HMaker +
+                    "','" + omodel.HMakeDate +
+                    "','" + omodel.HProjectID +
+                    "','" + omodel.HProNumber +
+                    "','" + omodel.HProName +
+                    "','" + omodel.HCusID +
+                    "','" + omodel.HPMTeamID +
+                    "','" + omodel.HPMEmpID +
+                    "','" + omodel.HWorkEmpID +
+                    "','" + omodel.HManagerID +
+                    "','" + omodel.HOrgID +
+                    "','" + omodel.HNote +
+                    "','" + omodel.HPlanBeginDate +
+                    "','" + omodel.HPlanEndDate +
+                    "','" + omodel.HSumMoney +
+                    "','" + omodel.HProType +
+                    "','" + omodel.HMoney +
+                     "','" + omodel.HConWorkDays +
+                    "')";
+
+                oCn.RunProc(mainSql);
+
+                //鎻掑叆瀛愯〃
+                //foreach (Model.ClsPM_ProjectMoneyBillSub oSub in DetailColl)
+                //{
+                //    string subSql = "insert into PM_ProjectMoneyBillSub " +
+                //        "" +
+                //        "" +
+                //        "" +
+                //        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+                //        ",HProMoneyID,HQty,HPrice,HMoney) " +
+                //        " values(" +
+                //        "" + omodel.HInterID.ToString() +
+                //        "," + oSub.HEntryID.ToString() +
+                //        "," + oSub.HSourceInterID +
+                //        "," + oSub.HSourceEntryID +
+                //        ",'" + oSub.HSourceBillNo +
+                //        "','" + oSub.HSourceBillType +
+                //        "','" + oSub.HProMoneyID +
+                //        "'," + oSub.HQty +
+                //        "," + oSub.HPrice +
+                //        ",'" + oSub.HMoney +
+                //        "')";
+                //    oCn.RunProc(subSql);
+                //}
+
+                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        #endregion
+
+        #region 鏄剧ず鍗曟嵁
+        public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //鏌ヨ涓昏〃
+                DataSet Ds;
+                Ds = oCn.RunProcReturn("select * from PM_ProjectBeginBillMain Where HInterID = " + lngBillKey.ToString(), "PM_ProjectBeginBillMain");
+                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();
+                //========================================================
+
+                //
+
+                //寰幆
+                DataSet DsSub;
+                DsSub = oCn.RunProcReturn("select * from PM_ProjectBeginBillSub where HInterID = " + lngBillKey.ToString() + "order by HEntryID", "PM_ProjectBeginBillSub");
+                DetailColl.Clear();//娓呯┖
+                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
+                {
+                    Model.ClsPM_ProjectBeginBillSub oSub = new Model.ClsPM_ProjectBeginBillSub();
+                    // 鍥哄畾璧嬪��===============================================
+                    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();
+                    //===================================================
+                   
+
+                    DetailColl.Add(oSub);
+                }
+                sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+        }
+        #endregion
+
+    }
+
+}
diff --git a/DAL/ClsPM_ProjectEndBillMain.cs b/DAL/ClsPM_ProjectEndBillMain.cs
new file mode 100644
index 0000000..989c8a5
--- /dev/null
+++ b/DAL/ClsPM_ProjectEndBillMain.cs
@@ -0,0 +1,293 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data;
+
+namespace DAL
+{
+    public class ClsPM_ProjectEndBillMain : DBUtility.ClsXt_BaseBill
+    {
+
+        public Model.ClsPM_ProjectEndBillMain omodel = new Model.ClsPM_ProjectEndBillMain();
+        public List<Model.ClsPM_ProjectEndBillSub> DetailColl = new List<Model.ClsPM_ProjectEndBillSub>();
+
+        public ClsPM_ProjectEndBillMain()
+        {
+            base.MvarItemKeySub = "PM_ProjectEndBillSub";
+            base.MvarItemKeySub2 = "";
+            base.MvarItemKeySub3 = "";
+            base.MvarItemKeySub4 = "";
+            base.MvarItemKey = "PM_ProjectEndBillMain";
+            base.MvarReportTitle = "椤圭洰楠屾敹鍗�";
+            base.BillType = "4761";
+            base.HBillSubType = "4761";
+
+        }
+
+        #region 鍥哄畾浠g爜
+        #region 鏃犲弬鏋勯�犲嚱鏁�
+        ~ClsPM_ProjectEndBillMain()
+        {
+            DetailColl = null;
+        }
+        #endregion
+        #endregion
+
+        //#region 淇敼鍗曟嵁
+        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                
+                oCn.BeginTran();
+                //鏇存柊涓昏〃
+                string mainSql = "update PM_ProjectEndBillMain set " +
+                    " HBillNo = '" + omodel.HBillNo +
+                     "', HRemark  = '" + omodel.HRemark +
+                     "', HProjectID  = '" + omodel.HProjectID +
+                    "', HProNumber   = '" + omodel.HProNumber +
+                    "', HProName  = '" + omodel.HProName +
+                    "', HCusID  = '" + omodel.HCusID +
+                     "', HPMTeamID  = '" + omodel.HPMTeamID +
+                    "', HPMEmpID = '" + omodel.HPMEmpID +
+                    "', HWorkEmpID  = '" + omodel.HWorkEmpID +
+                     "', HManagerID  = '" + omodel.HManagerID +
+                    "', HOrgID  ='" + omodel.HOrgID +
+                     "', HNote  ='" + omodel.HNote +
+                     "', HTestNote ='" + omodel.HTestNote +
+                     "', HTestDate  ='" + omodel.HTestDate +
+                     "', HTestEmp  ='" + omodel.HTestEmp +
+                     "', HRunBeginDate  ='" + omodel.HRunBeginDate +
+                     "', HEndDate  ='" + omodel.HEndDate +
+                     "', HConWorkDays  ='" + omodel.HConWorkDays +
+                     "', HUpDater = '" + omodel.HUpDater +
+                    "', HUpDateDate = getdate()" +
+                    //===============================================================
+
+                    " where HInterID = " + omodel.HInterID;
+                oCn.RunProc(mainSql);
+                //鍒犻櫎鍏宠仈
+                DeleteRelation(ref sReturn, lngBillKey);
+                //鍒犻櫎瀛愯〃
+                DeleteBillSub(lngBillKey);
+
+                ////鎻掑叆瀛愯〃
+                //omodel.HInterID = lngBillKey;
+                //foreach (Model.ClsPM_ProjectMoneyBillSub oSub in DetailColl)
+                //{
+                //    string subSql = "insert into PM_ProjectMoneyBillSub " +
+                //        "" +
+                //        "" +
+                //        "" +
+                //        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+                //        ",HProMoneyID,HQty,HPrice,HMoney) " +
+                //        " values(" +
+                //        "" + omodel.HInterID.ToString() +
+                //        "," + oSub.HEntryID.ToString() +
+                //        "," + oSub.HSourceInterID +
+                //        "," + oSub.HSourceEntryID +
+                //        ",'" + oSub.HSourceBillNo +
+                //        "','" + oSub.HSourceBillType +
+                //        "','" + oSub.HProMoneyID +
+                //        "'," + oSub.HQty +
+                //        "," + oSub.HPrice +
+                //        ",'" + oSub.HMoney +
+                //        "')";
+                //    oCn.RunProc(subSql);
+                //}
+
+
+                sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        //#endregion
+
+        #region  鏂板鍗曟嵁
+        public override bool AddBill(ref string sReturn)
+        {
+            try
+            {
+                DataSet ds;
+
+
+                oCn.BeginTran();
+
+                //妫�鏌ヤ富琛ㄥ唴鐮佹槸鍚﹂噸澶嶏紝鑻ラ噸澶嶅垯閲嶆柊鐢熸垚骞剁户缁鏌ワ紝鐩村埌涓嶅啀閲嶅
+                while (true)
+                {
+                    ds = oCn.RunProcReturn("select * from PM_ProjectEndBillMain where HInterID = " + omodel.HInterID, "PM_ProjectEndBillMain");
+                    if (ds != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                    }
+                    else
+                    {
+                        break;
+                    }
+                }
+                
+                //鎻掑叆涓昏〃
+                string mainSql = "insert into PM_ProjectEndBillMain " +
+                    "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HRemark,HMaker,HMakeDate" +
+                    ",HProjectID,HProNumber,HProName,HCusID,HPMTeamID,HPMEmpID,HWorkEmpID,HManagerID,HOrgID,HTestEmp,HNote,HTestNote,HTestDate,HRunBeginDate,HEndDate,HConWorkDays) " +
+                    "values(" +
+                    "" + (omodel.HYear.ToString() != "0" ? omodel.HYear.ToString() : DateTime.Now.Year.ToString()) +
+                    "," + omodel.HPeriod.ToString() +
+                    ",'" + this.BillType +
+                    "','" + this.HBillSubType +
+                    "'," + omodel.HInterID +
+                    ",'" + omodel.HDate +
+                    "','" + omodel.HBillNo +
+                    "','" + omodel.HRemark +
+                    "','" + omodel.HMaker +
+                    "','" + omodel.HMakeDate +
+                    "','" + omodel.HProjectID +
+                    "','" + omodel.HProNumber +
+                    "','" + omodel.HProName +
+                    "','" + omodel.HCusID +
+                    "','" + omodel.HPMTeamID +
+                    "','" + omodel.HPMEmpID +
+                    "','" + omodel.HWorkEmpID +
+                    "','" + omodel.HManagerID +
+                    "','" + omodel.HOrgID +
+                    "','" + omodel.HTestEmp +
+                    "','" + omodel.HNote +
+                    "','" + omodel.HTestNote +
+                    "','" + omodel.HTestDate +
+                    "','" + omodel.HRunBeginDate +
+                    "','" + omodel.HEndDate +
+                     "','" + omodel.HConWorkDays +
+                    "')";
+
+                oCn.RunProc(mainSql);
+
+                //鎻掑叆瀛愯〃
+                //foreach (Model.ClsPM_ProjectMoneyBillSub oSub in DetailColl)
+                //{
+                //    string subSql = "insert into PM_ProjectMoneyBillSub " +
+                //        "" +
+                //        "" +
+                //        "" +
+                //        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+                //        ",HProMoneyID,HQty,HPrice,HMoney) " +
+                //        " values(" +
+                //        "" + omodel.HInterID.ToString() +
+                //        "," + oSub.HEntryID.ToString() +
+                //        "," + oSub.HSourceInterID +
+                //        "," + oSub.HSourceEntryID +
+                //        ",'" + oSub.HSourceBillNo +
+                //        "','" + oSub.HSourceBillType +
+                //        "','" + oSub.HProMoneyID +
+                //        "'," + oSub.HQty +
+                //        "," + oSub.HPrice +
+                //        ",'" + oSub.HMoney +
+                //        "')";
+                //    oCn.RunProc(subSql);
+                //}
+
+                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        #endregion
+
+        #region 鏄剧ず鍗曟嵁
+        public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //鏌ヨ涓昏〃
+                DataSet Ds;
+                Ds = oCn.RunProcReturn("select * from PM_ProjectEndBillMain  Where HInterID = " + lngBillKey.ToString(), "PM_ProjectEndBillMain");
+                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();
+                //========================================================
+
+            
+
+                //
+
+                //寰幆
+                DataSet DsSub;
+                DsSub = oCn.RunProcReturn("select * from PM_ProjectEndBillSub  where HInterID = " + lngBillKey.ToString() + "order by HEntryID", "PM_ProjectEndBillSub ");
+                DetailColl.Clear();//娓呯┖
+                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
+                {
+                    Model.ClsPM_ProjectEndBillSub oSub = new Model.ClsPM_ProjectEndBillSub();
+                    // 鍥哄畾璧嬪��===============================================
+                    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();
+                    //===================================================
+                 
+
+                    DetailColl.Add(oSub);
+                }
+                sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+        }
+        #endregion
+
+    }
+
+}
diff --git a/DAL/ClsPM_ProjectMoneyBillMain.cs b/DAL/ClsPM_ProjectMoneyBillMain.cs
index a91a6c8..af86b4d 100644
--- a/DAL/ClsPM_ProjectMoneyBillMain.cs
+++ b/DAL/ClsPM_ProjectMoneyBillMain.cs
@@ -42,16 +42,16 @@
                 string mainSql = "update PM_ProjectMoneyBillMain set " +
                     " HBillNo = '" + omodel.HBillNo +
                      "', HRemark  = '" + omodel.HRemark + 
-                    "', HProNumber  = '" + omodel.HProNumber +
                      "', HProjectID  = '" + omodel.HProjectID +
-                    "', HProNumber   = " + omodel.HProNumber+
-                    ", HProName  = " + omodel.HProName +
-                    ", HCusID  = '" + omodel.HCusID +
+                    "', HProNumber   = '" + omodel.HProNumber+
+                    "', HProName  = '" + omodel.HProName +
+                    "', HCusID  = '" + omodel.HCusID +
                      "', HPMTeamID  = '" + omodel.HPMTeamID +
                     "', HPMEmpID = '" + omodel.HPMEmpID +
                     "', HWorkEmpID  = '" + omodel.HWorkEmpID +
                      "', HManagerID  = '" + omodel.HManagerID +
                     "', HOrgID  ='" + omodel.HOrgID +
+                    "', HUpDater = '" + omodel.HUpDater +
                     "', HUpDateDate = getdate()" +
                     //===============================================================
 
@@ -142,8 +142,8 @@
                     "','" + omodel.HMakeDate +
                     "','" + omodel.HProjectID +
                     "','" + omodel.HProNumber +
-                    "'," + omodel.HProName+
-                    ",'" + omodel.HCusID+
+                    "','" + omodel.HProName+
+                    "','" + omodel.HCusID+
                     "','" + omodel.HPMTeamID+
                     "','" + omodel.HPMEmpID+
                     "','" + omodel.HWorkEmpID+
diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj
index 179c56c..350aa3b 100644
--- a/DAL/DAL.csproj
+++ b/DAL/DAL.csproj
@@ -80,8 +80,11 @@
     <Compile Include="ClsPay_EarlyLateErrBill.cs" />
     <Compile Include="ClsPay_RewardPunishBill.cs" />
     <Compile Include="ClsPay_WorkErrTimesBill.cs" />
+    <Compile Include="ClsPM_ProjectEndBillMain.cs" />
+    <Compile Include="ClsPM_ProjectBeginBillMain.cs" />
     <Compile Include="ClsPM_ProjectMoneyBillMain.cs" />
     <Compile Include="ClsPM_CustomerTaskBillMain.cs" />
+    <Compile Include="ClsGy_MaterialMouldBillMain.cs" />
     <Compile Include="ClsPM_WorkPlanMonthBillMain.cs" />
     <Compile Include="MES\ClsSc_SourceLineRepairBill.cs" />
     <Compile Include="MES\ClsSc_MESMaterToSourceBill .cs" />
@@ -628,6 +631,7 @@
     <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\璁惧鎶曚骇\ClsSb_EquipWorkBeforeCheckBill.cs" />
     <Compile Include="绯荤粺鍏敤\ClsXt_SystemParameter_Ctl.cs" />
     <Compile Include="绯荤粺鍏敤\ClsXt_BillSubType_Ctl.cs" />
+    <Compile Include="璁″垝绠$悊\ClsGy_MaterialTechParamBillMain.cs" />
     <Compile Include="璐ㄦ绠$悊\ClsQC_FirstPieceCheckBill.cs" />
     <Compile Include="璐ㄦ绠$悊\ClsQC_LastPieceCheckBill.cs" />
     <Compile Include="璐ㄦ绠$悊\ClsQC_NoPassProdCheckBill.cs" />
diff --git "a/DAL/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBill.cs" "b/DAL/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBill.cs"
index 85e60be..36e0d22 100644
--- "a/DAL/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBill.cs"
+++ "b/DAL/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBill.cs"
@@ -54,7 +54,11 @@
                 ",HExRate=" + omodel.HExRate.ToString() +
                 ",HDeptID=" + omodel.HDeptID.ToString() +
                 ",HEmpID=" + omodel.HEmpID.ToString() +
-                ",HSumMoney=" + omodel.HSumMoney.ToString() +
+                ",HProjectMoneyID =" + omodel.HProjectMoneyID.ToString() +
+                ",HType='" + omodel.HType.ToString() + "'" +
+                ",HMoney='" + omodel.HMoney + "'" +
+                ",HTaxRate='" + omodel.HTaxRate + "'" +
+                ",HSumMoney='" + omodel.HSumMoney + "'" +
                 ",HExplanation='" + omodel.HExplanation + "'" +
                 ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
                 " where HInterID=" + lngBillKey.ToString());
@@ -62,30 +66,7 @@
                 DeleteRelation(ref sReturn, lngBillKey);
                 //鍒犻櫎瀛愯〃
                 DeleteBillSub(lngBillKey);
-                //鎻掑叆瀛愯〃
-                omodel.HInterID = lngBillKey;
-                foreach (Model.ClsYS_ReceiveOtherBillSub oSub in DetailColl)
-                {
-                    //oCn.RunProc("Insert into YS_ReceiveOtherBillSub " +
-                    //  " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
-                    //  ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                    //  ") 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() +
-                    //  ") ");
-                }
-                //
-                //foreach (Model.ClsYS_ReceiveOtherBillSub oSub in DetailColl)
-                //{
-                //    Ds = oCn.RunProcReturn("exec h_p_YS_ReceiveOtherBill_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;
@@ -111,37 +92,14 @@
                 "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                 ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                 ",HAccDate,HCusID,HCurID,HExRate" +
-                ",HDeptID,HEmpID,HSumMoney,HExplanation,HInnerBillNo" +
+                ",HDeptID,HEmpID,HProjectMoneyID,HType,HMoney,HTaxRate,HSumMoney,HExplanation,HInnerBillNo,HOrgID" +
                 ") " +
                 " 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.HAccDate.ToShortDateString() + "'," + omodel.HCusID.ToString() + "," + omodel.HCurID.ToString() + "," + omodel.HExRate.ToString() +
-                ", " + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HSumMoney.ToString() + ",'"  + omodel.HExplanation +"','"+ omodel.HInnerBillNo + "'" +
+                ", '" + omodel.HDeptID.ToString() + "','" + omodel.HEmpID.ToString() + "','" + omodel.HProjectMoneyID.ToString() + "','"  + omodel.HType+ "','"+ omodel.HMoney+ "','" + omodel.HTaxRate + "','" + omodel.HSumMoney + "','" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "','" + omodel.HOrgID + "'" +
                 ") ");
-                //鎻掑叆瀛愯〃
-                foreach (Model.ClsYS_ReceiveOtherBillSub oSub in DetailColl)
-                {
-                    //oCn.RunProc("Insert into YS_ReceiveOtherBillSub " +
-                    //  " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
-                    //  ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                    //  ") 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() +
-                    //  ") ");
-                }
-                //
-                //foreach (Model.ClsYS_ReceiveOtherBillSub oSub in DetailColl)
-                //{
-                //    Ds = oCn.RunProcReturn("exec h_p_YS_ReceiveOtherBill_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;
diff --git "a/DAL/\350\256\241\345\210\222\347\256\241\347\220\206/ClsGy_MaterialTechParamBillMain.cs" "b/DAL/\350\256\241\345\210\222\347\256\241\347\220\206/ClsGy_MaterialTechParamBillMain.cs"
new file mode 100644
index 0000000..1fe62dc
--- /dev/null
+++ "b/DAL/\350\256\241\345\210\222\347\256\241\347\220\206/ClsGy_MaterialTechParamBillMain.cs"
@@ -0,0 +1,284 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data;
+
+namespace DAL
+{
+    public  class ClsGy_MaterialTechParamBillMain : DBUtility.ClsXt_BaseBill
+    {
+        public Model.ClsGy_MaterialTechParamBillMain omodel = new Model.ClsGy_MaterialTechParamBillMain();
+        public List<Model.ClsGy_MaterialTechParamBillSub> DetailColl = new List<Model.ClsGy_MaterialTechParamBillSub>();
+
+        public ClsGy_MaterialTechParamBillMain()
+        {
+            base.MvarItemKeySub = "Gy_MaterialTechParamBillSub";
+            base.MvarItemKeySub2 = "";
+            base.MvarItemKeySub3 = "";
+            base.MvarItemKeySub4 = "";
+            base.MvarItemKey= "Gy_MaterialTechParamBillMain";
+            base.MvarReportTitle= "浜у搧宸ヨ壓鍙傛暟娓呭崟";
+            base.BillType="3334";
+            base.HBillSubType = "3334";
+
+        }
+
+        #region 鍥哄畾浠g爜
+        #region 鏃犲弬鏋勯�犲嚱鏁�
+        ~ClsGy_MaterialTechParamBillMain()
+        {
+            DetailColl = null;
+        }
+        #endregion
+        #endregion
+
+        //#region 淇敼鍗曟嵁
+        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                oCn.BeginTran();
+                //鏇存柊涓昏〃
+                string mainSql = "update Gy_MaterialTechParamBillMain set " +
+                    " HBillNo = '" + omodel.HBillNo +
+                    "', HDate = '" + omodel.HDate +
+                    "', HRemark = '" + omodel.HRemark +
+                    "', HUpDater = '" + omodel.HUpDater +
+                    "', HUpDateDate = getdate()" +
+                     //===============================================================
+                    
+                     ", HDeptID = '" + omodel.HDeptID +
+                    "', HEmpID = '" + omodel.HEmpID +
+                    "', HMaterID = '" + omodel.HMaterID +
+                    "', HWorkCenterID = '" + omodel.HWorkCenterID +
+                    "', HProcID  = '" + omodel.HProcID +
+                    "', HEquipID  = '" + omodel.HEquipID +
+                    "', HOrgID	  = '" + omodel.HOrgID +
+                    "' where HInterID = " + omodel.HInterID;
+
+                oCn.RunProc(mainSql);
+                //鍒犻櫎鍏宠仈
+                DeleteRelation(ref sReturn, lngBillKey);
+                //鍒犻櫎瀛愯〃
+                DeleteBillSub(lngBillKey);
+
+                //鎻掑叆瀛愯〃
+                omodel.HInterID = lngBillKey;
+                foreach (Model.ClsGy_MaterialTechParamBillSub oSub in DetailColl)
+                {
+                    string subSql = "insert into Gy_MaterialTechParamBillSub" +
+                            "" +
+                            "" +
+                            "" +
+                            "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+                            ",HTechParamID,HTechParamUnitID,HStd,HMax,HMin) " +
+                            " values(" +
+                            "" + omodel.HInterID.ToString() +
+                            "," + oSub.HEntryID.ToString() +
+                            "," + oSub.HSourceInterID +
+                            "," + oSub.HSourceEntryID +
+                            ",'" + oSub.HSourceBillNo +
+                            "','" + oSub.HSourceBillType +
+                            "','" + oSub.HTechParamID +
+                             "','" + oSub.HTechParamUnitID +
+                            "'," + oSub.HStd +
+                            "," + oSub.HMax +
+                            ",'" + oSub.HMin +
+                            "')";
+                    oCn.RunProc(subSql);
+                }
+
+                sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        //#endregion
+
+        #region  鏂板鍗曟嵁
+        public override bool AddBill(ref string sReturn)
+        {
+            try
+            {
+                DataSet ds;
+
+
+                oCn.BeginTran();
+
+                //妫�鏌ヤ富琛ㄥ唴鐮佹槸鍚﹂噸澶嶏紝鑻ラ噸澶嶅垯閲嶆柊鐢熸垚骞剁户缁鏌ワ紝鐩村埌涓嶅啀閲嶅
+                while (true)
+                {
+                    ds = oCn.RunProcReturn("select * from Gy_MaterialTechParamBillMain where HInterID = " + omodel.HInterID, "Gy_MaterialTechParamBillMain");
+                    if(ds!=null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                    }
+                    else
+                    {
+                        break;
+                    }
+                }
+
+                //鎻掑叆涓昏〃
+                string mainSql = "insert into Gy_MaterialTechParamBillMain" +
+                    "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HRemark,HMaker,HMakeDate" +
+                    ",HDeptID,HEmpID,HMaterID,HWorkCenterID,HEquipID,HOrgID,HProcID ) " +
+                    "values(" +
+                    "" + omodel.HYear.ToString() +
+                    "," + omodel.HPeriod.ToString() +
+                    ",'" + this.BillType +
+                    "','" + this.HBillSubType +
+                    "'," + omodel.HInterID +
+                    ",'" + omodel.HDate +
+                    "','" + omodel.HBillNo +
+                    "','" + omodel.HRemark +
+                    "','" + omodel.HMaker +
+                    "','" + omodel.HMakeDate +
+                    "'," + omodel.HDeptID +
+                    "," + omodel.HEmpID +
+                    ",'" + omodel.HMaterID +
+                    "','" + omodel.HWorkCenterID +
+                    "','" + omodel.HEquipID +
+                    "','" + omodel.HOrgID +
+                     "','" + omodel.HProcID +
+                    "')";
+
+                oCn.RunProc(mainSql);
+
+                //鎻掑叆瀛愯〃
+                foreach (Model.ClsGy_MaterialTechParamBillSub oSub in DetailColl)
+                {
+                    string subSql = "insert into Gy_MaterialTechParamBillSub" +
+                           "" +
+                           "" +
+                           "" +
+                           "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+                           ",HTechParamID,HTechParamUnitID,HStd,HMax,HMin) " +
+                           " values(" +
+                           "" + omodel.HInterID.ToString() +
+                           "," + oSub.HEntryID.ToString() +
+                           "," + oSub.HSourceInterID +
+                           "," + oSub.HSourceEntryID +
+                           ",'" + oSub.HSourceBillNo +
+                           "','" + oSub.HSourceBillType +
+                           "','" + oSub.HTechParamID +
+                            "','" + oSub.HTechParamUnitID +
+                           "'," + oSub.HStd +
+                           "," + oSub.HMax +
+                           ",'" + oSub.HMin +
+                           "')";
+                    oCn.RunProc(subSql);
+                }
+                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        #endregion
+
+        #region 鏄剧ず鍗曟嵁
+        //public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
+        //{
+        //    try
+        //    {
+        //        //鏌ヨ涓昏〃
+        //        DataSet Ds ;
+        //        Ds = oCn.RunProcReturn("select * from PM_WorkReportWeekBillMain Where HInterID = " + lngBillKey.ToString(), "PM_WorkReportWeekBillMain");
+        //        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.HOrgID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HOrgID"]);
+        //        omodel.HWeek = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWeek"]);
+        //        omodel.HBeginDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBeginDate"]);
+        //        omodel.HEndDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HEndDate"]);
+        //        omodel.HPlanEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPlanEmpID"]);
+
+        //        //
+                
+        //        //寰幆
+        //        DataSet DsSub ;
+        //        DsSub = oCn.RunProcReturn("select * from PM_WorkTaskWeekBillSub where HInterID = " + lngBillKey.ToString() + "order by HEntryID", "PM_WorkTaskWeekBillSub");
+        //        DetailColl.Clear();//娓呯┖
+        //        for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
+        //        {
+        //            Model.ClsPM_WorkTaskWeekBillSub oSub = new Model.ClsPM_WorkTaskWeekBillSub();
+        //            // 鍥哄畾璧嬪��===============================================
+        //            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.HWeekDay = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWeekDay"]);
+        //            oSub.HSno = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSno"]);
+        //            oSub.HProjectID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProjectID"]);
+        //            oSub.HProjectStageID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProjectStageID"]);
+        //            oSub.HTaskNote = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HTaskNote"]);
+        //            oSub.HPlanTimes = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HPlanTimes"]);
+
+        //            DetailColl.Add(oSub);
+        //        }
+        //        sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�";
+        //        return true;
+        //    }
+        //    catch (Exception e)
+        //    {
+        //        sReturn = e.Message;
+        //        throw (e);
+        //    }
+        //}
+        #endregion
+
+    }
+
+}
diff --git "a/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs" "b/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs"
index 5337995..596454a 100644
--- "a/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs"
+++ "b/DAL/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBill.cs"
@@ -94,6 +94,7 @@
                 ",HEmpID=" + omodel.HEmpID.ToString() +
                 ",HCurID=" + omodel.HCurID.ToString() +
                 ",HExRate=" + omodel.HExRate.ToString() +
+                ",HEarnestRate=" + omodel.HEarnestRate.ToString() +
                 ",HManagerID=" + omodel.HManagerID.ToString() +
                 ",HSellSID=" + omodel.HSellSID.ToString() +
                 ",HSSID=" + omodel.HSSID.ToString() +
@@ -270,7 +271,7 @@
                 //鎻掑叆涓昏〃
                 string mainSql = "Insert Into Xs_SeOrderBillMain" +
                     "(HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HExplanation" +
-                    ",HInterID,HBillNo,HDate,HInnerBillNo,HAddress,HDeptID,HCusID,HEmpID,HCurID,HExRate,HManagerID,HSellSID,HSSID,HSSDate,HPayCusID,HRemark,HOrgID,HMaker,HMakeDate,HLinkMan,HLinkPhone" +
+                    ",HInterID,HBillNo,HDate,HInnerBillNo,HAddress,HDeptID,HCusID,HEmpID,HCurID,HExRate,HEarnestRate,HManagerID,HSellSID,HSSID,HSSDate,HPayCusID,HRemark,HOrgID,HMaker,HMakeDate,HLinkMan,HLinkPhone" +
                     ",HERPInterID,HERPBillType,HSALEORGID,HSALEGROUPID,HRECEIVEID,HSETTLEID,HCHARGEID,HHEADLOCID,HRECCONTACTID,HCORRESPONDORGID,HBUSINESSTYPE) " +
                     "values(" +
                     "" + omodel.HYear +
@@ -290,6 +291,7 @@
                     "," + omodel.HEmpID +
                     "," + omodel.HCurID +
                     "," + omodel.HExRate +
+                    "," + omodel.HEarnestRate +
                     "," + omodel.HManagerID +
                     "," + omodel.HSellSID +
                     "," + omodel.HSSID +
@@ -460,6 +462,7 @@
                 omodel.HCusID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCusID"]);
                 omodel.HCurID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCurID"]);
                 omodel.HExRate = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HExRate"]);
+                omodel.HEarnestRate = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HEarnestRate"]);
                 omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]);
                 omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]);
                 omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]);
diff --git "a/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBill.cs" "b/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBill.cs"
index c98eef1..f21f2eb 100644
--- "a/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBill.cs"
+++ "b/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBill.cs"
@@ -178,6 +178,43 @@
                 throw (e);
             }
         }
+        //琛屽弽鍏抽棴鍗曟嵁(鍖呭惈鍐欏叆鏃ュ織)    2024-01-31
+        public bool CancelRow(Int64 lngBillKey,Int64 HEntryID, string HBillNo, string sUser, ref string sReturn)
+        {
+            try
+            {
+                oCn.BeginTran();
+                string sql = "select * from " + MvarItemKeySub + " where HInterID=" + lngBillKey.ToString() + " and HEntryID = " + HEntryID;
+                DataSet ds = oCn.RunProcReturn(sql, MvarItemKeySub);
+                if(ds==null || ds.Tables[0].Rows.Count == 0)
+                {
+                    sReturn = "琛岃褰曚笉瀛樺湪锛�";
+                    return false;
+                }
+                else
+                {
+                    sql = " Update " + MvarItemKeySub + " set HCloseMan='',HEntryCloseDate='',HCloseType=0 Where HInterID=" + lngBillKey.ToString() + " and HEntryID = " + HEntryID;
+                    oCn.RunProc(sql);
+                }
+
+                //鍐欏叆鏃ュ織
+                string WorkList = "琛屽弽鍏抽棴锛屽崟鎹彿锛�" + HBillNo + "锛涘瓙琛ㄥ唴鐮侊細" + HEntryID;
+                string SystemName = "LMES-" + MvarReportTitle + "妯″潡";
+                oCn.RunProc("Insert into  System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " +
+                    "(getdate(),'" + sUser + "','" + ComputerName + "','" + WorkList + "','" + SystemName + "','" + IPAddress + "','琛屽弽鍏抽棴')"
+                    );
+
+                sReturn = "琛屽弽鍏抽棴鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
         //鍙嶅鏍�
         public bool AbandonCheck(Int64 lngBillKey, ref string sReturn)
         {
@@ -367,7 +404,7 @@
             {
                 string HCloseMan = ClsPub.CurUserName;
                 string HCloseDate = ClsPub.GetServerDate(-1); 
-                oCn.RunProc(" Update " + MvarItemKey + " set HCloseMan='" + HCloseMan + "',HCloseDate='" + HCloseDate + "',HBillStatus=3 Where HInterID=" + lngBillKey.ToString());
+                oCn.RunProc(" Update " + MvarItemKey + " set HCloseMan='" + HCloseMan + "',HCloseDate='" + HCloseDate + "',HBillStatus=3,HCloseType = 1 Where HInterID=" + lngBillKey.ToString());
                 sReturn = "";
                 return true;
             }
@@ -405,6 +442,46 @@
                 throw (e);
             }
         }
+        //琛屽叧闂崟鎹�(鍖呭惈鍐欏叆鏃ュ織)    2024-01-31
+        public bool CloseRow(Int64 lngBillKey,Int64 HEntryID, string HBillNo, string sUser, ref string sReturn)
+        {
+            DataSet ds;
+            try
+            {
+                oCn.BeginTran();
+                string HCloseMan = sUser;
+                string HEntryCloseDate = ClsPub.GetServerDate(-1);
+                //鍙樻洿琛屽叧闂姸鎬�
+                string sql = " Update " + MvarItemKeySub + " set HCloseMan='" + HCloseMan + "',HEntryCloseDate='" + HEntryCloseDate + "',HCloseType=1 Where HInterID=" + lngBillKey.ToString() + " and HEntryID = " + HEntryID;
+                oCn.RunProc(sql);
+
+                //妫�鏌ュ崟鎹瓙琛ㄦ墍鏈夎鏄惁閮藉叧闂紝鑻ラ兘鍏抽棴鍒欒嚜鍔ㄥ叧闂崟鎹�
+                //sql = "select * from " + MvarItemKeySub + " where HInterID=" + lngBillKey + " and HCloseMan=''";
+                //ds = oCn.RunProcReturn(sql, MvarItemKeySub);
+                //if(ds!=null && ds.Tables[0].Rows.Count == 0)
+                //{
+                //    sql = " Update " + MvarItemKey + " set HCloseMan='" + HCloseMan + "',HCloseDate=getdate(),HBillStatus=3,HCloseType = 0 Where HInterID=" + lngBillKey.ToString();
+                //    oCn.RunProc(sql);
+                //}
+
+                //鍐欏叆鏃ュ織
+                string WorkList = "琛屽叧闂紝鍗曟嵁鍙凤細" + HBillNo + "锛涘瓙琛ㄥ唴鐮侊細" + HEntryID;
+                string SystemName = "LMES-" + MvarReportTitle + "妯″潡";
+                oCn.RunProc("Insert into  System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " +
+                    "(getdate(),'" + sUser + "','" + ComputerName + "','" + WorkList + "','" + SystemName + "','" + IPAddress + "','琛屽叧闂�')"
+                    );
+
+                sReturn = "琛屽叧闂垚鍔燂紒";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
         //浣滃簾
         public bool Cancelltion(Int64 lngBillKey, ref string sReturn)
         {
diff --git a/Model/ClsGy_MaterialMouldBillSub.cs b/Model/ClsGy_MaterialMouldBillSub.cs
new file mode 100644
index 0000000..1729267
--- /dev/null
+++ b/Model/ClsGy_MaterialMouldBillSub.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsGy_MaterialMouldBillSub : DBUtility.ClsXt_BaseBillSub
+    {
+        public Int64 HMouldID;
+        public Int64 HMouldQty;
+        public decimal HQty;
+        public decimal HRate;
+    }
+}
diff --git a/Model/Model.csproj b/Model/Model.csproj
index 895c4a7..2dcbb71 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -104,6 +104,7 @@
     <Compile Include="ClsPay_RewardPunishBillSub.cs" />
     <Compile Include="ClsPay_WorkErrTimesBillMain.cs" />
     <Compile Include="ClsPay_WorkErrTimesBillSub.cs" />
+    <Compile Include="ClsGy_MaterialMouldBillSub.cs" />
     <Compile Include="ClsXt_PrintBill_Model.cs" />
     <Compile Include="CRM\ClsCrm_ClueBillMain.cs" />
     <Compile Include="CRM\ClsCrm_ClueBillSub.cs" />
@@ -225,6 +226,9 @@
     <Compile Include="浠撳簱绠$悊\ClsKf_EntrustOutBillMain.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_EntrustOutBillSub.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_EntrustReplenishOutBillMain.cs" />
+    <Compile Include="浠撳簱绠$悊\ClsKf_MoveStockStepInBillMain.cs" />
+    <Compile Include="浠撳簱绠$悊\ClsKf_MoveStockStepInBillScheme.cs" />
+    <Compile Include="浠撳簱绠$悊\ClsKf_MoveStockStepOutBillScheme.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_MateReplenishOutBillMain.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_MateOutBillMain.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_MateOutBillScheme.cs" />
@@ -242,6 +246,7 @@
     <Compile Include="浠撳簱绠$悊\ClsKf_MoveStockStepOutBillMain.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_MoveStockBillMain.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_MoveStockBillScheme.cs" />
+    <Compile Include="浠撳簱绠$悊\ClsKf_MoveStockStepInBillSub.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_MoveStockStepOutBillSub.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_MoveStockBillSub.cs" />
     <Compile Include="浠撳簱绠$悊\ClsKf_OtherInBillMain.cs" />
@@ -605,6 +610,8 @@
     <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipConkBookBillMain.cs" />
     <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipConkBookBillSub.cs" />
     <Compile Include="绯荤粺鍏敤\ClsXt_SystemParameter_Model.cs" />
+    <Compile Include="璁″垝绠$悊\ClsGy_MaterialTechParamBillSub.cs" />
+    <Compile Include="璁″垝绠$悊\ClsGy_MaterialTechParamBillMain.cs" />
     <Compile Include="璐ㄦ绠$悊\ClsSc_ProcessExchangeBillMain_Note.cs" />
     <Compile Include="璐ㄦ绠$悊\ClsQC_FirstPieceCheckBillSub_ValueGrid.cs" />
     <Compile Include="璐ㄦ绠$悊\ClsQC_PatrolProcCheckBillSub_BadReason.cs" />
@@ -980,9 +987,14 @@
     <Compile Include="閿�鍞鐞哱鍗曡瘉绠$悊\ClsXs_LadingBillSub.cs" />
     <Compile Include="閿�鍞鐞哱鍗曡瘉绠$悊\ClsXs_ShippingAdviceBillMain.cs" />
     <Compile Include="閿�鍞鐞哱鍗曡瘉绠$悊\ClsXs_ShippingAdviceBillSub.cs" />
+    <Compile Include="椤圭洰绠$悊\ClsPM_ProjectEndBillMain.cs" />
+    <Compile Include="椤圭洰绠$悊\ClsPM_ProjectBeginBillMain.cs" />
+    <Compile Include="椤圭洰绠$悊\ClsPM_ProjectEndBillSub.cs" />
+    <Compile Include="椤圭洰绠$悊\ClsPM_ProjectBeginBillSub.cs" />
     <Compile Include="椤圭洰绠$悊\ClsPM_ProjectMoneyBillSub.cs" />
     <Compile Include="椤圭洰绠$悊\ClsPM_ProjectMoneyBillMain.cs" />
     <Compile Include="椤圭洰绠$悊\ClsPM_CustomerTaskBillMain.cs" />
+    <Compile Include="椤圭洰绠$悊\ClsGy_MaterialMouldBillMain.cs" />
     <Compile Include="椤圭洰绠$悊\ClsPM_WorkPlanMonthBillMain.cs" />
     <Compile Include="椤圭洰绠$悊\ClsPM_CustomerTaskBillSub.cs" />
     <Compile Include="椤圭洰绠$悊\ClsPM_WorkReportWeekBillSub.cs" />
diff --git "a/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockBillMain.cs" "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockBillMain.cs"
index 1d498d9..91159fd 100644
--- "a/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockBillMain.cs"
+++ "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockBillMain.cs"
@@ -28,5 +28,7 @@
         public string HTransferDirect;  //    varchar(100)  //调拨方向
         public string HShipType;        //    varchar(100)  //出货类型
         public Int64 HGroupID;
+        public int HStockInOrgID;       //     int     		//调入组织ID
+        public int HStockOutOrgID;      //     int     		//调出组织ID
     }
 }
diff --git "a/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepInBillMain.cs" "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepInBillMain.cs"
new file mode 100644
index 0000000..c475add
--- /dev/null
+++ "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepInBillMain.cs"
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsKf_MoveStockStepInBillMain : DBUtility.ClsXt_BaseBillMain
+    {
+        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 string HExplanation;     //  varchar(200)    --摘要
+        public string HInnerBillNo;     //  varchar(50)     --内部单据号
+        public bool HRedBlueFlag;       //  bit    		    --红蓝单
+        public string HStockStyle;      //  varchar(100)    --调拨类型
+        public Int64 HStockInOrgID;     //  int             --调入库存组织
+        public Int64 HStockOutOrgID;    //  int             --调出库存组织
+    }
+}
diff --git "a/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepInBillScheme.cs" "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepInBillScheme.cs"
new file mode 100644
index 0000000..25c29b7
--- /dev/null
+++ "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepInBillScheme.cs"
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsKf_MoveStockStepInBillScheme : DBUtility.ClsXt_BaseBillSub
+    {
+        public Int64 HInterID;
+        public Int64 HEntryID;
+        public Int64 HItemID;
+        public string HBillType;
+        public Int64 HMaterID;
+        public Int64 HProcID;
+        public Int64 HWhID;
+        public Int64 HSCWhID;
+        public Int64 HGroupID;
+        public double HQty;
+        public string HBarCode;
+        public string HAddr;
+        public string HMaker;
+        public DateTime HMakeDate;
+        public Int64 HSourceInterID;
+        public Int64 HSourceEntryID;
+        public string HSourceBillType;
+        public string HSourceBillNo;
+        public Int64 HSourceItemID;
+
+    }
+}
diff --git "a/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepInBillSub.cs" "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepInBillSub.cs"
new file mode 100644
index 0000000..3c5dba5
--- /dev/null
+++ "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepInBillSub.cs"
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsKf_MoveStockStepInBillSub : DBUtility.ClsXt_BaseBillSub
+    {
+        public Int64 HMaterID;          //  int   			--物料ID
+        public string HBatchNo;         //  varchar(50)     --批次
+        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      		--调入仓位
+        public Int64 HSCSPID;           //  int         	--调出仓位ID 
+        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/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepOutBillMain.cs" "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepOutBillMain.cs"
index 31d783d..0d0af80 100644
--- "a/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepOutBillMain.cs"
+++ "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepOutBillMain.cs"
@@ -18,6 +18,9 @@
         public string HInnerBillNo;//  varchar(50)     	--内部单据号
         public bool HRedBlueFlag;//  bit    		--红蓝单
         public int HCurID;
+        public string HStockStyle;      //    varchar(100)  //调拨类型
+        public int HStockInOrgID;       //     int     		//调入组织ID
+        public int HStockOutOrgID;      //     int     		//调出组织ID
 
     }
 }
diff --git "a/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepOutBillScheme.cs" "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepOutBillScheme.cs"
new file mode 100644
index 0000000..a5f9cc5
--- /dev/null
+++ "b/Model/\344\273\223\345\272\223\347\256\241\347\220\206/ClsKf_MoveStockStepOutBillScheme.cs"
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsKf_MoveStockStepOutBillScheme : DBUtility.ClsXt_BaseBillSub
+    {
+        public Int64 HInterID;
+        public Int64 HEntryID;
+        public Int64 HItemID;
+        public string HBillType;
+        public Int64 HMaterID;
+        public Int64 HProcID;
+        public Int64 HWhID;
+        public Int64 HSCWhID;
+        public Int64 HGroupID;
+        public double HQty;
+        public string HBarCode;
+        public string HAddr;
+        public string HMaker;
+        public DateTime HMakeDate;
+        public Int64 HSourceInterID;
+        public Int64 HSourceEntryID;
+        public string HSourceBillType;
+        public string HSourceBillNo;
+        public Int64 HSourceItemID;
+
+    }
+}
diff --git "a/Model/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBillMain.cs" "b/Model/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBillMain.cs"
index a964ea1..0fba952 100644
--- "a/Model/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBillMain.cs"
+++ "b/Model/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBillMain.cs"
@@ -6,14 +6,19 @@
 {
     public class ClsYS_ReceiveOtherBillMain:DBUtility.ClsXt_BaseBillMain
     {
-        public DateTime HAccDate;//  datetime  //财务日期
-        public Int64 HCusID;//   int  //业务单位(gy_supplier)
+        public DateTime HAccDate;//  datetime  //收款日期
+        public Int64 HCusID;//   int  //客户(gy_supplier)
         public Int64 HCurID;//   int   //币别
         public Single HExRate;//    money //汇率(选币别带出)
         public Int64 HDeptID;//  int  //部门
-        public Int64 HEmpID;//   int	 //业务员
-        public double HSumMoney;//  dec(18,8) //单据金额
+        public Int64 HEmpID;//   int	 //经手人
+        public Int64 HProjectMoneyID;//   int	 //费用项目
+        public string HType;//   varchar(20)     --发票类型
+        public double HMoney;//  dec(18,8) //单据金额
+        public double HTaxRate;//  dec(18,8) //税率
+        public double HSumMoney;//  dec(18,8) //总金额
         public string HExplanation;//   varchar(200)     --摘要
         public string HInnerBillNo;// varchar(100)      --内部单据号
+        public Int64 HOrgID;   //组织
     }
 }
diff --git "a/Model/\350\256\241\345\210\222\347\256\241\347\220\206/ClsGy_MaterialTechParamBillMain.cs" "b/Model/\350\256\241\345\210\222\347\256\241\347\220\206/ClsGy_MaterialTechParamBillMain.cs"
new file mode 100644
index 0000000..3bdd883
--- /dev/null
+++ "b/Model/\350\256\241\345\210\222\347\256\241\347\220\206/ClsGy_MaterialTechParamBillMain.cs"
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsGy_MaterialTechParamBillMain : DBUtility.ClsXt_BaseBillMain
+    {
+
+        public Int64 HOrgID;        //int       组织
+        public Int64 HDeptID;         //int       部门
+        public Int64 HEmpID;         //int       负责人
+        public Int64 HMaterID;         //int       物料
+        public Int64 HWorkCenterID;    //int       工作中心
+        public Int64 HEquipID;    //int      设备ID
+        public Int64 HProcID;      //int  工序
+
+    }
+}
diff --git "a/Model/\350\256\241\345\210\222\347\256\241\347\220\206/ClsGy_MaterialTechParamBillSub.cs" "b/Model/\350\256\241\345\210\222\347\256\241\347\220\206/ClsGy_MaterialTechParamBillSub.cs"
new file mode 100644
index 0000000..74f3024
--- /dev/null
+++ "b/Model/\350\256\241\345\210\222\347\256\241\347\220\206/ClsGy_MaterialTechParamBillSub.cs"
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsGy_MaterialTechParamBillSub : DBUtility.ClsXt_BaseBillSub
+    {
+
+        public Int64 HTechParamID;   //工艺参数
+        public Int64 HTechParamUnitID;  //工艺参数单位    
+        public string HStd;         //标准值
+        public string HMax;         //上限
+        public string HMin;         //下限
+    }
+}
diff --git "a/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillMain.cs" "b/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillMain.cs"
index c7d23bd..441374c 100644
--- "a/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillMain.cs"
+++ "b/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillMain.cs"
@@ -16,6 +16,7 @@
         public Int64 HEmpID;            //      int       		--业务员  (Gy_Employee)
         public Int64 HCurID;            //      int      		--币别 (Gy_Currency)
         public Single HExRate;          //      money      		--汇率  (选择完币别带出)
+        public double HEarnestRate;     //      money           --定金比例%
         public Int64 HManagerID;        //      int     		--主管	(Gy_Employee)
         public Int64 HSellSID;          //	    int 			--销售方式 (Gy_SellStyle)		new
         public Int64 HSSID;             //	    int				--结算方式 (Gy_SettleStyle)
diff --git "a/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsGy_MaterialMouldBillMain.cs" "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsGy_MaterialMouldBillMain.cs"
new file mode 100644
index 0000000..4b3a76f
--- /dev/null
+++ "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsGy_MaterialMouldBillMain.cs"
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsGy_MaterialMouldBillMain : DBUtility.ClsXt_BaseBillMain
+    {
+        public Int64 HOrgID;        //int       组织
+        public Int64 HDeptID;         //int       部门
+        public Int64 HEmpID;         //int       负责人
+        public Int64 HMaterID;         //int       物料
+        public Int64 HWorkCenterID;    //int       工作中心
+        public Int64 HEquipID;    //int      设备ID
+
+    }
+}
diff --git "a/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_ProjectBeginBillMain.cs" "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_ProjectBeginBillMain.cs"
new file mode 100644
index 0000000..d2e532e
--- /dev/null
+++ "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_ProjectBeginBillMain.cs"
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsPM_ProjectBeginBillMain: DBUtility.ClsXt_BaseBillMain
+    {   
+
+        public Int64 HProjectID;    //int       项目内码
+        public string HProNumber;//	varchar(50)	//项目代码
+        public string HProName;//	varchar(50)	项目阶段
+        public string HNote;//	varchar(500)	启动内容
+        public DateTime HPlanBeginDate;   //datetime  计划开始日期
+        public DateTime HPlanEndDate;   // datetime  计划结束日期
+        public decimal HSumMoney;//		money 		 合同总金额
+        public string HProType;//	varchar(10)   项目类型(小型、标准、综合)
+        public Int64 HCusID;//		int		//客户
+        public Int64 HPMTeamID;// 	int  交付方
+        public Int64 HPMEmpID;//	int 	项目经理
+        public Int64 HWorkEmpID;//	int 	实施担当
+        public Int64 HManagerID;//	int 	管理员
+        public decimal HMoney;//		money 		 结算金额  
+        public Int64 HConWorkDays;//		int    合同预估人天
+        public Int64 HOrgID;//		int    组织
+
+
+    }
+}
diff --git "a/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_ProjectBeginBillSub.cs" "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_ProjectBeginBillSub.cs"
new file mode 100644
index 0000000..7b89ed9
--- /dev/null
+++ "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_ProjectBeginBillSub.cs"
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsPM_ProjectBeginBillSub : DBUtility.ClsXt_BaseBillSub
+    {
+       
+    }
+}
diff --git "a/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_ProjectEndBillMain.cs" "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_ProjectEndBillMain.cs"
new file mode 100644
index 0000000..ba64d48
--- /dev/null
+++ "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_ProjectEndBillMain.cs"
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsPM_ProjectEndBillMain : DBUtility.ClsXt_BaseBillMain
+    {   
+
+        public Int64 HProjectID;    //int       项目内码
+        public string HProNumber;//	varchar(50)	//项目代码
+        public string HProName;//	varchar(50)	项目名称
+        public string HNote;//	varchar(500)	验收内容
+        public DateTime HRunBeginDate;   //datetime  运行开始日期
+        public DateTime HEndDate;   // datetime  完工日期
+        public DateTime HTestDate;//		datetime  测试日期
+        public string HTestNote;//	varchar(10)   测试记录
+        public Int64 HTestEmp;//		int		测试人员
+        public Int64 HCusID;//		int		//客户
+        public Int64 HPMTeamID;// 	int  交付方
+        public Int64 HPMEmpID;//	int 	项目经理
+        public Int64 HWorkEmpID;//	int 	实施担当
+        public Int64 HManagerID;//	int 	管理员
+        public Int64 HConWorkDays;//		int    实际消耗人天
+        public Int64 HOrgID;//		int    组织
+
+
+    }
+}
diff --git "a/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_ProjectEndBillSub.cs" "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_ProjectEndBillSub.cs"
new file mode 100644
index 0000000..f2b3d3d
--- /dev/null
+++ "b/Model/\351\241\271\347\233\256\347\256\241\347\220\206/ClsPM_ProjectEndBillSub.cs"
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsPM_ProjectEndBillSub : DBUtility.ClsXt_BaseBillSub
+    {
+       
+    }
+}
diff --git a/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs b/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs
index 29c81c0..0d13801 100644
--- a/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs
@@ -747,25 +747,37 @@
                         return objJsonResult;
                     }
                     //
-                    if (oDept.DeleteByID(HItemID))
+                    try
                     {
-                        //鍐欏叆鏃ュ織
-                        ClsPub.Add_Log("", "鍒犻櫎椤圭洰锛屼唬鐮侊細" + oDeptHlp.omodel.HNumber + ",鍚嶇О锛�" + oDeptHlp.omodel.HName, ClsPub.CurUserName);
-                        //鏇存柊涓婄骇涓� 鏈骇
-                        objJsonResult.code = "1";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鍒犻櫎鎴愬姛";
-                        objJsonResult.data = null;
-                        return objJsonResult;
+                        if (oDept.DeleteByID(HItemID))
+                        {
+                            //鍐欏叆鏃ュ織
+                            ClsPub.Add_Log("", "鍒犻櫎椤圭洰锛屼唬鐮侊細" + oDeptHlp.omodel.HNumber + ",鍚嶇О锛�" + oDeptHlp.omodel.HName, ClsPub.CurUserName);
+                            //鏇存柊涓婄骇涓� 鏈骇
+                            objJsonResult.code = "1";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍒犻櫎鎴愬姛";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍒犻櫎澶辫触";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                     }
-                    else
+                    catch (Exception e)
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
-                        objJsonResult.Message = "鍒犻櫎澶辫触";
+                        objJsonResult.Message = "鍒犻櫎澶辫触锛岃瀹㈡埛瀛樺湪鍏宠仈鐨勯攢鍞鍗曘�侀攢鍞嚭搴撳崟銆佺敓浜ц鍗曪紝鎴栫▼搴忛敊璇��";
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
+                    
                 }
                 //ds = oCN.RunProcReturn("delete from Gy_Department where HItemID =  " + HItemID, "Gy_Department");
 
diff --git a/WebAPI/Controllers/JHGL/Gy_MaterialTechParamBillController.cs b/WebAPI/Controllers/JHGL/Gy_MaterialTechParamBillController.cs
new file mode 100644
index 0000000..ba7850a
--- /dev/null
+++ b/WebAPI/Controllers/JHGL/Gy_MaterialTechParamBillController.cs
@@ -0,0 +1,536 @@
+锘縰sing DBUtility;
+using Model;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+using System.Web.Http;
+using System.Windows.Forms;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers.MJGL
+{
+    public class Gy_MaterialTechParamBillController : ApiController
+    {
+
+
+        //浜у搧宸ヨ壓鍙傛暟娓呭崟   Gy_MaterialTechParamBill   Gy_MaterialTechParamBillMain  Gy_MaterialTechParamBillSub
+
+
+        private json objJsonResult = new json();
+        public DataSet ds = new DataSet();
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        public DAL.ClsGy_MaterialTechParamBillMain BillNew1 = new DAL.ClsGy_MaterialTechParamBillMain();   //浜у搧宸ヨ壓鍙傛暟娓呭崟瀵瑰簲鍗曟嵁绫�
+        public DAL.ClsGy_MaterialTechParamBillMain BillOld1 = new DAL.ClsGy_MaterialTechParamBillMain();
+
+        #region 浜у搧宸ヨ壓鍙傛暟娓呭崟鍒楄〃
+        [Route("Sc_MouldDotCheckRuleBill/Gy_MaterialTechParamBillMainList")]
+        [HttpGet]
+        public object Gy_MaterialTechParamBillMainList(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //缂栬緫鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_MaterialTechParamBillMain_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_Gy_MaterialTechParamBillMainList order by 鍗曟嵁鍙� desc", "h_v_Gy_MaterialTechParamBillMainList");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_Gy_MaterialTechParamBillMainList where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_Gy_MaterialTechParamBillMainList");
+                }
+                //娣诲姞鍒楀悕
+                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>
+        /// 淇濆瓨妯″叿缁翠慨鍗�
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Gy_MaterialTechParamBill/SaveGy_MaterialTechParamBillMain")]
+        [HttpPost]
+        public object SaveGy_MaterialTechParamBillMain([FromBody] JObject sMainSub)
+        {
+            var _value = sMainSub["sMainSub"].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[2].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+            string user = sArray[3].ToString();//鐢ㄦ埛鍚�
+
+            string UserName = "";
+            string s = "";
+            ListModels oListModels = new ListModels();
+            try
+            {
+                //淇濆瓨鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_MaterialTechParamBillMain_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                DAL.ClsGy_MaterialTechParamBillMain oBill = new DAL.ClsGy_MaterialTechParamBillMain();
+                List<Model.ClsGy_MaterialTechParamBillMain> lsmain = new List<Model.ClsGy_MaterialTechParamBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_MaterialTechParamBillMain(msg2);
+                foreach (Model.ClsGy_MaterialTechParamBillMain oItem in lsmain)
+                {
+                    if (refSav == "Add")
+                    {
+                        //鍗曟嵁鍙锋槸鍚﹂噸澶�
+                        if (BillNew1.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld1.omodel.HInterID))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
+                    if (refSav == "Update")
+                    {
+                        if (BillOld1.ShowBill(oItem.HInterID, ref s) == false)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        //鍒ゆ柇鏄惁鍙紪杈�
+                        if (BillOld1.omodel.HChecker != "" && BillOld1.omodel.HChecker != null)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (BillOld1.omodel.HBillStatus > 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld1, ref s))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = s + "锛屼笉鍏佽淇敼";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
+                    UserName = oItem.HMaker;  //鍒跺崟浜�
+                    oItem.HBillType = "3334";
+                    oItem.HBillSubType = "3334";
+
+
+
+                    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;
+                }
+                // 琛ㄤ綋鏁版嵁
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg3 = msg3.Substring(1, msg3.Length - 2);
+                msg3 = msg3.Replace("\\", "");
+                msg3 = msg3.Replace("\n", "");  //\n
+                List<Model.ClsGy_MaterialTechParamBillSub> ls = new List<Model.ClsGy_MaterialTechParamBillSub>();
+                ls = oListModels.getObjectByJson_Gy_MaterialTechParamBillSub(msg3);
+                int i = 0;
+                foreach (Model.ClsGy_MaterialTechParamBillSub oItemSub in ls)
+                {
+                    i++;
+                    oItemSub.HEntryID = i;
+
+
+                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+
+                    oBill.DetailColl.Add(oItemSub);
+
+                }
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                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("Gy_MaterialTechParamBill/Gy_MaterialTechParamBillMainEditList")]
+        [HttpGet]
+        public object Gy_MaterialTechParamBillMainEditList(string HInterID, string User)
+        {
+            try
+            {
+                List<DataTable> tableList = new List<DataTable>();
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_MaterialTechParamBillMain_Edit", 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;
+                }
+                
+                ds = oCN.RunProcReturn("exec h_p_Gy_MaterialTechParamBillMain_EditInit  " + HInterID, "h_p_Gy_MaterialTechParamBillMain_EditInit");
+                tableList.Add(ds.Tables[0]);
+                tableList.Add(ds.Tables[1]);
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = tableList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 浜у搧宸ヨ壓鍙傛暟娓呭崟璁板綍鍒犻櫎鍔熻兘
+        [Route("Gy_MaterialTechParamBill/DeleteGy_MaterialTechParamBillMain")]
+        [HttpGet]
+        public object DeleteGy_MaterialTechParamBillMain(string HInterID, string user)
+        {
+            try
+            {
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_MaterialTechParamBillMain_Drop", 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;
+                }
+
+                oCN.BeginTran();
+
+                oCN.RunProc("delete from Gy_MaterialTechParamBillMain    where HInterID = " + HInterID);
+                oCN.RunProc("delete from Gy_MaterialTechParamBillSub   where HInterID = " + HInterID);
+
+                oCN.Commit();
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 浜у搧宸ヨ壓鍙傛暟娓呭崟鍒楄〃 瀹℃牳/鍙嶅鏍稿姛鑳�
+        [Route("Gy_MaterialTechParamBill/CheckGy_MaterialTechParamBillMain")]
+        [HttpGet]
+        public object CheckGy_MaterialTechParamBillMain(string HInterID, int IsAudit, string user)
+        {
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_MaterialTechParamBillMain_Check", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                var ds = oCN.RunProcReturn("select * from Gy_MaterialTechParamBillMain  where HInterID=" + HInterID, "Gy_MaterialTechParamBillMain ");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                {
+                    oCN.RunProc("update Gy_MaterialTechParamBillMain  set HChecker='" + user + "',HCheckDate=getdate() where HInterID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "瀹℃牳鎴愬姛";
+                    objJsonResult.data = null;
+                }
+                if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                {
+                    oCN.RunProc("update Gy_MaterialTechParamBillMain  set HChecker='',HCheckDate=null where HInterID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+                    objJsonResult.data = null;
+                }
+                oCN.Commit();
+
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+        }
+        #endregion
+
+        #region 浜у搧宸ヨ壓鍙傛暟娓呭崟鍒楄〃 鍏抽棴/鍙嶅叧闂姛鑳�
+        [Route("Gy_MaterialTechParamBill/CloseGy_MaterialTechParamBillMain")]
+        [HttpGet]
+        public object CloseGy_MaterialTechParamBillMain(string HInterID, int IsAudit, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊叧闂潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Gy_MaterialTechParamBillMain_Close", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                var ds = oCN.RunProcReturn("select * from Gy_MaterialTechParamBillMain  where HInterID=" + HInterID, "Gy_MaterialTechParamBillMain");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (IsAudit == 0)  //鍏抽棴鍒ゆ柇
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅叧闂垽鏂�
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸弽鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                if (IsAudit == 0)  //鍏抽棴鍒ゆ柇
+                {
+                    oCN.RunProc("update Gy_MaterialTechParamBillMain  set HCloseMan='" + user + "',HCloseDate=getdate() where HInterID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍏抽棴鎴愬姛";
+                    objJsonResult.data = null;
+                }
+                if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                {
+                    oCN.RunProc("update Gy_MaterialTechParamBillMain  set HCloseMan='',HCloseDate=null where HInterID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍙嶅叧闂垚鍔�";
+                    objJsonResult.data = null;
+                }
+                oCN.Commit();
+
+                return objJsonResult;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Controllers/LMESController.cs b/WebAPI/Controllers/LMESController.cs
index a0f8cec..1824817 100644
--- a/WebAPI/Controllers/LMESController.cs
+++ b/WebAPI/Controllers/LMESController.cs
@@ -104,7 +104,29 @@
                 }
 
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillQuery where 1 = 1 " + sWhere + " order by hmainid desc ", "h_v_Sc_ProcessExchangeBillQuery");
+
+                
+                //鍒ゆ柇鐢ㄦ埛鏄惁鎷ユ湁鏌ョ湅鎵�鏈夊鎴锋潈闄�
+                if (DBUtility.ClsPub.Security_Log_second("Gy_UserLookAllCus", 1, false, user))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillQuery where 1 = 1 " + sWhere + " order by hmainid desc ", "h_v_Sc_ProcessExchangeBillQuery");
+                }
+                else
+                {
+                    //鑾峰彇鐢ㄦ埛缂栫爜
+                    string sql = "select * from Gy_Czygl where Czymc = '" + user + "'";
+                    ds = oCN.RunProcReturn(sql, "Gy_Czygl");
+                    string userID = ds.Tables[0].Rows[0]["Czybm"].ToString();
+
+                    string sql1 = " and HCusID in (select HCusID from Gy_UserCustomerRelation Where HUserID = '" + userID + "')";
+                    string sql2 = "select * from h_v_Sc_ProcessExchangeBillQuery where 1 = 1 " + sWhere + sql1 + " order by hmainid desc ";
+                    ds = oCN.RunProcReturn(sql2, "h_v_Sc_ProcessExchangeBillQuery");
+                }
+
+
+
+
+                
 
 
                 //娣诲姞鍒楀悕
diff --git a/WebAPI/Controllers/MJGL/Sc_MouldinventoryBillController.cs b/WebAPI/Controllers/MJGL/Sc_MouldinventoryBillController.cs
new file mode 100644
index 0000000..1cca0a0
--- /dev/null
+++ b/WebAPI/Controllers/MJGL/Sc_MouldinventoryBillController.cs
@@ -0,0 +1,536 @@
+锘縰sing DBUtility;
+using Model;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+using System.Web.Http;
+using System.Windows.Forms;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers.MJGL
+{
+    public class Sc_MouldinventoryBillController : ApiController
+    {
+
+
+        //浜у搧鍣ㄥ叿娓呭崟   Sc_MouldinventoryBill   Gy_MaterialMouldBillMain
+
+
+        private json objJsonResult = new json();
+        public DataSet ds = new DataSet();
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        public DAL.ClsGy_MaterialMouldBillMain BillNew1 = new DAL.ClsGy_MaterialMouldBillMain();   //浜у搧鍣ㄥ叿娓呭崟瀵瑰簲鍗曟嵁绫�
+        public DAL.ClsGy_MaterialMouldBillMain BillOld1 = new DAL.ClsGy_MaterialMouldBillMain();
+
+        #region 浜у搧鍣ㄥ叿娓呭崟鍗曞垪琛�
+        [Route("Sc_MouldDotCheckRuleBill/Gy_MaterialMouldBillMainList")]
+        [HttpGet]
+        public object Sc_MouldDotCheckRuleList(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //缂栬緫鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_MaterialMouldBillMain_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_Gy_MaterialMouldBillMainList order by 鍗曟嵁鍙� desc", "h_v_Gy_MaterialMouldBillMainList");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_Gy_MaterialMouldBillMainList where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_Gy_MaterialMouldBillMainList");
+                }
+                //娣诲姞鍒楀悕
+                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>
+        /// 淇濆瓨妯″叿缁翠慨鍗�
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Sc_MouldinventoryBill/SaveGy_MaterialMouldBillMain")]
+        [HttpPost]
+        public object SaveGy_MaterialMouldBillMain([FromBody] JObject sMainSub)
+        {
+            var _value = sMainSub["sMainSub"].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[2].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+            string user = sArray[3].ToString();//鐢ㄦ埛鍚�
+
+            string UserName = "";
+            string s = "";
+            ListModels oListModels = new ListModels();
+            try
+            {
+                //淇濆瓨鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_MaterialMouldBillMain_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                DAL.ClsGy_MaterialMouldBillMain oBill = new DAL.ClsGy_MaterialMouldBillMain();
+                List<Model.ClsGy_MaterialMouldBillMain> lsmain = new List<Model.ClsGy_MaterialMouldBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_MaterialMouldBillMain(msg2);
+                foreach (Model.ClsGy_MaterialMouldBillMain oItem in lsmain)
+                {
+                    if (refSav == "Add")
+                    {
+                        //鍗曟嵁鍙锋槸鍚﹂噸澶�
+                        if (BillNew1.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld1.omodel.HInterID))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
+                    if (refSav == "Update")
+                    {
+                        if (BillOld1.ShowBill(oItem.HInterID, ref s) == false)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        //鍒ゆ柇鏄惁鍙紪杈�
+                        if (BillOld1.omodel.HChecker != "" && BillOld1.omodel.HChecker != null)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (BillOld1.omodel.HBillStatus > 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld1, ref s))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = s + "锛屼笉鍏佽淇敼";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
+                    UserName = oItem.HMaker;  //鍒跺崟浜�
+                    oItem.HBillType = "3333";
+                    oItem.HBillSubType = "3333";
+
+
+
+                    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;
+                }
+                // 琛ㄤ綋鏁版嵁
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg3 = msg3.Substring(1, msg3.Length - 2);
+                msg3 = msg3.Replace("\\", "");
+                msg3 = msg3.Replace("\n", "");  //\n
+                List<Model.ClsGy_MaterialMouldBillSub> ls = new List<Model.ClsGy_MaterialMouldBillSub>();
+                ls = oListModels.getObjectByJson_Gy_MaterialMouldBillSub(msg3);
+                int i = 0;
+                foreach (Model.ClsGy_MaterialMouldBillSub oItemSub in ls)
+                {
+                    i++;
+                    oItemSub.HEntryID = i;
+
+
+                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+
+                    oBill.DetailColl.Add(oItemSub);
+
+                }
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                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_MouldinventoryBill/Gy_MaterialMouldBillMainEditList")]
+        [HttpGet]
+        public object Gy_MaterialMouldBillMainEditList(string HInterID, string User)
+        {
+            try
+            {
+                List<DataTable> tableList = new List<DataTable>();
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_MaterialMouldBillMain_Edit", 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;
+                }
+                
+                ds = oCN.RunProcReturn("exec h_p_Gy_MaterialMouldBillMain_EditInit  " + HInterID, "h_p_Gy_MaterialMouldBillMain_EditInit");
+                tableList.Add(ds.Tables[0]);
+                tableList.Add(ds.Tables[1]);
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = tableList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 浜у搧鍣ㄥ叿娓呭崟璁板綍鍒犻櫎鍔熻兘
+        [Route("Sc_MouldinventoryBill/DeleteGy_MaterialMouldBillMain")]
+        [HttpGet]
+        public object DeleteGy_MaterialMouldBillMain(string HInterID, string user)
+        {
+            try
+            {
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_MaterialMouldBillMain_Drop", 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;
+                }
+
+                oCN.BeginTran();
+
+                oCN.RunProc("delete from Gy_MaterialMouldBillMain   where HInterID = " + HInterID);
+                oCN.RunProc("delete from Gy_MaterialMouldBillSub   where HInterID = " + HInterID);
+
+                oCN.Commit();
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 浜у搧鍣ㄥ叿娓呭崟鍒楄〃 瀹℃牳/鍙嶅鏍稿姛鑳�
+        [Route("Sc_MouldinventoryBill/CheckGy_MaterialMouldBillMain")]
+        [HttpGet]
+        public object CheckGy_MaterialMouldBillMain(string HInterID, int IsAudit, string user)
+        {
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_MaterialMouldBillMain_Check", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                var ds = oCN.RunProcReturn("select * from Gy_MaterialMouldBillMain  where HInterID=" + HInterID, "Gy_MaterialMouldBillMain ");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                {
+                    oCN.RunProc("update Gy_MaterialMouldBillMain  set HChecker='" + user + "',HCheckDate=getdate() where HInterID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "瀹℃牳鎴愬姛";
+                    objJsonResult.data = null;
+                }
+                if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                {
+                    oCN.RunProc("update Gy_MaterialMouldBillMain  set HChecker='',HCheckDate=null where HInterID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+                    objJsonResult.data = null;
+                }
+                oCN.Commit();
+
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+        }
+        #endregion
+
+        #region 浜у搧鍣ㄥ叿娓呭崟鍒楄〃 鍏抽棴/鍙嶅叧闂姛鑳�
+        [Route("Sc_MouldinventoryBill/CloseGy_MaterialMouldBillMain")]
+        [HttpGet]
+        public object CloseGy_MaterialMouldBillMain(string HInterID, int IsAudit, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊叧闂潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Gy_MaterialMouldBillMain_Close", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                var ds = oCN.RunProcReturn("select * from Gy_MaterialMouldBillMain  where HInterID=" + HInterID, "Gy_MaterialMouldBillMain");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (IsAudit == 0)  //鍏抽棴鍒ゆ柇
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅叧闂垽鏂�
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸弽鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                if (IsAudit == 0)  //鍏抽棴鍒ゆ柇
+                {
+                    oCN.RunProc("update Gy_MaterialMouldBillMain  set HCloseMan='" + user + "',HCloseDate=getdate() where HInterID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍏抽棴鎴愬姛";
+                    objJsonResult.data = null;
+                }
+                if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                {
+                    oCN.RunProc("update Gy_MaterialMouldBillMain  set HCloseMan='',HCloseDate=null where HInterID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍙嶅叧闂垚鍔�";
+                    objJsonResult.data = null;
+                }
+                oCN.Commit();
+
+                return objJsonResult;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Controllers/SCGL/Sc_ICMOChangeBillController.cs b/WebAPI/Controllers/SCGL/Sc_ICMOChangeBillController.cs
index e78e6ca..44988ea 100644
--- a/WebAPI/Controllers/SCGL/Sc_ICMOChangeBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_ICMOChangeBillController.cs
@@ -488,8 +488,10 @@
                     }
 
                     //妫�鏌ユ簮鍗曟槸鍚﹀瓨鍦�
-                    string sql = "select * from Sc_ICMOBillSub where HInterID = " + oBill.omodel.HMainSourceInterID + " and HEntryID =" + oBill.omodel.HMainSourceEntryID;
-                    ds = oCN.RunProcReturn(sql, "Sc_ICMOBillSub");
+                    string sql = "select * from Sc_ICMOBillMain as a " +
+                        " inner join Sc_ICMOBillSub as b on a.HInterID = b.HInterID " +
+                        " where b.HInterID = " + oBill.omodel.HMainSourceInterID + " and b.HEntryID =" + oBill.omodel.HMainSourceEntryID;
+                    ds = oCN.RunProcReturn(sql, "Sc_ICMOBill");
                     if(ds==null || ds.Tables[0].Rows.Count == 0)
                     {
                         objJsonResult.code = "0";
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index 3cb072b..c82d6ef 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -8951,11 +8951,11 @@
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("Select HInterID,HEquipFileNumber,HName  from Gy_EquipFileBillMain where 0=0 Order by HInterID ", "Gy_EquipFileBillMain");
+                    ds = oCN.RunProcReturn("Select HInterID,HEquipFileNumber,HName,HModel2  from Gy_EquipFileBillMain where 0=0 Order by HInterID ", "Gy_EquipFileBillMain");
                 }
                 else
                 {
-                    string sql1 = "Select HInterID,HEquipFileNumber,HName  from Gy_EquipFileBillMain where 0=0  ";
+                    string sql1 = "Select HInterID,HEquipFileNumber,HName,HModel2  from Gy_EquipFileBillMain where 0=0  ";
                     string sql = sql1 + sWhere;
                     ds = oCN.RunProcReturn(sql, "Gy_EquipFileBillMain");
                 }
diff --git a/WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs b/WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs
index 58ee9ae..33bce9c 100644
--- a/WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs
+++ b/WebAPI/Controllers/XSGL/Kf_SellOutBillController.cs
@@ -1029,5 +1029,59 @@
             }
         }
         #endregion
+
+        #region 閿�鍞嚭搴撳崟 妫�鏌ュ崟鎹槸鍚﹀瓨鍦�
+        /// <summary>
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <returns></returns>
+        [Route("Kf_SellOutBill/CheckSellOutBill_IsExist")]
+        [HttpGet]
+        public object CheckSellOutBill_IsExist(int HInterID)
+        {
+            try
+            {
+                //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.ClsKf_SellOutBill oBill = new DAL.ClsKf_SellOutBill();                              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+                {
+                    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;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "绋嬪簭閿欒锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/XSGL/Xs_CusBalanceReportController.cs b/WebAPI/Controllers/XSGL/Xs_CusBalanceReportController.cs
new file mode 100644
index 0000000..4aa172b
--- /dev/null
+++ b/WebAPI/Controllers/XSGL/Xs_CusBalanceReportController.cs
@@ -0,0 +1,149 @@
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Pub_Class;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Web.Http;
+using WebAPI.Models;
+using System.IO;
+using System.Web;
+using WebAPI.Controllers.SCGL.鏃ヨ鍒掔鐞�;
+
+namespace WebAPI.Controllers
+{
+    //瀹㈡埛浣欓鏌ヨ鎶ヨ〃Controller
+    public class Xs_CusBalanceReportController : ApiController
+    {
+        //鑾峰彇绯荤粺鍙傛暟
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+
+        private json objJsonResult = new json();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        DataSet ds;
+
+        #region 瀹㈡埛浣欓鏌ヨ鎶ヨ〃 鏌ヨ
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Xs_CusBalanceReport/list")]
+        [HttpGet]
+        public object getXs_CusBalanceReport(string sWhere, string user, string userid)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                ////鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Xs_CusBalanceReport_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                //鏌ヨ
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    string sql = "exec h_p_Xs_CusBalanceReport_Query '','" + userid + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Xs_CusBalanceReport_Query");
+                }
+                else
+                {
+                    string sql = "exec h_p_Xs_CusBalanceReport_Query '" + sWhere + "','" + userid + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Xs_CusBalanceReport_Query");
+                }
+
+                //娣诲姞鍒楀悕
+                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 e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 瀹㈡埛浣欓鏌ヨ鎶ヨ〃 鍗犵敤棰濆害鏄庣粏
+        /// <summary>
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Xs_CusBalanceReport/getHIsUsingBalanceEntry")]
+        [HttpGet]
+        public object getHIsUsingBalanceEntry(string sWhere,Int64 HCusID, string user, string userid)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //////鏌ョ湅鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log("Xs_CusBalanceReport_Query", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                //鏌ヨ
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    string sql = "exec h_p_Xs_CusBalanceReport_Query '','" + userid + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Xs_CusBalanceReport_Query");
+                }
+                else
+                {
+                    string sql = "exec h_p_Xs_CusBalanceReport_Query '" + sWhere + "','" + userid + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Xs_CusBalanceReport_Query");
+                }
+
+                //娣诲姞鍒楀悕
+                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 e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs b/WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs
index 03f0323..02e88d1 100644
--- a/WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs
@@ -38,14 +38,14 @@
             {
                 List<object> columnNameList = new List<object>();
                 //鏌ョ湅鏉冮檺
-                //if (!DBUtility.ClsPub.Security_Log("Xs_ReceivableBill_Query", 1, false, user))
-                //{
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
+                if (!DBUtility.ClsPub.Security_Log("Xs_ReceivableBill_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 if (sWhere == null || sWhere.Equals(""))
                 {
@@ -105,14 +105,14 @@
             try
             {
                 //缂栬緫鏉冮檺
-                //if (!DBUtility.ClsPub.Security_Log_second("Xs_ReceivableBill_Edit", 1, false, msg4))
-                //{
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
+                if (!DBUtility.ClsPub.Security_Log_second("Xs_ReceivableBill_Edit", 1, false, msg4))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 DAL.ClsXs_ReceivableBill oBill = new DAL.ClsXs_ReceivableBill();
                 List<Model.ClsXs_ReceivableBillMain> lsmain = new List<Model.ClsXs_ReceivableBillMain>();
@@ -301,14 +301,14 @@
                 string s = "";
 
                 //鏌ョ湅鏉冮檺
-                //if (!DBUtility.ClsPub.Security_Log("Xs_ReceivableBill_Drop", 1, false, user))
-                //{
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
+                if (!DBUtility.ClsPub.Security_Log("Xs_ReceivableBill_Drop", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 if (HInterID == null || HInterID.Equals(""))
                 {
@@ -427,14 +427,14 @@
             try
             {
                 //瀹℃牳鏉冮檺
-                //if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
-                //{
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
+                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)
                 {
@@ -631,14 +631,14 @@
             try
             {
                 //妫�鏌ユ潈闄�
-                //if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
-                //{
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "鍏抽棴澶辫触锛佹棤鏉冮檺锛�";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
+                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)
                 {
diff --git a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
index ce31d58..5df7cf7 100644
--- a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
@@ -1153,6 +1153,17 @@
                             objJsonResult.data = 1;
                             return objJsonResult;
                         }
+
+                        string sql = "select count(*) Xs_ExceptiveCheckRequestBillCount from Xs_ExceptiveCheckRequestBillMain where HMainSourceInterID = " + BillOld.omodel.HInterID;
+                        ds = oCN.RunProcReturn(sql, "Xs_ExceptiveCheckRequestBillMain");
+                        if (ds != null && Int64.Parse(ds.Tables[0].Rows[0]["Xs_ExceptiveCheckRequestBillCount"].ToString()) > 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "淇濆瓨澶辫触锛屽崟鎹瓨鍦ㄤ笅娓稿崟鎹甗鐗规壒鐢宠鍗昡锛�";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
                     }
                     UserName = oItem.HMaker;  //鍒跺崟浜�
                     oItem.HBillType = "1401";
@@ -1549,7 +1560,7 @@
                 if (IsAudit == 1) //鍙嶅鏍告彁浜�
                 {
                     //鍙嶅鏍稿墠鎺у埗=========================================
-                    DataSet ds = oCN.RunProcReturn("Exec h_p_Xs_SeOrderBill_BeforeAbandonCheckCtrl " + lngBillKey, "h_p_Xs_SeOrderBill_BeforeAbandonCheckCtrl");
+                    DataSet ds = oCN.RunProcReturn("Exec h_p_Xs_SeOrderBill_BeforeAbandonCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Xs_SeOrderBill_BeforeAbandonCheckCtrl");
                     if (ds == null)
                     {
                         objJsonResult.code = "0";
@@ -1612,6 +1623,7 @@
         {
             string ModRightNameCheck = "Xs_SeOrderBill_Close";
             DBUtility.ClsPub.CurUserName = CurUserName;
+            string sql = "";
             try
             {
                 //妫�鏌ユ潈闄�
@@ -1678,6 +1690,18 @@
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
+
+                        //鍒ゆ柇鍗曟嵁鏄惁涓鸿嚜鍔ㄥ叧闂�
+                        sql = "select * from Xs_SeOrderBillMain where HInterID = " + HInterID;
+                        ds = oCN.RunProcReturn(sql, "Xs_SeOrderBillMain");
+                        if (ds.Tables[0].Rows[0]["HCloseType"].ToString() == "False")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅叧闂け璐�!鍗曟嵁涓鸿嚜鍔ㄥ叧闂紝涓嶈兘杩涜鎵嬪姩鍙嶅叧闂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                     }
                 }
                 else
@@ -1713,9 +1737,199 @@
                 }
                 if (IsAudit == 1) //鍙嶅叧闂彁浜�
                 {
+                    oBill.oCn.BeginTran();
                     //鍙嶅叧闂彁浜�
                     if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                     {
+                        ds = oCN.RunProcReturn("exec h_p_Kf_CheckSeOrderBill_CrediControl " + oBill.omodel.HInterID, "h_p_Kf_CheckSeOrderBill_CrediControl");
+                        if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString();
+                            objJsonResult.data = null;
+                            oBill.oCn.RollBack();
+                            return objJsonResult;
+                        }
+
+                        oBill.oCn.Commit();
+                        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;
+                        oBill.oCn.RollBack();
+                        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("Xs_SeOrderBill/CloseRowXs_SeOrderBill")]
+        [HttpGet]
+        public object CloseRowXs_SeOrderBill(int HInterID,int HEntryID, int IsAudit, string CurUserName)
+        {
+            string ModRightNameCheck = "Xs_SeOrderBill_Close";
+            string SubBillName = "Xs_SeOrderBillSub";                   //瀛愯〃琛ㄥ悕
+            DBUtility.ClsPub.CurUserName = CurUserName;
+            DataSet ds = null;
+            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.ClsXs_SeOrderBill oBill = new DAL.ClsXs_SeOrderBill();              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                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.HCloseMan.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;
+                    }
+
+                    string sql = "select * from " + SubBillName + " where HInterID = " + HInterID + " and HEntryID = " + HEntryID;
+                    ds = oCN.RunProcReturn(sql, "Xs_SeOrderBillSub");
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "璇ヨ鏁版嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (IsAudit == 0)  //琛屽叧闂垽鏂�
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "琛屽凡鍏抽棴!涓嶈兘鍐嶆琛屽叧闂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //琛屽弽鍏抽棴鍒ゆ柇
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "琛屾湭鍏抽棴!涓嶉渶瑕佸啀琛屽弽鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+
+                        //鍒ゆ柇琛屾槸鍚︿负鑷姩鍏抽棴
+                        string temp = ds.Tables[0].Rows[0]["HCloseType"].ToString();
+                        if (ds.Tables[0].Rows[0]["HCloseType"].ToString() == "False")
+                        {
+                            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.CloseRow(lngBillKey,HEntryID,oBill.omodel.HBillNo,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) //琛屽弽鍏抽棴鎻愪氦
+                {
+                    //琛屽弽鍏抽棴鎻愪氦
+                    if (oBill.CancelRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                    {
                         objJsonResult.code = "1";
                         objJsonResult.count = 1;
                         objJsonResult.Message = "鍙嶅叧闂垚鍔�";
diff --git a/WebAPI/Controllers/XSGL/YS_ReceiveBillController.cs b/WebAPI/Controllers/XSGL/YS_ReceiveBillController.cs
index 3eca178..eea8e80 100644
--- a/WebAPI/Controllers/XSGL/YS_ReceiveBillController.cs
+++ b/WebAPI/Controllers/XSGL/YS_ReceiveBillController.cs
@@ -1011,5 +1011,50 @@
             }
         }
         #endregion
+
+        #region 鏀舵鍗� 鏍规嵁瀹㈡埛鑾峰彇鍏宠仈鑱屽憳
+        [Route("YS_ReceiveBill/getRelationEmpByCusID")]
+        [HttpGet]
+        public object getRelationEmpByCusID(long HCusID)
+        {
+            try
+            {
+                string sql = @"select b.HEmpID HEmpID,e.HName HEmpName,b.HDeptID HDeptID,d.HName HDeptName,d.HEmpID HManagerID,e1.HName HManagerName
+                            from Gy_UserCustomerRelation as a
+                            left join Gy_Czygl as b on a.HUserID = b.Czybm
+                            left join Gy_Employee as e on b.HEmpID = e.HItemID
+                            left join Gy_Department as d on b.HDeptID = d.HItemID
+                            left join Gy_Employee as e1 on d.HEmpID = e1.HItemID
+                            where a.HCusID = " + HCusID;
+                ds = oCN.RunProcReturn(sql, "Gy_UserCustomerRelation");
+
+
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ュ鎴峰叧鑱旂殑鑱屽憳淇℃伅锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs b/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs
new file mode 100644
index 0000000..414620a
--- /dev/null
+++ b/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs
@@ -0,0 +1,907 @@
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Pub_Class;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Web.Http;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers
+{
+    //鍏朵粬搴旀敹鍗旵ontroller
+    public class YS_ReceiveOtherBillController : ApiController
+    {
+        //鍏朵粬搴旀敹鍗�
+        //鑾峰彇绯荤粺鍙傛暟    YS_ReceiveOtherBillMain
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+        public DAL.ClsYS_ReceiveOtherBill BillOld = new DAL.ClsYS_ReceiveOtherBill();
+        public DAL.ClsYS_ReceiveOtherBill BillNew0 = new DAL.ClsYS_ReceiveOtherBill();
+
+        private json objJsonResult = new json();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        DataSet ds;
+
+        #region 鍏朵粬搴旀敹鍗曞垪琛� 鏌ヨ
+        /// <summary>
+        /// 杩斿洖椤圭洰闃舵鍒楄〃
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("YS_ReceiveOtherBill/YS_ReceiveOtherBillMainList")]
+        [HttpGet]
+        public object YS_ReceiveOtherBillMainList(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("YS_ReceiveOtherBillMain_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_YS_ReceiveOtherBillMainList order by 鍗曟嵁鍙� desc", "h_v_YS_ReceiveOtherBillMainList");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_YS_ReceiveOtherBillMainList where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_YS_ReceiveOtherBillMainList");
+                }
+
+                //娣诲姞鍒楀悕
+                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 e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鍏朵粬搴旀敹鍗曚繚瀛� 鏂板/缂栬緫
+        [Route("YS_ReceiveOtherBill/SaveYS_ReceiveOtherBillMain")]
+        [HttpPost]
+        public object SaveYS_ReceiveOtherBillMain([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 refSav = sArray[1].ToString();                           //鎿嶄綔鏂瑰紡
+            string msg4 = sArray[2].ToString();                             //鐢ㄦ埛
+
+            DBUtility.ClsPub.CurUserName = msg4;
+
+            string UserName = "";
+            string s = "";
+            ListModels oListModels = new ListModels();
+            try
+            {
+                //缂栬緫鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("YS_ReceiveOtherBillMain_Edit", 1, false, msg4))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                DAL.ClsYS_ReceiveOtherBill oBill = new DAL.ClsYS_ReceiveOtherBill();
+                List<Model.ClsYS_ReceiveOtherBillMain> lsmain = new List<Model.ClsYS_ReceiveOtherBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_YS_ReceiveOtherBillMain(msg2);
+                foreach (Model.ClsYS_ReceiveOtherBillMain oItem in lsmain)
+                {
+                    if (refSav == "Add")
+                    {
+                        //鍗曟嵁鍙锋槸鍚﹂噸澶�
+                        if (BillNew0.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 (BillOld.ShowBill(oItem.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;
+                        }
+                        if (BillOld.omodel.HBillStatus > 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = s + "锛屼笉鍏佽淇敼";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
+                    UserName = oItem.HMaker;  //鍒跺崟浜�
+                    oItem.HBillType = "2002";
+                    oItem.HBillSubType = "2002";
+
+                    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("YS_ReceiveOtherBill/YS_ReceiveOtherBillMainEditList")]
+        [HttpGet]
+        public object YS_ReceiveOtherBillMainEditList(long HInterID)
+        {
+            try
+            {
+                ds = oCN.RunProcReturn("select * from h_v_YS_ReceiveOtherBillMainList where hmainid=" + HInterID, "h_v_YS_ReceiveOtherBillMainList");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "false锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鍏朵粬搴旀敹鍗� 鍒犻櫎
+        /// <summary>
+        ///鍙傛暟锛歴tring HInterID銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("YS_ReceiveOtherBill/DeleteYS_ReceiveOtherBillMain")]
+        [HttpGet]
+        public object DeleteYS_ReceiveOtherBillMain(string HInterID, string user)
+        {
+            try
+            {
+                string s = "";
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("YS_ReceiveOtherBillMain_Drop", 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_YS_ReceiveOtherBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveOtherBill_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 YS_ReceiveOtherBillMain where HInterID = " + HInterID);
+                oCN.RunProc("delete from YS_ReceiveOtherBillSub where HInterID= " + HInterID);
+
+                //鍒犻櫎鍚庢帶鍒�==================================================================================      
+                string sql2 = "exec h_p_YS_ReceiveOtherBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+                ds = oCN.RunProcReturn(sql2, "h_p_YS_ReceiveOtherBill_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("YS_ReceiveOtherBill/AuditYS_ReceiveOtherBillMain")]
+        [HttpGet]
+        public object AuditYS_ReceiveOtherBillMain(int HInterID, int IsAudit, string CurUserName)
+        {
+            string ModRightNameCheck = "YS_ReceiveOtherBillMain_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.ClsYS_ReceiveOtherBill oBill = new DAL.ClsYS_ReceiveOtherBill();                              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                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 = "";
+
+                    if(oBill.omodel.HMainSourceInterID != 0)
+                    {
+                        //妫�楠屾簮鍗曟槸鍚﹀瓨鍦ㄥ強鍗曟嵁鐘舵��
+                        string sql = "select * from YS_ReceiveOtherBillMain where HInterID = " + oBill.omodel.HMainSourceInterID;
+                        ds = oCN.RunProcReturn(sql, "YS_ReceiveOtherBillMain");
+                        if (ds == null || ds.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:婧愬崟-鐗规壒鐢宠鍗曚笉瀛樺湪!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else if (ds.Tables[0].Rows[0]["HBillStatus"].ToString() != "2")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:婧愬崟-鐗规壒鐢宠鍗曟湭澶勪簬宸插鏍哥姸鎬�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        
+                     
+                    }
+
+                    //瀹℃牳鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_YS_ReceiveOtherBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveOtherBill_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_YS_ReceiveOtherBill_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_YS_ReceiveOtherBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveOtherBill_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_YS_ReceiveOtherBill_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("YS_ReceiveOtherBill/CloseYS_ReceiveOtherBill")]
+        [HttpGet]
+        public object CloseYS_ReceiveOtherBill(int HInterID, int IsAudit, string CurUserName)
+        {
+            string ModRightNameCheck = "YS_ReceiveOtherBill_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.ClsYS_ReceiveOtherBill oBill = new DAL.ClsYS_ReceiveOtherBill();              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                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("YS_ReceiveOtherBill/DeleteYS_ReceiveOtherBill")]
+        [HttpGet]
+        public object DeleteYS_ReceiveOtherBill(int HInterID, int IsAudit, string CurUserName)
+        {
+            string ModRightNameCheck = "YS_ReceiveOtherBill_Delete";
+            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.ClsYS_ReceiveOtherBill oBill = new DAL.ClsYS_ReceiveOtherBill();              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                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
+
+      
+    }
+}
\ No newline at end of file
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_DuSubsidyItemBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_DuSubsidyItemBillController.cs"
index c4b7cf1..631f096 100644
--- "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_DuSubsidyItemBillController.cs"
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_DuSubsidyItemBillController.cs"
@@ -18,19 +18,589 @@
 {
     public class Pay_DuSubsidyItemBillController : ApiController
     {
-        public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
-        private json objJsonResult = new json();
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+        public const string ModName = "2233";                   //鍗曟嵁绫诲瀷
+        public const string ModCaption = "鎵hˉ椤圭洰璐圭敤鍗�";          //鍗曟嵁鍚嶇О
+        public const string ModRightName = "Pay_DuSubsidyItemBill";
+        public const string ModRightNameList = ModRightName + "List";       //鍒楄〃
+        public const string ModRightNameEdit = ModRightName + "_Edit";      //缂栬緫
+        public const string ModRightNameCheck = ModRightName + "_Check";    //瀹℃牳
+        public const string ModRightNameClose = ModRightName + "_Close";    //鍏抽棴
+        public const string ModRightNameDelete = ModRightName + "_Delete";  //浣滃簾
+        public const string ModRightNameDrop = ModRightName + "_Drop";      //鍒犻櫎
+        public const string ModRightNameMoney = ModRightName + "_Money";    //閲戦
+        public const string ModRightNameQty = ModRightName + "_Qty";        //鏁伴噺
         public DataSet ds = new DataSet();
-        public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        private json objJsonResult = new json();
+        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+        public DAL.ClsPay_DuSubsidyItemBill oBill = new DAL.ClsPay_DuSubsidyItemBill();
+        public DAL.ClsPay_DuSubsidyItemBill BillOld = new DAL.ClsPay_DuSubsidyItemBill();
         DAL.ClsGy_Employee_View oEmp = new DAL.ClsGy_Employee_View();
         DAL.ClsGy_Department_View oDept = new DAL.ClsGy_Department_View();
         DAL.ClsGy_Group_View oGroup = new DAL.ClsGy_Group_View();
         DAL.ClsGy_ORGANIZATIONS_View oOrg = new DAL.ClsGy_ORGANIZATIONS_View();
         DAL.ClsGy_DuSubsidyItem_View oDuSItem = new DAL.ClsGy_DuSubsidyItem_View();
-        public DAL.ClsPay_DuSubsidyItemBill BillOld = new DAL.ClsPay_DuSubsidyItemBill();
-        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
-        string user_LongShan = "";
-        string HName_LongShan = "";
+
+
+        #region 鎵hˉ椤圭洰璐圭敤鍗曞垪琛�
+        /// <summary>
+        /// 鑾峰彇鎵hˉ椤圭洰璐圭敤鍗曞垪琛ㄤ俊鎭�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Pay_DuSubsidyItemBillController/GetPay_DuSubsidyItemBillList_Json")]
+        [HttpGet]
+        public object GetPay_DuSubsidyItemBillList_Json(string sWhere, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameList, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //杩斿洖鍒楄〃淇℃伅
+                ds = oCn.RunProcReturn("select * from h_v_Pay_DuSubsidyItemBillList where 1=1 " + sWhere + " order by hmainid desc", "h_v_Pay_DuSubsidyItemBillList");
+                List<object> columnNameList = new List<object>();
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));  //鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鍒楄〃淇℃伅澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鎵hˉ椤圭洰璐圭敤鍗曞垹闄�
+        /// <summary>
+        /// 鍒犻櫎鎵hˉ椤圭洰璐圭敤鍗�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Pay_DuSubsidyItemBillController/GetPay_DuSubsidyItemBill_Delete_Json")]
+        [HttpGet]
+        public object GetPay_DuSubsidyItemBill_Delete_Json(Int64 HInterID, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameDrop, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鍒犻櫎鍔熻兘鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //鍒犻櫎鍓嶆帶鍒�
+                    DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_DuSubsidyItemBill_BeforeDelCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_DuSubsidyItemBill_BeforeDelCtrl");
+                    if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎鍓嶅垽鏂け璐ワ紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍒犻櫎澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    //鍒犻櫎鍗曟嵁锛堝寘鍚垹闄ゅ悗鎺у埗銆佸啓鍏ユ棩蹇楋級
+                    if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Pay_DuSubsidyItemBill_AfterDelCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍒犻櫎鎵hˉ椤圭洰璐圭敤鍗曟垚鍔燂紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ユ墸琛ラ」鐩垂鐢ㄥ崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎鎵hˉ椤圭洰璐圭敤鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鎵hˉ椤圭洰璐圭敤鍗曞鏍�/鍙嶅鏍�
+        /// <summary>
+        /// 瀹℃牳/鍙嶅鏍告墸琛ラ」鐩垂鐢ㄥ崟
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">瀹℃牳(1),鍙嶅鏍�(2)</param>
+        /// <param name="HMaker">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Pay_DuSubsidyItemBillController/GetPay_DuSubsidyItemBill_Check_Json")]
+        [HttpGet]
+        public object GetPay_DuSubsidyItemBill_Check_Json(Int64 HInterID, int Type, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡瀹℃牳/鍙嶅鏍稿姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    //Type 1 瀹℃牳  2  鍙嶅鏍�
+                    if (Type == 1)
+                    {
+                        if (oBill.omodel.HChecker.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍革紝涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        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;
+                        }
+                        //瀹℃牳鍓嶆帶鍒�
+                        DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_DuSubsidyItemBill_BeforeCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_DuSubsidyItemBill_BeforeCheckCtrl");
+                        if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳鍓嶅垽鏂け璐ワ紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                        }
+                        //瀹℃牳鍗曟嵁
+                        if (!oBill.CheckBill(HInterID, oBill.omodel.HBillNo, "h_p_Pay_DuSubsidyItemBill_AfterCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 瀹℃牳鎴愬姛锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                    else
+                    {
+                        if (oBill.omodel.HChecker.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍革紝涓嶉渶瑕佸弽瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅鏍稿墠鎺у埗
+                        DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_DuSubsidyItemBill_BeforeUnCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_DuSubsidyItemBill_BeforeUnCheckCtrl");
+                        if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅鏍稿墠鍒ゆ柇澶辫触锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "鍙嶅鏍稿け璐ワ紒" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                        }
+
+                        //鍙嶅鏍稿崟鎹�
+                        if (!oBill.AbandonCheck(HInterID, oBill.omodel.HBillNo, "h_p_Pay_DuSubsidyItemBill_AfterUnCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶅鏍告垚鍔燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ユ墸琛ラ」鐩垂鐢ㄥ崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "瀹℃牳鎴栧弽瀹℃牳鎵hˉ椤圭洰璐圭敤鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鎵hˉ椤圭洰璐圭敤鍗曞叧闂�/鍙嶅叧闂�
+        /// <summary>
+        /// 鍏抽棴/鍙嶅叧闂墸琛ラ」鐩垂鐢ㄥ崟
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">鍏抽棴(1),鍙嶅叧闂�(2)</param>
+        /// <param name="HMaker">鍏抽棴浜�</param>
+        /// <returns></returns>
+        [Route("Pay_DuSubsidyItemBillController/GetPay_DuSubsidyItemBill_Close_Json")]
+        [HttpGet]
+        public object GetPay_DuSubsidyItemBill_Close_Json(Int64 HInterID, int Type, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameClose, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鍏抽棴/鍙嶅叧闂姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    //Type 1 鍏抽棴  2  鍙嶅叧闂�
+                    if (Type == 1)
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂紝涓嶈兘鍐嶆鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍏抽棴鍗曟嵁
+                        if (!oBill.CloseBill(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍏抽棴鎴愬姛锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                    else
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈叧闂紝涓嶉渶瑕佸弽鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅叧闂崟鎹�
+                        if (!oBill.CancelClose(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶅叧闂垚鍔燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ユ墸琛ラ」鐩垂鐢ㄥ崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍏抽棴鎴栧弽鍏抽棴鎵hˉ椤圭洰璐圭敤鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鎵hˉ椤圭洰璐圭敤鍗曚綔搴�/鍙嶄綔搴�
+        /// <summary>
+        /// 浣滃簾/鍙嶄綔搴熸墸琛ラ」鐩垂鐢ㄥ崟
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">浣滃簾(1),鍙嶄綔搴�(2)</param>
+        /// <param name="HMaker">浣滃簾浜�</param>
+        /// <returns></returns>
+        [Route("Pay_DuSubsidyItemBillController/GetPay_DuSubsidyItemBill_Cancelltion_Json")]
+        [HttpGet]
+        public object GetPay_DuSubsidyItemBill_Cancelltion_Json(Int64 HInterID, int Type, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡浣滃簾/鍙嶄綔搴熷姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    //Type 1 浣滃簾  2  鍙嶄綔搴�
+                    if (Type == 1)
+                    {
+                        if (oBill.omodel.HDeleteMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴燂紝涓嶈兘鍐嶆浣滃簾锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //浣滃簾鍗曟嵁
+                        if (!oBill.Cancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 浣滃簾鎴愬姛锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                    else
+                    {
+                        if (oBill.omodel.HDeleteMan.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈綔搴燂紝涓嶉渶瑕佸弽浣滃簾锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶄綔搴熷崟鎹�
+                        if (!oBill.AbandonCancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶄綔搴熸垚鍔燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ユ墸琛ラ」鐩垂鐢ㄥ崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "浣滃簾鎴栧弽浣滃簾鎵hˉ椤圭洰璐圭敤鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
+
 
         #region 鎵hˉ椤圭洰璐圭敤鍗� 鏂板/缂栬緫
         #region 鎵hˉ椤圭洰璐圭敤鍗� 琛ㄥご鏁版嵁
@@ -92,19 +662,19 @@
             var _value = sMainSub["sMainSub"].ToString();
             string msg1 = _value.ToString();
             //寮�濮嬩簨鍔�
-            oCN.BeginTran();
+            oCn.BeginTran();
             //淇濆瓨涓昏〃
             objJsonResult = AddBillMain_Pay_DuSubsidyItemBill(msg1);
             if (objJsonResult.code == "0")
             {
-                oCN.RollBack();
+                oCn.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = objJsonResult.Message;
                 objJsonResult.data = null;
                 return objJsonResult;
             }
-            oCN.Commit();
+            oCn.Commit();
             objJsonResult.code = "1";
             objJsonResult.count = 1;
             objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
@@ -189,7 +759,7 @@
 
                 //if (OperationType == 2)
                 //{
-                //    ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
+                //    ds = oCn.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
                 //    if (ds.Tables[0].Rows.Count > 0)
                 //    {
                 //        objJsonResult.code = "0";
@@ -200,7 +770,7 @@
                 //    }
                 //}
 
-                ds = oCN.RunProcReturn("select * from Pay_DuSubsidyItemBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_DuSubsidyItemBillMain");
+                ds = oCn.RunProcReturn("select * from Pay_DuSubsidyItemBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_DuSubsidyItemBillMain");
 
                 if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
                 {
@@ -226,9 +796,9 @@
                         "')";
 
                     //涓昏〃
-                    oCN.RunProc(sql);
+                    oCn.RunProc(sql);
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板鎵hˉ椤圭洰璐圭敤鍗�:" + HBillNo);
-                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板鎵hˉ椤圭洰璐圭敤鍗曪細" + HBillNo + "','LMES-鎵hˉ椤圭洰璐圭敤鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+                    oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板鎵hˉ椤圭洰璐圭敤鍗曪細" + HBillNo + "','LMES-鎵hˉ椤圭洰璐圭敤鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)                    //缂栬緫
                 {
@@ -246,13 +816,13 @@
                         "', HUpdateDate = '" + HUpdaterDate +
                         "' where HInterID = " + HInterID;
 
-                    oCN.RunProc(sql);
+                    oCn.RunProc(sql);
 
                     //鍒犻櫎瀛愯〃
-                    oCN.RunProc("delete from Pay_DuSubsidyItemBillSub where HInterID= " + HInterID);
+                    oCn.RunProc("delete from Pay_DuSubsidyItemBillSub where HInterID= " + HInterID);
                     //璁板綍鏃ュ織
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼鎵hˉ椤圭洰璐圭敤鍗�:" + HBillNo);
-                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼鎵hˉ椤圭洰璐圭敤鍗曪細" + HBillNo + "','LMES-鎵hˉ椤圭洰璐圭敤鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+                    oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼鎵hˉ椤圭洰璐圭敤鍗曪細" + HBillNo + "','LMES-鎵hˉ椤圭洰璐圭敤鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 //淇濆瓨瀛愯〃
                 objJsonResult = AddBillSub1_Pay_DuSubsidyItemBill(msg3, HInterID, HBillNo, OperationType);
@@ -313,7 +883,7 @@
                     ",'" + HRemark +
                     "')";
 
-                oCN.RunProc(sql);
+                oCn.RunProc(sql);
             }
 
             objJsonResult.code = "1";
@@ -324,6 +894,7 @@
         }
         #endregion
         #endregion
+
         #region 鎵hˉ椤圭洰璐圭敤鍗� 缂栬緫-椤甸潰璧嬪��
         /// <summary>
         ///鍙傛暟锛歴tring HInterID銆�
@@ -356,7 +927,7 @@
                     return objJsonResult;
                 }
 
-                ds = oCN.RunProcReturn("exec h_p_Pay_DuSubsidyItemBill_EditInit " + HInterID, "h_p_Pay_DuSubsidyItemBill_EditInit");
+                ds = oCn.RunProcReturn("exec h_p_Pay_DuSubsidyItemBill_EditInit " + HInterID, "h_p_Pay_DuSubsidyItemBill_EditInit");
                 tableList.Add(ds.Tables[0]);
                 tableList.Add(ds.Tables[1]);
 
@@ -376,438 +947,6 @@
             }
         }
         #endregion
-
-        #region 鎵hˉ椤圭洰璐圭敤鍗� 鏌ヨ
-        [Route("Pay_DuSubsidyItemBill/list")]
-        [HttpGet]
-        public object getDuSubsidyItemBillList(string sWhere, string user)
-        {
-            try
-            {
-                List<object> columnNameList = new List<object>();
-                if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBillList", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-
-                if (sWhere == null || sWhere.Equals(""))
-                {
-                    ds = oCN.RunProcReturn("select * from h_v_Pay_DuSubsidyItemBillList order by hmainid desc", "h_v_Pay_DuSubsidyItemBillList");
-                }
-                else
-                {
-                    string sql1 = "select * from h_v_Pay_DuSubsidyItemBillList where 1 = 1 ";
-                    string sql = sql1 + sWhere + " order by hmainid desc";
-                    ds = oCN.RunProcReturn(sql, "h_v_Pay_DuSubsidyItemBillList");
-                }
-
-                //娣诲姞鍒楀悕
-                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 e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "Exception锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-        #region 鎵hˉ椤圭洰璐圭敤鍗� 鍒犻櫎
-        /// <summary>
-        ///鍙傛暟锛歴tring HInterID銆�
-        ///杩斿洖鍊硷細object銆�
-        /// </summary>
-        [Route("Pay_DuSubsidyItemBill/delete")]
-        [HttpGet]
-        public object deleteDuSubsidyItemBill(string HInterID, string user)
-        {
-            try
-            {
-                //鏌ョ湅鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBill_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;
-                }
-
-                oCN.BeginTran();
-
-                oCN.RunProc("delete from Pay_DuSubsidyItemBillMain where HInterID = " + HInterID);
-                oCN.RunProc("delete from Pay_DuSubsidyItemBillSub where HInterID= " + HInterID);
-
-                oCN.Commit();
-
-                objJsonResult.code = "1";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "Sucess锛�";
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "Exception锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-
-        #region 鎵hˉ椤圭洰璐圭敤鍗� 瀹℃牳/鍙嶅鏍�
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="HInterID">鍗曟嵁ID</param>
-        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
-        /// <param name="CurUserName">瀹℃牳浜�</param>
-        /// <returns></returns>
-        [Route("Pay_DuSubsidyItemBill/AuditPay_DuSubsidyItemBill")]
-        [HttpGet]
-        public object AuditPay_DuSubsidyItemBill(string HInterID, int Type, string user)
-        {
-            try
-            {
-                //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBill_Check", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愬鏍�!";
-                    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 = "Pay_DuSubsidyItemBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-
-                //Type 1 瀹℃牳  2  鍙嶅鏍�
-                if (Type == 1)
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
-                    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 (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 (!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 (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 (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                }
-
-                oCN.Commit();//鎻愪氦浜嬪姟
-
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎵ц鎴愬姛锛�";
-                objJsonResult.data = null;
-                return objJsonResult; ;
-
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-        #region 鎵hˉ椤圭洰璐圭敤鍗� 鍏抽棴/鍙嶅叧闂姛鑳�
-        [Route("Pay_DuSubsidyItemBill/ClosePay_DuSubsidyItemBill")]
-        [HttpGet]
-        public object ClosePay_DuSubsidyItemBill(string HInterID, int Type, string user)
-        {
-            try
-            {
-                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBill_Close", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
-                    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 = "Pay_DuSubsidyItemBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-
-                //Type 1 鍏抽棴  2  鍙嶅叧闂�
-                if (Type == 1)
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴
-                    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 (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 (!BillOld.CloseBill(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 (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 (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                }
-
-                oCN.Commit();//鎻愪氦浜嬪姟
-
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎵ц鎴愬姛锛�";
-                objJsonResult.data = null;
-                return objJsonResult; ;
-
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-        #region 鎵hˉ椤圭洰璐圭敤鍗� 浣滃簾/鍙嶄綔搴熷姛鑳�
-        [Route("Pay_DuSubsidyItemBill/DropPay_DuSubsidyItemBill")]
-        [HttpGet]
-        public object DropPay_DuSubsidyItemBill(string HInterID, int Type, string user)
-        {
-            try
-            {
-                //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Pay_DuSubsidyItemBill_Drop", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愪綔搴�!";
-                    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 = "Pay_DuSubsidyItemBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-
-                //Type 1 浣滃簾  2  鍙嶄綔搴�
-                if (Type == 1)
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾
-                    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 (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 (!BillOld.Cancelltion(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 (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 (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                }
-
-                oCN.Commit();//鎻愪氦浜嬪姟
-
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎵ц鎴愬姛锛�";
-                objJsonResult.data = null;
-                return objJsonResult; ;
-
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-
 
         #region 鎵hˉ椤圭洰璐圭敤鍗� 鏁版嵁瀵煎叆
         #region 鑾峰彇瀵煎叆鏂囦欢鐨勬暟鎹�
@@ -891,7 +1030,7 @@
                     error += "娌℃湁鎵惧埌銆愯亴鍛樺悕绉般�戠殑鏍囬,";
                 ////鑾峰彇鎵�鏈夌殑鎵hˉ椤圭洰锛屽垽瀹氬鍏ユ枃浠朵腑鏈寘鍚殑鎵hˉ椤圭洰
                 //DataSet ds_DuSubsidyItem;
-                //ds_DuSubsidyItem = oCN.RunProcReturn("select * from Gy_DuSubsidyItem", "Gy_DuSubsidyItem");
+                //ds_DuSubsidyItem = oCn.RunProcReturn("select * from Gy_DuSubsidyItem", "Gy_DuSubsidyItem");
                 //if (ds_DuSubsidyItem.Tables[0] != null)
                 //{
                 //    for (int i = 0; i < ds_DuSubsidyItem.Tables[0].Rows.Count; i++)
@@ -917,9 +1056,9 @@
                     return objJsonResult;
                 }
 
-                oCN.BeginTran();
+                oCn.BeginTran();
                 //鍒犻櫎涓存椂琛ㄦ暟鎹�
-                oCN.RunProc("delete from diyipi_Pay_DuSubsidyItemBill");
+                oCn.RunProc("delete from diyipi_Pay_DuSubsidyItemBill");
 
                 //涓存椂琛ㄦ坊鍔犳暟鎹�
                 for (int i = 0; i < tb2.Rows.Count; i++)
@@ -971,12 +1110,12 @@
                                 "'," + HMoney +
                                 ",'" + tb2.Rows[i]["琛ㄤ綋澶囨敞"] +
                                 "')";
-                            oCN.RunProc(sql);
+                            oCn.RunProc(sql);
                         }
                     }
                     
                 }
-                oCN.Commit();
+                oCn.Commit();
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -1135,7 +1274,7 @@
                     return objJsonResult;
                 }
                 //鑾峰彇涓存椂琛ㄦ暟鎹�
-                ds = oCN.RunProcReturn("select * from diyipi_Pay_DuSubsidyItemBill order by HDate desc,HYear desc,HPeriod desc,HOrgID desc,HDeptID desc,HGroupID desc,HRemarkMain desc,HEmpID desc", "diyipi_Pay_DuSubsidyItemBill");
+                ds = oCn.RunProcReturn("select * from diyipi_Pay_DuSubsidyItemBill order by HDate desc,HYear desc,HPeriod desc,HOrgID desc,HDeptID desc,HGroupID desc,HRemarkMain desc,HEmpID desc", "diyipi_Pay_DuSubsidyItemBill");
                 if (ds==null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -1145,7 +1284,7 @@
                     return objJsonResult;
                 }
                 //淇濆瓨鏁版嵁
-                oCN.BeginTran();
+                oCn.BeginTran();
                 DataTable dt = ds.Tables[0];
                 Pay_DuSubsidyItemBillMain mainTable = new Pay_DuSubsidyItemBillMain();
                 List<Pay_DuSubsidyItemBillSub> subTable = new List<Pay_DuSubsidyItemBillSub>();
@@ -1219,7 +1358,7 @@
                 }
 
 
-                oCN.Commit();
+                oCn.Commit();
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -1270,7 +1409,7 @@
                 string HMaker = mainList[0].HMaker;
                 string HMakerDate = mainList[0].HMakerDate;
                
-                ds = oCN.RunProcReturn("select * from Pay_DuSubsidyItemBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_DuSubsidyItemBillMain");
+                ds = oCn.RunProcReturn("select * from Pay_DuSubsidyItemBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_DuSubsidyItemBillMain");
 
                 //涓昏〃娣诲姞鏁版嵁
                 string sql = "insert into Pay_DuSubsidyItemBillMain" +
@@ -1295,9 +1434,9 @@
                     "')";
 
                 //涓昏〃
-                oCN.RunProc(sql);
+                oCn.RunProc(sql);
                 LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板鎵hˉ椤圭洰璐圭敤鍗�:" + HBillNo);
-                oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板鎵hˉ椤圭洰璐圭敤鍗曪細" + HBillNo + "','LMES-鎵hˉ椤圭洰璐圭敤鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+                oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板鎵hˉ椤圭洰璐圭敤鍗曪細" + HBillNo + "','LMES-鎵hˉ椤圭洰璐圭敤鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 
                
                 //淇濆瓨瀛愯〃
@@ -1358,7 +1497,7 @@
                     ",'" + HRemark +
                     "')";
 
-                oCN.RunProc(sql);
+                oCn.RunProc(sql);
             }
 
             objJsonResult.code = "1";
@@ -1379,7 +1518,7 @@
             {
                 //鑾峰彇鏈鐢ㄧ殑鎵hˉ椤圭洰
                 string sql = "select * from Gy_DuSubsidyItem where HStopFlag = 0";
-                ds = oCN.RunProcReturn(sql, "Gy_DuSubsidyItem");
+                ds = oCn.RunProcReturn(sql, "Gy_DuSubsidyItem");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_OutApplyBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_OutApplyBillController.cs"
index 868ad54..34e3fdc 100644
--- "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_OutApplyBillController.cs"
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_OutApplyBillController.cs"
@@ -15,13 +15,588 @@
 {
     public class Pay_OutApplyBillController : ApiController
     {
-        public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
-        private json objJsonResult = new json();
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+        public const string ModName = "2221";                   //鍗曟嵁绫诲瀷
+        public const string ModCaption = "璇峰亣鐢宠鍗�";          //鍗曟嵁鍚嶇О
+        public const string ModRightName = "Pay_OutApplyBill";
+        public const string ModRightNameList = ModRightName + "List";       //鍒楄〃
+        public const string ModRightNameEdit = ModRightName + "_Edit";      //缂栬緫
+        public const string ModRightNameCheck = ModRightName + "_Check";    //瀹℃牳
+        public const string ModRightNameClose = ModRightName + "_Close";    //鍏抽棴
+        public const string ModRightNameDelete = ModRightName + "_Delete";  //浣滃簾
+        public const string ModRightNameDrop = ModRightName + "_Drop";      //鍒犻櫎
+        public const string ModRightNameMoney = ModRightName + "_Money";    //閲戦
+        public const string ModRightNameQty = ModRightName + "_Qty";        //鏁伴噺
         public DataSet ds = new DataSet();
-        public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        private json objJsonResult = new json();
+        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+        public DAL.ClsPay_OutApplyBill oBill = new DAL.ClsPay_OutApplyBill();
         public DAL.ClsPay_OutApplyBill BillOld = new DAL.ClsPay_OutApplyBill();
-        string user_LongShan = "";
-        string HName_LongShan = "";
+
+
+        #region 璇峰亣鐢宠鍗曞垪琛�
+        /// <summary>
+        /// 鑾峰彇璇峰亣鐢宠鍗曞垪琛ㄤ俊鎭�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Pay_OutApplyBillController/GetPay_OutApplyBillList_Json")]
+        [HttpGet]
+        public object GetPay_OutApplyBillList_Json(string sWhere, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameList, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //杩斿洖鍒楄〃淇℃伅
+                ds = oCn.RunProcReturn("select * from h_v_Pay_OutApplyBillList where 1=1 " + sWhere + " order by hmainid desc", "h_v_Pay_OutApplyBillList");
+                List<object> columnNameList = new List<object>();
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));  //鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鍒楄〃淇℃伅澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 璇峰亣鐢宠鍗曞垹闄�
+        /// <summary>
+        /// 鍒犻櫎璇峰亣鐢宠鍗�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Pay_OutApplyBillController/GetPay_OutApplyBill_Delete_Json")]
+        [HttpGet]
+        public object GetPay_OutApplyBill_Delete_Json(Int64 HInterID, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameDrop, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鍒犻櫎鍔熻兘鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //鍒犻櫎鍓嶆帶鍒�
+                    DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_OutApplyBill_BeforeDelCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_OutApplyBill_BeforeDelCtrl");
+                    if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎鍓嶅垽鏂け璐ワ紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍒犻櫎澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    //鍒犻櫎鍗曟嵁锛堝寘鍚垹闄ゅ悗鎺у埗銆佸啓鍏ユ棩蹇楋級
+                    if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Pay_OutApplyBill_AfterDelCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍒犻櫎璇峰亣鐢宠鍗曟垚鍔燂紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ヨ鍋囩敵璇峰崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎璇峰亣鐢宠鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 璇峰亣鐢宠鍗曞鏍�/鍙嶅鏍�
+        /// <summary>
+        /// 瀹℃牳/鍙嶅鏍歌鍋囩敵璇峰崟
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">瀹℃牳(1),鍙嶅鏍�(2)</param>
+        /// <param name="HMaker">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Pay_OutApplyBillController/GetPay_OutApplyBill_Check_Json")]
+        [HttpGet]
+        public object GetPay_OutApplyBill_Check_Json(Int64 HInterID, int Type, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡瀹℃牳/鍙嶅鏍稿姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    //Type 1 瀹℃牳  2  鍙嶅鏍�
+                    if (Type == 1)
+                    {
+                        if (oBill.omodel.HChecker.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍革紝涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        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;
+                        }
+                        //瀹℃牳鍓嶆帶鍒�
+                        DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_OutApplyBill_BeforeCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_OutApplyBill_BeforeCheckCtrl");
+                        if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳鍓嶅垽鏂け璐ワ紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                        }
+                        //瀹℃牳鍗曟嵁
+                        if (!oBill.CheckBill(HInterID, oBill.omodel.HBillNo, "h_p_Pay_OutApplyBill_AfterCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 瀹℃牳鎴愬姛锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                    else
+                    {
+                        if (oBill.omodel.HChecker.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍革紝涓嶉渶瑕佸弽瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅鏍稿墠鎺у埗
+                        DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_OutApplyBill_BeforeUnCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_OutApplyBill_BeforeUnCheckCtrl");
+                        if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅鏍稿墠鍒ゆ柇澶辫触锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "鍙嶅鏍稿け璐ワ紒" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                        }
+
+                        //鍙嶅鏍稿崟鎹�
+                        if (!oBill.AbandonCheck(HInterID, oBill.omodel.HBillNo, "h_p_Pay_OutApplyBill_AfterUnCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶅鏍告垚鍔燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ヨ鍋囩敵璇峰崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "瀹℃牳鎴栧弽瀹℃牳璇峰亣鐢宠鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 璇峰亣鐢宠鍗曞叧闂�/鍙嶅叧闂�
+        /// <summary>
+        /// 鍏抽棴/鍙嶅叧闂鍋囩敵璇峰崟
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">鍏抽棴(1),鍙嶅叧闂�(2)</param>
+        /// <param name="HMaker">鍏抽棴浜�</param>
+        /// <returns></returns>
+        [Route("Pay_OutApplyBillController/GetPay_OutApplyBill_Close_Json")]
+        [HttpGet]
+        public object GetPay_OutApplyBill_Close_Json(Int64 HInterID, int Type, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameClose, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鍏抽棴/鍙嶅叧闂姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    //Type 1 鍏抽棴  2  鍙嶅叧闂�
+                    if (Type == 1)
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂紝涓嶈兘鍐嶆鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍏抽棴鍗曟嵁
+                        if (!oBill.CloseBill(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍏抽棴鎴愬姛锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                    else
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈叧闂紝涓嶉渶瑕佸弽鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅叧闂崟鎹�
+                        if (!oBill.CancelClose(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶅叧闂垚鍔燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ヨ鍋囩敵璇峰崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍏抽棴鎴栧弽鍏抽棴璇峰亣鐢宠鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 璇峰亣鐢宠鍗曚綔搴�/鍙嶄綔搴�
+        /// <summary>
+        /// 浣滃簾/鍙嶄綔搴熻鍋囩敵璇峰崟
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">浣滃簾(1),鍙嶄綔搴�(2)</param>
+        /// <param name="HMaker">浣滃簾浜�</param>
+        /// <returns></returns>
+        [Route("Pay_OutApplyBillController/GetPay_OutApplyBill_Cancelltion_Json")]
+        [HttpGet]
+        public object GetPay_OutApplyBill_Cancelltion_Json(Int64 HInterID, int Type, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡浣滃簾/鍙嶄綔搴熷姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    //Type 1 浣滃簾  2  鍙嶄綔搴�
+                    if (Type == 1)
+                    {
+                        if (oBill.omodel.HDeleteMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴燂紝涓嶈兘鍐嶆浣滃簾锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //浣滃簾鍗曟嵁
+                        if (!oBill.Cancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 浣滃簾鎴愬姛锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                    else
+                    {
+                        if (oBill.omodel.HDeleteMan.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈綔搴燂紝涓嶉渶瑕佸弽浣滃簾锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶄綔搴熷崟鎹�
+                        if (!oBill.AbandonCancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶄綔搴熸垚鍔燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ヨ鍋囩敵璇峰崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "浣滃簾鎴栧弽浣滃簾璇峰亣鐢宠鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
+
+
+
+
+
 
         #region 璇峰亣鐢宠鍗� 鏂板/缂栬緫
         #region 璇峰亣鐢宠鍗� 琛ㄥご鏁版嵁
@@ -90,19 +665,19 @@
             var _value = sMainSub["sMainSub"].ToString();
             string msg1 = _value.ToString();
             //寮�濮嬩簨鍔�
-            oCN.BeginTran();
+            oCn.BeginTran();
             //淇濆瓨涓昏〃
             objJsonResult = AddBillMain_Pay_OutApplyBill(msg1);
             if (objJsonResult.code == "0")
             {
-                oCN.RollBack();
+                oCn.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = objJsonResult.Message;
                 objJsonResult.data = null;
                 return objJsonResult;
             }
-            oCN.Commit();
+            oCn.Commit();
             objJsonResult.code = "1";
             objJsonResult.count = 1;
             objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
@@ -191,7 +766,7 @@
 
                 //if (OperationType == 2)
                 //{
-                //    ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
+                //    ds = oCn.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
                 //    if (ds.Tables[0].Rows.Count > 0)
                 //    {
                 //        objJsonResult.code = "0";
@@ -202,7 +777,7 @@
                 //    }
                 //}
 
-                ds = oCN.RunProcReturn("select * from Pay_OutApplyBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_OutApplyBillMain");
+                ds = oCn.RunProcReturn("select * from Pay_OutApplyBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_OutApplyBillMain");
 
                 if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
                 {
@@ -229,9 +804,9 @@
                         "')";
 
                     //涓昏〃
-                    oCN.RunProc(sql);
+                    oCn.RunProc(sql);
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板璇峰亣鐢宠鍗�:" + HBillNo);
-                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板璇峰亣鐢宠鍗曪細" + HBillNo + "','LMES-璇峰亣鐢宠鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+                    oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板璇峰亣鐢宠鍗曪細" + HBillNo + "','LMES-璇峰亣鐢宠鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)                    //缂栬緫
                 {
@@ -251,13 +826,13 @@
                         "', HUpdateDate = '" + HUpdaterDate +
                         "' where HInterID = " + HInterID;
 
-                    oCN.RunProc(sql);
+                    oCn.RunProc(sql);
 
                     //鍒犻櫎瀛愯〃
-                    oCN.RunProc("delete from Pay_OutApplyBillSub where HInterID= " + HInterID);
+                    oCn.RunProc("delete from Pay_OutApplyBillSub where HInterID= " + HInterID);
                     //璁板綍鏃ュ織
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼璇峰亣鐢宠鍗�:" + HBillNo);
-                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼璇峰亣鐢宠鍗曪細" + HBillNo + "','LMES-璇峰亣鐢宠鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+                    oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼璇峰亣鐢宠鍗曪細" + HBillNo + "','LMES-璇峰亣鐢宠鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 //淇濆瓨瀛愯〃
                 objJsonResult = AddBillSub1_Pay_OutApplyBill(msg3, HInterID, HBillNo, OperationType);
@@ -326,7 +901,7 @@
                             "," + HRelTimes +
                             ",'" + HRemark +
                             "')";
-                oCN.RunProc(sql);
+                oCn.RunProc(sql);
             }
 
             objJsonResult.code = "1";
@@ -370,7 +945,7 @@
                     return objJsonResult;
                 }
 
-                ds = oCN.RunProcReturn("select * from Pay_OutApplyBillMain where HInterID = " + HInterID, "Pay_OutApplyBillMain");
+                ds = oCn.RunProcReturn("select * from Pay_OutApplyBillMain where HInterID = " + HInterID, "Pay_OutApplyBillMain");
                 string[] HBillStatusList = { "", "鏈", "瀹℃牳閫氳繃", "鍏抽棴", "浣滃簾", "瀹℃牳閫�鍥�", "瀹℃牳涓�", "宸查槄", "宸插洖澶�", "缁撴", "楠岃瘉", "涓嬭揪", "寮�宸�", "鐢宠瀹℃壒", "", "鐢宠妫�楠�", "鍒ゅ畾鍚堟牸", "鍒ゅ畾涓嶅悎鏍�" };
                 if (ds.Tables[0].Rows.Count > 0 && int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1)
                 {
@@ -383,7 +958,7 @@
                 }
 
 
-                ds = oCN.RunProcReturn("exec h_p_Pay_OutApplyBill_EditInit " + HInterID, "h_p_Pay_OutApplyBill_EditInit");
+                ds = oCn.RunProcReturn("exec h_p_Pay_OutApplyBill_EditInit " + HInterID, "h_p_Pay_OutApplyBill_EditInit");
                 tableList.Add(ds.Tables[0]);
                 tableList.Add(ds.Tables[1]);
 
@@ -404,435 +979,6 @@
         }
         #endregion
 
-        #region 璇峰亣鐢宠鍗� 鏌ヨ
-        [Route("Pay_OutApplyBill/list")]
-        [HttpGet]
-        public object getOutApplyBillList(string sWhere, string user)
-        {
-            try
-            {
-                List<object> columnNameList = new List<object>();
-                if (!DBUtility.ClsPub.Security_Log("Pay_OutApplyBillList", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
 
-                if (sWhere == null || sWhere.Equals(""))
-                {
-                    ds = oCN.RunProcReturn("select * from h_v_Pay_OutApplyBillList order by hmainid desc", "h_v_Pay_OutApplyBillList");
-                }
-                else
-                {
-                    string sql1 = "select * from h_v_Pay_OutApplyBillList where 1 = 1 ";
-                    string sql = sql1 + sWhere + " order by hmainid desc";
-                    ds = oCN.RunProcReturn(sql, "h_v_Pay_OutApplyBillList");
-                }
-
-                //娣诲姞鍒楀悕
-                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 e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "Exception锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-        #region 璇峰亣鐢宠鍗� 鍒犻櫎
-        /// <summary>
-        ///鍙傛暟锛歴tring HInterID銆�
-        ///杩斿洖鍊硷細object銆�
-        /// </summary>
-        [Route("Pay_OutApplyBill/delete")]
-        [HttpGet]
-        public object deleteOutApplyBill(string HInterID, string user)
-        {
-            try
-            {
-                //鏌ョ湅鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log("Pay_OutApplyBill_Drop", 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;
-                }
-
-                oCN.BeginTran();
-
-                oCN.RunProc("delete from Pay_OutApplyBillMain where HInterID = " + HInterID);
-                oCN.RunProc("delete from Pay_OutApplyBillSub where HInterID= " + HInterID);
-
-                oCN.Commit();
-
-                objJsonResult.code = "1";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "Sucess锛�";
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "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("Pay_OutApplyBill/AuditPay_OutApplyBill")]
-        [HttpGet]
-        public object AuditPay_OutApplyBill(string HInterID, int Type, string user)
-        {
-            try
-            {
-                //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Pay_OutApplyBill_Check", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愬鏍�!";
-                    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 = "Pay_OutApplyBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-
-                //Type 1 瀹℃牳  2  鍙嶅鏍�
-                if (Type == 1)
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
-                    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 (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 (!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 (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 (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                }
-
-                oCN.Commit();//鎻愪氦浜嬪姟
-
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎵ц鎴愬姛锛�";
-                objJsonResult.data = null;
-                return objJsonResult; ;
-
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-        #region 璇峰亣鐢宠鍗� 鍏抽棴/鍙嶅叧闂姛鑳�
-        [Route("Pay_OutApplyBill/ClosePay_OutApplyBill")]
-        [HttpGet]
-        public object ClosePay_OutApplyBill(string HInterID, int Type, string user)
-        {
-            try
-            {
-                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Pay_OutApplyBill_Close", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
-                    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 = "Pay_OutApplyBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-
-                //Type 1 鍏抽棴  2  鍙嶅叧闂�
-                if (Type == 1)
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴
-                    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 (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 (!BillOld.CloseBill(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 (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 (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                }
-
-                oCN.Commit();//鎻愪氦浜嬪姟
-
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎵ц鎴愬姛锛�";
-                objJsonResult.data = null;
-                return objJsonResult; ;
-
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-        #region 璇峰亣鐢宠鍗� 浣滃簾/鍙嶄綔搴熷姛鑳�
-        [Route("Pay_OutApplyBill/DropPay_OutApplyBill")]
-        [HttpGet]
-        public object DropPay_OutApplyBill(string HInterID, int Type, string user)
-        {
-            try
-            {
-                //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Pay_OutApplyBill_Delete", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愪綔搴�!";
-                    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 = "Pay_OutApplyBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-
-                //Type 1 浣滃簾  2  鍙嶄綔搴�
-                if (Type == 1)
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾
-                    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 (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 (!BillOld.Cancelltion(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 (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 (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                }
-
-                oCN.Commit();//鎻愪氦浜嬪姟
-
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎵ц鎴愬姛锛�";
-                objJsonResult.data = null;
-                return objJsonResult; ;
-
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
     }
 }
\ No newline at end of file
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_OverApplyBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_OverApplyBillController.cs"
index 602e540..0c5e960 100644
--- "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_OverApplyBillController.cs"
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_OverApplyBillController.cs"
@@ -15,13 +15,585 @@
 {
     public class Pay_OverApplyBillController : ApiController
     {
-        public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
-        private json objJsonResult = new json();
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+        public const string ModName = "2209";                   //鍗曟嵁绫诲瀷
+        public const string ModCaption = "鍔犵彮鐢宠鍗�";          //鍗曟嵁鍚嶇О
+        public const string ModRightName = "Pay_OverApplyBill";
+        public const string ModRightNameList = ModRightName + "List";       //鍒楄〃
+        public const string ModRightNameEdit = ModRightName + "_Edit";      //缂栬緫
+        public const string ModRightNameCheck = ModRightName + "_Check";    //瀹℃牳
+        public const string ModRightNameClose = ModRightName + "_Close";    //鍏抽棴
+        public const string ModRightNameDelete = ModRightName + "_Delete";  //浣滃簾
+        public const string ModRightNameDrop = ModRightName + "_Drop";      //鍒犻櫎
+        public const string ModRightNameMoney = ModRightName + "_Money";    //閲戦
+        public const string ModRightNameQty = ModRightName + "_Qty";        //鏁伴噺
         public DataSet ds = new DataSet();
-        public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        private json objJsonResult = new json();
+        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+        public DAL.ClsPay_OverApplyBill oBill = new DAL.ClsPay_OverApplyBill();
         public DAL.ClsPay_OverApplyBill BillOld = new DAL.ClsPay_OverApplyBill();
-        string user_LongShan = "";
-        string HName_LongShan = "";
+
+
+        #region 鍔犵彮鐢宠鍗曞垪琛�
+        /// <summary>
+        /// 鑾峰彇鍔犵彮鐢宠鍗曞垪琛ㄤ俊鎭�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Pay_OverApplyBillController/GetPay_OverApplyBillList_Json")]
+        [HttpGet]
+        public object GetPay_OverApplyBillList_Json(string sWhere, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameList, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //杩斿洖鍒楄〃淇℃伅
+                ds = oCn.RunProcReturn("select * from h_v_Pay_OverApplyBillList where 1=1 " + sWhere + " order by hmainid desc", "h_v_Pay_OverApplyBillList");
+                List<object> columnNameList = new List<object>();
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));  //鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鍒楄〃淇℃伅澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鍔犵彮鐢宠鍗曞垹闄�
+        /// <summary>
+        /// 鍒犻櫎鍔犵彮鐢宠鍗�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Pay_OverApplyBillController/GetPay_OverApplyBill_Delete_Json")]
+        [HttpGet]
+        public object GetPay_OverApplyBill_Delete_Json(Int64 HInterID, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameDrop, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鍒犻櫎鍔熻兘鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //鍒犻櫎鍓嶆帶鍒�
+                    DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_OverApplyBill_BeforeDelCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_OverApplyBill_BeforeDelCtrl");
+                    if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎鍓嶅垽鏂け璐ワ紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍒犻櫎澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    //鍒犻櫎鍗曟嵁锛堝寘鍚垹闄ゅ悗鎺у埗銆佸啓鍏ユ棩蹇楋級
+                    if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Pay_OverApplyBill_AfterDelCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍒犻櫎鍔犵彮鐢宠鍗曟垚鍔燂紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ュ姞鐝敵璇峰崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎鍔犵彮鐢宠鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鍔犵彮鐢宠鍗曞鏍�/鍙嶅鏍�
+        /// <summary>
+        /// 瀹℃牳/鍙嶅鏍稿姞鐝敵璇峰崟
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">瀹℃牳(1),鍙嶅鏍�(2)</param>
+        /// <param name="HMaker">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Pay_OverApplyBillController/GetPay_OverApplyBill_Check_Json")]
+        [HttpGet]
+        public object GetPay_OverApplyBill_Check_Json(Int64 HInterID, int Type, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡瀹℃牳/鍙嶅鏍稿姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    //Type 1 瀹℃牳  2  鍙嶅鏍�
+                    if (Type == 1)
+                    {
+                        if (oBill.omodel.HChecker.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍革紝涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        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;
+                        }
+                        //瀹℃牳鍓嶆帶鍒�
+                        DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_OverApplyBill_BeforeCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_OverApplyBill_BeforeCheckCtrl");
+                        if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳鍓嶅垽鏂け璐ワ紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                        }
+                        //瀹℃牳鍗曟嵁
+                        if (!oBill.CheckBill(HInterID, oBill.omodel.HBillNo, "h_p_Pay_OverApplyBill_AfterCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 瀹℃牳鎴愬姛锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                    else
+                    {
+                        if (oBill.omodel.HChecker.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍革紝涓嶉渶瑕佸弽瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅鏍稿墠鎺у埗
+                        DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_OverApplyBill_BeforeUnCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_OverApplyBill_BeforeUnCheckCtrl");
+                        if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅鏍稿墠鍒ゆ柇澶辫触锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "鍙嶅鏍稿け璐ワ紒" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                        }
+
+                        //鍙嶅鏍稿崟鎹�
+                        if (!oBill.AbandonCheck(HInterID, oBill.omodel.HBillNo, "h_p_Pay_OverApplyBill_AfterUnCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶅鏍告垚鍔燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ュ姞鐝敵璇峰崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "瀹℃牳鎴栧弽瀹℃牳鍔犵彮鐢宠鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鍔犵彮鐢宠鍗曞叧闂�/鍙嶅叧闂�
+        /// <summary>
+        /// 鍏抽棴/鍙嶅叧闂姞鐝敵璇峰崟
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">鍏抽棴(1),鍙嶅叧闂�(2)</param>
+        /// <param name="HMaker">鍏抽棴浜�</param>
+        /// <returns></returns>
+        [Route("Pay_OverApplyBillController/GetPay_OverApplyBill_Close_Json")]
+        [HttpGet]
+        public object GetPay_OverApplyBill_Close_Json(Int64 HInterID, int Type, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameClose, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鍏抽棴/鍙嶅叧闂姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    //Type 1 鍏抽棴  2  鍙嶅叧闂�
+                    if (Type == 1)
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂紝涓嶈兘鍐嶆鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍏抽棴鍗曟嵁
+                        if (!oBill.CloseBill(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍏抽棴鎴愬姛锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                    else
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈叧闂紝涓嶉渶瑕佸弽鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅叧闂崟鎹�
+                        if (!oBill.CancelClose(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶅叧闂垚鍔燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ュ姞鐝敵璇峰崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍏抽棴鎴栧弽鍏抽棴鍔犵彮鐢宠鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鍔犵彮鐢宠鍗曚綔搴�/鍙嶄綔搴�
+        /// <summary>
+        /// 浣滃簾/鍙嶄綔搴熷姞鐝敵璇峰崟
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">浣滃簾(1),鍙嶄綔搴�(2)</param>
+        /// <param name="HMaker">浣滃簾浜�</param>
+        /// <returns></returns>
+        [Route("Pay_OverApplyBillController/GetPay_OverApplyBill_Cancelltion_Json")]
+        [HttpGet]
+        public object GetPay_OverApplyBill_Cancelltion_Json(Int64 HInterID, int Type, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡浣滃簾/鍙嶄綔搴熷姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    //Type 1 浣滃簾  2  鍙嶄綔搴�
+                    if (Type == 1)
+                    {
+                        if (oBill.omodel.HDeleteMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴燂紝涓嶈兘鍐嶆浣滃簾锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //浣滃簾鍗曟嵁
+                        if (!oBill.Cancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 浣滃簾鎴愬姛锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                    else
+                    {
+                        if (oBill.omodel.HDeleteMan.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈綔搴燂紝涓嶉渶瑕佸弽浣滃簾锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶄綔搴熷崟鎹�
+                        if (!oBill.AbandonCancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶄綔搴熸垚鍔燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ュ姞鐝敵璇峰崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "浣滃簾鎴栧弽浣滃簾鍔犵彮鐢宠鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
+
+
 
         #region 鍔犵彮鐢宠鍗� 鏂板/缂栬緫
         #region 鍔犵彮鐢宠鍗� 琛ㄥご鏁版嵁
@@ -85,19 +657,19 @@
             var _value = sMainSub["sMainSub"].ToString();
             string msg1 = _value.ToString();
             //寮�濮嬩簨鍔�
-            oCN.BeginTran();
+            oCn.BeginTran();
             //淇濆瓨涓昏〃
             objJsonResult = AddBillMain_Pay_OverApplyBill(msg1);
             if (objJsonResult.code == "0")
             {
-                oCN.RollBack();
+                oCn.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = objJsonResult.Message;
                 objJsonResult.data = null;
                 return objJsonResult;
             }
-            oCN.Commit();
+            oCn.Commit();
             objJsonResult.code = "1";
             objJsonResult.count = 1;
             objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
@@ -184,7 +756,7 @@
 
                 //if (OperationType == 2)
                 //{
-                //    ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
+                //    ds = oCn.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
                 //    if (ds.Tables[0].Rows.Count > 0)
                 //    {
                 //        objJsonResult.code = "0";
@@ -195,7 +767,7 @@
                 //    }
                 //}
 
-                ds = oCN.RunProcReturn("select * from Pay_OverApplyBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_PayMentBillMain");
+                ds = oCn.RunProcReturn("select * from Pay_OverApplyBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_PayMentBillMain");
 
                 if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
                 {
@@ -221,9 +793,9 @@
                         "')";
 
                     //涓昏〃
-                    oCN.RunProc(sql);
+                    oCn.RunProc(sql);
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板鍔犵彮鐢宠鍗�:" + HBillNo);
-                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板鍔犵彮鐢宠鍗曪細" + HBillNo + "','LMES-鍔犵彮鐢宠鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+                    oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板鍔犵彮鐢宠鍗曪細" + HBillNo + "','LMES-鍔犵彮鐢宠鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)                    //缂栬緫
                 {
@@ -242,13 +814,13 @@
                         "', HUpdateDate = '" + HUpdaterDate +
                         "' where HInterID = " + HInterID;
 
-                    oCN.RunProc(sql);
+                    oCn.RunProc(sql);
 
                     //鍒犻櫎瀛愯〃
-                    oCN.RunProc("delete from Pay_OverApplyBillSub where HInterID= " + HInterID);
+                    oCn.RunProc("delete from Pay_OverApplyBillSub where HInterID= " + HInterID);
                     //璁板綍鏃ュ織
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼鍔犵彮鐢宠鍗�:" + HBillNo);
-                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼鍔犵彮鐢宠鍗曪細" + HBillNo + "','LMES-鍔犵彮鐢宠鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+                    oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼鍔犵彮鐢宠鍗曪細" + HBillNo + "','LMES-鍔犵彮鐢宠鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 //淇濆瓨瀛愯〃
                 objJsonResult = AddBillSub1_Pay_OverApplyBill(msg3, HInterID, HBillNo, OperationType);
@@ -314,7 +886,7 @@
                     "," + HRelTimes +
                     ",'" + HRemark +
                     "')";
-                oCN.RunProc(sql);
+                oCn.RunProc(sql);
             }
 
             objJsonResult.code = "1";
@@ -357,7 +929,7 @@
                     return objJsonResult;
                 }
 
-                ds = oCN.RunProcReturn("select * from Pay_OverApplyBillMain where HInterID = " + HInterID, "Pay_PayMentBillMain");
+                ds = oCn.RunProcReturn("select * from Pay_OverApplyBillMain where HInterID = " + HInterID, "Pay_PayMentBillMain");
                 string[] HBillStatusList = { "", "鏈", "瀹℃牳閫氳繃", "鍏抽棴", "浣滃簾", "瀹℃牳閫�鍥�", "瀹℃牳涓�", "宸查槄", "宸插洖澶�", "缁撴", "楠岃瘉", "涓嬭揪", "寮�宸�", "鐢宠瀹℃壒", "", "鐢宠妫�楠�", "鍒ゅ畾鍚堟牸", "鍒ゅ畾涓嶅悎鏍�" };
                 if (ds.Tables[0].Rows.Count > 0 && int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString())>1)
                 {
@@ -370,7 +942,7 @@
                 }
 
 
-                ds = oCN.RunProcReturn("exec h_p_Pay_OverApplyBill_EditInit " + HInterID, "h_p_Pay_OverApplyBill_EditInit");
+                ds = oCn.RunProcReturn("exec h_p_Pay_OverApplyBill_EditInit " + HInterID, "h_p_Pay_OverApplyBill_EditInit");
                 tableList.Add(ds.Tables[0]);
                 tableList.Add(ds.Tables[1]);
 
@@ -391,435 +963,6 @@
         }
         #endregion
 
-        #region 鍔犵彮鐢宠鍗� 鏌ヨ
-        [Route("Pay_OverApplyBill/list")]
-        [HttpGet]
-        public object getOverApplyBillList(string sWhere, string user)
-        {
-            try
-            {
-                List<object> columnNameList = new List<object>();
-                if (!DBUtility.ClsPub.Security_Log("Pay_OverApplyBillList", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
 
-                if (sWhere == null || sWhere.Equals(""))
-                {
-                    ds = oCN.RunProcReturn("select * from h_v_Pay_OverApplyBillList order by hmainid desc", "h_v_Pay_OverApplyBillList");
-                }
-                else
-                {
-                    string sql1 = "select * from h_v_Pay_OverApplyBillList where 1 = 1 ";
-                    string sql = sql1 + sWhere + " order by hmainid desc";
-                    ds = oCN.RunProcReturn(sql, "h_v_Pay_OverApplyBillList");
-                }
-
-                //娣诲姞鍒楀悕
-                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 e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "Exception锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-        #region 鍔犵彮鐢宠鍗� 鍒犻櫎
-        /// <summary>
-        ///鍙傛暟锛歴tring HInterID銆�
-        ///杩斿洖鍊硷細object銆�
-        /// </summary>
-        [Route("Pay_OverApplyBill/delete")]
-        [HttpGet]
-        public object deleteOverApplyBill(string HInterID, string user)
-        {
-            try
-            {
-                //鏌ョ湅鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log("Pay_OverApplyBill_Drop", 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;
-                }
-
-                oCN.BeginTran();
-
-                oCN.RunProc("delete from Pay_OverApplyBillMain where HInterID = " + HInterID);
-                oCN.RunProc("delete from Pay_OverApplyBillSub where HInterID= " + HInterID);
-
-                oCN.Commit();
-
-                objJsonResult.code = "1";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "Sucess锛�";
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "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("Pay_OverApplyBill/AuditPay_OverApplyBill")]
-        [HttpGet]
-        public object AuditPay_OverApplyBill(string HInterID, int Type, string user)
-        {
-            try
-            {
-                //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Pay_OverApplyBill_Check", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愬鏍�!";
-                    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 = "Pay_OverApplyBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-
-                //Type 1 瀹℃牳  2  鍙嶅鏍�
-                if (Type == 1)
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
-                    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 (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 (!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 (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 (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                }
-
-                oCN.Commit();//鎻愪氦浜嬪姟
-
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎵ц鎴愬姛锛�";
-                objJsonResult.data = null;
-                return objJsonResult; ;
-
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-        #region 鍔犵彮鐢宠鍗� 鍏抽棴/鍙嶅叧闂姛鑳�
-        [Route("Pay_OverApplyBill/ClosePay_OverApplyBill")]
-        [HttpGet]
-        public object ClosePay_OverApplyBill(string HInterID, int Type, string user)
-        {
-            try
-            {
-                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Pay_OverApplyBill_Close", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
-                    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 = "Pay_OverApplyBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-
-                //Type 1 鍏抽棴  2  鍙嶅叧闂�
-                if (Type == 1)
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴
-                    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 (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 (!BillOld.CloseBill(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 (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 (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                }
-
-                oCN.Commit();//鎻愪氦浜嬪姟
-
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎵ц鎴愬姛锛�";
-                objJsonResult.data = null;
-                return objJsonResult; ;
-
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-        #region 鍔犵彮鐢宠鍗� 浣滃簾/鍙嶄綔搴熷姛鑳�
-        [Route("Pay_OverApplyBill/DropPay_OverApplyBill")]
-        [HttpGet]
-        public object DropPay_OverApplyBill(string HInterID, int Type, string user)
-        {
-            try
-            {
-                //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Pay_OverApplyBill_Delete", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愪綔搴�!";
-                    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 = "Pay_OverApplyBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-
-                //Type 1 浣滃簾  2  鍙嶄綔搴�
-                if (Type == 1)
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾
-                    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 (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 (!BillOld.Cancelltion(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 (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 (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                }
-
-                oCN.Commit();//鎻愪氦浜嬪姟
-
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎵ц鎴愬姛锛�";
-                objJsonResult.data = null;
-                return objJsonResult; ;
-
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
     }
 }
\ No newline at end of file
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_PayMentBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_PayMentBillController.cs"
index 9fcc17f..1149cb1 100644
--- "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_PayMentBillController.cs"
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_PayMentBillController.cs"
@@ -15,13 +15,587 @@
 {
     public class Pay_PayMentBillController : ApiController
     {
-        public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
-        private json objJsonResult = new json();
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+        public const string ModName = "2202";                   //鍗曟嵁绫诲瀷
+        public const string ModCaption = "宸ヨ祫鍗�";          //鍗曟嵁鍚嶇О
+        public const string ModRightName = "Pay_PayMentBill";
+        public const string ModRightNameList = ModRightName + "List";       //鍒楄〃
+        public const string ModRightNameEdit = ModRightName + "_Edit";      //缂栬緫
+        public const string ModRightNameCheck = ModRightName + "_Check";    //瀹℃牳
+        public const string ModRightNameClose = ModRightName + "_Close";    //鍏抽棴
+        public const string ModRightNameDelete = ModRightName + "_Delete";  //浣滃簾
+        public const string ModRightNameDrop = ModRightName + "_Drop";      //鍒犻櫎
+        public const string ModRightNameMoney = ModRightName + "_Money";    //閲戦
+        public const string ModRightNameQty = ModRightName + "_Qty";        //鏁伴噺
         public DataSet ds = new DataSet();
-        public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        private json objJsonResult = new json();
+        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+        public DAL.ClsPay_PayMentBill oBill = new DAL.ClsPay_PayMentBill();
         public DAL.ClsPay_PayMentBill BillOld = new DAL.ClsPay_PayMentBill();
-        string user_LongShan = "";
-        string HName_LongShan = "";
+
+
+        #region 宸ヨ祫鍗曞垪琛�
+        /// <summary>
+        /// 鑾峰彇宸ヨ祫鍗曞垪琛ㄤ俊鎭�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Pay_PayMentBillController/GetPay_PayMentBillList_Json")]
+        [HttpGet]
+        public object GetPay_PayMentBillList_Json(string sWhere, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameList, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //杩斿洖鍒楄〃淇℃伅
+                ds = oCn.RunProcReturn("select * from h_v_Pay_PayMentBillList where 1=1 " + sWhere + " order by hmainid desc", "h_v_Pay_PayMentBillList");
+                List<object> columnNameList = new List<object>();
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));  //鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鍒楄〃淇℃伅澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ヨ祫鍗曞垹闄�
+        /// <summary>
+        /// 鍒犻櫎宸ヨ祫鍗�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Pay_PayMentBillController/GetPay_PayMentBill_Delete_Json")]
+        [HttpGet]
+        public object GetPay_PayMentBill_Delete_Json(Int64 HInterID, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameDrop, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鍒犻櫎鍔熻兘鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //鍒犻櫎鍓嶆帶鍒�
+                    DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_PayMentBill_BeforeDelCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_PayMentBill_BeforeDelCtrl");
+                    if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎鍓嶅垽鏂け璐ワ紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍒犻櫎澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    //鍒犻櫎鍗曟嵁锛堝寘鍚垹闄ゅ悗鎺у埗銆佸啓鍏ユ棩蹇楋級
+                    if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Pay_PayMentBill_AfterDelCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍒犻櫎宸ヨ祫鍗曟垚鍔燂紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ュ伐璧勫崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎宸ヨ祫鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ヨ祫鍗曞鏍�/鍙嶅鏍�
+        /// <summary>
+        /// 瀹℃牳/鍙嶅鏍稿伐璧勫崟
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">瀹℃牳(1),鍙嶅鏍�(2)</param>
+        /// <param name="HMaker">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Pay_PayMentBillController/GetPay_PayMentBill_Check_Json")]
+        [HttpGet]
+        public object GetPay_PayMentBill_Check_Json(Int64 HInterID, int Type, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡瀹℃牳/鍙嶅鏍稿姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    //Type 1 瀹℃牳  2  鍙嶅鏍�
+                    if (Type == 1)
+                    {
+                        if (oBill.omodel.HChecker.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍革紝涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        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;
+                        }
+                        //瀹℃牳鍓嶆帶鍒�
+                        DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_PayMentBill_BeforeCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_PayMentBill_BeforeCheckCtrl");
+                        if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳鍓嶅垽鏂け璐ワ紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                        }
+                        //瀹℃牳鍗曟嵁
+                        if (!oBill.CheckBill(HInterID, oBill.omodel.HBillNo, "h_p_Pay_PayMentBill_AfterCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 瀹℃牳鎴愬姛锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                    else
+                    {
+                        if (oBill.omodel.HChecker.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍革紝涓嶉渶瑕佸弽瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅鏍稿墠鎺у埗
+                        DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Pay_PayMentBill_BeforeUnCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Pay_PayMentBill_BeforeUnCheckCtrl");
+                        if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅鏍稿墠鍒ゆ柇澶辫触锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "鍙嶅鏍稿け璐ワ紒" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                        }
+
+                        //鍙嶅鏍稿崟鎹�
+                        if (!oBill.AbandonCheck(HInterID, oBill.omodel.HBillNo, "h_p_Pay_PayMentBill_AfterUnCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶅鏍告垚鍔燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ュ伐璧勫崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "瀹℃牳鎴栧弽瀹℃牳宸ヨ祫鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ヨ祫鍗曞叧闂�/鍙嶅叧闂�
+        /// <summary>
+        /// 鍏抽棴/鍙嶅叧闂伐璧勫崟
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">鍏抽棴(1),鍙嶅叧闂�(2)</param>
+        /// <param name="HMaker">鍏抽棴浜�</param>
+        /// <returns></returns>
+        [Route("Pay_PayMentBillController/GetPay_PayMentBill_Close_Json")]
+        [HttpGet]
+        public object GetPay_PayMentBill_Close_Json(Int64 HInterID, int Type, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameClose, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鍏抽棴/鍙嶅叧闂姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    //Type 1 鍏抽棴  2  鍙嶅叧闂�
+                    if (Type == 1)
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂紝涓嶈兘鍐嶆鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍏抽棴鍗曟嵁
+                        if (!oBill.CloseBill(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍏抽棴鎴愬姛锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                    else
+                    {
+                        if (oBill.omodel.HCloseMan.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈叧闂紝涓嶉渶瑕佸弽鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅叧闂崟鎹�
+                        if (!oBill.CancelClose(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶅叧闂垚鍔燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ュ伐璧勫崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍏抽棴鎴栧弽鍏抽棴宸ヨ祫鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ヨ祫鍗曚綔搴�/鍙嶄綔搴�
+        /// <summary>
+        /// 浣滃簾/鍙嶄綔搴熷伐璧勫崟
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="Type">浣滃簾(1),鍙嶄綔搴�(2)</param>
+        /// <param name="HMaker">浣滃簾浜�</param>
+        /// <returns></returns>
+        [Route("Pay_PayMentBillController/GetPay_PayMentBill_Cancelltion_Json")]
+        [HttpGet]
+        public object GetPay_PayMentBill_Cancelltion_Json(Int64 HInterID, int Type, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡浣滃簾/鍙嶄綔搴熷姛鑳芥潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //鍒ゆ柇瀛樺湪鎬�
+                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+                {
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oBill.omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    //Type 1 浣滃簾  2  鍙嶄綔搴�
+                    if (Type == 1)
+                    {
+                        if (oBill.omodel.HDeleteMan.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴燂紝涓嶈兘鍐嶆浣滃簾锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //浣滃簾鍗曟嵁
+                        if (!oBill.Cancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 浣滃簾鎴愬姛锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                    else
+                    {
+                        if (oBill.omodel.HDeleteMan.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈綔搴燂紝涓嶉渶瑕佸弽浣滃簾锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶄綔搴熷崟鎹�
+                        if (!oBill.AbandonCancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍗曟嵁鍙凤細" + oBill.omodel.HBillNo + " 鍙嶄綔搴熸垚鍔燂紒";
+                            objJsonResult.data = null;
+                            return objJsonResult; ;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ュ伐璧勫崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "浣滃簾鎴栧弽浣滃簾宸ヨ祫鍗曞け璐ワ紒" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
+
+
+
+
 
         #region 宸ヨ祫鍗� 鏂板/缂栬緫
         #region 宸ヨ祫鍗� 琛ㄥご鏁版嵁
@@ -94,19 +668,19 @@
             var _value = sMainSub["sMainSub"].ToString();
             string msg1 = _value.ToString();
             //寮�濮嬩簨鍔�
-            oCN.BeginTran();
+            oCn.BeginTran();
             //淇濆瓨涓昏〃
             objJsonResult = AddBillMain_Pay_PayMentBill(msg1);
             if (objJsonResult.code == "0")
             {
-                oCN.RollBack();
+                oCn.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = objJsonResult.Message;
                 objJsonResult.data = null;
                 return objJsonResult;
             }
-            oCN.Commit();
+            oCn.Commit();
             objJsonResult.code = "1";
             objJsonResult.count = 1;
             objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
@@ -191,7 +765,7 @@
 
                 //if (OperationType == 2)
                 //{
-                //    ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
+                //    ds = oCn.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
                 //    if (ds.Tables[0].Rows.Count > 0)
                 //    {
                 //        objJsonResult.code = "0";
@@ -202,7 +776,7 @@
                 //    }
                 //}
 
-                ds = oCN.RunProcReturn("select * from Pay_PayMentBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_PayMentBillMain");
+                ds = oCn.RunProcReturn("select * from Pay_PayMentBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_PayMentBillMain");
 
                 if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
                 {
@@ -229,9 +803,9 @@
                         "')";
 
                     //涓昏〃
-                    oCN.RunProc(sql);
+                    oCn.RunProc(sql);
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板宸ヨ祫鍗�:" + HBillNo);
-                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板宸ヨ祫鍗曪細" + HBillNo + "','LMES-宸ヨ祫鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+                    oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板宸ヨ祫鍗曪細" + HBillNo + "','LMES-宸ヨ祫鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)                    //缂栬緫
                 {
@@ -251,13 +825,13 @@
                         "', HUpdateDate = '" + HUpdaterDate +
                         "' where HInterID = " + HInterID;
 
-                    oCN.RunProc(sql);
+                    oCn.RunProc(sql);
 
                     //鍒犻櫎瀛愯〃
-                    oCN.RunProc("delete from Pay_PayMentBillSub where HInterID= " + HInterID);
+                    oCn.RunProc("delete from Pay_PayMentBillSub where HInterID= " + HInterID);
                     //璁板綍鏃ュ織
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼宸ヨ祫鍗�:" + HBillNo);
-                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼宸ヨ祫鍗曪細" + HBillNo + "','LMES-宸ヨ祫鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+                    oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼宸ヨ祫鍗曪細" + HBillNo + "','LMES-宸ヨ祫鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 //淇濆瓨瀛愯〃
                 objJsonResult = AddBillSub1_Pay_PayMentBill(msg3, HInterID, HBillNo, OperationType);
@@ -342,7 +916,7 @@
                     "," + HRelPay +
                     ",'" + HRemark +
                     "')";
-                oCN.RunProc(sql);
+                oCn.RunProc(sql);
             }
 
             objJsonResult.code = "1";
@@ -385,7 +959,7 @@
                     return objJsonResult;
                 }
 
-                ds = oCN.RunProcReturn("exec h_p_Pay_PayMentBill_EditInit " + HInterID, "h_p_Pay_PayMentBill_EditInit");
+                ds = oCn.RunProcReturn("exec h_p_Pay_PayMentBill_EditInit " + HInterID, "h_p_Pay_PayMentBill_EditInit");
                 tableList.Add(ds.Tables[0]);
                 tableList.Add(ds.Tables[1]);
 
@@ -406,436 +980,7 @@
         }
         #endregion
 
-        #region 宸ヨ祫鍗� 鏌ヨ
-        [Route("Pay_PayMentBill/list")]
-        [HttpGet]
-        public object getPayMentBillList(string sWhere, string user)
-        {
-            try
-            {
-                List<object> columnNameList = new List<object>();
-                if (!DBUtility.ClsPub.Security_Log("Pay_PayMentBillList", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
 
-                if (sWhere == null || sWhere.Equals(""))
-                {
-                    ds = oCN.RunProcReturn("select * from h_v_Pay_PayMentBillList order by hmainid desc", "h_v_Pay_PayMentBillList");
-                }
-                else
-                {
-                    string sql1 = "select * from h_v_Pay_PayMentBillList where 1 = 1 ";
-                    string sql = sql1 + sWhere + " order by hmainid desc";
-                    ds = oCN.RunProcReturn(sql, "h_v_Pay_PayMentBillList");
-                }
-
-                //娣诲姞鍒楀悕
-                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 e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "Exception锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-        #region 宸ヨ祫鍗� 鍒犻櫎
-        /// <summary>
-        ///鍙傛暟锛歴tring HInterID銆�
-        ///杩斿洖鍊硷細object銆�
-        /// </summary>
-        [Route("Pay_PayMentBill/delete")]
-        [HttpGet]
-        public object deletePayMentBill(string HInterID, string user)
-        {
-            try
-            {
-                //鏌ョ湅鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log("Pay_PayMentBill_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;
-                }
-
-                oCN.BeginTran();
-
-                oCN.RunProc("delete from Pay_PayMentBillMain where HInterID = " + HInterID);
-                oCN.RunProc("delete from Pay_PayMentBillSub where HInterID= " + HInterID);
-
-                oCN.Commit();
-
-                objJsonResult.code = "1";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "Sucess锛�";
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "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("Pay_PayMentBill/AuditPay_PayMentBill")]
-        [HttpGet]
-        public object AuditPay_PayMentBill(string HInterID, int Type, string user)
-        {
-            try
-            {
-                //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Pay_PayMentBill_Check", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愬鏍�!";
-                    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 = "Pay_PayMentBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-
-                //Type 1 瀹℃牳  2  鍙嶅鏍�
-                if (Type == 1)
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
-                    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 (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 (!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 (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 (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                }
-
-                oCN.Commit();//鎻愪氦浜嬪姟
-
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎵ц鎴愬姛锛�";
-                objJsonResult.data = null;
-                return objJsonResult; ;
-
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-        #region 宸ヨ祫鍗� 鍏抽棴/鍙嶅叧闂姛鑳�
-        [Route("Pay_PayMentBill/ClosePay_PayMentBill")]
-        [HttpGet]
-        public object ClosePay_PayMentBill(string HInterID, int Type, string user)
-        {
-            try
-            {
-                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Pay_PayMentBill_Close", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
-                    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 = "Pay_PayMentBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-
-                //Type 1 鍏抽棴  2  鍙嶅叧闂�
-                if (Type == 1)
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴
-                    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 (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 (!BillOld.CloseBill(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 (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 (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                }
-
-                oCN.Commit();//鎻愪氦浜嬪姟
-
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎵ц鎴愬姛锛�";
-                objJsonResult.data = null;
-                return objJsonResult; ;
-
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
-        #region 宸ヨ祫鍗� 浣滃簾/鍙嶄綔搴熷姛鑳�
-        [Route("Pay_PayMentBill/DropPay_PayMentBill")]
-        [HttpGet]
-        public object DropPay_PayMentBill(string HInterID, int Type, string user)
-        {
-            try
-            {
-                //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
-                if (!DBUtility.ClsPub.Security_Log("Pay_PayMentBill_Drop", 1, false, user))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犳潈闄愪綔搴�!";
-                    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 = "Pay_PayMentBillMain";
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-
-                //Type 1 浣滃簾  2  鍙嶄綔搴�
-                if (Type == 1)
-                {
-                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾
-                    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 (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 (!BillOld.Cancelltion(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 (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 (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                }
-
-                oCN.Commit();//鎻愪氦浜嬪姟
-
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎵ц鎴愬姛锛�";
-                objJsonResult.data = null;
-                return objJsonResult; ;
-
-            }
-            catch (Exception e)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
-        }
-        #endregion
 
         #region 鏍规嵁鐝粍鑾峰彇宸ヨ祫鍗曞瓙琛ㄦ暟鎹�
         [Route("Pay_PayMentBill/getPayMentBillSub")]
@@ -846,7 +991,7 @@
             {
                 List<object> columnNameList = new List<object>();
                 string sql = "exec h_v_Pay_PayMentBill_getSubDataBasedGroupID " + HGroupID + "," + HYear + "," + HMonth;
-                ds = oCN.RunProcReturn(sql, "h_v_Pay_PayMentBill_getSubDataBasedGroupID");
+                ds = oCn.RunProcReturn(sql, "h_v_Pay_PayMentBill_getSubDataBasedGroupID");
 
                 //娣诲姞鍒楀悕
                 foreach (DataColumn col in ds.Tables[0].Columns)
diff --git "a/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs" "b/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs"
index d0e61c6..279d1bd 100644
--- "a/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs"
+++ "b/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs"
@@ -2317,7 +2317,6 @@
 
         #endregion
 
-
         #region 鐢熶骇琛ユ枡    涓婁紶鐢熷崟
 
         #region 鐢熶骇琛ユ枡    鏍¢獙妯″紡
@@ -2377,7 +2376,6 @@
 
         #endregion
 
-
         #region 濮斿琛ユ枡    涓婁紶鐢熷崟
 
         #region 濮斿琛ユ枡    鏍¢獙妯″紡
@@ -2436,7 +2434,6 @@
         #endregion
 
         #endregion
-
 
         #region 鐩存帴璋冩嫧    涓婁紶鐢熷崟
 
@@ -2513,8 +2510,10 @@
                 }
                 websLsmain.HMaker = lsmain[0].HMaker;
                 websLsmain.HBillerID = lsmain[0].HBillerID;
-                websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
-                websLsmain.HOWNERID = lsmain[0].HSTOCKORGID;
+                websLsmain.HStockInOrgID = lsmain[0].HStockInOrgID;
+                websLsmain.HStockOutOrgID = lsmain[0].HStockOutOrgID;
+                websLsmain.HSTOCKORGID = lsmain[0].HStockOutOrgID;
+                websLsmain.HOWNERID = lsmain[0].HStockOutOrgID;
 
                 if (oWebs.set_SaveMoveStockBill(websLsmain, sSourceType, ref DBUtility.ClsPub.sErrInfo))
                 {
@@ -2588,7 +2587,179 @@
 
         #endregion
 
+        #region 鍒嗘寮忚皟鍑�    涓婁紶鐢熷崟
 
+        #region 鍒嗘寮忚皟鍑�    鏂板妯″紡
+
+        /// <summary>
+        /// 鍒嗘寮忚皟鍑烘柊澧炰笂浼�
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/set_SaveMoveStockStepOutBill_Json")]
+        [HttpPost]
+        public object set_SaveMoveStockStepOutBill_Json([FromBody] JObject oMain)
+        {
+            var _value = oMain["oMain"].ToString();
+            string msg1 = _value.ToString();
+            try
+            {
+                List<Model.ClsKf_MoveStockStepOutBillMain> lsmain = new List<Model.ClsKf_MoveStockStepOutBillMain>();
+                ListModels oListModels = new ListModels();
+                lsmain = oListModels.getMoveStockStepOutBillMainByJson(msg1);
+                WebS.ClsKf_MoveStockStepOutBillMain websLsmain = new WebS.ClsKf_MoveStockStepOutBillMain();
+                string sSourceType = lsmain[0].HMainSourceBillType;
+                websLsmain.HInterID = lsmain[0].HInterID;
+                websLsmain.HBillNo = lsmain[0].HBillNo;
+                websLsmain.HBillType = lsmain[0].HBillType;
+                websLsmain.HDate = lsmain[0].HDate;
+                websLsmain.HDeptID = lsmain[0].HDeptID;
+                websLsmain.HWHID = lsmain[0].HWHID;
+                websLsmain.HSCWHID = lsmain[0].HSCWHID;
+                websLsmain.HSupID = lsmain[0].HSupID;
+                websLsmain.HKeeperID = lsmain[0].HKeeperID;
+                websLsmain.HSecManagerID = lsmain[0].HSecManagerID;
+                websLsmain.HEmpID = lsmain[0].HEmpID;
+                websLsmain.HManagerID = lsmain[0].HManagerID;
+                websLsmain.HRemark = lsmain[0].HRemark;
+                websLsmain.HExplanation = lsmain[0].HExplanation;
+                websLsmain.HInnerBillNo = lsmain[0].HInnerBillNo;
+                websLsmain.HRedBlueFlag = lsmain[0].HRedBlueFlag;
+                websLsmain.HBillSubType = lsmain[0].HBillSubType;
+                websLsmain.HStockStyle = lsmain[0].HStockStyle;
+                if (lsmain[0].HMainSourceBillType == "1402")
+                {
+                    websLsmain.HMainSourceBillType = "鍙戣揣閫氱煡鍗�";
+                }
+                else if (lsmain[0].HMainSourceBillType == "1243")
+                {
+                    websLsmain.HMainSourceBillType = "璋冩嫧鐢宠鍗�";
+                }
+                else
+                {
+                    websLsmain.HMainSourceBillType = "鎵嬪伐褰曞叆";
+                }
+                websLsmain.HMaker = lsmain[0].HMaker;
+                websLsmain.HBillerID = lsmain[0].HBillerID;
+                websLsmain.HStockInOrgID = lsmain[0].HStockInOrgID;
+                websLsmain.HStockOutOrgID = lsmain[0].HStockOutOrgID;
+                websLsmain.HSTOCKORGID = lsmain[0].HStockOutOrgID;
+                websLsmain.HOWNERID = lsmain[0].HStockOutOrgID;
+
+                if (oWebs.set_SaveMoveStockStepOutBill_New(websLsmain, sSourceType, ref DBUtility.ClsPub.sErrInfo))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //鎴愬姛锛�
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //澶辫触锛�
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒嗘寮忚皟鍑哄崟涓婁紶澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        #endregion
+
+        #endregion
+
+        #region 鍒嗘寮忚皟鍏�    涓婁紶鐢熷崟
+
+        #region 鍒嗘寮忚皟鍏�    鏂板妯″紡
+
+        /// <summary>
+        /// 鍒嗘寮忚皟鍏ユ柊澧炰笂浼�
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/set_SaveMoveStockStepInBill_Json")]
+        [HttpPost]
+        public object set_SaveMoveStockStepInBill_Json([FromBody] JObject oMain)
+        {
+            var _value = oMain["oMain"].ToString();
+            string msg1 = _value.ToString();
+            try
+            {
+                List<Model.ClsKf_MoveStockStepInBillMain> lsmain = new List<Model.ClsKf_MoveStockStepInBillMain>();
+                ListModels oListModels = new ListModels();
+                lsmain = oListModels.getMoveStockStepInBillMainByJson(msg1);
+                WebS.ClsKf_MoveStockStepInBillMain websLsmain = new WebS.ClsKf_MoveStockStepInBillMain();
+                string sSourceType = lsmain[0].HMainSourceBillType;
+                websLsmain.HInterID = lsmain[0].HInterID;
+                websLsmain.HBillNo = lsmain[0].HBillNo;
+                websLsmain.HBillType = lsmain[0].HBillType;
+                websLsmain.HDate = lsmain[0].HDate;
+                websLsmain.HDeptID = lsmain[0].HDeptID;
+                websLsmain.HWHID = lsmain[0].HWHID;
+                websLsmain.HSCWHID = lsmain[0].HSCWHID;
+                websLsmain.HSupID = lsmain[0].HSupID;
+                websLsmain.HKeeperID = lsmain[0].HKeeperID;
+                websLsmain.HSecManagerID = lsmain[0].HSecManagerID;
+                websLsmain.HEmpID = lsmain[0].HEmpID;
+                websLsmain.HManagerID = lsmain[0].HManagerID;
+                websLsmain.HRemark = lsmain[0].HRemark;
+                websLsmain.HExplanation = lsmain[0].HExplanation;
+                websLsmain.HInnerBillNo = lsmain[0].HInnerBillNo;
+                websLsmain.HRedBlueFlag = lsmain[0].HRedBlueFlag;
+                websLsmain.HBillSubType = lsmain[0].HBillSubType;
+                websLsmain.HStockStyle = lsmain[0].HStockStyle;
+                if (lsmain[0].HMainSourceBillType == "1250")
+                {
+                    websLsmain.HMainSourceBillType = "鍒嗘寮忚皟鍑哄崟";
+                }
+                else
+                {
+                    websLsmain.HMainSourceBillType = "鎵嬪伐褰曞叆";
+                }
+                websLsmain.HMaker = lsmain[0].HMaker;
+                websLsmain.HBillerID = lsmain[0].HBillerID;
+                websLsmain.HStockInOrgID = lsmain[0].HStockInOrgID;
+                websLsmain.HStockOutOrgID = lsmain[0].HStockOutOrgID;
+                websLsmain.HSTOCKORGID = lsmain[0].HStockOutOrgID;
+                websLsmain.HOWNERID = lsmain[0].HStockOutOrgID;
+
+                if (oWebs.set_SaveMoveStockStepInBill_New(websLsmain, sSourceType, ref DBUtility.ClsPub.sErrInfo))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //鎴愬姛锛�
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //澶辫触锛�
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒嗘寮忚皟鍏ュ崟涓婁紶澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        #endregion
+
+        #endregion
 
         #region 鐢熶骇缁勬墭鍗�    涓婁紶鐢熷崟
 
diff --git "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs" "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs"
index 87a3d34..8bc0e61 100644
--- "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs"
+++ "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs"
@@ -2583,7 +2583,7 @@
         {
             try
             {
-                List<object> columnNameList = new List<object>();
+                List<DataTable> tableList = new List<DataTable>();
 
                 //鏌ョ湅鏉冮檺
                 if (!DBUtility.ClsPub.Security_Log("PM_ProjectMoneyBillMain_Edit", 1, false, User))
@@ -2604,22 +2604,17 @@
                     return objJsonResult;
                 }
 
-                ds = oCN.RunProcReturn("select * from  h_v_PM_ProjectMoneyBillMainList where HInterID =" + HInterID, "h_v_PM_ProjectMoneyBillMainList");
-                //娣诲姞鍒楀悕
-                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鍒楀璞$殑鍒楀悕
-                }
+                ds = oCN.RunProcReturn("exec h_p_PM_ProjectMoneyBill_EditInit   " + HInterID, "h_p_PM_ProjectMoneyBill_EditInit");
+                tableList.Add(ds.Tables[0]);
+                tableList.Add(ds.Tables[1]);
+                
 
 
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "鏌ヨ鎴愬姛锛�";
-                objJsonResult.data = ds.Tables[0];
-                objJsonResult.list = columnNameList;
+                objJsonResult.data = tableList;
                 return objJsonResult;
             }
             catch (Exception e)
@@ -2866,5 +2861,1282 @@
         #endregion
 
 
+        #region 椤圭洰鍚姩鍗� 淇濆瓨/缂栬緫
+        /// <summary>
+        /// 椤圭洰璐圭敤
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("PM_ProjectBill/SavePM_ProjectBeginBillMain")]
+        [HttpPost]
+        public object SavePM_ProjectBeginBillMain([FromBody] JObject sMainSub)
+        {
+            var _value = sMainSub["sMainSub"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string refSav = sArray[1].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+            string user = sArray[2].ToString();//鐢ㄦ埛鍚�
+
+            string UserName = "";
+            string s = "";
+            ListModels oListModels = new ListModels();
+            try
+            {
+                //淇濆瓨鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("PM_ProjectBeginBillMain_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                
+                DAL.ClsPM_ProjectBeginBillMain oBill = new DAL.ClsPM_ProjectBeginBillMain();
+                List<Model.ClsPM_ProjectBeginBillMain> lsmain = new List<Model.ClsPM_ProjectBeginBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_PM_ProjectBeginBillMain(msg2);
+                foreach (Model.ClsPM_ProjectBeginBillMain oItem in lsmain)
+                {
+                    if (refSav == "Add")
+                    {
+                        //鍗曟嵁鍙锋槸鍚﹂噸澶�
+                        if (BillNew1.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 (BillOld1.ShowBill(oItem.HInterID, ref s) == false)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        //鍒ゆ柇鏄惁鍙紪杈�
+                        if (BillOld1.omodel.HChecker != "" && BillOld1.omodel.HChecker != null)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (BillOld1.omodel.HBillStatus > 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = s + "锛屼笉鍏佽淇敼";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
+                    UserName = oItem.HMaker;  //鍒跺崟浜�
+                    oItem.HBillType = "4760";
+                    oItem.HBillSubType = "4760";
+
+
+
+                    //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 = "淇濆瓨鎴愬姛锛�";
+                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 椤圭洰鍚姩鍗曞垪琛� 鏌ヨ
+        /// <summary>
+        /// 杩斿洖椤圭洰鍚姩鍗曞垪琛�
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("PM_ProjectBill/getPM_ProjectBeginBillMainList")]
+        [HttpGet]
+        public object getPM_ProjectBeginBillMainList(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("PM_ProjectBeginBillMain_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_PM_ProjectBeginBillMainList order by 鍗曟嵁鍙� desc", "h_v_PM_ProjectBeginBillMainList");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_PM_ProjectBeginBillMainList where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_PM_ProjectBeginBillMainList");
+                }
+
+                //娣诲姞鍒楀悕
+                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 e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 椤圭洰鍚姩鍗曞垪琛� 鑾峰彇缂栬緫鍒楄〃鏁版嵁
+        [Route("PM_ProjectBill/PM_ProjectBeginBillMainEditList")]
+        [HttpGet]
+        public object PM_ProjectBeginBillMainEditList(string HInterID, string User)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("PM_ProjectBeginBillMain_Edit", 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;
+                }
+
+                ds = oCN.RunProcReturn("select * from h_v_PM_ProjectBeginBillMainList where  HInterID='" + HInterID + "'", "h_v_PM_ProjectBeginBillMainList");
+
+                //娣诲姞鍒楀悕
+                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 e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 椤圭洰鍚姩鍗曞垪琛� 瀹℃牳/鍙嶅鏍稿姛鑳�
+        [Route("PM_ProjectBill/CheckPM_ProjectBeginBillMain")]
+        [HttpGet]
+        public object CheckPM_ProjectBeginBillMain(int HInterID, int IsAudit, string CurUserName)
+        {
+            DBUtility.ClsPub.CurUserName = CurUserName;
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("PM_ProjectEndBillMain_Check", 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.ClsPM_ProjectBeginBillMain oBill = new DAL.ClsPM_ProjectBeginBillMain();                              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                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 = "";
+
+                    if (oBill.omodel.HMainSourceInterID != 0)
+                    {
+                        //妫�楠屾簮鍗曟槸鍚﹀瓨鍦ㄥ強鍗曟嵁鐘舵��
+                        string sql = "select * from PM_ProjectBeginBillMain where HInterID = " + oBill.omodel.HMainSourceInterID;
+                        ds = oCN.RunProcReturn(sql, "PM_ProjectBeginBillMain");
+                        if (ds == null || ds.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:婧愬崟-鐗规壒鐢宠鍗曚笉瀛樺湪!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else if (ds.Tables[0].Rows[0]["HBillStatus"].ToString() != "2")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:婧愬崟-鐗规壒鐢宠鍗曟湭澶勪簬宸插鏍哥姸鎬�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+
+
+                    }
+
+                    //瀹℃牳鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_PM_ProjectBeginBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_PM_ProjectBeginBill_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_PM_ProjectBeginBill_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_PM_ProjectBeginBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_PM_ProjectBeginBill_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_PM_ProjectBeginBill_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 椤圭洰鍚姩鍗曞垪琛� 鍏抽棴/鍙嶅叧闂姛鑳�
+        [Route("PM_ProjectBill/ClosePM_ProjectBeginBillMain")]
+        [HttpGet]
+        public object ClosePM_ProjectBeginBillMain(string HInterID, int IsAudit, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊叧闂潈闄�
+                if (!DBUtility.ClsPub.Security_Log("PM_ProjectBeginBillMain_Close", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                var ds = oCN.RunProcReturn("select * from PM_ProjectBeginBillMain  where HInterID=" + HInterID, "PM_ProjectBeginBillMain");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (IsAudit == 0)  //鍏抽棴鍒ゆ柇
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅叧闂垽鏂�
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸弽鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                if (IsAudit == 0)  //鍏抽棴鍒ゆ柇
+                {
+                    oCN.RunProc("update PM_ProjectBeginBillMain  set HCloseMan='" + user + "',HCloseDate=getdate() where HInterID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍏抽棴鎴愬姛";
+                    objJsonResult.data = null;
+                }
+                if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                {
+                    oCN.RunProc("update PM_ProjectBeginBillMain  set HCloseMan='',HCloseDate=null where HInterID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍙嶅叧闂垚鍔�";
+                    objJsonResult.data = null;
+                }
+                oCN.Commit();
+
+                return objJsonResult;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 椤圭洰鍚姩鍗曞垪琛� 鍒犻櫎
+        /// <summary>
+        ///鍙傛暟锛歴tring HInterID銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("PM_ProjectBill/PM_ProjectBeginBillMainDelete")]
+        [HttpGet]
+        public object PM_ProjectBeginBillMainDelete(string HInterID, string user)
+        {
+            try
+            {
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("PM_ProjectBeginBillMain_Drop", 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;
+                }
+
+                oCN.BeginTran();
+
+                oCN.RunProc("delete from PM_ProjectBeginBillMain   where HInterID = " + HInterID);
+
+                oCN.Commit();
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
+
+        #region 椤圭洰楠屾敹鍗� 淇濆瓨/缂栬緫
+        /// <summary>
+        /// 椤圭洰楠屾敹鍗�
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("PM_ProjectBill/SavePM_ProjectEndBillMain")]
+        [HttpPost]
+        public object SavePM_ProjectEndBillMain([FromBody] JObject sMainSub)
+        {
+            var _value = sMainSub["sMainSub"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string refSav = sArray[1].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+            string user = sArray[2].ToString();//鐢ㄦ埛鍚�
+
+            string UserName = "";
+            string s = "";
+            ListModels oListModels = new ListModels();
+            try
+            {
+                //淇濆瓨鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("PM_ProjectEndBillMain_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                DAL.ClsPM_ProjectEndBillMain oBill = new DAL.ClsPM_ProjectEndBillMain();
+                List<Model.ClsPM_ProjectEndBillMain> lsmain = new List<Model.ClsPM_ProjectEndBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_PM_ProjectEndBillMain(msg2);
+                foreach (Model.ClsPM_ProjectEndBillMain oItem in lsmain)
+                {
+                    if (refSav == "Add")
+                    {
+                        //鍗曟嵁鍙锋槸鍚﹂噸澶�
+                        if (BillNew1.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 (BillOld1.ShowBill(oItem.HInterID, ref s) == false)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        //鍒ゆ柇鏄惁鍙紪杈�
+                        if (BillOld1.omodel.HChecker != "" && BillOld1.omodel.HChecker != null)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (BillOld1.omodel.HBillStatus > 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = s + "锛屼笉鍏佽淇敼";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
+                    UserName = oItem.HMaker;  //鍒跺崟浜�
+                    oItem.HBillType = "4761";
+                    oItem.HBillSubType = "4761";
+
+
+
+                    //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 = "淇濆瓨鎴愬姛锛�";
+                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 椤圭洰楠屾敹鍗曞垪琛� 鏌ヨ
+        /// <summary>
+        /// 杩斿洖椤圭洰楠屾敹鍗曞垪琛�
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("PM_ProjectBill/getPM_ProjectEndBillMainList")]
+        [HttpGet]
+        public object getPM_ProjectEndBillMainList(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("PM_ProjectEndBillMain_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_PM_ProjectEndBillMainList order by 鍗曟嵁鍙� desc", "h_v_PM_ProjectEndBillMainList");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_PM_ProjectEndBillMainList where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "h_v_PM_ProjectEndBillMainList");
+                }
+
+                //娣诲姞鍒楀悕
+                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 e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 椤圭洰楠屾敹鍗曞垪琛� 鑾峰彇缂栬緫鍒楄〃鏁版嵁
+        [Route("PM_ProjectBill/PM_ProjectEndBillMainEditList")]
+        [HttpGet]
+        public object PM_ProjectEndBillMainEditList(string HInterID, string User)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("PM_ProjectEndBillMain_Edit", 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;
+                }
+
+                ds = oCN.RunProcReturn("select * from h_v_PM_ProjectEndBillMainList where  HInterID='" + HInterID + "'", "h_v_PM_ProjectEndBillMainList");
+
+                //娣诲姞鍒楀悕
+                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 e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 椤圭洰楠屾敹鍗曞垪琛� 瀹℃牳/鍙嶅鏍稿姛鑳�
+        [Route("PM_ProjectBill/CheckPM_ProjectEndBillMain")]
+        [HttpGet]
+
+        public object CheckPM_ProjectEndBillMain(int HInterID, int IsAudit, string CurUserName)
+        {
+           
+            DBUtility.ClsPub.CurUserName = CurUserName;
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("PM_ProjectEndBillMain_Check", 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.ClsPM_ProjectEndBillMain oBill = new DAL.ClsPM_ProjectEndBillMain();                              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+                //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+                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 = "";
+
+                    if (oBill.omodel.HMainSourceInterID != 0)
+                    {
+                        //妫�楠屾簮鍗曟槸鍚﹀瓨鍦ㄥ強鍗曟嵁鐘舵��
+                        string sql = "select * from PM_ProjectEndBillMain where HInterID = " + oBill.omodel.HMainSourceInterID;
+                        ds = oCN.RunProcReturn(sql, "PM_ProjectEndBillMain");
+                        if (ds == null || ds.Tables[0].Rows.Count == 0)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:婧愬崟-鐗规壒鐢宠鍗曚笉瀛樺湪!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else if (ds.Tables[0].Rows[0]["HBillStatus"].ToString() != "2")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:婧愬崟-鐗规壒鐢宠鍗曟湭澶勪簬宸插鏍哥姸鎬�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+
+
+                    }
+
+                    //瀹℃牳鍓嶆帶鍒�=========================================      
+                    string sql1 = "exec h_p_PM_ProjectEndBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_PM_ProjectEndBill_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_PM_ProjectEndBill_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_PM_ProjectEndBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_PM_ProjectEndBill_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_PM_ProjectEndBill_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 椤圭洰楠屾敹鍗曞垪琛� 鍏抽棴/鍙嶅叧闂姛鑳�
+        [Route("PM_ProjectBill/ClosePM_ProjectEndBillMain")]
+        [HttpGet]
+        public object ClosePM_ProjectEndBillMain(string HInterID, int IsAudit, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊叧闂潈闄�
+                if (!DBUtility.ClsPub.Security_Log("PM_ProjectEndBillMain_Close", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                var ds = oCN.RunProcReturn("select * from PM_ProjectEndBillMain  where HInterID=" + HInterID, "PM_ProjectEndBillMain");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (IsAudit == 0)  //鍏抽棴鍒ゆ柇
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅叧闂垽鏂�
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸弽鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                if (IsAudit == 0)  //鍏抽棴鍒ゆ柇
+                {
+                    oCN.RunProc("update PM_ProjectEndBillMain  set HCloseMan='" + user + "',HCloseDate=getdate() where HInterID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍏抽棴鎴愬姛";
+                    objJsonResult.data = null;
+                }
+                if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                {
+                    oCN.RunProc("update PM_ProjectEndBillMain  set HCloseMan='',HCloseDate=null where HInterID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍙嶅叧闂垚鍔�";
+                    objJsonResult.data = null;
+                }
+                oCN.Commit();
+
+                return objJsonResult;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 椤圭洰楠屾敹鍗曞垪琛� 鍒犻櫎
+        /// <summary>
+        ///鍙傛暟锛歴tring HInterID銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("PM_ProjectBill/PM_ProjectEndBillMainDelete")]
+        [HttpGet]
+        public object PM_ProjectEndBillMainDelete(string HInterID, string user)
+        {
+            try
+            {
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("PM_ProjectEndBillMain_Drop", 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;
+                }
+
+                oCN.BeginTran();
+
+                oCN.RunProc("delete from PM_ProjectEndBillMain   where HInterID = " + HInterID);
+
+                oCN.Commit();
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
     }
 }
\ No newline at end of file
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index a5d729b..1a7fcc6 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -101,6 +101,19 @@
             List<Model.ClsKf_MoveStockStepOutBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsKf_MoveStockStepOutBillMain>>(jsonString);
             return list;
         }
+
+        /// <summary>
+        /// 鍒嗘寮忚皟鍏ュ崟鍙嶅簭鍒楀寲
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsKf_MoveStockStepInBillMain> getMoveStockStepInBillMainByJson(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsKf_MoveStockStepInBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsKf_MoveStockStepInBillMain>>(jsonString);
+            return list;
+        }
+
         /// <summary>
         /// 浜у搧鍏ュ簱鍙嶅簭鍒楀寲
         /// </summary>
@@ -1076,6 +1089,91 @@
             List<Model.ClsPM_ProjectMoneyBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPM_ProjectMoneyBillSub>>(jsonString);
             return list;
         }
+        
+        /// <summary>
+        /// 澶勭悊鏂板椤圭洰鍚姩琛ㄧ殑json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsPM_ProjectBeginBillMain> getObjectByJson_PM_ProjectBeginBillMain(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsPM_ProjectBeginBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPM_ProjectBeginBillMain>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
+        /// 澶勭悊鏂板椤圭洰楠屾敹鍗曡〃鐨刯son
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsPM_ProjectEndBillMain> getObjectByJson_PM_ProjectEndBillMain(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsPM_ProjectEndBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPM_ProjectEndBillMain>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
+        /// 澶勭悊鏂板浜у搧鍣ㄥ叿娓呭崟琛ㄧ殑json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsGy_MaterialMouldBillMain> getObjectByJson_Gy_MaterialMouldBillMain(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsGy_MaterialMouldBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_MaterialMouldBillMain>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
+        /// 澶勭悊鏂板浜у搧鍣ㄥ叿娓呭崟瀛愯〃鐨刯son
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsGy_MaterialMouldBillSub> getObjectByJson_Gy_MaterialMouldBillSub(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsGy_MaterialMouldBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_MaterialMouldBillSub>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
+        /// 澶勭悊鏂板浜у搧宸ヨ壓鍙傛暟娓呭崟琛ㄧ殑json
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsGy_MaterialTechParamBillMain> getObjectByJson_Gy_MaterialTechParamBillMain(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsGy_MaterialTechParamBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_MaterialTechParamBillMain>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
+        /// 澶勭悊鏂板浜у搧宸ヨ壓鍙傛暟娓呭崟瀛愯〃鐨刯son
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsGy_MaterialTechParamBillSub> getObjectByJson_Gy_MaterialTechParamBillSub(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsGy_MaterialTechParamBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_MaterialTechParamBillSub>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
+        /// 澶勭悊鏂板鍏朵粬搴旀敹鍗曡〃鐨刯son
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsYS_ReceiveOtherBillMain> getObjectByJson_YS_ReceiveOtherBillMain(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsYS_ReceiveOtherBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsYS_ReceiveOtherBillMain>>(jsonString);
+            return list;
+        }
+
         /// <summary>
         /// 澶勭悊鏂板妯″叿淇濆吇璁板綍琛ㄤ富琛ㄧ殑json
         /// </summary>
diff --git a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
index e6ac5aa..2ac6f8b 100644
--- a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
+++ b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -9,7 +9,7 @@
   </PropertyGroup>
   <ItemGroup>
     <File Include="apiapp.json">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="bin/Antlr3.Runtime.dll">
       <publishTime>02/22/2013 16:43:40</publishTime>
@@ -81,7 +81,7 @@
       <publishTime>08/25/2021 10:28:25</publishTime>
     </File>
     <File Include="bin/Kingdee.BOS.WebApi.Client.dll">
-      <publishTime>09/25/2023 09:42:56</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="bin/Kingdee.BOS.WebApi.FormService.dll">
       <publishTime>09/20/2018 19:23:20</publishTime>
@@ -115,7 +115,7 @@
       <publishTime>02/26/2024 09:57:25</publishTime>
     </File>
     <File Include="bin/Models/ClsSc_MouldScrapOutBillMain.cs">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="bin/Newtonsoft.Json.dll">
       <publishTime>08/04/2014 04:33:56</publishTime>
@@ -251,7 +251,7 @@
       <publishTime>11/28/2018 21:01:00</publishTime>
     </File>
     <File Include="bin/System.Web.Http.WebHost.dll">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="bin/System.Web.Mvc.dll">
       <publishTime>01/28/2015 12:02:18</publishTime>
@@ -306,58 +306,58 @@
       <publishTime>11/29/2018 21:26:30</publishTime>
     </File>
     <File Include="Config/kdapi.config">
-      <publishTime>09/25/2023 09:42:56</publishTime>
+      <publishTime>04/06/2023 15:57:01</publishTime>
     </File>
     <File Include="Content/bootstrap.css">
-      <publishTime>09/25/2023 09:42:56</publishTime>
+      <publishTime>04/06/2023 15:57:01</publishTime>
     </File>
     <File Include="Content/bootstrap.min.css">
-      <publishTime>09/25/2023 09:42:56</publishTime>
+      <publishTime>04/06/2023 15:57:01</publishTime>
     </File>
     <File Include="Content/Site.css">
-      <publishTime>09/25/2023 09:42:56</publishTime>
+      <publishTime>04/06/2023 15:57:01</publishTime>
     </File>
     <File Include="DLL/BLL.dll">
-      <publishTime>09/25/2023 09:42:56</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="DLL/DAL.dll">
-      <publishTime>09/25/2023 09:42:56</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="DLL/DBUtility.dll">
-      <publishTime>09/25/2023 09:42:56</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="DLL/Kingdee.BOS.WebApi.Client.dll">
-      <publishTime>09/25/2023 09:42:56</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="DLL/Model.dll">
-      <publishTime>09/25/2023 09:42:56</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="DLL/Newtonsoft.Json.Net35.dll">
-      <publishTime>09/25/2023 09:42:56</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="DLL/Pub_Class.dll">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="DLL/Pub_Control.dll">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="DLL/SQLHelper.dll">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="fonts/glyphicons-halflings-regular.eot">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="fonts/glyphicons-halflings-regular.svg">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="fonts/glyphicons-halflings-regular.ttf">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="fonts/glyphicons-halflings-regular.woff">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Global.asax">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="grpc_csharp_ext.x64.dll">
       <publishTime>03/22/2022 13:17:22</publishTime>
@@ -366,7 +366,7 @@
       <publishTime>03/22/2022 13:17:22</publishTime>
     </File>
     <File Include="Index.html">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="libgrpc_csharp_ext.x64.dylib">
       <publishTime>03/19/2022 07:38:44</publishTime>
@@ -375,121 +375,121 @@
       <publishTime>03/19/2022 07:38:42</publishTime>
     </File>
     <File Include="libman.json">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>07/12/2023 08:14:21</publishTime>
     </File>
     <File Include="Metadata/deploymentTemplates/apiappconfig.azureresource.json">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="packages.config">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Views/Scripts/bootstrap.js">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Views/Scripts/bootstrap.min.js">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Views/Scripts/jquery-1.10.2.js">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Views/Scripts/jquery-1.10.2.min.js">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Views/Scripts/jquery-1.10.2.min.map">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Views/Scripts/jquery.validate.js">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Views/Scripts/jquery.validate.min.js">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Views/Scripts/jquery.validate.unobtrusive.js">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Views/Scripts/jquery.validate.unobtrusive.min.js">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Views/Scripts/modernizr-2.6.2.js">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Views/Shared/Error.cshtml">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Views/Shared/_Layout.cshtml">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Views/web.config">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Views/_ViewStart.cshtml">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsCLD_Customer_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsCLD_Department_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsCLD_Employee_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsCLD_StockPlace_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsCLD_Supplier_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsCLD_Warehouse_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsGy_BadReason_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsGy_BarCodeBill_WMS_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsGy_BarCodeBill_WMS_Model_View.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsGy_Customer_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsGy_Department_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsGy_Employee_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsGy_Group_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsGy_Item30JiTai_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsGy_Source_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsGy_StockPlace_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsGy_Supplier_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsGy_Warehouse_Model.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsKf_ICStockBill_Mould.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/ClsKf_ICStockBill_WMS.datasource">
-      <publishTime>09/25/2023 09:42:57</publishTime>
+      <publishTime>04/06/2023 15:57:02</publishTime>
     </File>
     <File Include="Web References/WebS/Reference.cs">
       <publishTime>12/20/2021 13:19:56</publishTime>
     </File>
     <File Include="Web References/WebS/Reference.map">
-      <publishTime>11/01/2023 11:13:09</publishTime>
+      <publishTime>02/25/2024 21:39:05</publishTime>
     </File>
     <File Include="Web References/WebS/WebService1.disco">
       <publishTime>12/20/2021 13:19:56</publishTime>
diff --git a/WebAPI/Web References/WebS/Reference.cs b/WebAPI/Web References/WebS/Reference.cs
index 14942a0..6a789db 100644
--- a/WebAPI/Web References/WebS/Reference.cs
+++ b/WebAPI/Web References/WebS/Reference.cs
@@ -42881,6 +42881,10 @@
         
         private long hOWNERIDField;
         
+        private long hStockInOrgIDField;
+        
+        private long hStockOutOrgIDField;
+        
         /// <remarks/>
         public long HSupID {
             get {
@@ -43100,6 +43104,26 @@
                 this.hOWNERIDField = value;
             }
         }
+        
+        /// <remarks/>
+        public long HStockInOrgID {
+            get {
+                return this.hStockInOrgIDField;
+            }
+            set {
+                this.hStockInOrgIDField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public long HStockOutOrgID {
+            get {
+                return this.hStockOutOrgIDField;
+            }
+            set {
+                this.hStockOutOrgIDField = value;
+            }
+        }
     }
     
     /// <remarks/>
diff --git a/WebAPI/Web References/WebS/WebService1.wsdl b/WebAPI/Web References/WebS/WebService1.wsdl
index aae9795..6de8fc9 100644
--- a/WebAPI/Web References/WebS/WebService1.wsdl
+++ b/WebAPI/Web References/WebS/WebService1.wsdl
@@ -9262,6 +9262,8 @@
               <s:element minOccurs="0" maxOccurs="1" name="HShipType" type="s:string" />
               <s:element minOccurs="1" maxOccurs="1" name="HSTOCKORGID" type="s:long" />
               <s:element minOccurs="1" maxOccurs="1" name="HOWNERID" type="s:long" />
+              <s:element minOccurs="1" maxOccurs="1" name="HStockInOrgID" type="s:long" />
+              <s:element minOccurs="1" maxOccurs="1" name="HStockOutOrgID" type="s:long" />
             </s:sequence>
           </s:extension>
         </s:complexContent>
diff --git a/WebAPI/Web.config b/WebAPI/Web.config
index fc218c8..d07132f 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.56.1:81/web/WebService1.asmx"/> 	<!--闄堥洴闈欐湰鍦伴厤缃�-->
+		<!--<add key="sUrl" value="http://192.168.56.1:81/web/WebService1.asmx"/>--> 	<!--闄堥洴闈欐湰鍦伴厤缃�-->
 		<!--<add key="sUrl" value="http://192.168.1.57:8082/WEBS-WMS/WebService1.asmx"/>--> <!--涔濊彵-->
 		<!--<add key="sUrl" value="http://192.168.60.12/WEBS-WMS/WebService1.asmx"/>--> <!--涓帶-->
 		<add key="webpages:Version" value="3.0.0.0" />
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index aa05fca..6ab7973 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -409,6 +409,8 @@
     <Compile Include="Controllers\CJGL\Cj_SingleStationController.cs" />
     <Compile Include="Controllers\Gy_MateMouldController.cs" />
     <Compile Include="Controllers\Gy_StdMinPickQtyController.cs" />
+    <Compile Include="Controllers\JHGL\Gy_MaterialTechParamBillController.cs" />
+    <Compile Include="Controllers\MJGL\Sc_MouldinventoryBillController.cs" />
     <Compile Include="Controllers\MJGL\Sc_MouldDotCheckRuleBillController.cs" />
     <Compile Include="Controllers\MJGL\Sc_MouldLifeUseBillController.cs" />
     <Compile Include="Controllers\MJGL\Sc_MouldScrapRequestBillController.cs" />
@@ -467,6 +469,7 @@
     <Compile Include="Controllers\Sc_ProcessMangementController.cs" />
     <Compile Include="Controllers\Sc_ProcessReportController.cs" />
     <Compile Include="Controllers\XSGL\Kf_ICStockBackBillController.cs" />
+    <Compile Include="Controllers\XSGL\Xs_CusBalanceReportController.cs" />
     <Compile Include="Controllers\XSGL\Xs_ReceivableBillController.cs" />
     <Compile Include="Controllers\XSGL\YS_ContactBalController.cs" />
     <Compile Include="Controllers\XSGL\Xs_SeOrderChangeBillController.cs" />
@@ -475,6 +478,7 @@
     <Compile Include="Controllers\CGGL\YF_PayMentBackBillController.cs" />
     <Compile Include="Controllers\CGGL\YF_PayMentBillController.cs" />
     <Compile Include="Controllers\XSGL\YS_ReceiveBackBillController.cs" />
+    <Compile Include="Controllers\XSGL\YS_ReceiveOtherBillController.cs" />
     <Compile Include="Controllers\XSGL\YS_ReceiveBillController.cs" />
     <Compile Include="Controllers\XSGL\Kf_SellOutBillController.cs" />
     <Compile Include="Controllers\浜轰簨绠$悊\鍏ヨ亴鐢宠\HR_EmpEngageRequestBillController.cs" />
diff --git a/WebAPI/WebAPI.csproj.user b/WebAPI/WebAPI.csproj.user
index 315ec51..250cea5 100644
--- a/WebAPI/WebAPI.csproj.user
+++ b/WebAPI/WebAPI.csproj.user
@@ -9,7 +9,7 @@
     <WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
     <NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
     <NameOfLastUsedPublishProfile>D:\Git\houduan\WebAPI\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
-    <NameOfLastUsedPublishProfile>D:\涔斾竴璁¢噺鍗曚綅鍒楄〃\MES-WEB-API\WebAPI\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
+    <NameOfLastUsedPublishProfile>D:\缃戠珯鍙戝竷\鍚庣浠g爜\MES-WEB-API\MES-WEB-API\WebAPI\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
     <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
     <UseIISExpress>false</UseIISExpress>
     <Use64BitIISExpress />

--
Gitblit v1.9.1