Browse Source

添加未打印列表回去数据方法

master
lvzb 1 year ago
parent
commit
2bfcea4f4e
  1. 4
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Interfaces/IAlreadyPrintAppService.cs
  2. 1
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Interfaces/IWaitPrintAppService.cs
  3. 172
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/AlreadyPrintAppService.cs
  4. 30
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs
  5. 30
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml

4
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Interfaces/IAlreadyPrintAppService.cs

@ -3,10 +3,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Uow;
using WY.NewJit.PrintTable.Dtos;
namespace WY.NewJit.PrintTable
{
public interface IAlreadyPrintAppService
{
Task<PagedResultDto<AlreadyPrintDto>> GetAlreadyPrintListAsync(QueryAlreadyPrintDto input);
}
}

1
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Interfaces/IWaitPrintAppService.cs

@ -11,7 +11,6 @@ namespace WY.NewJit.PrintTable
{
public interface IWaitPrintAppService
{
Task<PagedResultDto<AlreadyPrintDto>> GetAlreadyPrintListAsync(QueryAlreadyPrintDto input);
Task<PagedResultDto<WaitPrintDto>> GetReplenishPrintListAsync(QueryReplenishPrintDto input);
Task<PagedResultDto<WaitPrintDto>> GetReplenishPrintZHBListAsync(QueryReplenishPrintDto input);

172
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/AlreadyPrintAppService.cs

@ -24,43 +24,153 @@ using WY.NewJit.PrintTable.Dtos;
namespace WY.NewJit.PrintTable
{
[Route("api/newjit/already-print")]
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.报文打印)]
public class AlreadyPrintAppService : ApplicationService, IAlreadyPrintAppService
{
/// <summary>
/// 取待打印列表
/// 错误信息前缀
/// </summary>
private string _errorMessagePrefix
{
get
{
return System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + ".";
}
}
private ILogger<WaitPrint> _logger;
private readonly NewJitDapperRepository _newJitDapperRepository;
public AlreadyPrintAppService(ILogger<WaitPrint> logger, NewJitDapperRepository newJitDapperRepository)
{
_logger = logger;
_newJitDapperRepository = newJitDapperRepository;
}
/// <summary>
/// 已打印列表
/// </summary>
/// <param name="input">输入查询条件</param>
/// <returns>返回符合条件的排序分页列表</returns>
//[HttpGet]
//[UnitOfWork(false)]
//[Route("wait-print-list")]
//public virtual async Task<PagedResultDto<WaitPrintDto>> GetWaitPrintListAsync(QueryAlreadyPrintDto input)
//{
// _logger.LogDebug(_errorMessagePrefix + "GetListAsync 进入");
// try
// {
// PagedResultDto<WaitPrintDto> ret = new PagedResultDto<WaitPrintDto>();
// if (input.BusinessType == BusinessTypeEnum.MenBan)
// {
// ret = await QueryByConditionAsync(input, (PagedAndSortedBase)input);
// }
// else if (input.BusinessType == BusinessTypeEnum.OtherZhuHuBan || input.BusinessType == BusinessTypeEnum.ZhuHuBan)
// {
// ret = await QueryZHBByConditionAsync(input, (PagedAndSortedBase)input);
// }
// else
// {
// throw new BusinessException("1001", "请传入正确的BusinessType参数!");
// }
// return ret;
// }
// catch (Exception ex)
// {
// string errMsg = _errorMessagePrefix + "GetListAsync 执行出错:" + ex.Message;
// _logger.LogError(errMsg);
// return new PagedResultDto<WaitPrintDto>(0, new List<WaitPrintDto>());
// }
//}
[HttpGet]
[UnitOfWork(false)]
[Route("already-print-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>());
}
}
private static string GetWhere(QueryAlreadyPrintDto input)
{
//select * from FisWaitPrint
//where 1=1 and BusinessType = 1 and ProductLine = '01' and PrintType = 1 and HostSN >= 10377 and HostSN <= 10388
//order by HostSN2
string where = "";
if (input.BusinessType != null)
{
where += string.Format(" and BusinessType = {0}", ((int)input.BusinessType).ToString());
}
if (input.ProductLine != null)
{
where += string.Format(" and ProductLine = '{0}'", input.ProductLine);
}
if (input.PrintType != null)
{
where += string.Format(" and PrintType = {0}", ((int)input.PrintType).ToString());
}
if (input.HostSNBegin.HasValue())
{
where += string.Format(" and HostSN >= {0}", input.HostSNBegin);
}
if (input.HostSNEnd.HasValue())
{
where += string.Format(" and HostSN <= {0}", input.HostSNEnd);
}
if (!string.IsNullOrEmpty(input.KNRBegin))
{
where += string.Format(" and KNR >= '{0}'", input.KNRBegin);
}
if (!string.IsNullOrEmpty(input.KNREnd))
{
where += string.Format(" and KNR <= '{0}'", input.KNREnd);
}
if (!string.IsNullOrEmpty(input.VINBegin))
{
where += string.Format(" and VIN >= '{0}'", input.VINBegin);
}
if (!string.IsNullOrEmpty(input.VINEnd))
{
where += string.Format(" and VIN <= '{0}'", input.VINEnd);
}
if (input.AssemblyID != null)
{
where += string.Format(" and AssemblyID = '{0}'", input.AssemblyID.ToString());
}
if (input.OnlineTimeBegin != null)
{
where += string.Format(" and OnlineTime >= '{0}'", ((DateTime)input.OnlineTimeBegin).ToString("yyyy-MM-dd HH:mm:ss"));
}
if (input.OnlineTimeEnd != null)
{
where += string.Format(" and OnlineTime <= '{0}'", ((DateTime)input.OnlineTimeEnd).ToString("yyyy-MM-dd HH:mm:ss"));
}
if (input.VehicleModelCode != null)
{
where += string.Format(" and VehicleModelCode like '%{0}%'", input.VehicleModelCode);
}
if (input.ReceiveTimeBegin != null)
{
where += string.Format(" and ReceiveTime >= '{0}'", ((DateTime)input.ReceiveTimeBegin).ToString("yyyy-MM-dd HH:mm:ss"));
}
if (input.ReceiveTimeEnd != null)
{
where += string.Format(" and ReceiveTime <= '{0}'", ((DateTime)input.ReceiveTimeEnd).ToString("yyyy-MM-dd HH:mm:ss"));
}
if (input.BillStatus != null && input.BillStatus != BillStatusEnum.None)
{
where += string.Format(" and BillStatus = {0}", ((int)input.BillStatus).ToString());
}
return where;
}
/// <summary>
/// 取单表记录总数
/// </summary>
/// <param name="tableName"></param>
/// <param name="where"></param>
/// <param name="orderFieldName"></param>
/// <param name="pageSize"></param>
/// <param name="pageIndex"></param>
/// <returns></returns>
private async Task<int> GetEntityCountAsync(string tableName, string where)
{
string sql = $"select count(*) from {tableName} where 1=1 {where}";
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;
}
}
}

