| | |
| | | /// </summary> |
| | | public class CallMaterialOrderAppService : CMSPluginAppService, ICallMaterialOrderAppService |
| | | { |
| | | private readonly ICallMaterialOrderRepository callMaterialOrderRepository; |
| | | private readonly ICallMaterialOrderRepository _callMaterialOrderRepository; |
| | | private readonly SharedService _sharedService; |
| | | private readonly IServiceProvider _serviceProvider; |
| | | /// <summary> |
| | | /// Initializes a new instance of the <see cref="CallMaterialOrderAppService"/> class. |
| | | /// </summary> |
| | | /// <param name="CallMaterialOrderRepository">The task job repository.</param> |
| | | public CallMaterialOrderAppService(ICallMaterialOrderRepository _CallMaterialOrderRepository, SharedService sharedService, IServiceProvider serviceProvider) |
| | | public CallMaterialOrderAppService(ICallMaterialOrderRepository callMaterialOrderRepository, SharedService sharedService, IServiceProvider serviceProvider) |
| | | { |
| | | callMaterialOrderRepository = _CallMaterialOrderRepository; |
| | | _callMaterialOrderRepository = callMaterialOrderRepository; |
| | | _sharedService = sharedService; |
| | | _serviceProvider = serviceProvider; |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public virtual async Task<CallMaterialOrderDto> GetAsync(Guid id) |
| | | { |
| | | return ObjectMapper.Map<CallMaterialOrder, CallMaterialOrderDto>(await callMaterialOrderRepository.GetAsync(id)); |
| | | return ObjectMapper.Map<CallMaterialOrder, CallMaterialOrderDto>(await _callMaterialOrderRepository.GetAsync(id)); |
| | | } |
| | | |
| | | public virtual async Task CallMaterialByDataIdentifier(Guid id) |
| | | { |
| | | await _sharedService.CallMaterialByDataIdentifier(id, _serviceProvider); |
| | | } |
| | | |
| | | public virtual async Task<CallMaterialOrder> FindByWmsTaskNoAsync(string wmsTaskNo) |
| | | { |
| | | return await _callMaterialOrderRepository.FindByWmsTaskNoAsync(wmsTaskNo); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | #endregion |
| | | |
| | | var count = await callMaterialOrderRepository.GetCountAsync(whereConditions); |
| | | var list = await callMaterialOrderRepository.GetListAsync(whereConditions, input.Sorting, input.MaxResultCount, input.SkipCount); |
| | | var count = await _callMaterialOrderRepository.GetCountAsync(whereConditions); |
| | | var list = await _callMaterialOrderRepository.GetListAsync(whereConditions, input.Sorting, input.MaxResultCount, input.SkipCount); |
| | | |
| | | return new PagedResultDto<CallMaterialOrderDto>(count, ObjectMapper.Map<List<CallMaterialOrder>, List<CallMaterialOrderDto>>(list)); |
| | | } |
| | |
| | | { |
| | | await CheckCreateOrUpdateDtoAsync(input); |
| | | |
| | | var exist = await callMaterialOrderRepository.NameExistAsync(input.DataIdentifier); |
| | | var exist = await _callMaterialOrderRepository.NameExistAsync(input.DataIdentifier); |
| | | if (exist) |
| | | { |
| | | throw new UserFriendlyException(L[CMSPluginDomainErrorCodes.NameAlreadyExists, input.DataIdentifier]); |
| | | } |
| | | |
| | | var maxSort = await callMaterialOrderRepository.GetMaxSortAsync(); |
| | | var maxSort = await _callMaterialOrderRepository.GetMaxSortAsync(); |
| | | var sort = input.Sort ?? maxSort; |
| | | |
| | | var insertObj = ObjectMapper.Map<CallMaterialOrderCreateDto, CallMaterialOrder>(input); |
| | | insertObj.Sort = sort; |
| | | input.MapExtraPropertiesTo(insertObj, MappingPropertyDefinitionChecks.None); |
| | | |
| | | await callMaterialOrderRepository.InsertAsync(insertObj); |
| | | await _callMaterialOrderRepository.InsertAsync(insertObj); |
| | | |
| | | //if (input.Sort.HasValue && insertObj.Sort != maxSort) |
| | | //{ |
| | |
| | | { |
| | | await CheckCreateOrUpdateDtoAsync(input); |
| | | |
| | | var updateObj = await callMaterialOrderRepository.GetAsync(id); |
| | | var exist = await callMaterialOrderRepository.NameExistAsync(input.DataIdentifier, updateObj.Id); |
| | | var updateObj = await _callMaterialOrderRepository.GetAsync(id); |
| | | var exist = await _callMaterialOrderRepository.NameExistAsync(input.DataIdentifier, updateObj.Id); |
| | | if (exist) |
| | | { |
| | | throw new UserFriendlyException(L[CMSPluginDomainErrorCodes.NameAlreadyExists, input.DataIdentifier]); |
| | |
| | | updateObj.Remark = input.Remark; |
| | | |
| | | |
| | | await callMaterialOrderRepository.UpdateAsync(updateObj); |
| | | await _callMaterialOrderRepository.UpdateAsync(updateObj); |
| | | |
| | | return ObjectMapper.Map<CallMaterialOrder, CallMaterialOrderDto>(updateObj); |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public virtual Task DeleteAsync(Guid id) |
| | | { |
| | | return callMaterialOrderRepository.DeleteAsync(id); |
| | | return _callMaterialOrderRepository.DeleteAsync(id); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | public virtual async Task AdjustSortAsync(Guid id, int sort) |
| | | { |
| | | var list = await callMaterialOrderRepository.GetListAsync(null, nameof(CallMaterialOrder.Sort)); |
| | | var list = await _callMaterialOrderRepository.GetListAsync(null, nameof(CallMaterialOrder.Sort)); |
| | | if (list != null && list.Any()) |
| | | { |
| | | var initSort = 1; |
| | |
| | | } |
| | | } |
| | | |
| | | await callMaterialOrderRepository.UpdateManyAsync(list); |
| | | await _callMaterialOrderRepository.UpdateManyAsync(list); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | throw new UserFriendlyException(errorMsg); |
| | | } |
| | | |
| | | var oldCallMaterialOrder = await callMaterialOrderRepository.FindByNameAsync(impItem.DataIdentifier); |
| | | var oldCallMaterialOrder = await _callMaterialOrderRepository.FindByNameAsync(impItem.DataIdentifier); |
| | | if (oldCallMaterialOrder != null) |
| | | { |
| | | var callMaterialOrderUpdateDto = new CallMaterialOrderUpdateDto |
| | |
| | | #endregion |
| | | |
| | | |
| | | var list = await callMaterialOrderRepository.GetListAsync(whereConditions, input.Sorting, input.MaxResultCount, input.SkipCount, includeDetails: true); |
| | | var list = await _callMaterialOrderRepository.GetListAsync(whereConditions, input.Sorting, input.MaxResultCount, input.SkipCount, includeDetails: true); |
| | | var result = ObjectMapper.Map<List<CallMaterialOrder>, List<CallMaterialOrderDto>>(list); |
| | | |
| | | var sheets = new Dictionary<string, object> |
| | |
| | | |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据条件获取叫料单表列表 |
| | | /// </summary> |
| | | /// <param name="whereConditions"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<List<CallMaterialOrder>> GetListByFilterAsync(Expression<Func<CallMaterialOrder, bool>> whereConditions, CancellationToken cancellationToken = default) |
| | | { |
| | | return await _callMaterialOrderRepository.GetListByFilterAsync(whereConditions); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据条件获取单个叫料单表 |
| | | /// </summary> |
| | | /// <param name="whereConditions"></param> |
| | | /// <param name="isMultipleThrowException">是否查询出多条就报错</param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="UserFriendlyException"></exception> |
| | | public async Task<CallMaterialOrder> GetSingleByFilterAsync(Expression<Func<CallMaterialOrder, bool>> whereConditions, bool isMultipleThrowException = false, CancellationToken cancellationToken = default) |
| | | { |
| | | return await _callMaterialOrderRepository.GetSingleByFilterAsync(whereConditions, isMultipleThrowException); |
| | | } |
| | | } |