コード例 #1
0
 /// <summary>
 /// 物流发货
 /// </summary>
 /// <param name="orderId"></param>
 /// <param name="logisticsType"></param>
 /// <param name="logisticsNo"></param>
 /// <param name="deliverName"></param>
 /// <param name="deliverAddress"></param>
 /// <param name="receiverName"></param>
 /// <param name="receiverAddress"></param>
 /// <param name="deliveTime"></param>
 public void Deliver(Guid orderId, LogisticsType logisticsType, string logisticsNo, string deliverName, string deliverAddress, Guid deliverUserId, string receiverName, string receiverAddress, DateTime?deliveTime)
 {
     OrderId       = orderId;
     LogisticsType = logisticsType;
     LogisticsNo   = logisticsNo;
     if (string.IsNullOrEmpty(deliverName))
     {
         throw new DomainException("发货人无效!");
     }
     if (string.IsNullOrEmpty(deliverAddress))
     {
         throw new DomainException("发货地址未填写!");
     }
     DeliverUserId   = deliverUserId;
     DeliverName     = deliverName;
     DeliverAddress  = deliverAddress;
     ReceiverName    = receiverName;
     ReceiverAddress = receiverAddress;
     if (deliveTime != null && deliveTime.Value >= DateTime.Now)
     {
         throw new DomainException("发货时间不能晚于现在!");
     }
     DeliveTime     = deliveTime ?? DateTime.Now;
     LogisticsState = LogisticsState.DeliverGoods;
 }
コード例 #2
0
 /// <summary>
 /// 物流收货
 /// </summary>
 /// <param name="receiveTime"></param>
 public void Receive(Guid receiverUserId, DateTime?receiveTime)
 {
     if (LogisticsState == LogisticsState.DeliverGoods)
     {
         LogisticsState = LogisticsState.ReceivingGoods;
         ReceiverUserId = receiverUserId;
         if (receiveTime != null && receiveTime.Value >= DateTime.Now)
         {
             throw new DomainException("确认收货时间不能晚于现在!");
         }
         ReceiveTime = receiveTime ?? DateTime.Now;
     }
     else
     {
         throw new DomainException("当前状态无法进行收货操作");
     }
 }