wtt
2025-08-14 9b6cd6ba2508314b3a4967b3764153170d40e66c
WebAPI/Controllers/ÏîÄ¿¹ÜÀí/¹¤³ÌÏîÄ¿/PM_ProjectBillController.cs
@@ -43,6 +43,8 @@
        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
@@ -101,6 +103,7 @@
            public string HProjectNote;
            public string HContacts;
            public string HContactNumber;
            public int HDeptID;
            public int HSupplierID;                  //分包单位(gy_supllier)
            public int HMangerEmpID;                 //管理员(gy_Employee)
@@ -115,6 +118,10 @@
            public string HWaterSupplyDate;             //通水日期
            public string HWorkNote;                    //竣工资料(富文本)
            public string HWorkProcNote;                //施工完成情况(富文本)
            public string HProBeginDate;                  //工程开工日期
            public string HProEndDate;             //工程完工日期
            public int HProPMEmpID;                    //工程项目经理
            public string HWorkPicNumber;                //竣工图编号
            public double HYuSuanMoney;                 //预算造价
            public double HHeTongMoney;                 //合同造价
@@ -124,8 +131,8 @@
            public double HAnZhuangMoney;               //安装费
            public double HBanZuMoney;                  //班组工费
            public double HYuShouKuanMoney;             //预收款
            public double HGongFeiMoney;                //工费结账
            public double HJieZhangMoney;            //结算结账
            public string HGongFeiMoney;                //工费结账
            public string HJieZhangMoney;            //结算结账
            public int HTaskClassID; //任务大类(Gy_TaskClass)
            public int HTaskClassEntryID; //任务项目分类(Gy_TaskClass)
@@ -317,7 +324,7 @@
                string HProjectNote = mainList[0].HProjectNote;
                string HContacts = mainList[0].HContacts;
                string HContactNumber = mainList[0].HContactNumber;
                int HDeptID = mainList[0].HDeptID;  //部门
                int HSupplierID = mainList[0].HSupplierID;                      //分包单位(gy_supllier)
                int HMangerEmpID = mainList[0].HMangerEmpID;                    //管理员(gy_Employee)
@@ -332,7 +339,10 @@
                string HWaterSupplyDate = mainList[0].HWaterSupplyDate;         //通水日期
                string HWorkNote = mainList[0].HWorkNote;                       //竣工资料(富文本)
                string HWorkProcNote = mainList[0].HWorkProcNote;               //施工完成情况(富文本)
                int HProPMEmpID = mainList[0].HProPMEmpID;                      //项目经理
                string HWorkPicNumber = mainList[0].HWorkPicNumber;             //竣工图编号
                string HProBeginDate = mainList[0].HProBeginDate;               //项目开工日期
                string HProEndDate = mainList[0].HProEndDate;                   //项目完工日期
                double HYuSuanMoney = mainList[0].HYuSuanMoney;                 //预算造价
                double HHeTongMoney = mainList[0].HHeTongMoney;                 //合同造价
                double HJieSuanMoney = mainList[0].HJieSuanMoney;               //结算造价
@@ -341,8 +351,8 @@
                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;            //结算结账
                string HGongFeiMoney = mainList[0].HGongFeiMoney;               //工费结账
                string HJieZhangMoney = mainList[0].HJieZhangMoney;            //结算结账
                int HTaskClassID = mainList[0].HTaskClassID; //任务大类(Gy_TaskClass)
                int HTaskClassEntryID = mainList[0].HTaskClassEntryID; //任务项目分类(Gy_TaskClass)
@@ -403,7 +413,7 @@
                        "(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,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)" +
                        "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,HDeptID,HProPMEmpID,HWorkPicNumber,HProBeginDate,HProEndDate)" +
                        "values(" +
                        "" + HYear +
                        "," + HPeriod +
@@ -473,7 +483,7 @@
                        ",'" + 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 + "'" +
                        ",'" + HCloseValveQty + "'" + ",'" + HBeginOpenValveTime + "'" + ",'" + HEndOpenValveTime + "'" + ",'" + HOpenValveQty + "'" + ",'" + HValveWorkEmp + "'" + ",'" + HTaskRemark + "','" + HDeptID + "','" + HProPMEmpID + "','" + HWorkPicNumber + "','" + HProBeginDate + "','" + HProEndDate + "'"+
                        ")";
                    //主表
@@ -552,10 +562,9 @@
                        "',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 +
                        "',HCloseValveQty = '" + HCloseValveQty + "',HBeginOpenValveTime = '" + HBeginOpenValveTime + "',HEndOpenValveTime = '" + HEndOpenValveTime + "',HOpenValveQty = '" + HOpenValveQty + "',HValveWorkEmp = '" + HValveWorkEmp + "',HTaskRemark = '" + HTaskRemark + "',HDeptID = '" + HDeptID + "'" +
                         ",HProBeginDate = '" + HProBeginDate + "',HProEndDate = '" + HProEndDate + "',HProPMEmpID = '" + HProPMEmpID + "',HWorkPicNumber = '" + HWorkPicNumber +
                        "' where HInterID = " + HInterID;
                    oCN.RunProc(sql);
                    //删除子表
@@ -809,6 +818,44 @@
        }
        #endregion
        #region (任务类)的工程项目新增 æ ¹æ®ä»»åŠ¡å¤§ç±» ä»»åŠ¡é¡¹ç›®åˆ†ç±» æ—¥æœŸ æ›´æ–° é¡¹ç›®ä»£ç 
        [Route("PM_ProjectBill/GetHProjectHNumber")]
        [HttpGet]
        public object GetHProjectHNumber( int HDeptID, DateTime HDate,int HTaskClassID,int HTaskClassEntryID,int HType)
        {
            DataSet ds;
            try
            {
                List<object> columnNameList = new List<object>();
                ds = oCN.RunProcReturn("exec h_p_Xt_GetMaxBillNo_SubType '4750','" + HDate + "','" + HTaskClassID + "','" + HTaskClassEntryID + "','" + HDeptID + "',"+HType, "h_p_Xt_GetMaxBillNo_SubType");
                //添加列名
                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 å·¥ç¨‹é¡¹ç›® ç¼–辑-页面赋值
        /// <summary>
@@ -1502,6 +1549,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 æœˆåº¦é˜¶æ®µè®¡åˆ’保存/编辑
@@ -5670,5 +5755,386 @@
        }
        #endregion
        #endregion
        #region é¡¹ç›®è´¹ç”¨å¾…审核列表
        #region å·¥ç¨‹é¡¹ç›®è´¹ç”¨å¾…审核列表
        [Route("PM_ProjectBill/NeedCheckQuery")]
        [HttpGet]
        public object PM_ProjectBillNeedCheckQuery(string user,string sWhere)
        {
            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 " + sWhere, "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,string sWhere)
        {
            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 "+sWhere, "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
    }
}