示例#1
0
        /// <summary>
        /// </summary>
        /// <param name="account"></param>
        /// <param name="changeAmount"></param>
        /// <param name="actionType"></param>
        /// <param name="prefixIntro"></param>
        public Bill CreateBill(Account account, decimal changeAmount, BillActionType actionType, string prefixIntro)
        {
            var moneyConfigList = Resolve <IAutoConfigService>().GetList <MoneyTypeConfig>();
            var moneyConfig     =
                moneyConfigList.FirstOrDefault(r => r.Id == account.MoneyTypeId && r.Status == Status.Normal);

            if (moneyConfig == null)
            {
                throw new ArgumentNullException("account moneyconfig is null or status is not normal");
            }

            var baseUser = Resolve <IUserService>().GetSingle(r => r.Id == account.UserId);

            if (baseUser == null)
            {
                throw new ArgumentNullException("user is not exist");
            }

            var flow = AccountFlow.Spending;

            if (changeAmount >= 0)
            {
                flow = AccountFlow.Income;
            }

            var intro =
                $"{prefixIntro},用户{baseUser.GetUserName()}的{moneyConfig.Name}{flow.GetDisplayName()}金额{changeAmount}";

            return(CreateBill(account, changeAmount, actionType, intro, 0, string.Empty, string.Empty));
        }
示例#2
0
        /// <summary>
        /// 获取表单动作
        /// </summary>
        /// <param name="loggingSession">登录信息</param>
        /// <param name="billKindId">类型标识</param>
        /// <param name="billActionType">动作标识</param>
        /// <returns></returns>
        public BillActionModel GetBillAction(string billKindId, BillActionType billActionType)
        {
            BillActionModel billAction = null;
            string          conn       = "";

            switch (billActionType)
            {
            case BillActionType.Create:
                conn = " and a.create_flag=1 ";
                break;

            case BillActionType.Modify:
                conn = " and a.modify_flag=1 ";
                break;

            case BillActionType.Approve:
                conn = " and a.approve_flag=1 ";
                break;

            case BillActionType.Reject:
                conn = " and a.reject_flag=1 ";
                break;

            case BillActionType.Cancel:
                conn = " and a.cancel_flag=1 ";
                break;

            case BillActionType.Open:
                conn = " and 1=1 ";
                break;

            case BillActionType.Stop:
                conn = " and 1=1 ";
                break;

            default:
                conn = " and 1=1";
                return(null);
            }
            DataSet ds = billService.GetBillAction(billKindId, billActionType, conn);

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                billAction = DataTableToObject.ConvertToObject <BillActionModel>(ds.Tables[0].Rows[0]);
            }
            return(billAction);
        }
示例#3
0
        /// <summary>
        /// </summary>
        /// <param name="account"></param>
        /// <param name="changeAmount"></param>
        /// <param name="actionType"></param>
        /// <param name="intro"></param>
        /// <param name="targetUserId"></param>
        /// <param name="orderSerial"></param>
        /// <param name="remark"></param>
        public Bill CreateBill(Account account, decimal changeAmount, BillActionType actionType, string intro = null,
                               long targetUserId = 0, string orderSerial = null, string remark = null)
        {
            var moneyConfigList = Resolve <IAutoConfigService>().GetList <MoneyTypeConfig>();
            var moneyConfig     =
                moneyConfigList.FirstOrDefault(r => r.Id == account.MoneyTypeId && r.Status == Status.Normal);

            if (moneyConfig == null)
            {
                throw new ArgumentNullException("account moneyconfig is null or status is not normal");
            }

            var flow = AccountFlow.Spending;

            if (changeAmount >= 0)
            {
                flow = AccountFlow.Income;
            }

            if (intro.IsNullOrEmpty())
            {
                var baseUser = Resolve <IUserService>().GetSingle(account.UserId);
                if (baseUser == null)
                {
                    throw new ArgumentNullException("user is not exist");
                }

                intro =
                    $@"用户{baseUser.GetUserName()}完成{actionType.GetDisplayName()}操作,{moneyConfig.Name}{
                            flow.GetDisplayName()
                        }金额{changeAmount}";
            }

            var bill = new Bill
            {
                UserId      = account.UserId,
                Amount      = changeAmount,
                AfterAmount = account.Amount,
                Type        = actionType,
                MoneyTypeId = account.MoneyTypeId,
                Flow        = flow,
                Intro       = intro
                              //Remark = remark
            };

            return(bill);
        }
