示例#1
0
        public WF_AuditBillResult GetAuditBillRecord(WF_AuditRecordParam param)
        {
            ExeResult rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.WF.WF_AuditRecordBLL", "GetAuditBillRecord", param);
            WF_AuditBillResult ret = new WF_AuditBillResult();

            ret = (rst == null ? new WF_AuditBillResult() : rst.Result as WF_AuditBillResult);
            return(ret);
        }
示例#2
0
        /// <summary>
        /// 获取一条信息记录
        /// </summary>
        /// <param name="param">条件实体</param>
        /// <returns></returns>
        public WF_AuditBillResult GetInfo(WF_AuditBillParam param)
        {
            WF_AuditBillResult rst = new WF_AuditBillResult();

            try
            {
                this.CheckSession();
                #region 判断
                if (param.WFAuditGuid == null &&
                    param.TableName.ToStringHasNull().Trim() == "")
                {
                    throw new WarnException("请指定获取审核单据的条件!");
                }
                #endregion
                #region 获取主单实体
                WhereClip where = WF_AuditBill._.GCompanyID == this.SessionInfo.CompanyID && WF_AuditBill._.IsDeleted == false && WF_AuditBill._.IsStop == false;
                if (param.WFAuditGuid != null)
                {
                    where = where && WF_AuditBill._.WFAuditGuid == param.WFAuditGuid;
                }
                if (param.TableName.ToStringHasNull().Trim() != "")
                {
                    where = where && WF_AuditBill._.TableName == param.TableName;
                }
                rst = this.Select <WF_AuditBillResult>(where);
                #endregion
                #region 获取明细实体
                if (rst != null && rst.WFAuditGuid != null)
                {
                    where = WF_AuditBillLine._.WFAuditGuid == rst.WFAuditGuid &&
                            WF_AuditBillLine._.GCompanyID == this.SessionInfo.CompanyID &&
                            WF_AuditBillLine._.IsDeleted == false;
                    List <WF_AuditBillLineResult> lineRst = new List <WF_AuditBillLineResult>();
                    lineRst = this.SelectList <WF_AuditBillLineResult>(where, WF_AuditBillLine._.StepNo.Asc);
                    rst.WF_AuditBillLineList = lineRst;
                }
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
            }
            return(rst);
        }
示例#3
0
        void BindData(int pageIndex)
        {
            this.btnReturn.Enabled      = false; //收回
            this.btnNoPass.Enabled      = false; //拒绝
            this.btnCancelCheck.Enabled = false; //驳回
            this.btnArgee.Enabled       = false; //同意

            WF_AuditRecordLogic logic = new WF_AuditRecordLogic(this);
            WF_AuditRecordParam param = new WF_AuditRecordParam();

            param.SourceTableEngName = _tableName;
            param.SourceBillGuid     = _sourceGuidKey;
            param.PageIndex          = pageIndex;
            param.PageSize           = int.MaxValue;
            param.IsPage             = true;
            WF_AuditBillResult rst = this.AsyncExecute <WF_AuditBillResult, WF_AuditRecordParam>(param, logic.GetAuditBillRecord, BindDataComplete);
        }
