From 909d89a0ff7a84d0099ca456cc494f70274ea0a0 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期二, 27 二月 2024 10:46:45 +0800
Subject: [PATCH] 项目费用,项目启动单,项目验收单  单据与列表

---
 DAL/ClsPM_ProjectMoneyBillMain.cs                        |   12 
 WebAPI/ListModels.cs                                     |   24 
 Model/项目管理/ClsPM_ProjectEndBillSub.cs                    |   11 
 DAL/ClsPM_ProjectEndBillMain.cs                          |  302 ++++++++++
 DAL/ClsPM_ProjectBeginBillMain.cs                        |  302 ++++++++++
 DAL/DAL.csproj                                           |    2 
 Model/项目管理/ClsPM_ProjectBeginBillMain.cs                 |   29 
 Model/Model.csproj                                       |    4 
 Model/项目管理/ClsPM_ProjectEndBillMain.cs                   |   29 
 WebAPI/Controllers/项目管理/工程项目/PM_ProjectBillController.cs | 1024 +++++++++++++++++++++++++++++++++
 Model/项目管理/ClsPM_ProjectBeginBillSub.cs                  |   11 
 11 files changed, 1,733 insertions(+), 17 deletions(-)

diff --git a/DAL/ClsPM_ProjectBeginBillMain.cs b/DAL/ClsPM_ProjectBeginBillMain.cs
new file mode 100644
index 0000000..2f6692d
--- /dev/null
+++ b/DAL/ClsPM_ProjectBeginBillMain.cs
@@ -0,0 +1,302 @@
+锘縰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_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_ProjectEndBillMain.cs b/DAL/ClsPM_ProjectEndBillMain.cs
new file mode 100644
index 0000000..15aeb93
--- /dev/null
+++ b/DAL/ClsPM_ProjectEndBillMain.cs
@@ -0,0 +1,302 @@
+锘縰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_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_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 63365c6..290cc0b 100644
--- a/DAL/DAL.csproj
+++ b/DAL/DAL.csproj
@@ -80,6 +80,8 @@
     <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="ClsPM_WorkPlanMonthBillMain.cs" />
diff --git a/Model/Model.csproj b/Model/Model.csproj
index e7160a2..3c85724 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -976,6 +976,10 @@
     <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" />
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/\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..396901b 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,1012 @@
         #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(string HInterID, int IsAudit, string user)
+        {
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("PM_ProjectBeginBillMain_Check", 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]["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 PM_ProjectBeginBillMain  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 PM_ProjectBeginBillMain  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("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(string HInterID, int IsAudit, string user)
+        {
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("PM_ProjectEndBillMain_Check", 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]["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 PM_ProjectEndBillMain  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 PM_ProjectEndBillMain  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("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 c3cb37c..de91f2c 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -1076,6 +1076,30 @@
             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>

--
Gitblit v1.9.1