/// <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); }
/// <summary> /// 根据订单ID查询评价 /// </summary> /// <param name="OrderID"></param> /// <returns></returns> public P_EVALUATE LoadByOrderID(Guid OrderID) { return(evaluateService.LoadByOrderID(OrderID)); }