wtt
2025-04-02 95257e3cf13f5ab3779908f46e0c4c12e1f095b4
WebAPI/Controllers/ÏîÄ¿¹ÜÀí/¹¤³ÌÏîÄ¿/PM_ProjectBillController.cs
@@ -10,7 +10,7 @@
using System.Web.Http;
using System.Windows.Forms;
using WebAPI.Models;
using SyntacticSugar.constant;
namespace WebAPI.Controllers.项目管理.工程项目
{
    public class PM_ProjectBillController : ApiController
@@ -34,11 +34,21 @@
        public DAL.ClsPM_ProjectMoneyBillMain BillNew4 = new DAL.ClsPM_ProjectMoneyBillMain();   //项目费用单对应单据类
        public DAL.ClsPM_ProjectMoneyBillMain BillOld4 = new DAL.ClsPM_ProjectMoneyBillMain();
        public DAL.ClsPM_ProjectBeginBillMain BillNew5 = new DAL.ClsPM_ProjectBeginBillMain();   //项目启动单对应单据类
        public DAL.ClsPM_ProjectBeginBillMain BillOld5 = new DAL.ClsPM_ProjectBeginBillMain();
        public DAL.ClsPM_ProjectEndBillMain BillNew6 = new DAL.ClsPM_ProjectEndBillMain();   //项目验收单对应单据类
        public DAL.ClsPM_ProjectEndBillMain BillOld6 = new DAL.ClsPM_ProjectEndBillMain();
        public DAL.ClsGy_ProjectMoneyBOMBill BillNew7 = new DAL.ClsGy_ProjectMoneyBOMBill();   //项目费用清单对应单据类
        public DAL.ClsGy_ProjectMoneyBOMBill BillOld7 = new DAL.ClsGy_ProjectMoneyBOMBill();
        #region å·¥ç¨‹é¡¹ç›® æ–°å¢ž/编辑
        #region å·¥ç¨‹é¡¹ç›® è¡¨å¤´æ•°æ®
        public class PM_ProjectBill_Main
        {
            public int HInterID;
            public string HBillSubType;
            public string HBillNo;
            public string HProNumber;
            public string HProName;
@@ -81,6 +91,78 @@
            public int HConWorkDays;
            public int HDepDays;
            public double HLastMoney;
            public int HProjectClassID;
            public string HBuildComp;
            public string HBuildAddress;
            public string HWorkNo;
            public string HReDate;
            public string HPicNo;
            public string HWorkTask;
            public string HProjectNote;
            public string HContacts;
            public string HContactNumber;
            public int HSupplierID;                  //分包单位(gy_supllier)
            public int HMangerEmpID;                 //管理员(gy_Employee)
            public string HMaterPlanDate;               //材料计划
            public int HWorkerID;                    //施工员(gy_Employee)
            public double HPlanWorkTimes;               //计划工期
            public double HRelWorkTimes;                //实际工期
            public string HTestDate;                    //试压日期
            public int HTestCheckerID;               //试压验收人(gy_Employee)
            public string HTestNote;                    //试压记录(富文本)
            public string HSewageDate;                  //排污日期
            public string HWaterSupplyDate;             //通水日期
            public string HWorkNote;                    //竣工资料(富文本)
            public string HWorkProcNote;                //施工完成情况(富文本)
            public double HYuSuanMoney;                 //预算造价
            public double HHeTongMoney;                 //合同造价
            public double HJieSuanMoney;                //结算造价
            public double HShenJiMoney;                 //审计造价
            public double HCaiLiaoMoney;                //材料费
            public double HAnZhuangMoney;               //安装费
            public double HBanZuMoney;                  //班组工费
            public double HYuShouKuanMoney;             //预收款
            public double HGongFeiMoney;                //工费结账
            public double HJieZhangMoney;            //结算结账
            public int HTaskClassID; //任务大类(Gy_TaskClass)
            public int HTaskClassEntryID; //任务项目分类(Gy_TaskClass)
            public string  HTaskAddress; //任务地点
            public string  HBreakStatus; //损坏情况
            public string  HWaterLeakage; //漏水量
            public string  HPipeDiameter; //管径
            public string  HPipeMaterial; //管道材质
            public string  HAlarmEmp; //报漏人
            public string  HAlarmLink; //报漏人联系电话
            public string  HReceEmp; //受理人
            public string  HReceTime; //受理时间(年月日时分秒)
            public double HTaskMaterMoney; //任务材料费
            public double HTaskSetupMoney; //任务安装费
            public double HTaskOtherMoney; //任务附属费
            public double HTaskExamMoney; //任务考核费
            public double HTaskWorkMoney; //任务工费
            public bool  HIsAccount; //是否结账(复选框)
            public string  HAccountDate; //结算结账日期
            public string  HAccountWorkMoneyDate; //工费结账日期
            public bool HIsCheckExam; //是否审核考核费(复选框)
            public bool HIsCheckWorkMoney; //是否审核工费(复选框)
            public string  HInfoBackTime; //回复时间(年月日时分秒)
            public string HInfoBackMan; //回复人
            public string HInfoNote; //回复内容(富文本)
            public string  HTaskBTime; //任务开始时间(年月日时分秒)
            public string  HTaskETime; //任务完工时间(年月日时分秒)
            public string  HTaskNote; //任务详细内容(富文本)
            public string  HTaskWorkEmp; //工作人员(富文本)
            public string  HBeginCloseValveTime; //开始关阀时间(年月日时分秒)
            public string  HEndCloseValveTime; //结束关阀时间(年月日时分秒)
            public long  HCloseValveQty; //关阀只数
            public string  HBeginOpenValveTime; //开始开阀时间(年月日时分秒)
            public string  HEndOpenValveTime; //结束开阀时间(年月日时分秒)
            public long HOpenValveQty; //开阀只数
            public string  HValveWorkEmp; //操作人员
            public string  HTaskRemark; //任务备注(富文本)
        }
        #endregion
@@ -196,7 +278,7 @@
                int HYear = int.Parse(mainList[0].HDate.Split('-')[0]);
                int HPeriod = int.Parse(mainList[0].HDate.Split('-')[1]);
                string HBillType = "4750";
                string HBillSubType = "";
                string HBillSubType = mainList[0].HBillSubType;
                int HInterID = mainList[0].HInterID;
                string HDate = mainList[0].HDate;
                string HBillNo = mainList[0].HBillNo;
@@ -225,6 +307,80 @@
                int HMaterID = mainList[0].HMaterID;
                string HUpdater = mainList[0].HUpdater;
                string HUpdaterDate = mainList[0].HUpdaterDate;
                int HProjectClassID = mainList[0].HProjectClassID;
                string HBuildComp = mainList[0].HBuildComp;
                string HBuildAddress = mainList[0].HBuildAddress;
                string HWorkNo = mainList[0].HWorkNo;
                string HReDate = mainList[0].HReDate;
                string HPicNo = mainList[0].HPicNo;
                string HWorkTask = mainList[0].HWorkTask;
                string HProjectNote = mainList[0].HProjectNote;
                string HContacts = mainList[0].HContacts;
                string HContactNumber = mainList[0].HContactNumber;
                int HSupplierID = mainList[0].HSupplierID;                      //分包单位(gy_supllier)
                int HMangerEmpID = mainList[0].HMangerEmpID;                    //管理员(gy_Employee)
                string HMaterPlanDate = mainList[0].HMaterPlanDate;             //材料计划
                int HWorkerID = mainList[0].HWorkerID;                          //施工员(gy_Employee)
                double HPlanWorkTimes = mainList[0].HPlanWorkTimes;             //计划工期
                double HRelWorkTimes = mainList[0].HRelWorkTimes;               //实际工期
                string HTestDate = mainList[0].HTestDate;                       //试压日期
                int HTestCheckerID = mainList[0].HTestCheckerID;                //试压验收人(gy_Employee)
                string HTestNote = mainList[0].HTestNote;                       //试压记录(富文本)
                string HSewageDate = mainList[0].HSewageDate;                   //排污日期
                string HWaterSupplyDate = mainList[0].HWaterSupplyDate;         //通水日期
                string HWorkNote = mainList[0].HWorkNote;                       //竣工资料(富文本)
                string HWorkProcNote = mainList[0].HWorkProcNote;               //施工完成情况(富文本)
                double HYuSuanMoney = mainList[0].HYuSuanMoney;                 //预算造价
                double HHeTongMoney = mainList[0].HHeTongMoney;                 //合同造价
                double HJieSuanMoney = mainList[0].HJieSuanMoney;               //结算造价
                double HShenJiMoney = mainList[0].HShenJiMoney;                 //审计造价
                double HCaiLiaoMoney = mainList[0].HCaiLiaoMoney;               //材料费
                double HAnZhuangMoney = mainList[0].HAnZhuangMoney;             //安装费
                double HBanZuMoney = mainList[0].HBanZuMoney;                   //班组工费
                double HYuShouKuanMoney = mainList[0].HYuShouKuanMoney;         //预收款
                double HGongFeiMoney = mainList[0].HGongFeiMoney;               //工费结账
                double HJieZhangMoney = mainList[0].HJieZhangMoney;            //结算结账
                int HTaskClassID = mainList[0].HTaskClassID; //任务大类(Gy_TaskClass)
                int HTaskClassEntryID = mainList[0].HTaskClassEntryID; //任务项目分类(Gy_TaskClass)
                string HTaskAddress = mainList[0].HTaskAddress; //任务地点
                string HBreakStatus = mainList[0].HBreakStatus; //损坏情况
                string HWaterLeakage = mainList[0].HWaterLeakage; //漏水量
                string HPipeDiameter = mainList[0].HPipeDiameter; //管径
                string HPipeMaterial = mainList[0].HPipeMaterial; //管道材质
                string HAlarmEmp = mainList[0].HAlarmEmp; //报漏人
                string HAlarmLink = mainList[0].HAlarmLink; //报漏人联系电话
                string HReceEmp = mainList[0].HReceEmp; //受理人
                string HReceTime = mainList[0].HReceTime; //受理时间(年月日时分秒)
                double HTaskMaterMoney = mainList[0].HTaskMaterMoney; //任务材料费
                double HTaskSetupMoney = mainList[0].HTaskSetupMoney; //任务安装费
                double HTaskOtherMoney = mainList[0].HTaskOtherMoney; //任务附属费
                double HTaskExamMoney = mainList[0].HTaskExamMoney; //任务考核费
                double HTaskWorkMoney = mainList[0].HTaskWorkMoney; //任务工费
                bool HIsAccount = mainList[0].HIsAccount; //是否结账(复选框)
                string HAccountDate = mainList[0].HAccountDate; //结算结账日期
                string HAccountWorkMoneyDate = mainList[0].HAccountWorkMoneyDate; //工费结账日期
                bool HIsCheckExam = mainList[0].HIsCheckExam; //是否审核考核费(复选框)
                bool HIsCheckWorkMoney = mainList[0].HIsCheckWorkMoney; //是否审核工费(复选框)
                string HInfoBackTime = mainList[0].HInfoBackTime; //回复时间(年月日时分秒)
                string HInfoBackMan = mainList[0].HInfoBackMan; //回复人
                string HInfoNote = mainList[0].HInfoNote; //回复内容(富文本)
                string HTaskBTime = mainList[0].HTaskBTime; //任务开始时间(年月日时分秒)
                string HTaskETime = mainList[0].HTaskETime; //任务完工时间(年月日时分秒)
                string HTaskNote = mainList[0].HTaskNote; //任务详细内容(富文本)
                string HTaskWorkEmp = mainList[0].HTaskWorkEmp; //工作人员(富文本)
                string HBeginCloseValveTime = mainList[0].HBeginCloseValveTime; //开始关阀时间(年月日时分秒)
                string HEndCloseValveTime = mainList[0].HEndCloseValveTime; //结束关阀时间(年月日时分秒)
                long HCloseValveQty = mainList[0].HCloseValveQty; //关阀只数
                string HBeginOpenValveTime = mainList[0].HBeginOpenValveTime; //开始开阀时间(年月日时分秒)
                string HEndOpenValveTime = mainList[0].HEndOpenValveTime; //结束开阀时间(年月日时分秒)
                long HOpenValveQty = mainList[0].HOpenValveQty; //开阀只数
                string HValveWorkEmp = mainList[0].HValveWorkEmp; //操作人员
                string HTaskRemark = mainList[0].HTaskRemark; //任务备注(富文本)
                if (OperationType == 2)
                {
@@ -245,7 +401,9 @@
                {
                    string sql = "insert into PM_ProjectBillMain" +
                        "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HBillStatus,HRemark,HMaker,HMakeDate,HProNumber,HProName,HCusID,HBeginDate,HEndDate,HSumMoney," +
                        "HProMoney,HWorkMoney,HOtherMoney,HProType,HPMEmpID,HWorkEmpID,HDepEmpID,HConWorkDays,HDepDays,HLastMoney,HPayCusID,HOrgID,HMaterID) " +
                        "HProMoney,HWorkMoney,HOtherMoney,HProType,HPMEmpID,HWorkEmpID,HDepEmpID,HConWorkDays,HDepDays,HLastMoney,HPayCusID,HOrgID,HMaterID,HProjectClassID,HBuildComp,HBuildAddress,HWorkNo,HReDate,HPicNo,HWorkTask,HProjectNote,HContacts,HContactNumber" +
                        ",HSupplierID,HMangerEmpID,HMaterPlanDate,HWorkerID,HPlanWorkTimes,HRelWorkTimes,HTestDate,HTestCheckerID,HTestNote,HSewageDate,HWaterSupplyDate,HWorkNote,HWorkProcNote,HYuSuanMoney,HHeTongMoney,HJieSuanMoney,HShenJiMoney,HCaiLiaoMoney,HAnZhuangMoney,HBanZuMoney,HYuShouKuanMoney,HGongFeiMoney,HJieZhangMoney," +
                        "HTaskClassID,HTaskClassEntryID,HTaskAddress,HBreakStatus,HWaterLeakage,HPipeDiameter,HPipeMaterial,HAlarmEmp,HAlarmLink,HReceEmp,HReceTime,HTaskMaterMoney,HTaskSetupMoney,HTaskOtherMoney,HTaskExamMoney,HTaskWorkMoney,HIsAccount,HAccountDate,HAccountWorkMoneyDate,HIsCheckExam,HIsCheckWorkMoney,HInfoBackTime,HInfoBackMan,HInfoNote,HTaskBTime,HTaskETime,HTaskNote,HTaskWorkEmp,HBeginCloseValveTime,HEndCloseValveTime,HCloseValveQty,HBeginOpenValveTime,HEndOpenValveTime,HOpenValveQty,HValveWorkEmp,HTaskRemark)" +
                        "values(" +
                        "" + HYear +
                        "," + HPeriod +
@@ -277,6 +435,45 @@
                        "," + HPayCusID +
                        "," + HOrgID +
                        "," + HMaterID +
                        "," + HProjectClassID +
                        ",'" + HBuildComp +
                        "','" + HBuildAddress +
                        "','" + HWorkNo +
                        "','" + HReDate +
                        "','" + HPicNo +
                        "','" + HWorkTask +
                        "','" + HProjectNote +
                        "','" + HContacts +
                        "','" + HContactNumber +
                        "','" + HSupplierID + "'" +
                        ",'" + HMangerEmpID + "'" +
                        ",'" + HMaterPlanDate + "'" +
                        ",'" + HWorkerID + "'" +
                        ",'" + HPlanWorkTimes + "'" +
                        ",'" + HRelWorkTimes + "'" +
                        ",'" + HTestDate + "'" +
                        ",'" + HTestCheckerID + "'" +
                        ",'" + HTestNote + "'" +
                        ",'" + HSewageDate + "'" +
                        ",'" + HWaterSupplyDate + "'" +
                        ",'" + HWorkNote + "'" +
                        ",'" + HWorkProcNote + "'" +
                        ",'" + HYuSuanMoney + "'" +
                        ",'" + HHeTongMoney + "'" +
                        ",'" + HJieSuanMoney + "'" +
                        ",'" + HShenJiMoney + "'" +
                        ",'" + HCaiLiaoMoney + "'" +
                        ",'" + HAnZhuangMoney + "'" +
                        ",'" + HBanZuMoney + "'" +
                        ",'" + HYuShouKuanMoney + "'" +
                        ",'" + HGongFeiMoney + "'" +
                        ",'" + HJieZhangMoney + "'" +
                        ",'" + HTaskClassID + "'" + ",'" + HTaskClassEntryID + "'" + ",'" + HTaskAddress + "'" + ",'" + HBreakStatus + "'" + ",'" + HWaterLeakage + "'" + ",'" + HPipeDiameter + "'" + ",'" + HPipeMaterial + "'" +
                        ",'" + HAlarmEmp + "'" +",'" + HAlarmLink + "'" + ",'" + HReceEmp + "'" + ",'" + HReceTime + "'" + ",'" + HTaskMaterMoney + "'" + ",'" + HTaskSetupMoney + "'" + ",'" + HTaskOtherMoney + "'" +
                        ",'" + HTaskExamMoney + "'" + ",'" + HTaskWorkMoney + "'" + ",'" + (HIsAccount?1:0) + "'" + ",'" + HAccountDate + "'" + ",'" + HAccountWorkMoneyDate + "'" + ",'" + (HIsCheckExam ? 1 : 0) + "'" +
                        ",'" + (HIsCheckWorkMoney ? 1 : 0) + "'" + ",'" + HInfoBackTime + "'" + ",'" + HInfoBackMan + "'" + ",'" + HInfoNote + "'" + ",'" + HTaskBTime + "'" +
                        ",'" + HTaskETime + "'" + ",'" + HTaskNote + "'" + ",'" + HTaskWorkEmp + "'" + ",'" + HBeginCloseValveTime + "'" + ",'" + HEndCloseValveTime + "'" +
                        ",'" + HCloseValveQty + "'" + ",'" + HBeginOpenValveTime + "'" + ",'" + HEndOpenValveTime + "'" + ",'" + HOpenValveQty + "'" + ",'" + HValveWorkEmp + "'" + ",'" + HTaskRemark + "'" +
                        ")";
                    //主表
@@ -287,14 +484,14 @@
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)                    //编辑
                {
                    string sql = "update PM_ProjectBillMain set " +
                        "HYear = " + HYear +
                        ",HPeriod = " + HPeriod +
                        ",HBillType = '" + HBillType +
                        "',HBillSubType = '" + HBillSubType +
                        "',HDate = '" + HDate +
                        "',HBillNo = '" + HBillNo +
                        "',HBillStatus = " + HBillStatus +
                        ",HRemark = '" + HRemark +
                        //"HYear = " + HYear +
                        //",HPeriod = " + HPeriod +
                        //",HBillType = '" + HBillType +
                        //"',HBillSubType = '" + HBillSubType +
                        //"',HDate = '" + HDate +
                        "HBillNo = '" + HBillNo +
                        //"',HBillStatus = " + HBillStatus +
                        "',HRemark = '" + HRemark +
                        "',HUpdater = '" + HUpdater +
                        "',HUpdateDate = '" + HUpdaterDate +
                        "',HProNumber = '" + HProNumber +
@@ -316,7 +513,48 @@
                        ",HPayCusID = " + HPayCusID +
                        ",HOrgID = " + HOrgID +
                        ",HMaterID = " + HMaterID +
                        " where HInterID = " + HInterID;
                        ",HProjectClassID = " + HProjectClassID +
                        ",HBuildComp = '" + HBuildComp +
                        "',HBuildAddress = '" + HBuildAddress +
                        "',HWorkNo = '" + HWorkNo +
                        "',HReDate = '" + HReDate +
                        "',HPicNo = '" + HPicNo +
                        "',HWorkTask = '" + HWorkTask +
                        "',HProjectNote ='" + HProjectNote +
                        "',HContacts ='" + HContacts +
                        "',HContactNumber ='" + HContactNumber +
                        "',HSupplierID = '" + HSupplierID +
                        "',HMangerEmpID = '" + HMangerEmpID +
                        "',HMaterPlanDate = '" + HMaterPlanDate +
                        "',HWorkerID = '" + HWorkerID +
                        "',HPlanWorkTimes = '" + HPlanWorkTimes +
                        "',HRelWorkTimes = '" + HRelWorkTimes +
                        "',HTestDate = '" + HTestDate +
                        "',HTestCheckerID = '" + HTestCheckerID +
                        "',HTestNote = '" + HTestNote +
                        "',HSewageDate = '" + HSewageDate +
                        "',HWaterSupplyDate = '" + HWaterSupplyDate +
                        "',HWorkNote = '" + HWorkNote +
                        "',HWorkProcNote = '" + HWorkProcNote +
                        "',HYuSuanMoney = '" + HYuSuanMoney +
                        "',HHeTongMoney = '" + HHeTongMoney +
                        "',HJieSuanMoney = '" + HJieSuanMoney +
                        "',HShenJiMoney = '" + HShenJiMoney +
                        "',HCaiLiaoMoney = '" + HCaiLiaoMoney +
                        "',HAnZhuangMoney = '" + HAnZhuangMoney +
                        "',HBanZuMoney = '" + HBanZuMoney +
                        "',HYuShouKuanMoney = '" + HYuShouKuanMoney +
                        "',HGongFeiMoney = '" + HGongFeiMoney +
                        "',HJieZhangMoney = '" + HJieZhangMoney +
                        "',HTaskClassID = '" + HTaskClassID + "',HTaskClassEntryID = '" + HTaskClassEntryID + "',HTaskAddress = '" + HTaskAddress + "',HBreakStatus = '" + HBreakStatus + "',HWaterLeakage = '" + HWaterLeakage + "',HPipeDiameter = '" + HPipeDiameter +
                        "',HPipeMaterial = '" + HPipeMaterial + "',HAlarmEmp = '" + HAlarmEmp + "',HAlarmLink = '" + HAlarmLink + "',HReceEmp = '" + HReceEmp + "',HReceTime = '" + HReceTime + "',HTaskMaterMoney = '" + HTaskMaterMoney +
                        "',HTaskSetupMoney = '" + HTaskSetupMoney + "',HTaskOtherMoney = '" + HTaskOtherMoney + "',HTaskExamMoney = '" + HTaskExamMoney + "',HTaskWorkMoney = '" + HTaskWorkMoney + "',HIsAccount = '" + (HIsAccount?1:0) + "',HAccountDate = '" + HAccountDate +
                        "',HAccountWorkMoneyDate = '" + HAccountWorkMoneyDate + "',HIsCheckExam = '" + (HIsCheckExam?1:0) + "',HIsCheckWorkMoney = '" + (HIsCheckWorkMoney?1:0) + "',HInfoBackTime = '" + HInfoBackTime + "',HInfoBackMan = '" + HInfoBackMan + "',HInfoNote = '" + HInfoNote +
                        "',HTaskBTime = '" + HTaskBTime + "',HTaskETime = '" + HTaskETime + "',HTaskNote = '" + HTaskNote + "',HTaskWorkEmp = '" + HTaskWorkEmp + "',HBeginCloseValveTime = '" + HBeginCloseValveTime + "',HEndCloseValveTime = '" + HEndCloseValveTime +
                        "',HCloseValveQty = '" + HCloseValveQty + "',HBeginOpenValveTime = '" + HBeginOpenValveTime + "',HEndOpenValveTime = '" + HEndOpenValveTime + "',HOpenValveQty = '" + HOpenValveQty + "',HValveWorkEmp = '" + HValveWorkEmp + "',HTaskRemark = '" + HTaskRemark +
                        "' where HInterID = " + HInterID;
                    oCN.RunProc(sql);
@@ -515,6 +753,62 @@
            }
        }
        #endregion
        #region å·¥ç¨‹é¡¹ç›®åˆ†é¡µåˆ—表
        [Route("PM_ProjectBill/page")]
        [HttpGet]
        public object PM_ProjectBillPage(string sWhere, string user, int page, int size)
        {
            DataSet ds;
            try
            {
                List<object> columnNameList = new List<object>();
                //判断权限
                //if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBillQuery", 1, false, user))
                //{
                //    objJsonResult.code = CodeConstant.FAIL;
                //    objJsonResult.count = CountConstant.FAIL;
                //    objJsonResult.Message = "您没有该模块权限,请与管理员联系!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_PM_ProjectBillList " + page + "," + size + ",''", "h_p_PM_ProjectBillList");
                }
                else
                {
                    sWhere = sWhere.Replace("'", "''");
                    ds = oCN.RunProcReturn("exec h_p_PM_ProjectBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_PM_ProjectBillList");
                }
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = CodeConstant.SUCCEED;
                objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                objJsonResult.Message = "Sucess!";
                objJsonResult.list = columnNameList;
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = CodeConstant.FAIL;
                objJsonResult.count = CountConstant.FAIL;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥ç¨‹é¡¹ç›® ç¼–辑-页面赋值
        /// <summary>
@@ -1208,6 +1502,44 @@
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥ç¨‹é¡¹ç›®  ä»»åŠ¡å®‰è£…è´¹ ã€ä»»åŠ¡è€ƒæ ¸è´¹ã€ä»»åŠ¡é™„å±žè´¹ã€ä»»åŠ¡å·¥è´¹  é€‰æ‹©é¡¹ç›®è´¹ç”¨åˆ†ç±»è¿”回 å¯¹åº”分类的项目费用
        [Route("PM_ProjectBill/getGy_Project")]
        [HttpGet]
        public object getGy_Project(string HItemID)
        {
            try
            {
                ds = oCN.RunProcReturn("select top 1 * from Gy_ProjectMoney where HProjectMoneyClassID='"+HItemID+ "' and isnull(HCheckEmp,'') !='' and HStopflag=0 order by HItemID desc", "Gy_ProjectMoney");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "该项目费用分类下的项目费用无数据";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                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 æœˆåº¦é˜¶æ®µè®¡åˆ’保存/编辑
@@ -3224,7 +3556,7 @@
                    if (refSav == "Add")
                    {
                        //单据号是否重复
                        if (BillNew1.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
                        if (BillNew5.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -3235,7 +3567,7 @@
                    }
                    if (refSav == "Update")
                    {
                        if (BillOld1.ShowBill(oItem.HInterID, ref s) == false)
                        if (BillOld5.ShowBill(oItem.HInterID, ref s) == false)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -3244,7 +3576,7 @@
                            return objJsonResult;
                        }
                        //判断是否可编辑
                        if (BillOld1.omodel.HChecker != "" && BillOld1.omodel.HChecker != null)
                        if (BillOld5.omodel.HChecker != "" && BillOld5.omodel.HChecker != null)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -3252,7 +3584,7 @@
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        if (BillOld1.omodel.HBillStatus > 1)
                        if (BillOld5.omodel.HBillStatus > 1)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -3862,7 +4194,7 @@
                    if (refSav == "Add")
                    {
                        //单据号是否重复
                        if (BillNew1.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
                        if (BillNew6.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -3873,7 +4205,7 @@
                    }
                    if (refSav == "Update")
                    {
                        if (BillOld1.ShowBill(oItem.HInterID, ref s) == false)
                        if (BillOld6.ShowBill(oItem.HInterID, ref s) == false)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -3882,7 +4214,7 @@
                            return objJsonResult;
                        }
                        //判断是否可编辑
                        if (BillOld1.omodel.HChecker != "" && BillOld1.omodel.HChecker != null)
                        if (BillOld6.omodel.HChecker != "" && BillOld6.omodel.HChecker != null)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -3890,7 +4222,7 @@
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        if (BillOld1.omodel.HBillStatus > 1)
                        if (BillOld6.omodel.HBillStatus > 1)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -4433,6 +4765,1329 @@
        }
        #endregion
        #region é¡¹ç›®è´¹ç”¨æ¸…单
        #region é¡¹ç›®è´¹ç”¨æ¸…单 ä¿å­˜/编辑
        /// <summary>
        /// é¡¹ç›®è´¹ç”¨æ¸…单
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("PM_ProjectBill/SaveGy_ProjectMoneyBOMBill")]
        [HttpPost]
        public object SaveGy_ProjectMoneyBOMBill([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("PM_ProjectMoneyBOMBill_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DAL.ClsGy_ProjectMoneyBOMBill oBill = new DAL.ClsGy_ProjectMoneyBOMBill();
                List<Model.ClsGy_ProjectMoneyBOMBillMain> lsmain = new List<Model.ClsGy_ProjectMoneyBOMBillMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");  //\n
                //序列化主表数据
                var jsonString = "[" + msg2.ToString() + "]";
                lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_ProjectMoneyBOMBillMain>>(jsonString);
                foreach (Model.ClsGy_ProjectMoneyBOMBillMain oItem in lsmain)
                {
                    if (refSav == "Add")
                    {
                        //单据号是否重复
                        if (BillNew7.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 (BillNew7.ShowBill(oItem.HInterID, ref s) == false)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据有误!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        //判断是否可编辑
                        if (BillNew7.omodel.HChecker != "" && BillNew7.omodel.HChecker != null)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据已经被审核,不允许修改!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        if (BillNew7.omodel.HBillStatus > 1)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    UserName = oItem.HMaker;  //制单人
                    oItem.HBillType = "3338";
                    oItem.HBillSubType = "3338";
                    //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_ProjectMoneyBOMBillSub> ls = new List<Model.ClsGy_ProjectMoneyBOMBillSub>();
                jsonString = "[" + msg3.ToString() + "]";
                ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_ProjectMoneyBOMBillSub>>(jsonString);
                int i = 0;
                foreach (Model.ClsGy_ProjectMoneyBOMBillSub 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 é¡¹ç›®è´¹ç”¨æ¸…单列表 æŸ¥è¯¢
        /// <summary>
        /// è¿”回项目费用清单列表
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("PM_ProjectBill/getGy_ProjectMoneyBOMBillList")]
        [HttpGet]
        public object getGy_ProjectMoneyBOMBillList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log_second("PM_ProjectMoneyBOMBill_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_ProjectMoneyBOMBillList order by å•据号 desc", "h_v_Gy_ProjectMoneyBOMBillList");
                }
                else
                {
                    string sql1 = "select * from h_v_Gy_ProjectMoneyBOMBillList where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_Gy_ProjectMoneyBOMBillList");
                }
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                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/Gy_ProjectMoneyBOMBillEditList")]
        [HttpGet]
        public object Gy_ProjectMoneyBOMBillMainEditList(string HInterID, string User)
        {
            try
            {
                List<DataTable> tableList = new List<DataTable>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("PM_ProjectMoneyBOMBill_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_Gy_ProjectMoneyBOMBillList where HInterID =" + HInterID, "h_v_Gy_ProjectMoneyBOMBillList");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "false!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region é¡¹ç›®è´¹ç”¨æ¸…单列表 å®¡æ ¸/反审核功能
        [Route("PM_ProjectBill/CheckGy_ProjectMoneyBOMBill")]
        [HttpGet]
        public object CheckGy_ProjectMoneyBOMBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有审核权限
                if (!DBUtility.ClsPub.Security_Log("PM_ProjectMoneyBOMBill_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;
                BillOld1.MvarItemKey = "Gy_ProjectMoneyBOMBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                {
                    //判断单据是否已经审核
                    DataSet ds;
                    string sql = "select * from " + BillOld1.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld1.MvarItemKey);
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据不存在!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    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 (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已作废!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //审核单据
                        if (!BillOld1.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 " + BillOld1.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld1.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 (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已作废!不能进行反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核单据
                        if (!BillOld1.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("PM_ProjectBill/CloseGy_ProjectMoneyBOMBill")]
        [HttpGet]
        public object CloseGy_ProjectMoneyBOMBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("PM_ProjectMoneyBOMBill_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;
                BillOld7.MvarItemKey = "Gy_ProjectMoneyBOMBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 å…³é—­  2  åå…³é—­
                if (Type == 1)
                {
                    //判断单据是否已经关闭
                    DataSet ds;
                    string sql = "select * from " + BillOld7.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld7.MvarItemKey);
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据不存在!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    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 (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 (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 (!BillOld7.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 " + BillOld7.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld7.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 (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 (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 (!BillOld7.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("PM_ProjectBill/DropGy_ProjectMoneyBOMBill")]
        [HttpGet]
        public object DropGy_ProjectMoneyBOMBillMain(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有作废权限
                if (!DBUtility.ClsPub.Security_Log("PM_ProjectMoneyBOMBill_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;
                BillOld7.MvarItemKey = "Gy_ProjectMoneyBOMBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 ä½œåºŸ  2  åä½œåºŸ
                if (Type == 1)
                {
                    //判断单据是否已经作废
                    DataSet ds;
                    string sql = "select * from " + BillOld7.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld7.MvarItemKey);
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据不存在!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    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 (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 (!BillOld7.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 " + BillOld7.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld7.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 (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 (!BillOld7.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 é¡¹ç›®è´¹ç”¨æ¸…单列表 åˆ é™¤
        /// <summary>
        ///参数:string HInterID。
        ///返回值:object。
        /// </summary>
        [Route("PM_ProjectBill/DeleteGy_ProjectMoneyBOMBill")]
        [HttpGet]
        public object DeleteGy_ProjectMoneyBOMBillMain(string HInterID, string user)
        {
            try
            {
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("PM_ProjectMoneyBOMBill_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 Gy_ProjectMoneyBOMBillMain   where HInterID = " + HInterID);
                oCN.RunProc("delete from Gy_ProjectMoneyBOMBillSub   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="HInterID">单据ID</param>
        /// <param name="IsAudit">关闭(1),反关闭(2)</param>
        /// <param name="CurUserName">关闭人</param>
        /// <returns></returns>
        [Route("PM_ProjectBill/CloseRowGy_ProjectMoneyBOMBill")]
        [HttpGet]
        public object CloseRowGy_ProjectMoneyBOMBill(int HInterID, int HEntryID, int IsAudit, string CurUserName)
        {
            string ModRightNameCheck = "PM_ProjectMoneyBOMBill_Close";
            string SubBillName = "Gy_ProjectMoneyBOMBillSub";                   //子表表名
            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);                                         //对HInterID进行类型的转换
                DAL.ClsGy_ProjectMoneyBOMBill oBill = new DAL.ClsGy_ProjectMoneyBOMBill();              //实例化单据操作类,用于进行相关操作
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                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, "Cg_POOrderBillSub");
                    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 == 1)  //行关闭判断
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "行已关闭!不能再次行关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 2) //行反关闭判断
                    {
                        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 == 1) //行关闭提交
                {
                    //行关闭提交
                    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 == 2) //行反关闭提交
                {
                    //行反关闭提交
                    if (oBill.CancelRow(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;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #endregion
        #region é¡¹ç›®è´¹ç”¨å¾…审核列表
        #region å·¥ç¨‹é¡¹ç›®è´¹ç”¨å¾…审核列表
        [Route("PM_ProjectBill/NeedCheckQuery")]
        [HttpGet]
        public object PM_ProjectBillNeedCheckQuery(string user)
        {
            DataSet ds;
            try
            {
                List<object> columnNameList = new List<object>();
                //判断权限
                //if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBillQuery", 1, false, user))
                //{
                //    objJsonResult.code = CodeConstant.FAIL;
                //    objJsonResult.count = CountConstant.FAIL;
                //    objJsonResult.Message = "您没有该模块权限,请与管理员联系!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                //sWhere = sWhere.Replace("'", "''");
                ds = oCN.RunProcReturn("exec h_p_PM_ProjectBillNeedCheckQuery ", "h_p_PM_ProjectBillNeedCheckQuery");
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = CodeConstant.SUCCEED;
                objJsonResult.count = CountConstant.SUCCEED;
                objJsonResult.Message = "Sucess!";
                objJsonResult.list = columnNameList;
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = CodeConstant.FAIL;
                objJsonResult.count = CountConstant.FAIL;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥ç¨‹é¡¹ç›®è´¹ç”¨ å®¡æ ¸/反审核
        [Route("PM_ProjectBill/AuditTaskMoney")]
        [HttpGet]
        public object AuditTaskMoney(string HInterID, string Type, string user)
        {
            try
            {
                //判断是否有审核权限
                if (!DBUtility.ClsPub.Security_Log("Pm_ProjectBill_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 = "PM_ProjectBillMain";
                oCN.BeginTran();//开始事务
                DataSet ds;
                string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //Type ä»»åŠ¡å®‰è£…è´¹å®¡æ ¸æ ‡è®°
                if (Type == "SetupMoneyCheck")
                {
                    if (ds.Tables[0].Rows[0]["HTaskSetupMoneyCheckFlag"].ToString() == "False")
                    {
                        oCN.RunProcReturn("update PM_ProjectBillMain set HTaskSetupMoneyCheckFlag = 1 where HInterID = " + HInterID, "PM_ProjectBillMain");
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "费用已审核!";
                        objJsonResult.data = null;
                        return objJsonResult; ;
                    }
                }
                //任务附属审核
                else if (Type == "OtherMoneyCheck")
                {
                    if (ds.Tables[0].Rows[0]["HTaskOtherMoneyCheckFlag"].ToString() == "False")
                    {
                        oCN.RunProcReturn("update PM_ProjectBillMain set HTaskOtherMoneyCheckFlag = 1 where HInterID = " + HInterID, "PM_ProjectBillMain");
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "费用已审核!";
                        objJsonResult.data = null;
                        return objJsonResult; ;
                    }
                }
                //任务考核费审核
                else if (Type == "ExamMoneyCheck")
                {
                    if (ds.Tables[0].Rows[0]["HTaskExamMoneyCheckFlag"].ToString() == "False")
                    {
                        oCN.RunProcReturn("update PM_ProjectBillMain set HTaskExamMoneyCheckFlag = 1 where HInterID = " + HInterID, "PM_ProjectBillMain");
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "费用已审核!";
                        objJsonResult.data = null;
                        return objJsonResult; ;
                    }
                }
                //任务工费审核标记
                else if (Type == "WorkMoneyCheck")
                {
                    if (ds.Tables[0].Rows[0]["HTaskWorkMoneyCheckFlag"].ToString() == "False")
                    {
                        oCN.RunProcReturn("update PM_ProjectBillMain set HTaskWorkMoneyCheckFlag = 1 where HInterID = " + HInterID, "PM_ProjectBillMain");
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "费用已审核!";
                        objJsonResult.data = null;
                        return objJsonResult; ;
                    }
                }
                //反审核费用
                else if (Type == "UnCheck")
                {
                    oCN.RunProcReturn("update PM_ProjectBillMain set HTaskWorkMoneyCheckFlag = 0,HTaskExamMoneyCheckFlag = 0,HTaskOtherMoneyCheckFlag = 0,HTaskSetupMoneyCheckFlag = 0 where HInterID = " + HInterID, "PM_ProjectBillMain");
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核类型不存在!";
                    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
        #endregion
        #region é¡¹ç›®è´¹ç”¨å¾…保存列表
        #region å·¥ç¨‹é¡¹ç›®è´¹ç”¨å¾…保存列表
        [Route("PM_ProjectBill/NeedSaveQuery")]
        [HttpGet]
        public object PM_ProjectBillNeedSaveQuery(string user)
        {
            DataSet ds;
            try
            {
                List<object> columnNameList = new List<object>();
                //判断权限
                //if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBillQuery", 1, false, user))
                //{
                //    objJsonResult.code = CodeConstant.FAIL;
                //    objJsonResult.count = CountConstant.FAIL;
                //    objJsonResult.Message = "您没有该模块权限,请与管理员联系!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                //sWhere = sWhere.Replace("'", "''");
                ds = oCN.RunProcReturn("exec h_p_PM_ProjectBillNeedSaveQuery ", "h_p_PM_ProjectBillNeedSaveQuery");
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = CodeConstant.SUCCEED;
                objJsonResult.count = CountConstant.SUCCEED;
                objJsonResult.Message = "Sucess!";
                objJsonResult.list = columnNameList;
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = CodeConstant.FAIL;
                objJsonResult.count = CountConstant.FAIL;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥ç¨‹é¡¹ç›®è´¹ç”¨ ä¿å­˜åä¿å­˜
        [Route("PM_ProjectBill/SaveTaskMoney")]
        [HttpGet]
        public object SaveTaskMoney(string HInterID, string Type, string user,int HMoney)
        {
            try
            {
                //判断是否有审核权限
                if (!DBUtility.ClsPub.Security_Log("Pm_ProjectBill_edit", 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 = "PM_ProjectBillMain";
                oCN.BeginTran();//开始事务
                DataSet ds;
                string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //Type ä»»åŠ¡å®‰è£…è´¹ä¿å­˜æ ‡è®°
                if (Type == "SetupMoneySave")
                {
                    if (ds.Tables[0].Rows[0]["HTaskSetupMoneySaveFlag"].ToString() == "False")
                    {
                        oCN.RunProcReturn("update PM_ProjectBillMain set HTaskSetupMoneySaveFlag = 1,HTaskSetupMoney="+HMoney+" where HInterID = " + HInterID, "PM_ProjectBillMain");
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "费用已保存!";
                        objJsonResult.data = null;
                        return objJsonResult; ;
                    }
                }
                //任务附属保存
                else if (Type == "OtherMoneySave")
                {
                    if (ds.Tables[0].Rows[0]["HTaskOtherMoneySaveFlag"].ToString() == "False")
                    {
                        oCN.RunProcReturn("update PM_ProjectBillMain set HTaskOtherMoneySaveFlag = 1,HTaskOtherMoney=" + HMoney + " where HInterID = " + HInterID, "PM_ProjectBillMain");
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "费用已保存!";
                        objJsonResult.data = null;
                        return objJsonResult; ;
                    }
                }
                //任务考核费保存
                else if (Type == "ExamMoneySave")
                {
                    if (ds.Tables[0].Rows[0]["HTaskExamMoneySaveFlag"].ToString() == "False")
                    {
                        oCN.RunProcReturn("update PM_ProjectBillMain set HTaskExamMoneySaveFlag = 1,HTaskExamMoney=" + HMoney + "  where HInterID = " + HInterID, "PM_ProjectBillMain");
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "费用已保存!";
                        objJsonResult.data = null;
                        return objJsonResult; ;
                    }
                }
                //任务工费保存标记
                else if (Type == "WorkMoneySave")
                {
                    if (ds.Tables[0].Rows[0]["HTaskWorkMoneySaveFlag"].ToString() == "False")
                    {
                        oCN.RunProcReturn("update PM_ProjectBillMain set HTaskWorkMoneySaveFlag = 1,HTaskWorkMoney=" + HMoney + " where HInterID = " + HInterID, "PM_ProjectBillMain");
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "费用已保存!";
                        objJsonResult.data = null;
                        return objJsonResult; ;
                    }
                }
                //反保存费用
                else if (Type == "UnSave")
                {
                    oCN.RunProcReturn("update PM_ProjectBillMain set HTaskWorkMoneySaveFlag = 0,HTaskExamMoneySaveFlag = 0,HTaskOtherMoneySaveFlag = 0,HTaskSetupMoneySaveFlag = 0 where HInterID = " + HInterID, "PM_ProjectBillMain");
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核类型不存在!";
                    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
        #endregion
    }
}