示例#4
0
        void BindDataComplete(WF_AuditBillResult a)
        {
            List <WF_AuditRecordResult> lstRrcord     = a.WF_AuditRecordResultList;
            List <WF_AuditRecordResult> lstBindRrcord = lstRrcord.Where(b => b.IsCurrent == 0).ToList();

            #region 绑定表格
            int seqNo = 1;
            foreach (WF_AuditRecordResult info in lstBindRrcord)
            {
                info.SeqNo = seqNo;
                seqNo++;
            }
            this.dgvMain.DataSource = lstBindRrcord;
            #endregion
            #region 获取单据编号和审核状态
            WF_AuditRecordResult findRecord = lstRrcord.Find(b => b.IsCurrent == 1);
            txtBillNo.Text        = (lstRrcord.Count <= 0 ? "" : lstRrcord[0].SourceBillNo);
            txtApproveStatus.Text = a.ApproveStatus;
            if (findRecord == null)
            {
                txtCurrentCheckMan.Text = "";
            }
            else
            {
                txtCurrentCheckMan.Text = findRecord.AuditEmpNames;
            }
            #endregion
            #region 设置按钮状态
            List <WF_AuditRecordResult> lstAudit = a.WF_AuditRecordResultList;
            if (lstAudit == null && lstAudit.Count <= 0) //未提交
            {
                this.btnSubmit.Enabled      = true;      //提交
                this.btnReturn.Enabled      = false;     //收回
                this.btnNoPass.Enabled      = false;     //拒绝
                this.btnCancelCheck.Enabled = false;     //驳回
                this.btnArgee.Enabled       = false;     //同意
            }
            else
            {
                int countNum = lstAudit.Where(b => b.IsCurrent.ToInt32() > 0).Count();
                if (countNum > 0)                        //已提交待审核
                {
                    this.btnSubmit.Enabled      = false; //提交
                    this.btnReturn.Enabled      = true;  //收回
                    this.btnNoPass.Enabled      = true;  //拒绝
                    this.btnCancelCheck.Enabled = true;  //驳回
                    this.btnArgee.Enabled       = true;  //同意
                    if (lstAudit.Where(b => b.AuditEmpIDs.IndexOf("," + this.SessionInfo.UserID + ",") >= 0).Count() <= 0)
                    {
                        this.btnNoPass.Enabled      = false; //拒绝
                        this.btnCancelCheck.Enabled = false; //驳回
                        this.btnArgee.Enabled       = false; //同意
                    }
                }
                else //已提交待审核
                {
                    if (a.BillStatus.ToLower() == "new")
                    {
                        this.btnSubmit.Enabled      = true;  //提交
                        this.btnReturn.Enabled      = false; //收回
                        this.btnNoPass.Enabled      = false; //拒绝
                        this.btnCancelCheck.Enabled = false; //驳回
                        this.btnArgee.Enabled       = false; //同意
                    }
                    else if (a.BillStatus.ToLower() == "complete")
                    {
                        this.btnSubmit.Enabled      = false; //提交
                        this.btnReturn.Enabled      = false; //收回
                        this.btnNoPass.Enabled      = false; //拒绝
                        this.btnCancelCheck.Enabled = false; //驳回
                        this.btnArgee.Enabled       = false; //同意
                    }
                    else if (a.BillStatus.ToLower() == "nopass")
                    {
                        this.btnSubmit.Enabled      = false; //提交
                        this.btnReturn.Enabled      = false; //收回
                        this.btnNoPass.Enabled      = false; //拒绝
                        this.btnCancelCheck.Enabled = false; //驳回
                        this.btnArgee.Enabled       = false; //同意
                    }
                }
            }
            #endregion
        }
