|
|
@ -42,7 +42,7 @@ namespace WY.NewJit.PrintTable |
|
|
|
return System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "."; |
|
|
|
} |
|
|
|
} |
|
|
|
private ILogger<WaitPrint> _logger; |
|
|
|
private ILogger<AlreadyPrint> _logger; |
|
|
|
private readonly NewJitDapperRepository _newJitDapperRepository; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
@ -50,7 +50,7 @@ namespace WY.NewJit.PrintTable |
|
|
|
/// </summary>
|
|
|
|
private readonly IBlobContainer<OurFileContainer> _blobContainer; |
|
|
|
|
|
|
|
public AlreadyPrintAppService(ILogger<WaitPrint> logger, |
|
|
|
public AlreadyPrintAppService(ILogger<AlreadyPrint> logger, |
|
|
|
NewJitDapperRepository newJitDapperRepository, |
|
|
|
IBlobContainer<OurFileContainer> blobContainer |
|
|
|
) |
|
|
@ -59,41 +59,11 @@ namespace WY.NewJit.PrintTable |
|
|
|
_newJitDapperRepository = newJitDapperRepository; |
|
|
|
_blobContainer = blobContainer; |
|
|
|
} |
|
|
|
/// <summary>
|
|
|
|
/// 已打印列表
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input">输入查询条件</param>
|
|
|
|
/// <returns>返回符合条件的排序分页列表</returns>
|
|
|
|
[HttpGet] |
|
|
|
[UnitOfWork(false)] |
|
|
|
[Route("list")] |
|
|
|
public virtual async Task<PagedResultDto<AlreadyPrintDto>> GetAlreadyPrintListAsync(QueryAlreadyPrintDto input) |
|
|
|
{ |
|
|
|
_logger.LogDebug(_errorMessagePrefix + "GetAlreadyPrintListAsync 进入"); |
|
|
|
try |
|
|
|
{ |
|
|
|
PagedResultDto<AlreadyPrintDto> ret = new PagedResultDto<AlreadyPrintDto>(); |
|
|
|
string where = GetWhere(input); |
|
|
|
ret.TotalCount = await GetEntityCountAsync("FisAlreadyPrint", where); |
|
|
|
//计算分页
|
|
|
|
int skipNum = input.SkipCount; |
|
|
|
int takeNum = input.MaxResultCount; |
|
|
|
var lst = await GetEntityListFromToAsync<AlreadyPrintDto>("FisAlreadyPrint", where, "HostSN2", skipNum, takeNum); |
|
|
|
ret.Items = lst; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
string errMsg = _errorMessagePrefix + "GetAlreadyPrintListAsync 执行出错:" + ex.Message; |
|
|
|
_logger.LogError(errMsg); |
|
|
|
return new PagedResultDto<AlreadyPrintDto>(0, new List<AlreadyPrintDto>()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#region 私有方法
|
|
|
|
private static string GetWhere(QueryAlreadyPrintDto input) |
|
|
|
{ |
|
|
|
//select * from FisWaitPrint
|
|
|
|
//select * from FisAlreadyPrint
|
|
|
|
//where 1=1 and BusinessType = 1 and ProductLine = '01' and PrintType = 1 and HostSN >= 10377 and HostSN <= 10388
|
|
|
|
//order by HostSN2
|
|
|
|
string where = ""; |
|
|
@ -164,7 +134,6 @@ namespace WY.NewJit.PrintTable |
|
|
|
return where; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 取单表记录总数
|
|
|
|
/// </summary>
|
|
|
@ -180,12 +149,45 @@ namespace WY.NewJit.PrintTable |
|
|
|
var ret = await _newJitDapperRepository.GetSingleBySqlAsync<int>(sql); |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
private async Task<List<T>> GetEntityListFromToAsync<T>(string tableName, string where, string orderFieldName, int skipNum, int takeNum) |
|
|
|
{ |
|
|
|
string sql = $"select * from {tableName} where 1=1 {where} order by {orderFieldName} offset {skipNum} rows fetch next {takeNum} rows only"; |
|
|
|
var ret = await _newJitDapperRepository.GetListBySqlAsync<T>(sql); |
|
|
|
return ret; |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 已打印列表
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input">输入查询条件</param>
|
|
|
|
/// <returns>返回符合条件的排序分页列表</returns>
|
|
|
|
[HttpGet] |
|
|
|
[UnitOfWork(false)] |
|
|
|
[Route("list")] |
|
|
|
public virtual async Task<PagedResultDto<AlreadyPrintDto>> GetAlreadyPrintListAsync(QueryAlreadyPrintDto input) |
|
|
|
{ |
|
|
|
_logger.LogDebug(_errorMessagePrefix + "GetAlreadyPrintListAsync 进入"); |
|
|
|
try |
|
|
|
{ |
|
|
|
PagedResultDto<AlreadyPrintDto> ret = new PagedResultDto<AlreadyPrintDto>(); |
|
|
|
string where = GetWhere(input); |
|
|
|
ret.TotalCount = await GetEntityCountAsync("FisAlreadyPrint", where); |
|
|
|
//计算分页
|
|
|
|
int skipNum = input.SkipCount; |
|
|
|
int takeNum = input.MaxResultCount; |
|
|
|
var lst = await GetEntityListFromToAsync<AlreadyPrintDto>("FisAlreadyPrint", where, "HostSN2", skipNum, takeNum); |
|
|
|
ret.Items = lst; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
string errMsg = _errorMessagePrefix + "GetAlreadyPrintListAsync 执行出错:" + ex.Message; |
|
|
|
_logger.LogError(errMsg); |
|
|
|
return new PagedResultDto<AlreadyPrintDto>(0, new List<AlreadyPrintDto>()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 导出信息
|
|
|
|