示例#4
0
        /// <summary>
        /// 获取表单动作
        /// </summary>
        /// <param name="billKindId"></param>
        /// <param name="billActionType"></param>
        /// <param name="con"></param>
        /// <returns></returns>
        public DataSet GetBillAction(string billKindId, BillActionType billActionType, string con)
        {
            string sql = " select a.bill_action_id Id, a.bill_kind_id KindId, a.bill_action_code Code "
                         + " ,a.create_flag CreateFlag, a.modify_flag ModifyFlag, a.approve_flag ApproveFlag "
                         + " , a.reject_flag RejectFlag, a.cancel_flag CancelFlag,a.bill_action_name Description,a.display_index display_index "
                         + " from t_def_bill_action a "
                         + "where a.bill_kind_id= '" + billKindId + "'  and a.customer_id = '" + this.loggingSessionInfo.CurrentLoggingManager.Customer_Id + "'"
                         + con;
            PublicService p = new PublicService();

            sql = p.GetLinkSql(sql, "a.bill_action_code", billActionType.ToString(), "=");

            DataSet ds = new DataSet();

            ds = this.SQLHelper.ExecuteDataset(sql);
            return(ds);
        }
示例#5
0
        /// <summary>
        /// 批准一个Bill(事务由调用方负责) Jermyn2012-09-17
        /// </summary>
        /// <param name="loggingSession">当前登录用户的Session信息</param>
        /// <param name="billId">Bill</param>
        /// <param name="remark">批注</param>
        /// <param name="strBillActionType">状态</param>
        /// <param name="strError">输出错误参数</param>
        /// <returns>操作的状态</returns>
        public BillOperateStateService ApproveBill(string billId, string remark, BillActionType strBillActionType, out string strError)
        {
            if (strBillActionType.Equals(""))
            {
                strError          = "BillActionType.Approve";
                strBillActionType = BillActionType.Approve;
            }
            BillModel bill = GetBillById(billId);

            if (bill == null)
            {
                strError = "BillOperateStateService.NotExist";
                return(BillOperateStateService.NotExist);
            }

            BillKindModel billKind = GetBillKindById(bill.KindId);

            if (billKind == null)
            {
                strError = "BillOperateStateService.NotExistKind";
                return(BillOperateStateService.NotExistKind);
            }
            BillStatusModel currentBillStatus = GetBillStatusByKindIdAndStatus(billKind.Id, bill.Status);

            if (currentBillStatus == null)
            {
                strError = "BillOperateStateService.NotExistStatus";
                return(BillOperateStateService.NotExistStatus);
            }
            BillActionModel billApproveAction = GetBillAction(bill.KindId, strBillActionType);

            if (billApproveAction == null)
            {
                strError = "BillOperateStateService.NotSetApproveAction";
                return(BillOperateStateService.NotSetApproveAction);
            }
            //获取审批权限
            DataSet             ds = billService.GetbillCreateActionRole(bill.KindId, billApproveAction.Id, GetBasicRoleId(this.loggingSessionInfo.CurrentUserRole.RoleId), currentBillStatus.Status);
            BillActionRoleModel billApproveActionRole = new BillActionRoleModel();

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                billApproveActionRole = DataTableToObject.ConvertToObject <BillActionRoleModel>(ds.Tables[0].Rows[0]);
            }
            if (billApproveActionRole == null)
            {
                strError = "BillOperateStateService.NotAllowApprove--"
                           //+ "RoleId:" + GetBasicRoleId(loggingSession.CurrentUserRole.RoleId).ToString() + "----"
                           //+ "BillKindId:" + bill.KindId + "----"
                           //+ "BillActionId:" + billApproveAction.Id + "----"
                           //+ "PreviousBillStatus:" + currentBillStatus.Status + "----"
                           + "InoutStatus" + bill.Status + "--" + bill.BillStatusDescription + "--" + bill.Id
                ;
                return(BillOperateStateService.NotAllowApprove);
            }

            //if (billKind.MoneyFlag == 1)
            //{
            //    if ((bill.Money < billApproveActionRole.MinMoney) || (bill.Money > billApproveActionRole.MaxMoney))
            //    {
            //        strError = "BillOperateStateService.OutOfMoneyScope";
            //        return BillOperateStateService.OutOfMoneyScope;
            //    }
            //}

            bill.ModifyUserId = this.loggingSessionInfo.CurrentUser.User_Id;
            bill.ModifyDate   = GetCurrentDateTime();
            bill.Status       = billApproveActionRole.CurrentStatus;

            BillStatusModel nextBillStatus = GetBillStatusByKindIdAndStatus(billKind.Id, billApproveActionRole.CurrentStatus);

            if (nextBillStatus == null)
            {
                strError = "BillOperateStateService.NotExistStatus";
                return(BillOperateStateService.NotExistStatus);
            }
            //修改bill
            billService.UpdateBill(bill);
            //InsertBillActionLog(loggingSession, bill, billApproveAction, billApproveActionRole, remark);
            strError = "BillOperateStateService.ApproveSuccessful";
            return(BillOperateStateService.ApproveSuccessful);
        }
