コード例 #1
0
        public async Task <SubmitResult> OrderStorage(OrderStorageDto orderStorageDto, int storageNumber)
        {
            var verifyResult = await _storageVerifyService.VerifyForCollection(_mapper.Map <OrderPlacing>(orderStorageDto), storageNumber);

            if (!string.IsNullOrEmpty(verifyResult))
            {
                return(new SubmitResult()
                {
                    IsSucceed = false, Message = verifyResult
                });
            }

            try
            {
                var storage = _mapper.Map <Storage>(orderStorageDto);
                storage.Number = storageNumber;

                _storageRepository.Insert(storage);

                //更新订单
                _orderRepository.OrderStorageNumberAdd(orderStorageDto.OrderId, storageNumber);

                //更新每日记录
                _dayFinishedRepository.UpdateStorageFinished(storageNumber);

                return(new SubmitResult
                {
                    IsSucceed = _unitOfWork2.SaveChanges()
                });
            }
            catch (Exception ex)
            {
                return(new SubmitResult()
                {
                    IsSucceed = false, Message = ex.Message
                });
            }
        }
コード例 #2
0
 public bool ChangeOrderStorageState(OrderStorageDto orderStorageDto, bool finished)
 {
     _orderRepository.ChangeOrderStorageState(orderStorageDto.OrderId, finished);
     return(_unitOfWork2.SaveChanges());
 }