| | |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsMaterialStocks; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Services; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterialStocks; |
| | | using CMS.Plugin.HIAWms.Domain.Shared; |
| | | using CMS.Plugin.HIAWms.Domain.Shared.WmsMaterialStocks; |
| | | using CMS.Plugin.HIAWms.Domain.WmsAreas; |
| | | using CMS.Plugin.HIAWms.Domain.WmsContainers; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterials; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterialStocks; |
| | | using CMS.Plugin.HIAWms.Domain.WmsPlaces; |
| | | using CmsQueryExtensions; |
| | | using Microsoft.Extensions.DependencyInjection; |
| | | using System.Text.Json; |
| | | using Volo.Abp; |
| | | using Volo.Abp.Application.Dtos; |
| | | using Volo.Abp.Data; |
| | | using Volo.Abp.ObjectExtending; |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Util; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterials; |
| | | using CMS.Plugin.HIAWms.Domain.WmsContainers; |
| | | using CMS.Plugin.HIAWms.Domain.WmsPlaces; |
| | | using CMS.Plugin.HIAWms.Domain.WmsAreas; |
| | | using Volo.Abp.Uow; |
| | | using Microsoft.Extensions.DependencyInjection; |
| | | using NPOI.POIFS.Storage; |
| | | using System.Text.Json; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.Implements; |
| | | |
| | |
| | | { |
| | | throw new UserFriendlyException("库位库区信息不存在"); |
| | | } |
| | | var wmsmaterialstockList = await _wmsmaterialstockRepository.GetStockListAsync(new WmsMaterialStock { PlaceNo = input.PlaceNo }); |
| | | if (wmsmaterialstockList.Count > 0) |
| | | { |
| | | if (wmsmaterialstockList[0].MaterialNo != input.MaterialNo) |
| | | { |
| | | throw new UserFriendlyException("当前库位已存放别的物料"); |
| | | } |
| | | } |
| | | |
| | | var maxSort = await _wmsmaterialstockRepository.GetMaxSortAsync(); |
| | | var sort = input.Sort ?? maxSort; |
| | | var wmsmaterialstock = ObjectMapper.Map<WmsMaterialStockCreateDto, WmsMaterialStock>(input); |
| | |
| | | stock = JsonSerializer.Deserialize<WmsMaterialStock>(json); |
| | | stock.MaterialId = Guid.NewGuid().ToString("N"); |
| | | stock.StockNumber = 1; |
| | | stockList.Add(stock); |
| | | stockList.Add(stock); |
| | | } |
| | | |
| | | await _wmsmaterialstockRepository.InsertManyAsync(stockList); |
| | |
| | | await _wmscontainerRepository.UpdateAsync(container); |
| | | await _wmsplaceRepository.UpdateAsync(place); |
| | | |
| | | if (input.Sort.HasValue && wmsmaterialstock.Sort != maxSort) |
| | | { |
| | | await AdjustSortAsync(wmsmaterialstock.Id, wmsmaterialstock.Sort); |
| | | } |
| | | //if (input.Sort.HasValue && wmsmaterialstock.Sort != maxSort) |
| | | //{ |
| | | // await AdjustSortAsync(wmsmaterialstock.Id, wmsmaterialstock.Sort); |
| | | //} |
| | | await uow.SaveChangesAsync(); |
| | | await uow.CompleteAsync(); |
| | | return ObjectMapper.Map<WmsMaterialStock, WmsMaterialStockDto>(wmsmaterialstock); |