30
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs

@ -818,36 +818,6 @@ namespace WY.NewJit.PrintTable
}
}
/// <summary>
/// 已打印列表
/// </summary>
/// <param name="input">输入查询条件</param>
/// <returns>返回符合条件的排序分页列表</returns>
[HttpGet]
[UnitOfWork(false)]
[Route("already-print-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>
/// 打印前检查大众顺序号是否断号
/// </summary>
/// <param name="input"></param>

30
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml

@ -1858,6 +1858,29 @@
<param name="billType"></param>
<returns></returns>
</member>
<member name="P:WY.NewJit.PrintTable.AlreadyPrintAppService._errorMessagePrefix">
<summary>
错误信息前缀
</summary>
</member>
<member name="M:WY.NewJit.PrintTable.AlreadyPrintAppService.GetAlreadyPrintListAsync(WY.NewJit.PrintTable.Dtos.QueryAlreadyPrintDto)">
<summary>
已打印列表
</summary>
<param name="input">输入查询条件</param>
<returns>返回符合条件的排序分页列表</returns>
</member>
<member name="M:WY.NewJit.PrintTable.AlreadyPrintAppService.GetEntityCountAsync(System.String,System.String)">
<summary>
取单表记录总数
</summary>
<param name="tableName"></param>
<param name="where"></param>
<param name="orderFieldName"></param>
<param name="pageSize"></param>
<param name="pageIndex"></param>
<returns></returns>
</member>
<member name="P:WY.NewJit.PrintTable.WaitPrintAppService._errorMessagePrefix">
<summary>
错误信息前缀
@ -1996,13 +2019,6 @@
<param name="input">输入查询条件</param>
<returns>返回符合条件的排序分页列表</returns>
</member>
<member name="M:WY.NewJit.PrintTable.WaitPrintAppService.GetAlreadyPrintListAsync(WY.NewJit.PrintTable.Dtos.QueryAlreadyPrintDto)">
<summary>
已打印列表
</summary>
<param name="input">输入查询条件</param>
<returns>返回符合条件的排序分页列表</returns>
</member>
<member name="M:WY.NewJit.PrintTable.WaitPrintAppService.CheckMBHostSNBreakNum(WY.NewJit.Extends.MenBanPrintInputDto)">
<summary>
打印前检查大众顺序号是否断号

Loading…
Cancel
Save