| | |
| | | using Volo.Abp.Data; |
| | | using Volo.Abp.ObjectExtending; |
| | | using Volo.Abp.ObjectMapping; |
| | | using CmsQueryExtensions.Entitys; |
| | | |
| | | namespace CMS.Plugin.PipeLineLems.Application.Implements; |
| | | |
| | |
| | | public class CallMaterialOrderAppService : CMSPluginAppService, ICallMaterialOrderAppService |
| | | { |
| | | 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) |
| | | { |
| | | _callMaterialOrderRepository = callMaterialOrderRepository; |
| | | _sharedService = sharedService; |
| | | _serviceProvider = serviceProvider; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public virtual async Task<CallMaterialOrderDto> GetAsync(Guid 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> |
| | |
| | | insertObj.Sort = sort; |
| | | input.MapExtraPropertiesTo(insertObj, MappingPropertyDefinitionChecks.None); |
| | | |
| | | insertObj.CreatorName = input.CreatorName;//创建人 |
| | | await _callMaterialOrderRepository.InsertAsync(insertObj); |
| | | |
| | | //if (input.Sort.HasValue && insertObj.Sort != maxSort) |
| | |
| | | |
| | | updateObj.DataIdentifier = input.DataIdentifier; |
| | | updateObj.MaterialMode = input.MaterialMode; |
| | | updateObj.MaterialBatch = input.MaterialBatch; |
| | | updateObj.CallMaterialStatus = input.CallMaterialStatus; |
| | | updateObj.Quantity = input.Quantity; |
| | | updateObj.WmsRetResult = input.WmsRetResult; |
| | | updateObj.WmsTaskNo = input.WmsTaskNo; |
| | | updateObj.Remark = input.Remark; |
| | | |
| | | |
| | | updateObj.LastModifierName = input.LastModifierName;//修改人 |
| | | |
| | | await _callMaterialOrderRepository.UpdateAsync(updateObj); |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="ids"></param> |
| | | /// <returns></returns> |
| | | public async Task<List<CallMaterialOrderDto>> CloneAsync(IEnumerable<Guid> ids) |
| | | public async Task<List<CallMaterialOrderDto>> CloneAsync(IEnumerable<Guid> ids, MyCurrentUser myCurrentUser) |
| | | { |
| | | //var callMaterialOrders = new List<CallMaterialOrder>(); |
| | | //if (ids != null) |
| | | //{ |
| | | // var sort = await callMaterialOrderRepository.GetMaxSortAsync(); |
| | | // var sort = await _callMaterialOrderRepository.GetMaxSortAsync(); |
| | | // foreach (var id in ids) |
| | | // { |
| | | // var CallMaterialOrder = await callMaterialOrderRepository.FindAsync(id); |
| | | // var CallMaterialOrder = await _callMaterialOrderRepository.FindAsync(id); |
| | | // if (CallMaterialOrder != null) |
| | | // { |
| | | // var name = CallMaterialOrder.Name + CallMaterialOrderConsts.CloneTag; |
| | | // var notExist = false; |
| | | // while (!notExist) |
| | | // { |
| | | // var exist = await callMaterialOrderRepository.NameExistAsync(name); |
| | | // var exist = await _callMaterialOrderRepository.NameExistAsync(name); |
| | | // if (exist || callMaterialOrders.Any(x => x.Name == name)) |
| | | // { |
| | | // name += CallMaterialOrderConsts.CloneTag; |
| | |
| | | // notExist = true; |
| | | // } |
| | | |
| | | // //CallMaterialOrder = await callMaterialOrderRepository.InsertAsync(CallMaterialOrder.Clone(GuidGenerator.Create(), name, sort++)); |
| | | // //CallMaterialOrder = await _callMaterialOrderRepository.InsertAsync(CallMaterialOrder.Clone(GuidGenerator.Create(), name, sort++)); |
| | | // callMaterialOrders.Add(CallMaterialOrder); |
| | | // } |
| | | // } |
| | |
| | | /// </summary> |
| | | /// <param name="ids"></param> |
| | | /// <returns></returns> |
| | | public async Task DeleteManyAsync(IEnumerable<Guid> ids) |
| | | public async Task DeleteManyAsync(IEnumerable<Guid> ids, MyCurrentUser myCurrentUser) |
| | | { |
| | | foreach (var id in ids) |
| | | { |
| | | await DeleteAsync(id); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 物理删除叫料单表 |
| | | /// </summary> |
| | | /// <param name="id">主键ID</param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public virtual async Task DeletePermanentlyAsync(Guid id, MyCurrentUser myCurrentUser, CancellationToken cancellationToken = default) |
| | | { |
| | | _callMaterialOrderRepository.DeletePermanentlyAsync(id); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 批量物理删除叫料单表(直接删除,不软删除) |
| | | /// </summary> |
| | | /// <param name="ids">要删除的主键ID列表</param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public virtual async Task BatchDeletePermanentlyAsync(IEnumerable<Guid> ids, MyCurrentUser myCurrentUser, CancellationToken cancellationToken = default) |
| | | { |
| | | _callMaterialOrderRepository.BatchDeletePermanentlyAsync(ids); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="UserFriendlyException"></exception> |
| | | public async Task ImportAsync(CallMaterialOrdersImportModel input) |
| | | public async Task ImportAsync(CallMaterialOrdersImportModel input, MyCurrentUser myCurrentUser) |
| | | { |
| | | Check.NotNull(input, nameof(input)); |
| | | |
| | |
| | | { |
| | | DataIdentifier = impItem.DataIdentifier, |
| | | MaterialMode = impItem.MaterialMode, |
| | | MaterialBatch = impItem.MaterialBatch, |
| | | CallMaterialStatus = impItem.CallMaterialStatus, |
| | | Quantity = impItem.Quantity, |
| | | WmsRetResult = impItem.WmsRetResult, |
| | |
| | | { |
| | | DataIdentifier = impItem.DataIdentifier, |
| | | MaterialMode = impItem.MaterialMode, |
| | | MaterialBatch = impItem.MaterialBatch, |
| | | CallMaterialStatus = impItem.CallMaterialStatus, |
| | | Quantity = impItem.Quantity, |
| | | WmsRetResult = impItem.WmsRetResult, |
| | |
| | | { |
| | | try |
| | | { |
| | | callMaterialOrderDto.Item.CreatorName = myCurrentUser.UserAccount;//创建人 |
| | | await CreateAsync(callMaterialOrderDto.Item); |
| | | } |
| | | catch (Exception e) |
| | |
| | | { |
| | | try |
| | | { |
| | | callMaterialOrderDto.Item.LastModifierName = myCurrentUser.UserAccount;//修改人 |
| | | await UpdateAsync(callMaterialOrderDto.Id, callMaterialOrderDto.Item); |
| | | } |
| | | catch (Exception e) |