示例#6
0
        /// <summary>
        /// 批准一个Bill(事务由调用方负责)
        /// </summary>
        /// <param name="loggingSession">当前登录用户的Session信息</param>
        /// <param name="billId">Bill</param>
        /// <param name="remark">批注</param>
        /// <param name="strBillActionType">状态</param>
        /// <returns>操作的状态</returns>
        public BillOperateStateService ApproveBill(string billId, string remark, BillActionType strBillActionType)
        {
            if (strBillActionType.Equals(""))
            {
                strBillActionType = BillActionType.Approve;
            }
            BillModel bill = GetBillById(billId);

            if (bill == null)
            {
                return(BillOperateStateService.NotExist);
            }

            BillKindModel billKind = GetBillKindById(bill.KindId);

            if (billKind == null)
            {
                return(BillOperateStateService.NotExistKind);
            }
            BillStatusModel currentBillStatus = GetBillStatusByKindIdAndStatus(billKind.Id, bill.Status);

            if (currentBillStatus == null)
            {
                return(BillOperateStateService.NotExistStatus);
            }
            BillActionModel billApproveAction = GetBillAction(bill.KindId, strBillActionType);

            if (billApproveAction == null)
            {
                return(BillOperateStateService.NotSetApproveAction);
            }
            Hashtable           hashTable             = new Hashtable();
            BillActionRoleModel billApproveActionRole = new BillActionRoleModel();
            DataSet             ds = new DataSet();

            ds = billService.GetbillCreateActionRole(bill.KindId, billApproveAction.Id, GetBasicRoleId(this.loggingSessionInfo.CurrentUserRole.RoleId), currentBillStatus.Status);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                billApproveActionRole = DataTableToObject.ConvertToObject <BillActionRoleModel>(ds.Tables[0].Rows[0]);
            }

            if (billApproveActionRole == null)
            {
                return(BillOperateStateService.NotAllowApprove);
            }

            //if (billKind.MoneyFlag == 1)
            //{
            //    if ((bill.Money < billApproveActionRole.MinMoney) || (bill.Money > billApproveActionRole.MaxMoney))
            //    {
            //        return BillOperateStateService.OutOfMoneyScope;
            //    }
            //}

            bill.ModifyUserId = this.loggingSessionInfo.CurrentUser.User_Id;
            bill.ModifyDate   = GetCurrentDateTime();
            bill.Status       = billApproveActionRole.CurrentStatus;

            BillStatusModel nextBillStatus = GetBillStatusByKindIdAndStatus(billKind.Id, billApproveActionRole.CurrentStatus);

            if (nextBillStatus == null)
            {
                return(BillOperateStateService.NotExistStatus);
            }
            billService.UpdateBill(bill);
            //InsertBillActionLog(loggingSession, bill, billApproveAction, billApproveActionRole, remark);

            return(BillOperateStateService.ApproveSuccessful);
        }
