| | |
| | | using Volo.Abp.Data; |
| | | using Volo.Abp.ObjectExtending; |
| | | using Volo.Abp.ObjectMapping; |
| | | using CMS.Plugin.HIAWms.Domain.WmsContainers; |
| | | using CMS.Plugin.HIAWms.Domain.WmsPlaces; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.Implements; |
| | | |
| | |
| | | public class WmsTaskAppService : CMSPluginAppService, IWmsTaskAppService |
| | | { |
| | | private readonly IWmsTaskRepository wmsTaskRepository; |
| | | private readonly IWmsContainerRepository _wmsContainerRepository; |
| | | private readonly IWmsPlaceRepository _wmsPlaceRepository; |
| | | |
| | | /// <summary> |
| | | /// Initializes a new instance of the <see cref="WmsTaskAppService"/> class. |
| | | /// </summary> |
| | | /// <param name="WmsTaskRepository">The task job repository.</param> |
| | | public WmsTaskAppService(IWmsTaskRepository _WmsTaskRepository) |
| | | public WmsTaskAppService(IWmsTaskRepository _WmsTaskRepository, IWmsContainerRepository wmsContainerRepository, IWmsPlaceRepository wmsPlaceRepository) |
| | | { |
| | | wmsTaskRepository = _WmsTaskRepository; |
| | | _wmsContainerRepository = wmsContainerRepository; |
| | | _wmsPlaceRepository = wmsPlaceRepository; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | throw new UserFriendlyException(L[CMSPluginDomainErrorCodes.NameAlreadyExists, input.TaskNo]); |
| | | } |
| | | // 校验托盘是否存在 |
| | | var existContainer = await _wmsContainerRepository.NameExistAsync(input.ContainerNo); |
| | | if (existContainer) |
| | | { |
| | | throw new UserFriendlyException("托盘不存在,请先添加托盘"); |
| | | } |
| | | // 校验物料是否存在 |
| | | var existSourcePlace = await _wmsPlaceRepository.NameExistAsync(input.SourcePlace); |
| | | if (existSourcePlace) |
| | | { |
| | | throw new UserFriendlyException("起始库位不存在,请先添加库位"); |
| | | } |
| | | //校验库位是否存在 |
| | | var existToPlace = await _wmsPlaceRepository.NameExistAsync(input.ToPlace); |
| | | if (existToPlace) |
| | | { |
| | | throw new UserFriendlyException("目标库位不存在,请先添加库位"); |
| | | } |
| | | |
| | | var maxSort = await wmsTaskRepository.GetMaxSortAsync(); |
| | | var sort = input.Sort ?? maxSort; |
| | |
| | | updateObj.MutableParam2 = input.MutableParam2; |
| | | updateObj.MutableParam3 = input.MutableParam3; |
| | | updateObj.IsDisabled = input.IsDisabled; |
| | | |
| | | |
| | | await wmsTaskRepository.UpdateAsync(updateObj); |
| | | |
| | |
| | | Check.NotNull(input.TaskLevel, "任务等级"); |
| | | Check.NotNull(input.TaskStatus, "任务状态"); |
| | | Check.NotNull(input.Dodevicetype, "设备类型"); |
| | | Check.NotNull(input.ContainerNo, "托盘号"); |
| | | Check.NotNull(input.SourcePlace, "起始位置"); |
| | | Check.NotNull(input.ToPlace, "目标未知"); |
| | | Check.NotNull(input.TaskDodeviceStatus, "设备任务状态"); |
| | | Check.NotNull(input.IsRead, "WCS是否可以读取"); |
| | | |