/// <summary> /// 批量取消(作废) /// </summary> /// <param name="OrderID"></param> public int BatchInvalidOrder(List <InoutInfo> OrderList, string Remark, LoggingSessionInfo LoggingSessionInfo) { var UpdateOrderList = new List <InoutInfo>(); foreach (var item in OrderList) { var result = this._currentDAO.GetByID(item.order_id); if (result != null) { var Entity = new InoutInfo() { order_id = result.order_id, Field2 = result.Field2, carrier_id = result.carrier_id, status = "800", status_desc = "已取消", OldStatusDesc = item.OldStatusDesc }; UpdateOrderList.Add(Entity); } } //更新订单状态 int Num = this._currentDAO.BatchChangeOrderStatus(UpdateOrderList); if (Num > 0) {//添加状态操作记录 var inoutStatus = new TInoutStatusBLL(LoggingSessionInfo); foreach (var itemes in UpdateOrderList) { var info = new TInoutStatusEntity() { InoutStatusID = Guid.Parse(Utils.NewGuid()), OrderID = itemes.order_id, CustomerID = LoggingSessionInfo.ClientID, Remark = Remark, OrderStatus = 800, StatusRemark = "订单状态从" + itemes.OldStatusDesc + "变为已取消[操作人:" + LoggingSessionInfo.CurrentUser.User_Name + "]" }; //执行 inoutStatus.Create(info); //执行取消订单业务 SetCancelOrder(itemes.order_id, 0, LoggingSessionInfo); } // Num = UpdateOrderList.Count(); } return(Num); }
/// <summary> /// 批量审核 /// </summary> /// <param name="OrderID"></param> public int BatchCheckOrder(List <string> OrderIdList, string Remark, LoggingSessionInfo LoggingSessionInfo) { var UpdateOrderList = new List <InoutInfo>(); foreach (var item in OrderIdList) { var result = this._currentDAO.GetByID(item); if (result != null) { var Entity = new InoutInfo() { order_id = result.order_id, Field2 = result.Field2, carrier_id = result.carrier_id, Field1 = result.Field1, status = "500", status_desc = "未发货" }; UpdateOrderList.Add(Entity); } } //更新订单状态 int Num = this._currentDAO.BatchChangeOrderStatus(UpdateOrderList); if (Num > 0) {//添加状态操作记录 var inoutStatus = new TInoutStatusBLL(LoggingSessionInfo); foreach (var itemes in UpdateOrderList) { var info = new TInoutStatusEntity() { InoutStatusID = Guid.Parse(Utils.NewGuid()), OrderID = itemes.order_id, CustomerID = LoggingSessionInfo.ClientID, Remark = Remark, OrderStatus = 500, StatusRemark = "订单状态从未审核变为未发货[操作人:" + LoggingSessionInfo.CurrentUser.User_Name + "]" }; //执行 inoutStatus.Create(info); #region 审核成功,并且已支付,调用RabbitMQ发送给ERP if (itemes.Field1 == "0") { continue; } try { var msg = new EventContract { Operation = OptEnum.Update, EntityType = EntityTypeEnum.Order, Id = itemes.order_id }; var eventService = new EventService(); eventService.PublishMsg(msg); } catch (Exception) { throw new Exception("RabbitMQ Error"); } #endregion } // Num = UpdateOrderList.Count(); } return(Num); }
/// <summary> /// 批量发货 /// </summary> /// <param name="OrderID"></param> public int BatchInvalidShip(List <InoutInfo> OrderList, string Remark, LoggingSessionInfo LoggingSessionInfo) { var UpdateOrderList = new List <InoutInfo>(); foreach (var item in OrderList) { var result = this._currentDAO.GetByID(item.order_id); if (result != null) { var Entity = new InoutInfo() { order_id = result.order_id, Field2 = item.Field2, carrier_id = item.carrier_id, status = "600", status_desc = "已发货" }; UpdateOrderList.Add(Entity); } } //更新订单状态 int Num = this._currentDAO.BatchChangeOrderStatus(UpdateOrderList); if (Num > 0) {//添加状态操作记录 var inoutStatus = new TInoutStatusBLL(LoggingSessionInfo); var vipBll = new VipBLL(LoggingSessionInfo); var inoutService = new Inout3Service(LoggingSessionInfo); var CommonBLL = new CommonBLL(); foreach (var itemes in UpdateOrderList) { var info = new TInoutStatusEntity() { InoutStatusID = Guid.Parse(Utils.NewGuid()), OrderID = itemes.order_id, CustomerID = LoggingSessionInfo.ClientID, Remark = Remark, OrderStatus = 600, StatusRemark = "订单状态从未发货变为已发货[操作人:" + LoggingSessionInfo.CurrentUser.User_Name + "]" }; //执行 inoutStatus.Create(info); #region 发送微信模板消息 //获取订单 var OerderInfoData = this._currentDAO.GetByID(itemes.order_id); if (OerderInfoData != null) { //获取会员信息 var vipInfo = vipBll.GetByID(OerderInfoData.vip_no); if (vipInfo != null) { //物流公司 itemes.carrier_name = "";//inoutService.GetCompanyName(itemes.carrier_id); // CommonBLL.SentShipMessage(itemes, vipInfo.WeiXinUserId, itemes.vip_no, LoggingSessionInfo); new SendOrderSendMsgBLL().SentShipMessage(itemes, vipInfo.WeiXinUserId, itemes.vip_no, LoggingSessionInfo); } } #endregion } // Num = UpdateOrderList.Count(); } return(Num); }