示例#7
0
        /// <summary>
        /// 批量批准Bill(含事务)
        /// </summary>
        /// <param name="loggingSession">当前登录用户的Session信息</param>
        /// <param name="billList">要批准的Bill的Id的列表</param>
        /// <param name="remark">批注</param>
        /// <param name="strBillActionType">第一个不能批准的Bill的Code</param>
        /// <param name="billId">输出标识</param>
        /// <returns>操作的状态</returns>
        public BillOperateStateService ApproveBills(IList <string> billList, string remark, BillActionType strBillActionType, out string billId)
        {
            billId = null;
            //如果没有审核的,则直接返回成功
            if (billList == null || billList.Count == 0)
            {
                return(BillOperateStateService.ApproveSuccessful);
            }
            //查找审核后的状态是最终状态的表单的种类的编码列表, 主要是为了刷新物化视图用
            //IList<string> bill_kind_code_list = GetApprovedBillKindCodes(billList);

            //cSqlMapper.Instance().BeginTransaction();
            try
            {
                BillOperateStateService state;
                foreach (string approveBillId in billList)
                {
                    state = ApproveBill(approveBillId, remark, strBillActionType);
                    if (state != BillOperateStateService.ApproveSuccessful)
                    {
                        //cSqlMapper.Instance().RollBackTransaction();
                        billId = approveBillId;
                        return(state);
                    }
                }
                //cSqlMapper.Instance().CommitTransaction();
            }
            catch (Exception ex)
            {
                //cSqlMapper.Instance().RollBackTransaction();
                throw ex;
            }


            return(BillOperateStateService.ApproveSuccessful);
        }