示例#5
0
文件: frmJobEdit.cs 项目: windygu/CRM
 protected void CheckAuditButton(string tableName, Guid?sourceGuid
                                 , Control conSubmit, Control conTakeBack, Control conAudit, Control conCancel)
 {
     #region 判断输入状态
     if (string.IsNullOrEmpty(tableName))
     {
         this.ShowMessage("请指定业务单据表名!");
     }
     if (sourceGuid == null)
     {
         this.ShowMessage("请指定业务单据ID!");
     }
     if (conSubmit == null && conTakeBack == null && conAudit == null && conCancel == null)
     {
         this.ShowMessage("请指定审批按钮!");
     }
     #endregion
     #region 获取审批状态
     WF_AuditBillResult  auditBillRst = new WF_AuditBillResult();
     WF_AuditRecordLogic recLogic     = new WF_AuditRecordLogic(this);
     WF_AuditRecordParam param        = new WF_AuditRecordParam();
     param.SourceTableEngName = tableName;
     param.SourceBillGuid     = sourceGuid;
     auditBillRst             = recLogic.GetAuditBillRecord(param);
     SetObjectPropertyValue(conSubmit, "Enabled", false);
     SetObjectPropertyValue(conAudit, "Enabled", false);
     SetObjectPropertyValue(conCancel, "Enabled", false);
     SetObjectPropertyValue(conTakeBack, "Enabled", false);
     if (auditBillRst == null)
     {
         this.ShowMessage("未定义当前单据审批流程!"); return;
     }
     #endregion
     #region 设置按钮状态
     List <WF_AuditRecordResult> lstAudit = auditBillRst.WF_AuditRecordResultList;
     if (lstAudit == null && lstAudit.Count <= 0)//未提交
     {
         SetObjectPropertyValue(conSubmit, "Enabled", true);
         SetObjectPropertyValue(conAudit, "Enabled", false);
         SetObjectPropertyValue(conCancel, "Enabled", false);
         SetObjectPropertyValue(conTakeBack, "Enabled", false);
     }
     else
     {
         int countNum = lstAudit.Where(a => a.IsCurrent.ToInt32() > 0).Count();
         if (countNum > 0)//已提交待审核
         {
             SetObjectPropertyValue(conSubmit, "Enabled", false);
             SetObjectPropertyValue(conAudit, "Enabled", true);
             SetObjectPropertyValue(conCancel, "Enabled", true);
             SetObjectPropertyValue(conTakeBack, "Enabled", true);
             if (lstAudit.Where(a => a.AuditEmpIDs.IndexOf("," + this.SessionInfo.UserID + ",") >= 0).Count() <= 0)
             {
                 SetObjectPropertyValue(conAudit, "Enabled", false);
             }
         }
         else //已提交待审核
         {
             if (auditBillRst.BillStatus.ToLower() == "new")
             {
                 SetObjectPropertyValue(conSubmit, "Enabled", true);
                 SetObjectPropertyValue(conAudit, "Enabled", true);
                 SetObjectPropertyValue(conCancel, "Enabled", false);
                 SetObjectPropertyValue(conTakeBack, "Enabled", false);
             }
             else if (auditBillRst.BillStatus.ToLower() == "complete")
             {
                 SetObjectPropertyValue(conSubmit, "Enabled", false);
                 SetObjectPropertyValue(conAudit, "Enabled", true);
                 SetObjectPropertyValue(conCancel, "Enabled", true);
                 SetObjectPropertyValue(conTakeBack, "Enabled", false);
             }
             else if (auditBillRst.BillStatus.ToLower() == "nopass")
             {
                 SetObjectPropertyValue(conSubmit, "Enabled", false);
                 SetObjectPropertyValue(conAudit, "Enabled", true);
                 SetObjectPropertyValue(conCancel, "Enabled", true);
                 SetObjectPropertyValue(conTakeBack, "Enabled", false);
             }
         }
     }
     #endregion
 }
