public RestReturnValue <bool> SetOrderStateByDistributionId(int distributionId, int orderId, int orderState) { COrderPO orderInf = COrderManager.Instance.GetById(orderId); if (orderInf == null) { throw new BusinessException("订单不存在"); } CDistributionManagerPO distributionManager = CDistributionManagerManager.Instance.GetById(distributionId); if (distributionManager == null) { throw new BusinessException("骑手不存在"); } if (orderInf.DistributionId.HasValue && orderInf.DistributionId != distributionManager.Id) { throw new BusinessException("此订单已被抢单"); } orderInf.OrderState = orderState; orderInf.DistributionId = distributionId; COrderManager.Instance.Update(orderInf, distributionManager.Name); return(RestReturnValue <bool> .Get200OK(true)); }
/// <summary> /// 获取未分配的订单 /// </summary> /// <returns></returns> public RestReturnValue <Core.Data.QueryResult <COrderDTO> > GetUnassignedOrder(int distributionId, int startIndex, int count) { CDistributionManagerPO po = CDistributionManagerManager.Instance.GetById(distributionId); if (po == null) { throw new BusinessException("此骑手不存在"); } return(RestReturnValue <Core.Data.QueryResult <COrderDTO> > .Get200OK(COrderManager.Instance.GetOrderDTOs(null, null, po.ResUUID, null, null, null, null, null, new List <int> { 5 }, new List <int> { 1, 2 }, null, null, null, null, null, null, null, null, null, startIndex, count, true, true))); }