示例#8
0
        /// <summary>
        /// 修改调价单状态
        /// </summary>
        /// <param name="loggingSessionInfo">登录model</param>
        /// <param name="order_id">标识</param>
        /// <param name="billActionType">类型</param>
        /// <returns></returns>
        public bool SetAdjustmentOrderStatus(LoggingSessionInfo loggingSessionInfo, string order_id, BillActionType billActionType)
        {
            string strResult = string.Empty;

            try
            {
                cPos.Admin.Service.BillService bs = new BillService();

                BillOperateStateService state = bs.ApproveBill(loggingSessionInfo, order_id, "", billActionType);
                if (state == BillOperateStateService.ApproveSuccessful)
                {
                    //获取要改变的表单信息
                    BillModel billInfo = new BillService().GetBillById(loggingSessionInfo, order_id);
                    //设置要改变的用户信息
                    AdjustmentOrderInfo itenAdjustmentOrderInfo = new AdjustmentOrderInfo();
                    itenAdjustmentOrderInfo.status         = billInfo.Status;
                    itenAdjustmentOrderInfo.status_desc    = billInfo.BillStatusDescription;
                    itenAdjustmentOrderInfo.order_id       = order_id;
                    itenAdjustmentOrderInfo.modify_user_id = loggingSessionInfo.CurrentUser.User_Id;
                    itenAdjustmentOrderInfo.modify_time    = GetCurrentDateTime(); //获取当前时间
                    //提交
                    MSSqlMapper.Instance(loggingSessionInfo.CurrentLoggingManager).Update("AdjustmentOrder.UpdateStatus", itenAdjustmentOrderInfo);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
示例#9
0
 public BillAction(DateTime date, string text, BillActionType type = BillActionType.Unknown)
 {
     Date = date;
     Text = text;
     Type = type;
 }
示例#10
0
        /// <summary>
        /// Inout状态修改(审核,删除。。。。)
        /// </summary>
        /// <param name="loggingSessionInfo"></param>
        /// <param name="order_id"></param>
        /// <param name="billActionType"></param>
        /// <param name="strError">输出信息</param>
        /// <returns></returns>
        public bool SetInoutOrderStatus(LoggingSessionInfo loggingSessionInfo, string order_id, BillActionType billActionType, out string strError)
        {
            string strResult = string.Empty;

            try
            {
                cPos.Admin.Service.BillService bs = new BillService();

                BillOperateStateService state = bs.ApproveBill(loggingSessionInfo, order_id, "", billActionType, out strResult);
                if (state == BillOperateStateService.ApproveSuccessful)
                {
                    //获取要改变的表单信息
                    BillModel billInfo = new BillService().GetBillById(loggingSessionInfo, order_id);
                    //设置要改变的用户信息
                    InoutInfo inoutInfo = new InoutInfo();
                    inoutInfo.status         = billInfo.Status;
                    inoutInfo.status_desc    = billInfo.BillStatusDescription;
                    inoutInfo.order_id       = order_id;
                    inoutInfo.modify_user_id = loggingSessionInfo.CurrentUser.User_Id;
                    inoutInfo.modify_time    = GetCurrentDateTime(); //获取当前时间
                    if (billActionType == BillActionType.Approve)
                    {
                        inoutInfo.approve_time    = GetCurrentDateTime();
                        inoutInfo.approve_user_id = loggingSessionInfo.CurrentUser.User_Id;
                    }
                    //提交
                    MSSqlMapper.Instance(loggingSessionInfo.CurrentLoggingManager).Update("Inout.UpdateStatus", inoutInfo);
                    strError = "审批成功";
                    return(true);
                }
                else
                {
                    strError = "获取状态失败--" + strResult;
                    return(false);
                }
            }
            catch (Exception ex)
            {
                strError = ex.ToString();
                throw (ex);
            }
        }
示例#11
0
        /// <summary>
        /// Inout状态修改(审核,删除。。。。)
        /// </summary>
        /// <param name="loggingSessionInfo"></param>
        /// <param name="order_id"></param>
        /// <param name="billActionType"></param>
        /// <returns></returns>
        public bool SetInoutOrderStatus(LoggingSessionInfo loggingSessionInfo, string order_id, BillActionType billActionType)
        {
            string err;

            return(SetInoutOrderStatus(loggingSessionInfo, order_id, billActionType, out err));
        }
示例#12
0
        /// <summary>
        /// 订单状态修改
        /// </summary>
        /// <param name="order_id"></param>
        /// <param name="billActionType"></param>
        /// <param name="strError"></param>
        /// <returns></returns>
        public bool SetCCStatusUpdate(string order_id, BillActionType billActionType, out string strError)
        {
            string strResult = string.Empty;

            try
            {
                CCInfo ccInfo = new CCInfo();
                ccInfo.order_id       = order_id;
                ccInfo.modify_user_id = loggingSessionInfo.CurrentUser.User_Id;
                ccInfo.modify_time    = GetCurrentDateTime(); //获取当前时间
                if (loggingSessionInfo.CurrentLoggingManager.IsApprove == null || loggingSessionInfo.CurrentLoggingManager.IsApprove.Equals("0"))
                {
                    switch (billActionType)
                    {
                    case BillActionType.Cancel:
                        ccInfo.status      = "-1";
                        ccInfo.status_desc = "删除";
                        break;

                    case BillActionType.Approve:
                        ccInfo.status          = "10";
                        ccInfo.status_desc     = "已审批";
                        ccInfo.approve_time    = GetCurrentDateTime();
                        ccInfo.approve_user_id = loggingSessionInfo.CurrentUser.User_Id;
                        break;

                    case BillActionType.Reject:
                        ccInfo.status      = "1";
                        ccInfo.status_desc = "未审批";
                        break;

                    case BillActionType.Create:
                        ccInfo.status      = "1";
                        ccInfo.status_desc = "未审批";
                        break;

                    default:
                        ccInfo.status      = "1";
                        ccInfo.status_desc = "未审批";
                        break;
                    }
                }
                else
                {
                    cBillService bs = new cBillService(loggingSessionInfo);

                    BillOperateStateService state = bs.ApproveBill(order_id, "", billActionType, out strResult);
                    if (state == BillOperateStateService.ApproveSuccessful)
                    {
                        //获取要改变的表单信息
                        BillModel billInfo = bs.GetBillById(order_id);
                        //设置要改变的用户信息

                        ccInfo.status      = billInfo.Status;
                        ccInfo.status_desc = billInfo.BillStatusDescription;

                        if (billActionType == BillActionType.Approve)
                        {
                            ccInfo.approve_time    = GetCurrentDateTime();
                            ccInfo.approve_user_id = loggingSessionInfo.CurrentUser.User_Id;
                        }
                    }
                    else
                    {
                        strError = "获取状态失败--" + strResult;
                        return(false);
                    }
                }
                bool bReturn = ccService.SetCCStatusUpdate(ccInfo);
                strError = "操作成功";
                return(true);
            }
            catch (Exception ex)
            {
                strError = ex.ToString();
                throw (ex);
            }
        }
示例#13
0
        /// <summary>
        /// 批量批准Bill(含事务)
        /// </summary>
        /// <param name="loggingSession">当前登录用户的Session信息</param>
        /// <param name="billList">要批准的Bill的Id的列表</param>
        /// <param name="remark">批注</param>
        /// <param name="strBillActionType">第一个不能批准的Bill的Code</param>
        /// <param name="billId">输出标识</param>
        /// <returns>操作的状态</returns>
        public BillOperateStateService ApproveBills(LoggingSessionInfo loggingSession, IList <string> billList, string remark, BillActionType strBillActionType, out string billId)
        {
            billId = null;
            //如果没有审核的,则直接返回成功
            if (billList == null || billList.Count == 0)
            {
                return(BillOperateStateService.ApproveSuccessful);
            }
            //查找审核后的状态是最终状态的表单的种类的编码列表, 主要是为了刷新物化视图用
            //IList<string> bill_kind_code_list = GetApprovedBillKindCodes(loggingSession, billList);

            cSqlMapper.Instance().BeginTransaction();
            try
            {
                BillOperateStateService state;
                foreach (string approveBillId in billList)
                {
                    state = ApproveBill(loggingSession, approveBillId, remark, strBillActionType);
                    if (state != BillOperateStateService.ApproveSuccessful)
                    {
                        cSqlMapper.Instance().RollBackTransaction();
                        billId = approveBillId;
                        return(state);
                    }
                }
                cSqlMapper.Instance().CommitTransaction();
            }
            catch (Exception ex)
            {
                cSqlMapper.Instance().RollBackTransaction();
                throw ex;
            }

            //根据表单类型编码刷新对应的物化视图
            //if (bill_kind_code_list != null)
            //{
            //    foreach (string code in bill_kind_code_list)
            //    {
            //        RefreshMViewByBillKindCode(code);
            //    }
            //}
            return(BillOperateStateService.ApproveSuccessful);
        }
示例#14
0
        /// <summary>
        /// 批准一个Bill(事务由调用方负责) Jermyn2012-09-17
        /// </summary>
        /// <param name="loggingSession">当前登录用户的Session信息</param>
        /// <param name="billId">Bill</param>
        /// <param name="remark">批注</param>
        /// <param name="strBillActionType">状态</param>
        /// <param name="strError">输出错误参数</param>
        /// <returns>操作的状态</returns>
        public BillOperateStateService ApproveBill(LoggingSessionInfo loggingSession, string billId, string remark, BillActionType strBillActionType, out string strError)
        {
            if (strBillActionType.Equals(""))
            {
                strError          = "BillActionType.Approve";
                strBillActionType = BillActionType.Approve;
            }
            BillModel bill = GetBillById(loggingSession, billId);

            if (bill == null)
            {
                strError = "BillOperateStateService.NotExist";
                return(BillOperateStateService.NotExist);
            }

            BillKindModel billKind = GetBillKindById(loggingSession, bill.KindId);

            if (billKind == null)
            {
                strError = "BillOperateStateService.NotExistKind";
                return(BillOperateStateService.NotExistKind);
            }
            BillStatusModel currentBillStatus = GetBillStatusByKindIdAndStatus(loggingSession, billKind.Id, bill.Status);

            if (currentBillStatus == null)
            {
                strError = "BillOperateStateService.NotExistStatus";
                return(BillOperateStateService.NotExistStatus);
            }
            BillActionModel billApproveAction = GetBillAction(loggingSession, bill.KindId, strBillActionType);

            if (billApproveAction == null)
            {
                strError = "BillOperateStateService.NotSetApproveAction";
                return(BillOperateStateService.NotSetApproveAction);
            }
            Hashtable hashTable = new Hashtable();

            //hashTable.Add("RoleId", loggingSession.CurrentUserRole.RoleId);
            hashTable.Add("RoleId", GetBasicRoleId(loggingSession.CurrentUserRole.RoleId));
            hashTable.Add("BillKindId", bill.KindId);
            hashTable.Add("BillActionId", billApproveAction.Id);
            hashTable.Add("PreviousBillStatus", currentBillStatus.Status);
            hashTable.Add("LanguageKindId", loggingSession.CurrentLanguageKindId);
            BillActionRoleModel billApproveActionRole = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionRoleModel>("BillActionRole.SelectByKindIdAndActionIdAndRoleIdAndPreviousStatus", hashTable);

            if (billApproveActionRole == null)
            {
                strError = "BillOperateStateService.NotAllowApprove--"
                           //+ "RoleId:" + GetBasicRoleId(loggingSession.CurrentUserRole.RoleId).ToString() + "----"
                           //+ "BillKindId:" + bill.KindId + "----"
                           //+ "BillActionId:" + billApproveAction.Id + "----"
                           //+ "PreviousBillStatus:" + currentBillStatus.Status + "----"
                           + "InoutStatus" + bill.Status + "--" + bill.BillStatusDescription + "--" + bill.Id
                ;
                return(BillOperateStateService.NotAllowApprove);
            }
            //判断是否超出系统设置时间
            //if (billApproveActionRole.ValidateDate == 0)
            //{
            //    return BillOperateStateService.OutDateTime;
            //}
            if (billKind.MoneyFlag == 1)
            {
                if ((bill.Money < billApproveActionRole.MinMoney) || (bill.Money > billApproveActionRole.MaxMoney))
                {
                    strError = "BillOperateStateService.OutOfMoneyScope";
                    return(BillOperateStateService.OutOfMoneyScope);
                }
            }

            bill.ModifyUserId = loggingSession.CurrentUser.User_Id;
            bill.ModifyDate   = GetCurrentDateTime();
            bill.Status       = billApproveActionRole.CurrentStatus;

            BillStatusModel nextBillStatus = GetBillStatusByKindIdAndStatus(loggingSession, billKind.Id, billApproveActionRole.CurrentStatus);

            if (nextBillStatus == null)
            {
                strError = "BillOperateStateService.NotExistStatus";
                return(BillOperateStateService.NotExistStatus);
            }

            cSqlMapper.Instance(loggingSession.CurrentLoggingManager).Update("Bill.Update", bill);
            InsertBillActionLog(loggingSession, bill, billApproveAction, billApproveActionRole, remark);
            strError = "BillOperateStateService.ApproveSuccessful";
            return(BillOperateStateService.ApproveSuccessful);
        }
示例#15
0
        /// <summary>
        /// 获取表单动作
        /// </summary>
        /// <param name="loggingSession">登录信息</param>
        /// <param name="billKindId">类型标识</param>
        /// <param name="billActionType">动作标识</param>
        /// <returns></returns>
        public BillActionModel GetBillAction(LoggingSessionInfo loggingSession, string billKindId, BillActionType billActionType)
        {
            Hashtable hashTable = new Hashtable();

            hashTable.Add("LanguageKindId", loggingSession.CurrentLanguageKindId);
            hashTable.Add("BillKindId", billKindId);
            hashTable.Add("BillActionCode", billActionType.ToString());
            hashTable.Add("CustomerId", loggingSession.CurrentLoggingManager.Customer_Id);
            BillActionModel billAction = null;

            switch (billActionType)
            {
            case BillActionType.Create:
                billAction = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionModel>("BillAction.GetCreateActionByKindId", hashTable);
                break;

            case BillActionType.Modify:
                billAction = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionModel>("BillAction.GetModifyActionByKindId", hashTable);
                break;

            case BillActionType.Approve:
                billAction = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionModel>("BillAction.GetApproveActionByKindId", hashTable);
                break;

            case BillActionType.Reject:
                billAction = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionModel>("BillAction.GetRejectActionByKindId", hashTable);
                break;

            case BillActionType.Cancel:
                billAction = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionModel>("BillAction.GetCancelActionByKindId", hashTable);
                break;

            case BillActionType.Open:
                billAction = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionModel>("BillAction.GetOpenActionByKindId", hashTable);
                break;

            case BillActionType.Stop:
                billAction = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionModel>("BillAction.GetStopActionByKindId", hashTable);
                break;

            default:
                return(null);
            }
            return(billAction);
        }