示例#6
0
        /// <summary>
        /// 获取审核列表
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public WF_AuditBillResult GetAuditBillRecord(WF_AuditRecordParam param)
        {
            WF_AuditBillResult ret = new WF_AuditBillResult();

            this.CheckSession();
            if (string.IsNullOrEmpty(param.SourceTableEngName))
            {
                throw new WarnException("请指定相关审核业务单据!");
            }
            if (param.SourceBillGuid == null)
            {
                throw new WarnException("请指定相关审核业务单据的ID!");
            }
            #region 获取相关表定义
            WF_TableResult tblRst = new WF_TableResult();
            WF_TableBLL    tblBll = new WF_TableBLL();
            tblBll.SessionInfo = this.SessionInfo;
            tblRst             = tblBll.GetInfo(new WF_TableParam()
            {
                WF_TableEngName = param.SourceTableEngName
            });
            if (tblRst == null || tblRst.WF_TableID <= 0)
            {
                throw new WarnException("系统中未发现定义的业务表!");
            }
            if (tblRst.WF_TableFieldList == null || tblRst.WF_TableFieldList.Count < 0)
            {
                throw new WarnException("系统中未发现定义的业务表相关字段!");
            }
            if (!tblRst.WF_TableFieldList.Exists(a => a.IsKeyGuid.ToBooleanHasNull() == true))
            {
                throw new WarnException("系统中未发现定义的业务表相关主键字段!");
            }
            #endregion
            #region 判断当前记录状态
            object sourceInfo    = this.GetSourceAuditStatus(tblRst, param.SourceBillGuid);
            string billStatus    = sourceInfo.GetType().GetProperty("Status").GetValue(sourceInfo, null).ToStringHasNull();
            string approveStatus = sourceInfo.GetType().GetProperty("ApproveStatus").GetValue(sourceInfo, null).ToStringHasNull();
            #endregion
            #region 审核状态
            WF_AuditBillBLL auditBll = new WF_AuditBillBLL();
            auditBll.SessionInfo = this.SessionInfo;
            ret = auditBll.GetInfo(new WF_AuditBillParam()
            {
                TableName = param.SourceTableEngName
            });
            if (ret == null)
            {
                return(ret);
            }
            PageList <WF_AuditRecordResult> recordRstList = new PageList <WF_AuditRecordResult>();
            recordRstList = GetAuditRecList(new WF_AuditRecordParam()
            {
                PageIndex = 1, PageSize = int.MaxValue, SourceTableEngName = param.SourceTableEngName, SourceBillGuid = param.SourceBillGuid
            });
            ret.WF_AuditRecordResultList = recordRstList.ResultList;
            ret.BillStatus    = billStatus;
            ret.ApproveStatus = approveStatus;
            #endregion
            return(ret);
        }
