| | |
| | | using Ao.Lang; |
| | | using CMS.Extensions.Abp.AspNetCore.Mvc.Filters; |
| | | using CMS.Framework.AspNetCore.Users; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsMaterial; |
| | | using CMS.Plugin.HIAWms.Application.Contracts.Services; |
| | | using Microsoft.AspNetCore.Authorization; |
| | |
| | | using System.Reflection; |
| | | using Volo.Abp; |
| | | using Volo.Abp.Application.Dtos; |
| | | using CmsQueryExtensions.Entitys; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Controller |
| | | { |
| | |
| | | public class WmsMaterialController : ControllerBase |
| | | { |
| | | private readonly IWmsMaterialAppService _wmsMaterialAppService; |
| | | private readonly ICurrentUser _currentUser; |
| | | |
| | | /// <summary> |
| | | /// Initializes a new instance of the <see cref="WmsMaterialController"/> class. |
| | | /// </summary> |
| | | /// <param name="wmsMaterialAppService">The wmsMaterial application service.</param> |
| | | public WmsMaterialController(IWmsMaterialAppService wmsMaterialAppService) |
| | | public WmsMaterialController(IWmsMaterialAppService wmsMaterialAppService, ICurrentUser currentUser) |
| | | { |
| | | _wmsMaterialAppService = wmsMaterialAppService; |
| | | _currentUser = currentUser; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | [HttpPost] |
| | | public virtual Task<WmsMaterialDto> CreateAsync(WmsMaterialCreateDto input) |
| | | { |
| | | input.CreatorName = _currentUser.UserAccount;//å建人 |
| | | return _wmsMaterialAppService.CreateAsync(input); |
| | | } |
| | | |
| | |
| | | [Route("{id}")] |
| | | public virtual Task<WmsMaterialDto> UpdateAsync(Guid id, WmsMaterialUpdateDto input) |
| | | { |
| | | input.LastModifierName = _currentUser.UserAccount;//ä¿®æ¹äºº |
| | | return _wmsMaterialAppService.UpdateAsync(id, input); |
| | | } |
| | | |
| | |
| | | [Route("{id}")] |
| | | public virtual Task DeleteAsync(Guid id) |
| | | { |
| | | return _wmsMaterialAppService.DeleteAsync(id); |
| | | //return _wmsMaterialAppService.DeleteAsync(id);//é»è¾å é¤ |
| | | return _wmsMaterialAppService.DeletePermanentlyAsync(id);//ç©çå é¤ |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | [HttpDelete] |
| | | public virtual Task DeleteAsync([FromBody] IEnumerable<Guid> ids) |
| | | { |
| | | return _wmsMaterialAppService.DeleteManyAsync(ids); |
| | | MyCurrentUser myCurrentUser = new MyCurrentUser() |
| | | { |
| | | UserAccount = _currentUser.UserAccount, |
| | | UserId = _currentUser.UserId |
| | | }; |
| | | // return _wmsMaterialAppService.DeleteManyAsync(ids);//é»è¾å é¤ |
| | | return _wmsMaterialAppService.BatchDeletePermanentlyAsync(ids);//ç©çå é¤ |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | throw new UserFriendlyException("è¯·æ£æ¥å¯¼å
¥çè¡¨æ ¼"); |
| | | } |
| | | |
| | | MyCurrentUser myCurrentUser = new MyCurrentUser() |
| | | { |
| | | UserAccount = _currentUser.UserAccount, |
| | | UserId = _currentUser.UserId |
| | | }; |
| | | await _wmsMaterialAppService.ImportAsync(new WmsMaterialsImportModel |
| | | { |
| | | WmsMaterials = wmsMaterialRows, |
| | | }); |
| | | }, myCurrentUser); |
| | | |
| | | return Ok(); |
| | | } |