6 changed files with 310 additions and 15 deletions
@ -0,0 +1,195 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text.Json; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Polly.Caching; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
using Win_in.Sfs.Auth.Application.Contracts; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
using Win_in.Sfs.Wms.Inventory.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Pda.Controllers.Jobs; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 注塑叫料任务
|
||||
|
/// </summary>
|
||||
|
[ApiController] |
||||
|
[Route($"{PdaHostConst.ROOT_ROUTE}job/injection")] |
||||
|
public class InjectionJobController : AbpController |
||||
|
{ |
||||
|
private readonly IInjectionJobAppService _injectionJobAppService; |
||||
|
|
||||
|
private readonly IUserWorkGroupAppService _userWorkGroupAppService; |
||||
|
|
||||
|
private readonly IDictAppService _dictApp; |
||||
|
|
||||
|
/// <summary>
|
||||
|
///
|
||||
|
/// </summary>
|
||||
|
/// <param name="injectionJobAppService"></param>
|
||||
|
/// <param name="userWorkGroupAppService"></param>
|
||||
|
public InjectionJobController( |
||||
|
IInjectionJobAppService injectionJobAppService, |
||||
|
IDictAppService dictApp |
||||
|
, IUserWorkGroupAppService userWorkGroupAppService) |
||||
|
{ |
||||
|
_userWorkGroupAppService = userWorkGroupAppService; |
||||
|
_injectionJobAppService = injectionJobAppService; |
||||
|
_dictApp = dictApp; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取任务详情
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("{id}")] |
||||
|
|
||||
|
public virtual async Task<ActionResult<InjectionJobDTO>> GetAsync(Guid id) |
||||
|
{ |
||||
|
var result = await _injectionJobAppService.GetAsync(id).ConfigureAwait(false); |
||||
|
return Ok(result); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取列表 筛选
|
||||
|
/// </summary>
|
||||
|
/// <param name="sfsRequestDTO"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("list")] |
||||
|
public virtual async Task<PagedResultDto<InjectionJobDTO>> GetListAsync(SfsJobRequestInputBase sfsRequestDTO) |
||||
|
{ |
||||
|
var list = await _injectionJobAppService.GetPagedListByFilterAsync(sfsRequestDTO, true).ConfigureAwait(false); |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取列表
|
||||
|
/// </summary>
|
||||
|
/// <param name="pageSize"></param>
|
||||
|
/// <param name="pageIndex"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("list")] |
||||
|
public virtual async Task<PagedResultDto<InjectionJobDTO>> GetListAsync(int pageSize, int pageIndex) |
||||
|
{ |
||||
|
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; |
||||
|
var jsonStatus = JsonSerializer.Serialize(status); |
||||
|
|
||||
|
var request = new SfsJobRequestInputBase |
||||
|
{ |
||||
|
MaxResultCount = pageSize, |
||||
|
SkipCount = (pageIndex - 1) * pageSize, |
||||
|
Sorting = $"{nameof(InjectionJobDTO.CreationTime)} ASC", |
||||
|
Condition = new Condition |
||||
|
{ |
||||
|
Filters = new List<Filter> |
||||
|
{ |
||||
|
new(nameof(IssueJobDTO.JobStatus),jsonStatus,"In") |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
var list = await _injectionJobAppService.GetPagedListByFilterAsync(request, true).ConfigureAwait(false); |
||||
|
|
||||
|
|
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据Job Number 获取任务列表
|
||||
|
/// </summary>
|
||||
|
/// <param name="jobNumber"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("by-number/{jobNumber}")] |
||||
|
public virtual async Task<ActionResult<InjectionJobDTO>> GetByNumberAsync(string jobNumber) |
||||
|
{ |
||||
|
var jobDto = await _injectionJobAppService.GetByNumberAsync(jobNumber).ConfigureAwait(false); |
||||
|
if (jobDto == null) |
||||
|
{ |
||||
|
throw new UserFriendlyException($"未找到编号为 {jobNumber} 的任务"); |
||||
|
} |
||||
|
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); |
||||
|
if (!wlgCodes.Contains(jobDto.WorkGroupCode)) |
||||
|
{ |
||||
|
return new NotFoundObjectResult($"任务属于工作组 {jobDto.WorkGroupCode}"); |
||||
|
} |
||||
|
if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.AcceptUserId != CurrentUser.Id) |
||||
|
{ |
||||
|
return new NotFoundObjectResult($"任务正在被 {jobDto.AcceptUserName} 处理"); |
||||
|
} |
||||
|
return jobDto; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取任务数量
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("count")] |
||||
|
public virtual async Task<ActionResult<long>> CountAsync() |
||||
|
{ |
||||
|
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); |
||||
|
var jsonCodes = JsonSerializer.Serialize(wlgCodes); |
||||
|
|
||||
|
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; |
||||
|
var jsonStatus = JsonSerializer.Serialize(status); |
||||
|
|
||||
|
var request = new SfsJobRequestInputBase |
||||
|
{ |
||||
|
Sorting = $"{nameof(InjectionJobDTO.Priority)} ASC", |
||||
|
Condition = new Condition |
||||
|
{ |
||||
|
Filters = new List<Filter> |
||||
|
{ |
||||
|
new(nameof(InjectionJobDTO.WorkGroupCode),jsonCodes,"In"), |
||||
|
new(nameof(InjectionJobDTO.JobStatus),jsonStatus,"In") |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
var count = await _injectionJobAppService.GetCountByFilterAsync(request).ConfigureAwait(false); |
||||
|
|
||||
|
return Ok(count); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 承接任务
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("take/{id}")] |
||||
|
public virtual async Task TakeAsync(Guid id) |
||||
|
{ |
||||
|
await _injectionJobAppService.AcceptAsync(id).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 取消承接任务
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("cancel-take/{id}")] |
||||
|
public virtual async Task CancelTakeAsync(Guid id) |
||||
|
{ |
||||
|
await _injectionJobAppService.CancelAcceptAsync(id).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 执行任务
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <param name="dto"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("finish/{id}")] |
||||
|
public virtual async Task FinishAsync(Guid id, [FromBody] InjectionJobDTO dto) |
||||
|
{ |
||||
|
await _injectionJobAppService.CompleteAsync(id, dto).ConfigureAwait(false); |
||||
|
} |
||||
|
} |
@ -0,0 +1,38 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Pda.Controllers.Stores; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 注塑叫料记录
|
||||
|
/// </summary>
|
||||
|
[ApiController] |
||||
|
[Route($"{PdaHostConst.ROOT_ROUTE}store/injection-note")] |
||||
|
|
||||
|
public class InjectionNoteController : AbpController |
||||
|
{ |
||||
|
private readonly IInjectionNoteAppService _injectionNoteAppService; |
||||
|
|
||||
|
/// <summary>
|
||||
|
///
|
||||
|
/// </summary>
|
||||
|
/// <param name="injectionNoteAppService"></param>
|
||||
|
public InjectionNoteController(IInjectionNoteAppService injectionNoteAppService) |
||||
|
{ |
||||
|
_injectionNoteAppService = injectionNoteAppService; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建注塑叫料记录
|
||||
|
/// </summary>
|
||||
|
/// <param name="input">CreateInput</param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("")] |
||||
|
public virtual async Task CreateAsync(InjectionNoteEditInput input) |
||||
|
{ |
||||
|
await _injectionNoteAppService.CreateAsync(input).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,51 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Pda.Controllers.Stores; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 注塑叫料请求
|
||||
|
/// </summary>
|
||||
|
[ApiController] |
||||
|
[Route($"{PdaHostConst.ROOT_ROUTE}store/injection-request")] |
||||
|
|
||||
|
public class InjectionRequestController : AbpController |
||||
|
{ |
||||
|
private readonly IInjectionRequestAppService _injectionRequestAppService; |
||||
|
|
||||
|
/// <summary>
|
||||
|
///
|
||||
|
/// </summary>
|
||||
|
/// <param name="InjectionRequestAppService"></param>
|
||||
|
public InjectionRequestController(IInjectionRequestAppService InjectionRequestAppService) |
||||
|
{ |
||||
|
_injectionRequestAppService = InjectionRequestAppService; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 注塑叫料申请
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("")] |
||||
|
public virtual async Task CreateAsync(InjectionRequestEditInput input) |
||||
|
{ |
||||
|
_ = await _injectionRequestAppService.CreateAsync(input).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据number获取注塑叫料申请详情
|
||||
|
/// </summary>
|
||||
|
/// <param name="number"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("{number}")] |
||||
|
|
||||
|
public virtual async Task<ActionResult<InjectionRequestDTO>> GetAsync(string number) |
||||
|
{ |
||||
|
var result = await _injectionRequestAppService.GetByNumberAsync(number).ConfigureAwait(false); |
||||
|
return Ok(result); |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue