From 05f394de27aa414fcabf2808a33388ae8e2deb1b Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Thu, 16 Nov 2023 08:37:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=BA=9F=E3=80=81=E8=A1=A5=E6=89=93?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PrintTable/Dtos/QueryWaitPrintDto.cs | 22 +++ .../Interfaces/IWaitPrintAppService.cs | 11 +- .../WY.NewJit.Application.Contracts.xml | 20 +++ .../BillM100s/MenBanPackingRecService.cs | 137 ++++++++++++++++-- .../PrintTable/WaitPrintAppService.cs | 88 +++++++---- .../WY.NewJit.Application.xml | 19 +-- 6 files changed, 243 insertions(+), 54 deletions(-) diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Dtos/QueryWaitPrintDto.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Dtos/QueryWaitPrintDto.cs index becef94..3b43e2a 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Dtos/QueryWaitPrintDto.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Dtos/QueryWaitPrintDto.cs @@ -37,7 +37,29 @@ namespace WY.NewJit.PrintTable.Dtos public int? HostSNEnd { get; set; } } + [Serializable] + public class QueryReplenishPrintDto : QueryWaitPrintDto + { + /// + /// 底牌号起 + /// + public string VINBegin { get; set; } + + /// + /// 底牌号止 + /// + public string VINEnd { get; set; } + /// + /// 上线时间起 + /// + public DateTime? OnlineTimeBegin { get; set; } + + /// + /// 上线时间止 + /// + public DateTime? OnlineTimeEnd { get; set; } + } [Serializable] public class QueryAlreadyPrintDto : QueryWaitPrintDto 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 1e4c70d..e37aed1 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 @@ -3,17 +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 IWaitPrintAppService { - /// - /// 根据生产线获取正常打印单据的起始大众顺序号 - /// - /// 生产线 - /// 起始大众顺序号 - //Task> GetPrintStartHostSN2(string productLine, string isZhuHuBan, string GroupName = null); - + Task> GetReplenishPrintListAsync(QueryReplenishPrintDto input); } } diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml index 45cd1d0..b50e5de 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml @@ -3517,6 +3517,26 @@ 大众顺序号止 + + + 底牌号起 + + + + + 底牌号止 + + + + + 上线时间起 + + + + + 上线时间止 + + KNR起 diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/MenBanPackingRecService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/MenBanPackingRecService.cs index ebd3630..816a7dd 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/MenBanPackingRecService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/MenBanPackingRecService.cs @@ -32,6 +32,7 @@ using WY.NewJit.Extends.PaiGe.WMS; using WY.NewJit.Filter; using WY.NewJit.MsgBaseData; using WY.NewJit.MsgCheck; +using WY.NewJit.PrintTable; namespace Win.Sfs.SettleAccount.FISes { @@ -54,6 +55,8 @@ namespace Win.Sfs.SettleAccount.FISes private readonly LineSNDomianService _lineSNDomianServic; private readonly IRepository _tbBillScrapRepository; + private readonly IRepository _alreadyPrintRepository; + private readonly IRepository _waitPrintRepository; /// /// 门板装箱单仓储明细 @@ -63,7 +66,9 @@ namespace Win.Sfs.SettleAccount.FISes IRepository billM100Repository, WMSDapperRepository wmsRepository, LineSNDomianService lineSNDomianServic, - IRepository tbBillScrapRepository + IRepository tbBillScrapRepository, + IRepository alreadyPrintRepository, + IRepository waitPrintRepository ) { _menBanPackingListRepository = menBanPackingListRepository; @@ -71,6 +76,8 @@ namespace Win.Sfs.SettleAccount.FISes _wmsRepository = wmsRepository; _lineSNDomianServic = lineSNDomianServic; _tbBillScrapRepository = tbBillScrapRepository; + _alreadyPrintRepository = alreadyPrintRepository; + _waitPrintRepository = waitPrintRepository; } private void DelOrScrapWMSInterface(string billNum, bool isSynchronousMode = false) @@ -263,7 +270,7 @@ namespace Win.Sfs.SettleAccount.FISes /// 是否执行成功 [HttpPost] [Route("scrap")] - [UnitOfWork(isTransactional: false)] + [UnitOfWork] public virtual async Task> ScrapAsync(List ids) { var selLst = await _menBanPackingListRepository.Where(p => ids.Contains(p.Id)).ToListAsync(); @@ -335,17 +342,30 @@ namespace Win.Sfs.SettleAccount.FISes //批量改为未打印 var _childList = await _menBanPackingListRepository.Where(p => idList.Contains(p.Id)).SelectMany(p => p.Details).ToListAsync(); var _child = _childList.Select(p => p.M100BillId).Distinct().ToList(); - var m100Lst = await _billM100Repository.Where(p => _child.Contains(p.Id)).ToListAsync(); - m100Lst.ForEach(p => + var _apList = await _alreadyPrintRepository.Where(p => _child.Contains(p.Id)).ToListAsync(); + List _wpList = new List(); + foreach (var ap in _apList) { - if (p.BillStatus == BillStatusEnum.Publish) + var item = await _waitPrintRepository.GetListAsync(r => r.HostSN2 == ap.HostSN2); + if (item.Count == 0) { - p.SetBillStatus(BillStatusEnum.Match); + var wp = ObjectMapper.Map(ap); + _wpList.Add(wp); } - p.PrintTime = null; - }); - await _billM100Repository.UpdateManyAsync(m100Lst); - + else if(item.Count==1) + { + if(ap.BillStatus== BillStatusEnum.BreakNum&&item[0].BillStatus== BillStatusEnum.BreakNum) + { + throw new BusinessException("1001", "未打印列表和已打印列表出现都是断号的情况号码未【"+ ap.HostSN2 + "】,不能报废!"); + } + } + else if (item.Count > 1) + { + throw new BusinessException("1001", "未打印列表里出现大众顺序号重复号码为【"+ ap.HostSN2+ "】请检查后在报废!"); + } + } + await _alreadyPrintRepository.DeleteManyAsync(_apList); + await _waitPrintRepository.InsertManyAsync(_wpList); } else { @@ -354,6 +374,103 @@ namespace Win.Sfs.SettleAccount.FISes return wmsLst.Select(p => p.BillNum).ToList(); } + ///// + ///// 报废 + ///// + ///// IDs + ///// 是否执行成功 + //[HttpPost] + //[Route("scrap")] + //[UnitOfWork(isTransactional: false)] + //public virtual async Task> ScrapAsync(List ids) + //{ + // var selLst = await _menBanPackingListRepository.Where(p => ids.Contains(p.Id)).ToListAsync(); + // if (selLst == null || selLst.Count == 0) + // { + // throw new BusinessException("1001", "没有选中要作废的已打印装箱单!"); + // } + // foreach (var _obj in selLst) + // { + // string maxBillNum = await _menBanPackingListRepository.Where(itm => itm.ProductLine == _obj.ProductLine && itm.ReportStatus == ReportStatusEnum.已打印).MaxAsync(itm => itm.BillNum); //取当前生产线的最大装箱单号 + // if (string.IsNullOrEmpty(maxBillNum) == false) + // { + // MenBanPackingList firObj = await _menBanPackingListRepository.FirstOrDefaultAsync(itm => itm.BillNum == maxBillNum); + // if (firObj != null) + // { + // if (_obj.SortId != firObj.SortId) + // { + // throw new BusinessException("1001", "只能报废当前生产线的最后打印单据,要报废的单据不是最后打印单据!"); + // } + // } + // } + // } + + // var sortList = selLst.Select(p => p.SortId).Distinct().ToList();//筛选出匹配门板 + // List pairlist = _menBanPackingListRepository.Where(p => sortList.Contains(p.SortId)).ToList(); + + + // var idList = pairlist.Select(p => p.Id).ToList(); + // var _ls = pairlist.Select(p => p.BillNum).ToList(); + // var _strList = new List(); + + // _ls.ForEach(p => { + // _strList.Add(string.Format("'{0}'", p)); + // }); + // string str = string.Join(",", _strList.ToArray()); + // var wmsLst = _wmsRepository.GetListBySql(string.Format("select top 100 * from TB_BILL with(nolock) where (state=1 or state=2) and BillNum in ({0}) ", str)); + // if (wmsLst.Count() == 0) //库存没有排序 + // { + // //调用库存系统接口 + // List billNumLst = pairlist.Select(itm => itm.BillNum).Distinct().ToList(); + // foreach (string billNumStr in billNumLst) + // { + // DelOrScrapWMSInterface(billNumStr, true); + // } + + // #region 作废时单据序号减一 + // string curProductLine = selLst[0].ProductLine; + // DateTime curPrintDate = selLst[0].PrintDate; + // //string curPartType = selLst[0].PartType; + // var priorLst = _menBanPackingListRepository.Where(itm => itm.ReportStatus == ReportStatusEnum.已打印 && itm.ProductLine == curProductLine && idList.Contains(itm.Id) == false); + // if (priorLst.Any()) + // { + // string maxBillNum = priorLst.Max(itm => itm.BillNum); //除去要作废记录,取当前生产线的最大单据号 + // MenBanPackingList priorObj = priorLst.FirstOrDefault(itm => itm.BillNum == maxBillNum); //除去要作废记录,取当前生产线的最后打印记录 + // double updRecCnt = await _lineSNDomianServic.SetMaxSN(ProductTypeEnum.门板, curProductLine, "", priorObj.PrintDate, priorObj.BillSerialNum.TryToDoubleZero(), null); //调用减号接口 + // } + // else + // { + // double updRecCnt2 = await _lineSNDomianServic.SetMaxSN(ProductTypeEnum.门板, curProductLine, "", curPrintDate, 0, null); //调用减号接口,没有上条记录时 单据号传0 + // } + // #endregion + + // foreach (var itm in pairlist) + // { + // itm.ReportStatus = WY.NewJit.Extends.PaiGe.ReportStatusEnum.已作废; + // } + + // await _menBanPackingListRepository.UpdateManyAsync(pairlist); + // //批量改为未打印 + // var _childList = await _menBanPackingListRepository.Where(p => idList.Contains(p.Id)).SelectMany(p => p.Details).ToListAsync(); + // var _child = _childList.Select(p => p.M100BillId).Distinct().ToList(); + // var m100Lst = await _billM100Repository.Where(p => _child.Contains(p.Id)).ToListAsync(); + // m100Lst.ForEach(p => + // { + // if (p.BillStatus == BillStatusEnum.Publish) + // { + // p.SetBillStatus(BillStatusEnum.Match); + // } + // p.PrintTime = null; + // }); + // await _billM100Repository.UpdateManyAsync(m100Lst); + + // } + // else + // { + // throw new BusinessException("1001", "WMS已经排序,不能报废!"); + // } + // return wmsLst.Select(p => p.BillNum).ToList(); + //} } } 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 0dd0052..a068736 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 @@ -280,29 +280,29 @@ namespace WY.NewJit.PrintTable return ret; } - /// - /// 查询柱护板 - /// - /// - /// - /// - private async Task> QueryZHBByConditionAsync(QueryWaitPrintDto input, PagedAndSortedBase page) - { - PagedResultDto ret = new PagedResultDto(); - - var qryAlreadyPrintDto = ObjectMapper.Map(input); - string where = GetWhere(qryAlreadyPrintDto); - - ret.TotalCount = await GetEntityCountAsync("FisWaitPrint", where); - - //计算分页 - int fromRec = page.SkipCount + 1; - int ToRec = page.SkipCount + page.MaxResultCount; - - var lst = await GetEntityListFromToAsync("FisWaitPrint", where, "HostSN2", fromRec, ToRec); - ret.Items = lst; - return ret; - } + ///// + ///// 查询柱护板 + ///// + ///// + ///// + ///// + //private async Task> QueryZHBByConditionAsync(QueryWaitPrintDto input, PagedAndSortedBase page) + //{ + // PagedResultDto ret = new PagedResultDto(); + + // var qryAlreadyPrintDto = ObjectMapper.Map(input); + // string where = GetWhere(qryAlreadyPrintDto); + + // ret.TotalCount = await GetEntityCountAsync("FisWaitPrint", where); + + // //计算分页 + // int fromRec = page.SkipCount + 1; + // int ToRec = page.SkipCount + page.MaxResultCount; + + // var lst = await GetEntityListFromToAsync("FisWaitPrint", where, "HostSN2", fromRec, ToRec); + // ret.Items = lst; + // return ret; + //} private static string GetTrueString(string str) { @@ -480,7 +480,7 @@ namespace WY.NewJit.PrintTable //填充门板装箱单明细 MenBanPackingRec mbRec = new MenBanPackingRec(); mbRec.SetId(GuidGenerator.Create()); - mbRec.M100BillId = billObj.Id; + mbRec.M100BillId = billObj.Id; //传未打印列表id mbRec.KNR = billObj.KNR; //KNR订单号 mbRec.VIN = billObj.VIN; //底牌号 mbRec.HostSN = billObj.HostSN.ToString(); //大众顺序号 @@ -768,10 +768,10 @@ namespace WY.NewJit.PrintTable 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 if (input.BusinessType == BusinessTypeEnum.OtherZhuHuBan || input.BusinessType == BusinessTypeEnum.ZhuHuBan) + //{ + // ret = await QueryZHBByConditionAsync(input, (PagedAndSortedBase)input); } else { @@ -1159,6 +1159,38 @@ namespace WY.NewJit.PrintTable } #endregion + /// + /// 获取补账打印列表 + /// + /// 输入查询条件 + /// 返回符合条件的排序分页列表 + [HttpGet] + [UnitOfWork(false)] + [Route("replenish-print-list")] + public virtual async Task> GetReplenishPrintListAsync(QueryReplenishPrintDto input) + { + _logger.LogDebug(_errorMessagePrefix + "GetReplenishPrintListAsync 进入"); + try + { + PagedResultDto ret = new PagedResultDto(); + var qryAlreadyPrintDto = ObjectMapper.Map(input); + string where = GetWhere(qryAlreadyPrintDto); + ret.TotalCount = await GetEntityCountAsync("FisWaitPrint", where); + + //计算分页 + int fromRec = input.SkipCount + 1; + int ToRec = input.SkipCount + input.MaxResultCount; + var lst = await GetEntityListFromToAsync("FisWaitPrint", where, "HostSN2", fromRec, ToRec); + ret.Items = lst; + return ret; + } + catch (Exception ex) + { + string errMsg = _errorMessagePrefix + "GetReplenishPrintListAsync 执行出错:" + 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 a8dd94d..bdd5a6c 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 @@ -1089,6 +1089,8 @@ 生产线超时提醒(新) + 先取未打印列表然后更新缓存列表,如果未打印列表为空取m100更新缓存列表 + 当未打印列表没有数据,则取缓存列表返回 生产线编号列表 生产线超时情况 @@ -1952,14 +1954,6 @@ 根据筛选条件获取实体列表 - - - 查询柱护板 - - - - - 根据条件取用于打印的门板单据列表 @@ -2017,6 +2011,13 @@ 断号时Item不为空 + + + 获取补账打印列表 + + 输入查询条件 + 返回符合条件的排序分页列表 + 打印柱护板(3*8 左右合并成一个单元格)A上C上 @@ -2115,7 +2116,7 @@ 区域相关应用服务 - + 门板装箱单仓储明细