/// <summary> /// 发送消息给订餐项目组 /// </summary> public void SendMessageToWorkGroup(P_ORDER order) { P_WeChatOrder orderInfo = JsonConvert.DeserializeObject <P_WeChatOrder>(order.Detail); List <string> listMessage = new List <string>(); List <string> listTouser = new List <string>(); if (order.State == OrderState.WAITAPPROVE) { // 有MMCoE需要审批 var msg = $"您有需要审批的订单,{order.PO},供应商: {order.Channel.ToUpper()},请<a href='{WebConfigHandler.H5Domain}/P/Order/OrderApproval/{order.ID}'>点击这里</a>。"; listMessage.Add(msg); listTouser = groupMemberService.GetGroupMembersByType(GroupTypeEnum.MMCoE).Select(a => a.UserId).ToList(); } else if (order.State == OrderState.FOODLOSE) { // 未送达 var evaluate = evaluateService.LoadByOrderID(order.ID); if (evaluate != null) { var msg = $"订单未送达:{evaluate.OnTimeDiscrpion}。{order.PO},供应商: {order.Channel.ToUpper()},{order.DeliverTime.ToString("yyyy-MM-dd HH:mm")},医院:{orderInfo.preApproval.HospitalName},收餐人:{order.Consignee},收餐人电话:{order.Phone}"; listMessage.Add(msg); listTouser = groupMemberService.GetGroupMembersByType(GroupTypeEnum.Complaints).Select(a => a.UserId).ToList(); } } else if (order.State == OrderState.EVALUATED) { // 已评价 var evaluate = evaluateService.LoadByOrderID(order.ID); if (evaluate != null) { if (evaluate.OnTime == 5) { var msg = $"迟到超过60分钟:{evaluate.OnTimeDiscrpion}。{order.PO},供应商: {order.Channel.ToUpper()},{order.DeliverTime.ToString("yyyy-MM-dd HH:mm")},医院:{orderInfo.preApproval.HospitalName},餐厅:{order.RestaurantName},收餐人:{order.Consignee},收餐人电话:{order.Phone}"; listMessage.Add(msg); } if (evaluate.IsSafe == 1) { var msg = $"食品安全存在问题:{evaluate.SafeDiscrpion}。{order.PO},供应商: {order.Channel.ToUpper()},{order.DeliverTime.ToString("yyyy-MM-dd HH:mm")},医院:{orderInfo.preApproval.HospitalName},餐厅:{order.RestaurantName},收餐人:{order.Consignee},收餐人电话:{order.Phone}"; listMessage.Add(msg); } listTouser = groupMemberService.GetGroupMembersByType(GroupTypeEnum.Complaints).Select(a => a.UserId).ToList(); } } else if (order.State == OrderState.SCHEDULEDFAIL) { var msg = $"预定失败:{order.CN},原因:{order.XmsOrderReason}。供应商:{order.Channel.ToUpper()},{order.DeliverTime.ToString("yyyy-MM-dd HH:mm")},医院:{order.HospitalName},餐厅:{order.RestaurantName},收餐人:{order.Consignee}, 收餐人电话:{order.Phone}"; //预定失败 listTouser = groupMemberService.GetGroupMembersByType(GroupTypeEnum.Complaints).Select(a => a.UserId).ToList(); } var touser = string.Join("|", listTouser); SendQyMsg(listMessage, touser); }
public int ChangeOrder(Guid ID, Guid ChangeID, P_WeChatOrder _orderInfo) { try { return(orderService.ChangeOrder(ID, ChangeID, _orderInfo)); } catch (Exception ex) { LogHelper.Error("Order.ChangeOrder", ex); } return(0); }
public int AddOrder(Guid ID, string UserId, string XmsOrderId, P_WeChatOrder _orderInfo, string ipathOrderId, string channel) { try { return(orderService.AddOrder(ID, UserId, XmsOrderId, _orderInfo, ipathOrderId, channel)); } catch (Exception ex) { LogHelper.Error("Order.AddOrder", ex); } return(0); }
public int ChangeOrder(Guid ID, Guid ChangeID, P_WeChatOrder _orderInfo) { var oldOrder = orderDao.FindByID(ID); // 1.主动改单 或者 改单MMCoE申请被拒绝的 oldOrder.ChangeID = ChangeID; oldOrder.ChangeDetail = JsonConvert.SerializeObject(_orderInfo); oldOrder.IsChange = OrderIsChange.YES; oldOrder = SessionOrderToP_ORDER.ConvterIt(_orderInfo, oldOrder); oldOrder.State = OrderState.SUBMITTED; return(orderDao.ChangeOrder(oldOrder)); }
public int AddOrder(Guid ID, string UserId, string XmsOrderId, P_WeChatOrder _orderInfo, string ipathOrderId, string channel) { var CreateDate = DateTime.Now; var order = SessionOrderToP_ORDER.ConvterIt(_orderInfo); order.ID = ID; order.UserId = UserId; order.CreateDate = CreateDate; order.XmsOrderId = XmsOrderId; order.SendOrderDate = CreateDate; order.EnterpriseOrderId = ipathOrderId; order.Channel = channel; var res = orderDao.AddOrder(order); return(res); }
/// <summary> /// 把内存订单数据转换成数据库格式 /// </summary> /// <param name="_orderInfo"></param> /// <returns></returns> public static P_ORDER ConvterIt(P_WeChatOrder _orderInfo, P_ORDER oldOrder = null) { var order = new P_ORDER() { Market = _orderInfo.preApproval.Market, HospitalId = _orderInfo.preApproval.HospitalCode, Province = _orderInfo.preApproval.Province, City = _orderInfo.preApproval.City, HospitalName = _orderInfo.preApproval.HospitalName, Address = _orderInfo.preApproval.HospitalAddress, CN = _orderInfo.preApproval.HTCode, RestaurantId = _orderInfo.foods.resId, RestaurantName = _orderInfo.foods.resName, RestaurantLogo = _orderInfo.foods.resLogo, TotalPrice = _orderInfo.foods.allPrice, DeliveryGeo = $"{_orderInfo.hospital.Latitude},{_orderInfo.hospital.Longitude}", Detail = JsonConvert.SerializeObject(_orderInfo), FoodCount = _orderInfo.foods.foods.Sum(a => Convert.ToInt32(a.count)), AttendCount = _orderInfo.details.attendCount, DeliveryAddress = _orderInfo.details.deliveryAddress, Consignee = _orderInfo.details.consignee, Phone = _orderInfo.details.phone, DeliverTime = _orderInfo.details.deliverTime.Value, Remark = _orderInfo.details.remark, MMCoEImage = _orderInfo.preApproval.MMCoEImage, State = OrderState.SUBMITTED, ReceiveCode = string.Empty, XmsTotalPrice = -1, IsOuterMeeting = _orderInfo.hospital.External, RestaurantTel = _orderInfo.foods.resTel, RestaurantAddress = _orderInfo.foods.resAddress, MMCoEApproveState = string.IsNullOrEmpty(_orderInfo.preApproval.MMCoEImage) ? MMCoEApproveState.NO : MMCoEApproveState.WAITAPPROVE, MeetingCode = _orderInfo.preApproval.HTCode, MeetingName = _orderInfo.preApproval.MeetingName, TA = _orderInfo.preApproval.TA, IsNonHT = 0, }; if (oldOrder == null) { return(order); } else { oldOrder.RestaurantId = order.RestaurantId; oldOrder.RestaurantName = order.RestaurantName; oldOrder.RestaurantLogo = order.RestaurantLogo; oldOrder.TotalPrice = order.TotalPrice; oldOrder.FoodCount = order.FoodCount; oldOrder.AttendCount = order.AttendCount; oldOrder.DeliveryAddress = order.DeliveryAddress; oldOrder.Consignee = order.Consignee; oldOrder.Phone = order.Phone; oldOrder.DeliverTime = order.DeliverTime; oldOrder.Remark = order.Remark; oldOrder.MMCoEImage = order.MMCoEImage; oldOrder.RestaurantTel = order.RestaurantTel; oldOrder.RestaurantAddress = order.RestaurantAddress; return(oldOrder); } }
/// <summary> /// 修改订单 /// </summary> /// <param name="ID"></param> /// <param name="ChangeID"></param> /// <param name="_orderInfo"></param> /// <returns></returns> public int Change(Guid ID, Guid ChangeID, P_WeChatOrder _orderInfo) { var oldOrder = orderDao.FindCacheOrderByID(ID); return(orderDao.Change(oldOrder)); }