|
|
@ -21,14 +21,10 @@ namespace Win_in.Sfs.Wms.Pda.Controllers.Jobs; |
|
|
|
/// </summary>
|
|
|
|
[ApiController] |
|
|
|
[Route($"{PdaHostConst.ROOT_ROUTE}job/purchase-receipt")] |
|
|
|
|
|
|
|
public class PurchaseReceiptJobController : AbpController |
|
|
|
{ |
|
|
|
private readonly ISupplierAppService _supplierAppService; |
|
|
|
private readonly IPurchaseReceiptRequestAppService _purchaseReceiptRequestAppService; |
|
|
|
private readonly IPurchaseReceiptJobAppService _purchaseReceiptJobAppService; |
|
|
|
private readonly IFileAppService _fileAppService; |
|
|
|
|
|
|
|
private readonly IUserWorkGroupAppService _userWorkGroupAppService; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
@ -42,15 +38,11 @@ public class PurchaseReceiptJobController : AbpController |
|
|
|
public PurchaseReceiptJobController( |
|
|
|
IPurchaseReceiptJobAppService purchaseReceiptJobAppService |
|
|
|
, IUserWorkGroupAppService userWorkGroupAppService |
|
|
|
, IPurchaseReceiptRequestAppService purchaseReceiptRequestAppService |
|
|
|
, ISupplierAppService supplierAppService |
|
|
|
, IFileAppService fileAppService) |
|
|
|
, ISupplierAppService supplierAppService) |
|
|
|
{ |
|
|
|
_userWorkGroupAppService = userWorkGroupAppService; |
|
|
|
_purchaseReceiptJobAppService = purchaseReceiptJobAppService; |
|
|
|
_purchaseReceiptRequestAppService = purchaseReceiptRequestAppService; |
|
|
|
_supplierAppService = supplierAppService; |
|
|
|
_fileAppService = fileAppService; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
@ -59,10 +51,9 @@ public class PurchaseReceiptJobController : AbpController |
|
|
|
/// <param name="id"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet("{id}")] |
|
|
|
|
|
|
|
public virtual async Task<ActionResult<PurchaseReceiptJobDTO>> GetAsync(Guid id) |
|
|
|
{ |
|
|
|
var result = await _purchaseReceiptJobAppService.GetAsync(id).ConfigureAwait(false); |
|
|
|
var result = await _purchaseReceiptJobAppService.GetNoCacheAsync(id).ConfigureAwait(false); |
|
|
|
|
|
|
|
var supplier = await _supplierAppService.GetByCodeAsync(result.SupplierCode).ConfigureAwait(false); |
|
|
|
result.SupplierName = supplier.Name; |
|
|
@ -79,12 +70,13 @@ public class PurchaseReceiptJobController : AbpController |
|
|
|
/// <param name="isToday">是否今天</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet("list")] |
|
|
|
public virtual async Task<PagedResultDto<PurchaseReceiptJobDTO>> GetListAsync(int pageSize, int pageIndex, bool isTimeWindowSorting, bool isToday) |
|
|
|
public virtual async Task<PagedResultDto<PurchaseReceiptJobDTO>> GetListAsync(int pageSize, int pageIndex, |
|
|
|
bool isTimeWindowSorting, bool isToday) |
|
|
|
{ |
|
|
|
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); |
|
|
|
var jsonCodes = JsonSerializer.Serialize(wlgCodes); |
|
|
|
|
|
|
|
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; |
|
|
|
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; |
|
|
|
var jsonStatus = JsonSerializer.Serialize(status); |
|
|
|
|
|
|
|
var request = new SfsJobRequestInputBase |
|
|
@ -96,17 +88,19 @@ public class PurchaseReceiptJobController : AbpController |
|
|
|
{ |
|
|
|
Filters = new List<Filter> |
|
|
|
{ |
|
|
|
new(nameof(PurchaseReceiptJobDTO.WorkGroupCode),jsonCodes,"In"), |
|
|
|
new(nameof(PurchaseReceiptJobDTO.JobStatus),jsonStatus,"In") |
|
|
|
new(nameof(PurchaseReceiptJobDTO.WorkGroupCode), jsonCodes, "In"), |
|
|
|
new(nameof(PurchaseReceiptJobDTO.JobStatus), jsonStatus, "In") |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
if (isToday)//只看当日
|
|
|
|
if (isToday) //只看当日
|
|
|
|
{ |
|
|
|
request.Condition.Filters.Add(new Filter(nameof(PurchaseReceiptJobDTO.PlanArriveDate), Clock.Now.ToString("yyyy-MM-dd"), ">=", "And")); |
|
|
|
request.Condition.Filters.Add(new Filter(nameof(PurchaseReceiptJobDTO.PlanArriveDate), |
|
|
|
Clock.Now.ToString("yyyy-MM-dd"), ">=", "And")); |
|
|
|
} |
|
|
|
if (isTimeWindowSorting)//窗口时间排序
|
|
|
|
|
|
|
|
if (isTimeWindowSorting) //窗口时间排序
|
|
|
|
{ |
|
|
|
request.Sorting = $"{nameof(PurchaseReceiptJobDTO.TimeWindow)} ASC"; |
|
|
|
} |
|
|
@ -131,7 +125,8 @@ public class PurchaseReceiptJobController : AbpController |
|
|
|
[HttpPost("list")] |
|
|
|
public virtual async Task<PagedResultDto<PurchaseReceiptJobDTO>> GetListAsync(SfsJobRequestInputBase sfsRequestDTO) |
|
|
|
{ |
|
|
|
var list = await _purchaseReceiptJobAppService.GetPagedListByFilterAsync(sfsRequestDTO, true).ConfigureAwait(false); |
|
|
|
var list = await _purchaseReceiptJobAppService.GetPagedListByFilterAsync(sfsRequestDTO, true) |
|
|
|
.ConfigureAwait(false); |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
@ -155,22 +150,27 @@ public class PurchaseReceiptJobController : AbpController |
|
|
|
{ |
|
|
|
return new NotFoundObjectResult($"任务属于工作组 {jobDto.WorkGroupCode}"); |
|
|
|
} |
|
|
|
|
|
|
|
if (!wlgCodes.Any(r => r == jobDto.WorkGroupCode)) |
|
|
|
{ |
|
|
|
return new NotFoundObjectResult($"任务属于工作组 {jobDto.WorkGroupCode}"); |
|
|
|
} |
|
|
|
|
|
|
|
if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.AcceptUserId != CurrentUser.Id) |
|
|
|
{ |
|
|
|
return new NotFoundObjectResult($"任务正在被 {jobDto.AcceptUserName} 处理"); |
|
|
|
} |
|
|
|
if (isToday)//只看当日
|
|
|
|
|
|
|
|
if (isToday) //只看当日
|
|
|
|
{ |
|
|
|
if (jobDto.PlanArriveDate.ToString("yyyy-MM-dd") == Clock.Now.ToString("yyyy-MM-dd")) |
|
|
|
{ |
|
|
|
return jobDto; |
|
|
|
} |
|
|
|
|
|
|
|
return new NotFoundObjectResult($"不是当天的收货任务"); |
|
|
|
} |
|
|
|
|
|
|
|
return jobDto; |
|
|
|
} |
|
|
|
|
|
|
@ -181,12 +181,13 @@ public class PurchaseReceiptJobController : AbpController |
|
|
|
/// <param name="isToday"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet("list/by-asn")] |
|
|
|
public virtual async Task<PagedResultDto<PurchaseReceiptJobDTO>> GetListByAsnNumberAsync(string asnNumber, bool isToday) |
|
|
|
public virtual async Task<PagedResultDto<PurchaseReceiptJobDTO>> GetListByAsnNumberAsync(string asnNumber, |
|
|
|
bool isToday) |
|
|
|
{ |
|
|
|
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); |
|
|
|
var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); |
|
|
|
|
|
|
|
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; |
|
|
|
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; |
|
|
|
var jsonStatus = JsonSerializer.Serialize(status); |
|
|
|
|
|
|
|
var requestInput = new SfsJobRequestInputBase |
|
|
@ -198,17 +199,20 @@ public class PurchaseReceiptJobController : AbpController |
|
|
|
{ |
|
|
|
Filters = new List<Filter> |
|
|
|
{ |
|
|
|
new(nameof(PurchaseReceiptJobDTO.AsnNumber),asnNumber), |
|
|
|
new(nameof(IssueJobDTO.WorkGroupCode),jsonWlgCodes,"In"), |
|
|
|
new(nameof(IssueJobDTO.JobStatus),jsonStatus,"In"), |
|
|
|
new(nameof(PurchaseReceiptJobDTO.AsnNumber), asnNumber), |
|
|
|
new(nameof(IssueJobDTO.WorkGroupCode), jsonWlgCodes, "In"), |
|
|
|
new(nameof(IssueJobDTO.JobStatus), jsonStatus, "In"), |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
if (isToday)//只看当日
|
|
|
|
if (isToday) //只看当日
|
|
|
|
{ |
|
|
|
requestInput.Condition.Filters.Add(new Filter(nameof(PurchaseReceiptJobDTO.PlanArriveDate), Clock.Now.ToString("yyyy-MM-dd"), ">=", "And")); |
|
|
|
requestInput.Condition.Filters.Add(new Filter(nameof(PurchaseReceiptJobDTO.PlanArriveDate), |
|
|
|
Clock.Now.ToString("yyyy-MM-dd"), ">=", "And")); |
|
|
|
} |
|
|
|
var list = await _purchaseReceiptJobAppService.GetPagedListByFilterAsync(requestInput, true).ConfigureAwait(false); |
|
|
|
|
|
|
|
var list = await _purchaseReceiptJobAppService.GetPagedListByFilterAsync(requestInput, true) |
|
|
|
.ConfigureAwait(false); |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
@ -222,7 +226,7 @@ public class PurchaseReceiptJobController : AbpController |
|
|
|
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); |
|
|
|
var jsonCodes = JsonSerializer.Serialize(wlgCodes); |
|
|
|
|
|
|
|
List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; |
|
|
|
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; |
|
|
|
var jsonStatus = JsonSerializer.Serialize(status); |
|
|
|
|
|
|
|
var request = new SfsJobRequestInputBase |
|
|
@ -232,8 +236,8 @@ public class PurchaseReceiptJobController : AbpController |
|
|
|
{ |
|
|
|
Filters = new List<Filter> |
|
|
|
{ |
|
|
|
new(nameof(PurchaseReceiptJobDTO.WorkGroupCode),jsonCodes,"In"), |
|
|
|
new(nameof(PurchaseReceiptJobDTO.JobStatus),jsonStatus,"In") |
|
|
|
new(nameof(PurchaseReceiptJobDTO.WorkGroupCode), jsonCodes, "In"), |
|
|
|
new(nameof(PurchaseReceiptJobDTO.JobStatus), jsonStatus, "In") |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
@ -292,9 +296,11 @@ public class PurchaseReceiptJobController : AbpController |
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("save-detail-inspect/{id}")] |
|
|
|
public virtual async Task<PurchaseReceiptJobDetailDTO> SaveDetailAsync(Guid id, PurchaseReceiptJobDetailSaveInput purchaseReceiptJobDetailSaveInput) |
|
|
|
public virtual async Task<PurchaseReceiptJobDetailDTO> SaveDetailAsync(Guid id, |
|
|
|
PurchaseReceiptJobDetailSaveInput purchaseReceiptJobDetailSaveInput) |
|
|
|
{ |
|
|
|
return await _purchaseReceiptJobAppService.SaveDetailInspectAsync(id, purchaseReceiptJobDetailSaveInput).ConfigureAwait(false); |
|
|
|
return await _purchaseReceiptJobAppService.SaveDetailInspectAsync(id, purchaseReceiptJobDetailSaveInput) |
|
|
|
.ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|