예제 #1
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);
        }
예제 #2
0
        /// <summary>
        /// 审核单据
        /// </summary>
        /// <param name="param">条件实体</param>
        /// <returns></returns>
        public WCFAddUpdateResult AuditBill(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("请指定相关审核业务单据编号!");
                if (param.AuditResult.ToStringHasNull() == "")
                {
                    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);
                string oldStatus  = sourceInfo.GetType().GetProperty("Status").GetValue(sourceInfo, null).ToStringHasNull();
                if (oldStatus.ToLower() == "complete")
                {
                    throw new WarnException("您的单据已审核完成,不允许提交!");
                }
                if (oldStatus.ToLower() == "nopass")
                {
                    throw new WarnException("您提交的单据已拒绝,不允许再次提交!");
                }
                #endregion
                #region 判断是否已提交业务单据,否则加入审核记录
                string billStatus = "", billApproveStatus = "";
                List <WF_AuditRecordResult> stepList = new List <WF_AuditRecordResult>();
                WhereClip whereClip = WF_AuditRecord._.SourceBillGuid == param.SourceBillGuid &&
                                      WF_AuditRecord._.GCompanyID == this.SessionInfo.CompanyID &&
                                      WF_AuditRecord._.IsDeleted == false &&
                                      WF_AuditRecord._.IsCurrent > 0 &&
                                      WF_AuditRecord._.SourceTableEngName == param.SourceTableEngName;
                stepList = this.SelectList <WF_AuditRecordResult>(whereClip, WF_AuditRecord._.SeqNo.Asc);
                if (stepList == null && stepList.Count <= 0)
                {
                    throw new WarnException("您的相关单据未提交!");
                }
                List <WF_AuditRecordResult> newAuditRecList = new List <WF_AuditRecordResult>();
                WF_AuditRecordResult        currAuditRec    = new WF_AuditRecordResult();
                WF_AuditRecordResult        nextAuditRec    = new WF_AuditRecordResult();
                #region 添加审核记录
                if (!stepList.Exists(a => a.IsCurrent > 0))
                {
                    throw new WarnException("当前业务单据已审核完成!");
                }
                currAuditRec = stepList.FirstOrDefault(a => a.IsCurrent == 1 && a.AuditEmpIDs.IndexOf("," + this.SessionInfo.UserID.ToStringHasNull() + ",") >= 0);
                if (currAuditRec == null)
                {
                    throw new WarnException("您没有审核当前业务单据的权限!");
                }
                nextAuditRec = stepList.FirstOrDefault(a => a.IsCurrent == 2 && a.SeqNo > currAuditRec.SeqNo);
                #region 审核情况
                int stdManNum      = currAuditRec.GreeMans.ToInt32();
                int stdCheckManNum = currAuditRec.AuditEmpIDs.ToStringHasNull().Split(',').ToArray().Where(a => a.ToStringHasNull().Trim() != "").Distinct().ToArray().Length;
                if (stdManNum > stdCheckManNum)
                {
                    stdManNum = stdCheckManNum;
                }
                if (stdManNum <= 0)
                {
                    stdManNum = 1;
                }
                List <WF_AuditRecordLineResult> auditRecList = this.GetAuditRecLineList(new WF_AuditRecordLineParam()
                {
                    WF_RecGuid = currAuditRec.WF_RecGuid
                });

                if (auditRecList.Exists(a => a.AuditEmpID == this.SessionInfo.UserID && a.AuditResult.ToStringHasNull() != ""))
                {
                    throw new WarnException("您已审核当前业务单据,不允许重复审核!");
                }
                WF_AuditRecordLineResult currEmpAuditRec = auditRecList.Find(a => a.AuditEmpID == this.SessionInfo.UserID);
                #region 更新审核人意见
                if (currEmpAuditRec == null)
                {
                    currEmpAuditRec                    = new WF_AuditRecordLineResult();
                    currEmpAuditRec.WF_RecGuid         = currAuditRec.WF_RecGuid;
                    currEmpAuditRec.SourceBillGuid     = currAuditRec.SourceBillGuid;
                    currEmpAuditRec.WFAuditGuid        = currAuditRec.WFAuditGuid;
                    currEmpAuditRec.WFAuditLineGuid    = currAuditRec.WFAuditLineGuid;
                    currEmpAuditRec.SourceTableEngName = currAuditRec.SourceTableEngName;
                    currEmpAuditRec.SourceBillNo       = currAuditRec.SourceBillNo;
                    currEmpAuditRec.AuditEmpID         = this.SessionInfo.UserID;
                    currEmpAuditRec.AuditEmpName       = this.SessionInfo.UserName;
                    currEmpAuditRec.AuditResult        = param.AuditResult;
                    currEmpAuditRec.AuditRemark        = param.AuditRemark;
                }
                else
                {
                    currEmpAuditRec.AuditResult = param.AuditResult;
                    currEmpAuditRec.AuditRemark = param.AuditRemark;
                }
                this.AddOrUpdateAuditRecLine(currEmpAuditRec);
                #endregion
                #region 重新获取当前步骤的审批记录
                auditRecList = this.GetAuditRecLineList(new WF_AuditRecordLineParam()
                {
                    WF_RecGuid = currAuditRec.WF_RecGuid
                });
                int currManGreeNum = auditRecList.Where(a => a.AuditResult.ToStringHasNull() == "同意").Select(a => a.AuditEmpID).Distinct().ToArray().Length;
                #endregion
                #region  意的处理
                if (param.AuditResult == "同意")
                {
                    currManGreeNum++;
                    if (currManGreeNum >= stdManNum)//审核人数通过
                    {
                        currAuditRec.IsCurrent      = 0;
                        currAuditRec.AuditResult    = param.AuditResult;
                        currAuditRec.AuditRemark    = param.AuditRemark;
                        currAuditRec.UpdatedEmpID   = this.SessionInfo.UserID;
                        currAuditRec.UpdatedEmpName = this.SessionInfo.UserName;
                        currAuditRec.UpdatedTime    = DateTime.Now;
                        if (nextAuditRec == null)//审核完成
                        {
                            billStatus        = "Complete";
                            billApproveStatus = "审核完成";
                            ChangeSourceBllAuditStatus(tblRst, billStatus, billApproveStatus, sourceInfo);
                            AfterAuditExeMethod(param.SourceTableEngName, oldStatus, billStatus, tblRst.TriggerStatus, tblRst.AfterAuditMethodPath, tblRst.AfterAuditMethodName, param.SourceBillGuid);
                        }
                        else
                        {
                            this.Update <WF_AuditRecordResult>(new WF_AuditRecordResult()
                            {
                                IsCurrent      = 1,
                                UpdatedEmpID   = this.SessionInfo.UserID,
                                UpdatedEmpName = this.SessionInfo.UserName,
                                UpdatedTime    = DateTime.Now
                            }, WF_AuditRecord._.WF_RecGuid == nextAuditRec.WF_RecGuid);
                        }
                        this.Update <WF_AuditRecordResult>(currAuditRec, WF_AuditRecord._.WF_RecGuid == currAuditRec.WF_RecGuid);
                    }
                }
                #endregion
                #region 拒绝和驳回的处理(NoPass,Reject)
                else
                {
                    currAuditRec.IsCurrent      = 0;
                    currAuditRec.AuditResult    = param.AuditResult;
                    currAuditRec.AuditRemark    = param.AuditRemark;
                    currAuditRec.UpdatedEmpID   = this.SessionInfo.UserID;
                    currAuditRec.UpdatedEmpName = this.SessionInfo.UserName;
                    currAuditRec.UpdatedTime    = DateTime.Now;
                    this.Update <WF_AuditRecordResult>(currAuditRec, WF_AuditRecord._.WF_RecGuid == currAuditRec.WF_RecGuid);
                    if (param.AuditResult == "拒绝")
                    {
                        billStatus        = "NoPass";
                        billApproveStatus = "拒绝";
                    }
                    else
                    {
                        billStatus        = "New";
                        billApproveStatus = "待提交";
                    }
                    ChangeSourceBllAuditStatus(tblRst, billStatus, billApproveStatus, sourceInfo);
                    AfterAuditExeMethod(param.SourceTableEngName, oldStatus, billStatus, tblRst.TriggerStatus, tblRst.AfterAuditMethodPath, tblRst.AfterAuditMethodName, param.SourceBillGuid);

                    //将后续审批节点失效掉(删除)
                    this.Update <WF_AuditRecordResult>(new WF_AuditRecordResult()
                    {
                        IsDeleted      = true,
                        UpdatedEmpID   = this.SessionInfo.UserID,
                        UpdatedEmpName = this.SessionInfo.UserName,
                        UpdatedTime    = DateTime.Now
                    }, WF_AuditRecord._.IsCurrent == 2 &&
                                                       WF_AuditRecord._.WFAuditGuid == currAuditRec.WFAuditGuid &&
                                                       WF_AuditRecord._.SourceBillGuid == currAuditRec.SourceBillGuid &&
                                                       WF_AuditRecord._.IsDeleted == false);
                    this.Update <WF_AuditRecordLineResult>(new WF_AuditRecordLineResult()
                    {
                        IsDeleted      = true,
                        UpdatedEmpID   = this.SessionInfo.UserID,
                        UpdatedEmpName = this.SessionInfo.UserName,
                        UpdatedTime    = DateTime.Now
                    }, WF_AuditRecordLine._.IsDeleted == false &&
                                                           WF_AuditRecordLine._.AuditResult.IsNull("") == "" &&
                                                           WF_AuditRecordLine._.WFAuditGuid == currAuditRec.WFAuditGuid &&
                                                           WF_AuditRecordLine._.SourceBillGuid == currAuditRec.SourceBillGuid);
                }
                #endregion
                #endregion
                #endregion
                #endregion
                rst.Key = 1;
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
            }
            return(rst);
        }
예제 #3
0
        /// <summary>
        /// 撤消审核
        /// </summary>
        /// <param name="param">条件实体</param>
        /// <returns>返回生效的当前审核</returns>
        public WCFAddUpdateResult CancelBill(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 (param.AuditResult.ToStringHasNull() == "") 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 判断当前记录状态
                string operationType = "";
                object sourceInfo    = this.GetSourceAuditStatus(tblRst, param.SourceBillGuid);
                string oldStatus     = sourceInfo.GetType().GetProperty("Status").GetValue(sourceInfo, null).ToStringHasNull();
                if (param.OperationType.ToStringHasNull().ToLower() == "cancel")
                {
                    operationType = "撤消";
                    if (oldStatus.ToLower() == "new")
                    {
                        throw new WarnException("您的单据已处于未提交状态,不允许撤消!");
                    }
                }
                else
                {
                    operationType = "收回";
                    if (oldStatus.ToLower() == "new")
                    {
                        throw new WarnException("您的单据已处于未提交状态,不允许执行收回操作!");
                    }
                    else if (oldStatus.ToLower() == "complete")
                    {
                        throw new WarnException("您的单据已处于审核状态,不允许收回!");
                    }
                    #region 判断是否属于当前人的记录
                    string empFldIDName = tblRst.BelongEmpIDFld.ToStringHasNull();
                    if (empFldIDName != "")
                    {
                        string belongEmpID = sourceInfo.GetType().GetProperty(empFldIDName).GetValue(sourceInfo, null).ToStringHasNull();
                        if (belongEmpID.ToInt32() != this.SessionInfo.UserID)
                        {
                            throw new WarnException("当前单据记录不属于您创建,不允许收回!");
                        }
                    }
                    #endregion
                }
                #endregion
                #region 判断是否已提交业务单据,否则加入审核记录
                string billStatus = "", billApproveStatus = "";
                List <WF_AuditRecordResult> stepList = new List <WF_AuditRecordResult>();
                WhereClip whereClip = WF_AuditRecord._.SourceBillGuid == param.SourceBillGuid &&
                                      WF_AuditRecord._.GCompanyID == this.SessionInfo.CompanyID &&
                                      WF_AuditRecord._.IsDeleted == false &&
                                      WF_AuditRecord._.SourceTableEngName == param.SourceTableEngName;
                stepList = this.SelectList <WF_AuditRecordResult>(whereClip, WF_AuditRecord._.SeqNo.Asc);
                if (stepList == null && stepList.Count <= 0)
                {
                    throw new WarnException("您的相关单据未提交!");
                }
                List <WF_AuditRecordResult> newAuditRecList = new List <WF_AuditRecordResult>();
                WF_AuditRecordResult        currAuditRec    = new WF_AuditRecordResult();
                #region 撤消所有的审批
                currAuditRec      = stepList.LastOrDefault(a => a.IsCurrent == 0);
                billStatus        = "New";
                billApproveStatus = "未提交";
                ChangeSourceBllAuditStatus(tblRst, billStatus, billApproveStatus, sourceInfo);
                AfterAuditExeMethod(param.SourceTableEngName, oldStatus, billStatus, tblRst.TriggerStatus, tblRst.AfterAuditMethodPath, tblRst.AfterAuditMethodName, param.SourceBillGuid);
                #region 将后续审批节点失效掉(删除)
                this.Update <WF_AuditRecordResult>(new WF_AuditRecordResult()
                {
                    IsDeleted      = true,
                    UpdatedEmpID   = this.SessionInfo.UserID,
                    UpdatedEmpName = this.SessionInfo.UserName,
                    UpdatedTime    = DateTime.Now
                }, WF_AuditRecord._.IsCurrent > 0 &&
                                                   WF_AuditRecord._.WFAuditGuid == currAuditRec.WFAuditGuid &&
                                                   WF_AuditRecord._.SourceBillGuid == currAuditRec.SourceBillGuid &&
                                                   WF_AuditRecord._.IsDeleted == false);
                this.Update <WF_AuditRecordLineResult>(new WF_AuditRecordLineResult()
                {
                    IsDeleted      = true,
                    UpdatedEmpID   = this.SessionInfo.UserID,
                    UpdatedEmpName = this.SessionInfo.UserName,
                    UpdatedTime    = DateTime.Now
                }, WF_AuditRecordLine._.IsDeleted == false &&
                                                       WF_AuditRecordLine._.AuditResult.IsNull("") == "" &&
                                                       WF_AuditRecordLine._.WFAuditGuid == currAuditRec.WFAuditGuid &&
                                                       WF_AuditRecordLine._.SourceBillGuid == currAuditRec.SourceBillGuid);
                #endregion
                #endregion
                #region 添加撤消说明
                WF_AuditRecordResult newAuditRec = new WF_AuditRecordResult();
                newAuditRec.WF_RecGuid         = Guid.NewGuid();
                newAuditRec.GCompanyID         = this.SessionInfo.CompanyID;
                newAuditRec.SourceTableEngName = param.SourceTableEngName;
                newAuditRec.SourceBillNo       = currAuditRec.SourceBillNo;
                newAuditRec.SourceBillGuid     = param.SourceBillGuid;
                newAuditRec.WFAuditGuid        = currAuditRec.WFAuditGuid;
                newAuditRec.WFAuditLineGuid    = null;
                newAuditRec.SeqNo          = stepList.Max(a => a.SeqNo).ToInt32() + 1;
                newAuditRec.GreeMans       = 1;
                newAuditRec.AuditEmpIDs    = "," + this.SessionInfo.UserID + ",";//暂时是指定到人
                newAuditRec.AuditEmpNames  = this.SessionInfo.UserName;
                newAuditRec.AuditRemark    = "被用户" + this.SessionInfo.UserName + operationType;
                newAuditRec.AuditResult    = operationType;
                newAuditRec.IsCurrent      = 0;
                newAuditRec.CreatedEmpID   = this.SessionInfo.UserID;
                newAuditRec.CreatedEmpName = this.SessionInfo.UserName;
                newAuditRec.CreatedTime    = DateTime.Now;
                newAuditRec.IsDeleted      = false;
                this.Insert <WF_AuditRecordResult>(newAuditRec);
                #endregion
                #endregion
                rst.Key = 1;
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
            }
            return(rst);
        }
예제 #4
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);
        }