Exemple #1
0
        private StocktakingDto MapToStocktakingDto(Stocktaking entity)
        {
            StocktakingDto dto       = ObjectMapper.Map <StocktakingDto>(entity);
            var            shelf     = TaskManager.GetShelf(entity.ShelfId);
            var            cargoType = TaskManager.GetCargoType(shelf.CargoTypeId);

            dto.ActualInventory = cargoType.Ratio * dto.Inventory;

            if (!dto.Deviation.HasValue)
            {
                var currentInventory = shelf.Inventory.HasValue ? shelf.Inventory.Value : 0;
                dto.CurrentInventory = string.Format("{0} (偏差为 {1:F3})", currentInventory, dto.ActualInventory - currentInventory);
            }
            return(dto);
        }
Exemple #2
0
 public void InsertStocktaking(int objectId, int shelfId, double inventory, string remark, int workerId)
 {
     using (CurrentUnitOfWork.SetTenantId(1))
     {
         var entity = new Stocktaking()
         {
             ObjectId     = objectId,
             CarryoutDate = DateTime.Today,
             ShelfId      = shelfId,
             Inventory    = inventory,
             Remark       = remark,
             WorkerId     = workerId,
             CreateTime   = DateTime.Now
         };
         _stocktakingRepository.Insert(entity);
         CurrentUnitOfWork.SaveChanges();
     }
 }