示例#7
0
        /// <summary>
        /// 提交审核
        /// </summary>
        /// <param name="param">条件实体</param>
        /// <returns>返回生效的当前审核</returns>
        public WCFAddUpdateResult SubmitBill(WF_AuditRecordParam param)
        {
            WCFAddUpdateResult rst = new WCFAddUpdateResult();

            try
            {
                #region 判断提交值
                this.CheckSession();
                if (string.IsNullOrEmpty(param.SourceTableEngName))
                {
                    throw new WarnException("请指定相关审核业务单据!");
                }
                if (param.SourceBillGuid == null)
                {
                    throw new WarnException("请指定相关审核业务单据ID!");
                }
                //if (string.IsNullOrEmpty(param.SourceBillNo)) throw new WarnException("请指定相关审核业务单据编号!");

                #endregion
                #region 获取相关表定义
                WF_TableResult tblRst = new WF_TableResult();
                WF_TableBLL    tblBll = new WF_TableBLL();
                tblBll.SessionInfo = this.SessionInfo;
                tblRst             = tblBll.GetInfo(new WF_TableParam()
                {
                    WF_TableEngName = param.SourceTableEngName
                });
                if (tblRst == null || tblRst.WF_TableID <= 0)
                {
                    throw new WarnException("系统中未发现定义的业务表!");
                }
                if (tblRst.WF_TableFieldList == null || tblRst.WF_TableFieldList.Count < 0)
                {
                    throw new WarnException("系统中未发现定义的业务表相关字段!");
                }
                if (!tblRst.WF_TableFieldList.Exists(a => a.IsKeyGuid.ToBooleanHasNull() == true))
                {
                    throw new WarnException("系统中未发现定义的业务表相关主键字段!");
                }
                #endregion
                #region 判断当前记录状态
                object sourceInfo = this.GetSourceAuditStatus(tblRst, param.SourceBillGuid);
                //判断是否取消
                bool isCancel = sourceInfo.GetType().GetProperty("IsCancel") != null?sourceInfo.GetType().GetProperty("IsCancel").GetValue(sourceInfo, null).ToBooleanHasNull() : false;

                if (isCancel)
                {
                    throw new WarnException("您的单据已取消不允许执行当前操作!");
                }
                string oldStatus = sourceInfo.GetType().GetProperty("Status").GetValue(sourceInfo, null).ToStringHasNull();
                if (oldStatus.ToLower() == "approve")
                {
                    throw new WarnException("您的单据已提交,不允许重复提交!");
                }
                if (oldStatus.ToLower() == "complete")
                {
                    throw new WarnException("您的单据已审核完成,不允许提交!");
                }
                if (oldStatus.ToLower() == "nopass")
                {
                    throw new WarnException("您提交的单据已拒绝,不允许再次提交!");
                }
                #endregion
                #region 获取相关审核基础流程
                WF_AuditBillBLL auditBll = new WF_AuditBillBLL();
                auditBll.SessionInfo = this.SessionInfo;
                WF_AuditBillResult auditBillRst = auditBll.GetInfo(new WF_AuditBillParam()
                {
                    TableName = param.SourceTableEngName
                });
                if (auditBillRst == null || auditBillRst.WFAuditGuid == null ||
                    auditBillRst.WF_AuditBillLineList == null || auditBillRst.WF_AuditBillLineList.Count <= 0)
                {
                    throw new WarnException("未定相关业务单据的审核流程!");
                }
                if (auditBillRst.WF_AuditBillLineList.Exists(a => a.AuditEmpIDs.ToStringHasNull().Trim() == "" && a.NextType != "审核完成"))
                {
                    throw new WarnException("相关审批流程中,未找到相关审核人!");
                }
                #endregion
                #region 判断是否已提交业务单据,否则加入审核记录
                WF_AuditRecordResult currentStep = new WF_AuditRecordResult();
                WhereClip            whereClip   = WF_AuditRecord._.SourceBillGuid == param.SourceBillGuid &&
                                                   WF_AuditRecord._.GCompanyID == this.SessionInfo.CompanyID &&
                                                   WF_AuditRecord._.IsDeleted == false &&
                                                   WF_AuditRecord._.SourceTableEngName == param.SourceTableEngName &&
                                                   WF_AuditRecord._.IsCurrent == true;
                currentStep = this.Select <WF_AuditRecordResult>(whereClip);
                if (currentStep != null && currentStep.WF_RecGuid != null)
                {
                    throw new WarnException("当前单据已提交,正处于审核流程中,不允许重复提交!");
                }
                List <WF_AuditRecordResult> newAuditRecList = new List <WF_AuditRecordResult>();
                WF_AuditRecordResult        newAuditRec     = new WF_AuditRecordResult();
                #region 添加提交LOG记录
                newAuditRec.WF_RecGuid         = Guid.NewGuid();
                newAuditRec.GCompanyID         = this.SessionInfo.CompanyID;
                newAuditRec.SourceTableEngName = auditBillRst.TableName;
                newAuditRec.SourceBillNo       = param.SourceBillNo;
                newAuditRec.SourceBillGuid     = param.SourceBillGuid;
                newAuditRec.WFAuditGuid        = auditBillRst.WFAuditGuid;
                newAuditRec.WFAuditLineGuid    = null;
                newAuditRec.SeqNo          = 0;
                newAuditRec.GreeMans       = 0;
                newAuditRec.AuditEmpIDs    = "," + this.SessionInfo.UserID + ",";
                newAuditRec.AuditEmpNames  = this.SessionInfo.UserName;
                newAuditRec.IsCurrent      = 0;
                newAuditRec.AuditResult    = "提交";
                newAuditRec.AuditRemark    = "用户" + this.SessionInfo.UserName + "提交审核";
                newAuditRec.CreatedEmpID   = this.SessionInfo.UserID;
                newAuditRec.CreatedEmpName = this.SessionInfo.UserName;
                newAuditRec.CreatedTime    = DateTime.Now;
                newAuditRec.IsDeleted      = false;
                newAuditRecList.Add(newAuditRec);
                #endregion
                #region 添加审核记录
                string   billStatus = "", billApproveStatus = "";
                string[] arrEmpIds, arrEmpNames; int idx = 0;
                WF_AuditRecordLineResult auditRecLine;
                foreach (WF_AuditBillLineResult info in auditBillRst.WF_AuditBillLineList)
                {
                    newAuditRec                    = new WF_AuditRecordResult();
                    newAuditRec.WF_RecGuid         = Guid.NewGuid();
                    newAuditRec.GCompanyID         = this.SessionInfo.CompanyID;
                    newAuditRec.SourceTableEngName = auditBillRst.TableName;
                    newAuditRec.SourceBillNo       = param.SourceBillNo;
                    newAuditRec.SourceBillGuid     = param.SourceBillGuid;
                    newAuditRec.WFAuditGuid        = auditBillRst.WFAuditGuid;
                    newAuditRec.WFAuditLineGuid    = info.WFAuditLineGuid;
                    newAuditRec.SeqNo              = info.StepNo;
                    newAuditRec.GreeMans           = info.GreeMans;
                    newAuditRec.AuditEmpIDs        = info.AuditEmpIDs.ToStringHasNull().Trim() != "" ? ("," + info.AuditEmpIDs + ",") : "";//暂时是指定到人
                    newAuditRec.AuditEmpNames      = info.AuditEmpNames;
                    newAuditRec.IsCurrent          = 2;
                    newAuditRec.CreatedEmpID       = this.SessionInfo.UserID;
                    newAuditRec.CreatedEmpName     = this.SessionInfo.UserName;
                    newAuditRec.CreatedTime        = DateTime.Now;
                    newAuditRec.IsDeleted          = false;
                    if (info.OperationType == "提交")
                    {
                        newAuditRec.IsCurrent = 1;
                        billStatus            = "Approve";
                        billApproveStatus     = "待审核";//" + info.AuditEmpNames.ToStringHasNull() + "
                        if (info.NextType == "审核完成" && info.AuditEmpIDs.ToStringHasNull().Trim() == "")
                        {
                            billStatus            = "Complete";
                            billApproveStatus     = "审核完成";
                            newAuditRec.IsCurrent = 0;
                            newAuditRecList.Add(newAuditRec);
                            break;
                        }
                    }
                    newAuditRecList.Add(newAuditRec);
                    #region 添加审人明细记录
                    idx         = 0;
                    arrEmpIds   = newAuditRec.AuditEmpIDs.ToStringHasNull().Split(',').Where(a => a.ToStringHasNull().Trim() != "").Distinct().ToArray();
                    arrEmpNames = newAuditRec.AuditEmpNames.ToStringHasNull().Split(',').Where(a => a.ToStringHasNull().Trim() != "").Distinct().ToArray();
                    foreach (string s in arrEmpIds)
                    {
                        auditRecLine                    = new WF_AuditRecordLineResult();
                        auditRecLine.WF_RecGuid         = newAuditRec.WF_RecGuid;
                        auditRecLine.SourceBillGuid     = newAuditRec.SourceBillGuid;
                        auditRecLine.WFAuditGuid        = newAuditRec.WFAuditGuid;
                        auditRecLine.WFAuditLineGuid    = newAuditRec.WFAuditLineGuid;
                        auditRecLine.SourceTableEngName = newAuditRec.SourceTableEngName;
                        auditRecLine.SourceBillNo       = newAuditRec.SourceBillNo;
                        auditRecLine.AuditEmpID         = s.ToInt32();
                        auditRecLine.AuditEmpName       = arrEmpNames[idx];
                        this.AddOrUpdateAuditRecLine(auditRecLine);
                        idx++;
                    }
                    #endregion
                }
                if (newAuditRecList.Count > 0)
                {
                    this.BatchInsert <WF_AuditRecordResult>(newAuditRecList);
                    this.BatchExecute();
                }
                if (billStatus != "")
                {
                    ChangeSourceBllAuditStatus(tblRst, billStatus, billApproveStatus, sourceInfo);
                    AfterAuditExeMethod(param.SourceTableEngName, oldStatus, billStatus, tblRst.TriggerStatus, tblRst.AfterAuditMethodPath, tblRst.AfterAuditMethodName, param.SourceBillGuid);
                }
                #endregion
                #endregion
                rst.Key = 1;
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
            }
            return(rst);
        }