diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Interfaces/IAlreadyPrintAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Interfaces/IAlreadyPrintAppService.cs index e457e76..be2c0bf 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Interfaces/IAlreadyPrintAppService.cs +++ b/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> GetAlreadyPrintListAsync(QueryAlreadyPrintDto input); } } diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Interfaces/IWaitPrintAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Interfaces/IWaitPrintAppService.cs index 2ae2c21..520e606 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Interfaces/IWaitPrintAppService.cs +++ b/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> GetAlreadyPrintListAsync(QueryAlreadyPrintDto input); Task> GetReplenishPrintListAsync(QueryReplenishPrintDto input); Task> GetReplenishPrintZHBListAsync(QueryReplenishPrintDto input); diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/AlreadyPrintAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/AlreadyPrintAppService.cs index 1a5c706..71e6874 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/AlreadyPrintAppService.cs +++ b/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 { /// - /// 取待打印列表 + /// 错误信息前缀 + /// + private string _errorMessagePrefix + { + get + { + return System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "."; + } + } + private ILogger _logger; + private readonly NewJitDapperRepository _newJitDapperRepository; + public AlreadyPrintAppService(ILogger logger, NewJitDapperRepository newJitDapperRepository) + { + _logger = logger; + _newJitDapperRepository = newJitDapperRepository; + } + /// + /// 已打印列表 /// /// 输入查询条件 /// 返回符合条件的排序分页列表 - //[HttpGet] - //[UnitOfWork(false)] - //[Route("wait-print-list")] - //public virtual async Task> GetWaitPrintListAsync(QueryAlreadyPrintDto input) - //{ - // _logger.LogDebug(_errorMessagePrefix + "GetListAsync 进入"); - // try - // { - // PagedResultDto ret = new PagedResultDto(); - // 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(0, new List()); - // } - //} + [HttpGet] + [UnitOfWork(false)] + [Route("already-print-list")] + public virtual async Task> GetAlreadyPrintListAsync(QueryAlreadyPrintDto input) + { + _logger.LogDebug(_errorMessagePrefix + "GetAlreadyPrintListAsync 进入"); + try + { + PagedResultDto ret = new PagedResultDto(); + string where = GetWhere(input); + ret.TotalCount = await GetEntityCountAsync("FisAlreadyPrint", where); + //计算分页 + int skipNum = input.SkipCount; + int takeNum = input.MaxResultCount; + var lst = await GetEntityListFromToAsync("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(0, new List()); + } + } + + + 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; + } + + /// + /// 取单表记录总数 + /// + /// + /// + /// + /// + /// + /// + private async Task GetEntityCountAsync(string tableName, string where) + { + string sql = $"select count(*) from {tableName} where 1=1 {where}"; + var ret = await _newJitDapperRepository.GetSingleBySqlAsync(sql); + return ret; + } + private async Task> GetEntityListFromToAsync(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(sql); + return ret; + } } } diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs index c89d1b1..5455b89 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs @@ -818,36 +818,6 @@ namespace WY.NewJit.PrintTable } } /// - /// 已打印列表 - /// - /// 输入查询条件 - /// 返回符合条件的排序分页列表 - [HttpGet] - [UnitOfWork(false)] - [Route("already-print-list")] - public virtual async Task> GetAlreadyPrintListAsync(QueryAlreadyPrintDto input) - { - _logger.LogDebug(_errorMessagePrefix + "GetAlreadyPrintListAsync 进入"); - try - { - PagedResultDto ret = new PagedResultDto(); - string where = GetWhere(input); - ret.TotalCount = await GetEntityCountAsync("FisAlreadyPrint", where); - //计算分页 - int skipNum = input.SkipCount; - int takeNum = input.MaxResultCount; - var lst = await GetEntityListFromToAsync("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(0, new List()); - } - } - /// /// 打印前检查大众顺序号是否断号 /// /// diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml index 8963c36..9ccc8f9 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml @@ -1858,6 +1858,29 @@ + + + 错误信息前缀 + + + + + 已打印列表 + + 输入查询条件 + 返回符合条件的排序分页列表 + + + + 取单表记录总数 + + + + + + + + 错误信息前缀 @@ -1996,13 +2019,6 @@ 输入查询条件 返回符合条件的排序分页列表 - - - 已打印列表 - - 输入查询条件 - 返回符合条件的排序分页列表 - 打印前检查大众顺序号是否断号