public bool CancelFltRetModApply(int rmid) { FltRetModApplyEntity fltRetModApplyEntity = _fltRetModApplyDal.Find <FltRetModApplyEntity>(rmid); if (fltRetModApplyEntity.OrderStatus == FltModApplyStatusEnum.C.ToString()) { throw new Exception("当前申请已经取消!"); } fltRetModApplyEntity.OrderStatus = FltModApplyStatusEnum.C.ToString(); _fltRetModApplyDal.Update(fltRetModApplyEntity, new string[] { "OrderStatus" }); List <FltRetModFlightApplyEntity> fltRetModFlightApplyEntities = _fltRetModFlightApplyDal.Query <FltRetModFlightApplyEntity>(n => n.Rmid == rmid, true).ToList(); foreach (var fltRetModFlightApplyEntity in fltRetModFlightApplyEntities) { fltRetModFlightApplyEntity.OrderStatus = fltRetModApplyEntity.OrderStatus; _fltRetModFlightApplyDal.Update(fltRetModFlightApplyEntity, new string[] { "OrderStatus" }); } FltRetModApplyLogEntity log = new FltRetModApplyLogEntity(); log.LogTime = DateTime.Now; log.LogType = "取消申请"; log.Oid = "Sys"; log.Remark = "取消申请"; log.Rmid = rmid; _fltRetModApplyLogDal.Insert(log); return(true); }
public int AddRetModApply(AddRetModApplyModel addRetModApplyModel) { FltOrderEntity fltOrderEntity = _fltOrderDal.Find <FltOrderEntity>(addRetModApplyModel.OrderId); FltRetModApplyEntity applyEntity = Mapper.Map <AddRetModApplyModel, FltRetModApplyEntity>(addRetModApplyModel); applyEntity.CorpPolicyId = fltOrderEntity.CorpPolicyId; applyEntity.CorpAduitId = fltOrderEntity.CorpAduitId; if (!applyEntity.ProcessStatus.HasValue) { applyEntity.ProcessStatus = 0; } if (string.IsNullOrEmpty(applyEntity.RefundType)) { applyEntity.RefundType = "实退"; } applyEntity = _fltRetModApplyDal.Insert(applyEntity); List <FltRetModFlightApplyEntity> flightApplyEntities = Mapper.Map <List <FltRetModFlightApplyModel>, List <FltRetModFlightApplyEntity> >(addRetModApplyModel.DetailList); foreach (var fltRetModFlightApplyEntity in flightApplyEntities) { fltRetModFlightApplyEntity.Rmid = applyEntity.Rmid; fltRetModFlightApplyEntity.OrderStatus = applyEntity.OrderStatus; if (string.IsNullOrEmpty(fltRetModFlightApplyEntity.FlightNo)) { FltFlightEntity flightEntity = _fltFlightDal.Query <FltFlightEntity>( n => n.OrderId == applyEntity.OrderId && n.Sequence == fltRetModFlightApplyEntity.Sequence, true) .FirstOrDefault(); if (flightEntity != null) { fltRetModFlightApplyEntity.FlightNo = flightEntity.FlightNo; } } _fltRetModFlightApplyDal.Insert(fltRetModFlightApplyEntity); } string orderType = (addRetModApplyModel.OrderType == "R" ? "退票" : "改签"); FltRetModApplyLogEntity log = new FltRetModApplyLogEntity() { Rmid = applyEntity.Rmid, Oid = applyEntity.CreateOid, LogTime = DateTime.Now, Remark = addRetModApplyModel.Oid + "新增" + orderType + "申请", LogType = "新增" }; _fltRetModApplyLogDal.Insert(log); return(applyEntity.Rmid); }
public AuditResultModel DoSecondAudit(AuditRetApplySecond secondAudit) { FltRetModApplyEntity retApplyEntity = _fltRetModApplyDal.Find <FltRetModApplyEntity>(_retApplyQuery.Id); List <FltRetModFlightApplyEntity> retFlightApplyEntities = _fltRetModFlightApplyDal.Query <FltRetModFlightApplyEntity>(n => n.Rmid == retApplyEntity.Rmid).ToList(); FltRetModApplyLogEntity log = new FltRetModApplyLogEntity() { Rmid = retApplyEntity.Rmid, Oid = "sys", LogType = "审批申请", LogTime = DateTime.Now }; #region 进行审批 List <string> properties = new List <string>(); if (IsAgree) { retApplyEntity.OrderStatus = FltRetApplyStatusEnum.D.ToString(); log.Remark = "退票申请审核状态:二级审核通过。二级审核人:" + _retApplyQuery?.AuditCustomer?.RealName; } else { retApplyEntity.OrderStatus = FltRetApplyStatusEnum.C.ToString(); log.Remark = "退票申请审核状态:二级审核不通过。二级审核人:" + _retApplyQuery?.AuditCustomer?.RealName; } #endregion retFlightApplyEntities.ForEach(n => n.OrderStatus = retApplyEntity.OrderStatus); properties.Add("OrderStatus"); _fltRetModApplyDal.Update(retApplyEntity, properties.ToArray()); retFlightApplyEntities.ForEach(n => { _fltRetModFlightApplyDal.Update(n, properties.ToArray()); }); _fltRetModApplyLogDal.Insert(log); return(new AuditResultModel() { Code = 0, AuditResult = log.Remark, OwnCid = retApplyEntity.Cid, Id = retApplyEntity.Rmid, OrderType = OrderSourceTypeEnum.FltRetApply }); }
public ConfirmRetModAuditPriceResultModel ConfirmRetAuditPrice(ConfirmRetModAuditPriceModel query) { FltRetModApplyEntity fltRetModApplyEntity = _fltRetModApplyDal.Find <FltRetModApplyEntity>(query.Rmid); if (fltRetModApplyEntity == null) { throw new Exception("查无此申请"); } if (fltRetModApplyEntity.OrderStatus != FltRetApplyStatusEnum.A.ToString()) { throw new Exception("该审核已经提交审批"); } fltRetModApplyEntity.EditOid = query.Cid.ToString(); fltRetModApplyEntity.EditTime = DateTime.Now; fltRetModApplyEntity.OrderStatus = FltRetApplyStatusEnum.D.ToString(); _fltRetModApplyDal.Update(fltRetModApplyEntity, new string[] { "EditOid", "EditTime", "OrderStatus" }); bool isViolatePolicy = false; foreach (var detail in query.DetailList) { FltRetModFlightApplyEntity flightApplyEntity = _fltRetModFlightApplyDal.Query <FltRetModFlightApplyEntity>( n => n.Rmid == query.Rmid && n.Sequence == detail.Sequence && n.Pid == detail.Pid) .FirstOrDefault(); if (flightApplyEntity == null) { continue; } if (!string.IsNullOrEmpty(flightApplyEntity.PolicyDesc)) { isViolatePolicy = true; } flightApplyEntity.OrderStatus = fltRetModApplyEntity.OrderStatus; flightApplyEntity.ChoiceReasonId = detail.ChoiceReasonId; _fltRetModFlightApplyDal.Update(flightApplyEntity, new string[] { "ChoiceReasonId", "OrderStatus" }); } FltRetModApplyLogEntity log = new FltRetModApplyLogEntity() { Rmid = fltRetModApplyEntity.Rmid, LogTime = DateTime.Now, LogType = "修改退票申请", Oid = "sys", Remark = "进行核价" }; _fltRetModApplyLogDal.Insert(log); return(new ConfirmRetModAuditPriceResultModel() { IsSuccess = true, Rmid = fltRetModApplyEntity.Rmid, CorpAduitId = fltRetModApplyEntity.CorpAduitId, CorpPolicyId = fltRetModApplyEntity.CorpPolicyId, OwnCid = fltRetModApplyEntity.Cid, IsViolatePolicy = isViolatePolicy }); }
/// <summary> /// 核价确认阶段取消申请 /// </summary> /// <param name="query"></param> /// <returns></returns> public int CancelFltModApplyByWaitAuditStep(CancelFltRetModApplyModel query) { FltRetModApplyEntity fltRetModApplyEntity = _fltRetModApplyDal.Find <FltRetModApplyEntity>(query.Rmid); string orderType = fltRetModApplyEntity.OrderType == "M" ? "改签" : "退票"; if (!string.IsNullOrEmpty(query.Customer?.UserID) && query.Customer.UserID.ToLower() != "administrator" && query.Customer.Cid != fltRetModApplyEntity.Cid) { throw new Exception($"查无此{orderType}申请"); } if (!string.IsNullOrEmpty(query.Customer?.UserID) && query.Customer.UserID.ToLower() == "administrator") { throw new Exception($"管理员帐号不能取消{orderType}申请"); } string orderStatus = FltModApplyStatusEnum.C.ToString(); string wOrderStatus = FltModApplyStatusEnum.A.ToString(); if (fltRetModApplyEntity.OrderType == "R") { orderStatus = FltRetApplyStatusEnum.C.ToString(); wOrderStatus = FltRetApplyStatusEnum.A.ToString(); } if (fltRetModApplyEntity.OrderStatus == orderStatus) { throw new Exception($"当前{orderType}申请已经取消!"); } if (fltRetModApplyEntity.OrderStatus != wOrderStatus) { throw new Exception($"当前{orderType}申请无法取消!"); } fltRetModApplyEntity.OrderStatus = orderStatus; _fltRetModApplyDal.Update(fltRetModApplyEntity, new string[] { "OrderStatus" }); List <FltRetModFlightApplyEntity> fltRetModFlightApplyEntities = _fltRetModFlightApplyDal.Query <FltRetModFlightApplyEntity>(n => n.Rmid == query.Rmid, true).ToList(); foreach (var fltRetModFlightApplyEntity in fltRetModFlightApplyEntities) { fltRetModFlightApplyEntity.OrderStatus = orderStatus; _fltRetModFlightApplyDal.Update(fltRetModFlightApplyEntity, new string[] { "OrderStatus" }); } FltRetModApplyLogEntity log = new FltRetModApplyLogEntity(); log.LogTime = DateTime.Now; log.LogType = "取消申请"; log.Oid = "Sys"; log.Remark = "核价确认时取消了申请"; log.Rmid = query.Rmid; _fltRetModApplyLogDal.Insert(log); return(0); }