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 74be9cc..6b3fb37 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 @@ -339,29 +339,34 @@ namespace Win.Sfs.SettleAccount.FISes } await _menBanPackingListRepository.UpdateManyAsync(pairlist); - #region 删除已打印表、插入未打印表 + #region 删除已打印表、插入未打印表 【报废后, 未打印表有补账打印的、已打印表有断号或未知总成的、保留未打印表数据并更新补账打印为顺序打印】 var mbRecLst = await _menBanPackingListRepository.Where(p => idList.Contains(p.Id)).SelectMany(p => p.Details).ToListAsync(); var alreadyPrintIdLst = mbRecLst.Select(p => p.M100BillId).Distinct().ToList(); //未打印\已打印表id列表 var _apList = await _alreadyPrintRepository.Where(p => alreadyPrintIdLst.Contains(p.Id)).ToListAsync(); List _wpList = new List(); - foreach (var ap in _apList) //遍历已打印表 + foreach (var alreadyPrint in _apList) //遍历已打印表 { - var waitPrintLst = await _waitPrintRepository.GetListAsync(r => r.HostSN2 == ap.HostSN2 && r.BusinessType == ap.BusinessType); + var waitPrintLst = await _waitPrintRepository.GetListAsync(r => r.HostSN2 == alreadyPrint.HostSN2 && r.BusinessType == alreadyPrint.BusinessType); if (waitPrintLst.Count == 0) //未打印表没有(对应已打印表)记录 { - var wp = ObjectMapper.Map(ap); + var wp = ObjectMapper.Map(alreadyPrint); _wpList.Add(wp); } else if(waitPrintLst.Count == 1) //未打印表有一条记录 { - if (ap.BillStatus == BillStatusEnum.BreakNum && waitPrintLst[0].BillStatus == BillStatusEnum.BreakNum) + if (alreadyPrint.BillStatus == BillStatusEnum.BreakNum && waitPrintLst[0].BillStatus == BillStatusEnum.BreakNum) { - throw new BusinessException("1001", "未打印列表和已打印列表出现都是断号的情况号码未【" + ap.HostSN2 + "】,不能报废!"); + throw new BusinessException("1001", "未打印列表和已打印列表出现都是断号的情况号码未【" + alreadyPrint.HostSN2 + "】,不能报废!"); + } + if (waitPrintLst[0].PrintType == WY.NewJit.PrintTable.PrintTypeEnum.ReplenishPrint) + { + waitPrintLst[0].PrintType = WY.NewJit.PrintTable.PrintTypeEnum.OrderPrint; + await _waitPrintRepository.UpdateAsync(waitPrintLst[0]); } } else if (waitPrintLst.Count > 1) { - throw new BusinessException("1001", "未打印列表里出现大众顺序号重复号码为【"+ ap.HostSN2+ "】请检查后在报废!"); + throw new BusinessException("1001", "未打印列表里出现大众顺序号重复号码为【"+ alreadyPrint.HostSN2+ "】请检查后在报废!"); } } await _alreadyPrintRepository.DeleteManyAsync(_apList); diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs index d3fa72c..9dbe1db 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs @@ -49,6 +49,7 @@ namespace WY.NewJit.MsgCheck private readonly IRepository _billR100Repository; private readonly IRepository _billM100Repository; private readonly IRepository _waitPrintRepository; + private readonly M100DomainService _m100DomainService; /// /// ERP总成仓储 @@ -134,7 +135,8 @@ namespace WY.NewJit.MsgCheck M100CheckDomainService m100CheckDomainService, IDistributedEventBus distributedEventBus, IRepository partCfgRepository, - IRepository waitPrintRepository + IRepository waitPrintRepository, + M100DomainService m100DomainService ) { _UnknownAssemblyRepository = UnknownAssemblyRepository; @@ -157,6 +159,7 @@ namespace WY.NewJit.MsgCheck _distributedEventBus = distributedEventBus; _partCfgRepository = partCfgRepository; _waitPrintRepository = waitPrintRepository; + _m100DomainService = m100DomainService; } #endregion @@ -193,9 +196,9 @@ select * from with b as ( - select Id,HostSN,KNR,'' as VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus, Description from FisBillR100 where BillStatus =1 + select Id,HostSN,KNR,'' as VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus, Description, SerialNumStr from FisBillR100 where BillStatus =1 union all - select Id,HostSN,KNR,VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus, Description from FisBillM100 where BillStatus =1 + select Id,HostSN,KNR,VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus, Description, SerialNumStr from FisBillM100 where BillStatus =1 ) ,d as ( @@ -837,7 +840,7 @@ select * from union all select Id from FisBillM100 where BillStatus =1 ) - select a.Id from FisUnknownAssembly a where IsDeleted <> 1 and BillID in (select Id from b) + select a.Id from FisUnknownAssembly a where IsDeleted = 0 and BillID in (select Id from b) "; selLst = await _newJitDapperRepository.GetListBySqlAsync(sql, true); } @@ -882,7 +885,7 @@ select * from else { notMatchNum++; - var billNotExistPartLst = r100Obj.BillR100Parts.Where(itm => allAssemblyPartLst.Contains(itm.PartCode) == false).ToList(); + var billNotExistPartLst = r100Obj.BillR100Parts.Where(itm => itm.PartType == "1" && allAssemblyPartLst.Contains(itm.PartCode) == false).ToList(); if (billNotExistPartLst.Count > 0) { string desc = "如下是新零件,在总成子零件中不存在:" + billNotExistPartLst.Select(itm => itm.PartCode).Distinct().JoinAsString(","); @@ -907,19 +910,22 @@ select * from if (isMatch) { matchNum++; + //判断未打印表是否有数据,有则更新,没有则插入 + ObjectResultDto res = await _m100DomainService.InsertOrUpdateWaitPrintByM100(m100Obj); + #region 当前单据在未匹配时已经参与打印,重新解析后进入补打 - bool hasPrintData = _billM100Repository.Any(itm => itm.ProductLine == curPL && itm.SerialNumStr.CompareTo(curSNStr) > 0 && itm.BillStatus == BillStatusEnum.Publish); - if (hasPrintData) //该单据处于未解析时,已经打印 - { - m100Obj.NeedReplenishPrint = 1; - await _billM100Repository.UpdateAsync(m100Obj); - } + //bool hasPrintData = _billM100Repository.Any(itm => itm.ProductLine == curPL && itm.SerialNumStr.CompareTo(curSNStr) > 0 && itm.BillStatus == BillStatusEnum.Publish); + //if (hasPrintData) //该单据处于未解析时,已经打印 + //{ + // m100Obj.NeedReplenishPrint = 1; + // await _billM100Repository.UpdateAsync(m100Obj); + //} #endregion } else { notMatchNum++; - var billNotExistPartLst = m100Obj.BillM100Parts.Where(itm => allAssemblyPartLst.Contains(itm.PartCode) == false).ToList(); + var billNotExistPartLst = m100Obj.BillM100Parts.Where(itm => itm.PartType == "1" && allAssemblyPartLst.Contains(itm.PartCode) == false).ToList(); if (billNotExistPartLst.Count > 0) { string desc = "如下是新零件,在总成子零件中不存在:" + billNotExistPartLst.Select(itm => itm.PartCode).Distinct().JoinAsString(","); 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 71e6874..ef125a7 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 @@ -1,6 +1,9 @@ -using Microsoft.AspNetCore.Mvc; +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; +using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; +using Shouldly; using System; using System.Collections.Generic; using System.Diagnostics; @@ -10,6 +13,7 @@ using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; +using Volo.Abp.BlobStoring; using Volo.Abp.Domain.Repositories; using Volo.Abp.Uow; using WY.NewJit.Common; @@ -40,10 +44,20 @@ namespace WY.NewJit.PrintTable } private ILogger _logger; private readonly NewJitDapperRepository _newJitDapperRepository; - public AlreadyPrintAppService(ILogger logger, NewJitDapperRepository newJitDapperRepository) + + /// + /// BLOB存储 + /// + private readonly IBlobContainer _blobContainer; + + public AlreadyPrintAppService(ILogger logger, + NewJitDapperRepository newJitDapperRepository, + IBlobContainer blobContainer + ) { _logger = logger; _newJitDapperRepository = newJitDapperRepository; + _blobContainer = blobContainer; } /// /// 已打印列表 @@ -52,7 +66,7 @@ namespace WY.NewJit.PrintTable /// 返回符合条件的排序分页列表 [HttpGet] [UnitOfWork(false)] - [Route("already-print-list")] + [Route("list")] public virtual async Task> GetAlreadyPrintListAsync(QueryAlreadyPrintDto input) { _logger.LogDebug(_errorMessagePrefix + "GetAlreadyPrintListAsync 进入"); @@ -172,5 +186,47 @@ namespace WY.NewJit.PrintTable var ret = await _newJitDapperRepository.GetListBySqlAsync(sql); return ret; } + + /// + /// 导出信息 + /// + /// 导出查询条件 + /// 执行成功返回真 + [UnitOfWork(false)] + [HttpPost] + [Route("export")] + public virtual async Task> ExportAsync(QueryAlreadyPrintDto input) + { + _logger.LogDebug(_errorMessagePrefix + "ExportAsync 进入"); + ObjectResultDto ret = new ObjectResultDto(); + try + { + string where = GetWhere(input); + //计算分页 + int skipNum = 0; + int takeNum = 50000; + List items = await GetEntityListFromToAsync("FisAlreadyPrint", where, "HostSN2", skipNum, takeNum); + + //将实体列表转换成excel文件流 + IExporter exporter = new ExcelExporter(); + byte[] byteArr = await exporter.ExportAsByteArray(items); + byteArr.ShouldNotBeNull(); + //将excel文件流保存到服务器端文件系统 + string fileName = string.Format("已打印表_{0}.xlsx", Guid.NewGuid().ToString()); + await _blobContainer.SaveAsync(fileName, byteArr); + + ret.Item = fileName; + return ret; + + } + catch (Exception ex) + { + ret.Status = false; + ret.Message = _errorMessagePrefix + "ExportAsync 执行出错:" + ex.Message; + _logger.LogError(ret.Message); + return ret; + } + } + } } diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService_ZHB.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService_ZHB.cs index 614c4bf..211d0b1 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService_ZHB.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService_ZHB.cs @@ -854,7 +854,7 @@ namespace WY.NewJit.PrintTable bool containNotMatch = billLst.Any(itm => itm.BillStatus == BillStatusEnum.NotMatch); if (containNotMatch) { - var lst = billLst.Where(itm => itm.BillStatus == BillStatusEnum.NotMatch).OrderBy(itm => itm.HostSN2).Select(itm => itm.HostSN2.ToString() + ",").ToList(); + var lst = billLst.Where(itm => itm.BillStatus == BillStatusEnum.NotMatch).OrderBy(itm => itm.HostSN2).Select(itm => itm.HostSN2.ToString() + ", ").ToList(); string str = string.Concat(lst); retLst.Add($"存在未知总成:{str}"); return new ListResultDto(retLst); 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 9ccc8f9..1eb9ef7 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 @@ -1611,7 +1611,7 @@ 错误信息前缀 - + 构造函数 @@ -1863,6 +1863,11 @@ 错误信息前缀 + + + BLOB存储 + + 已打印列表 @@ -1881,6 +1886,13 @@ + + + 导出信息 + + 导出查询条件 + 执行成功返回真 + 错误信息前缀 diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/M100DomainService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/M100DomainService.cs index 5608406..1b6adfa 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/M100DomainService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/M100DomainService.cs @@ -138,19 +138,30 @@ namespace WY.NewJit.MsgCheck var m100Ret = await _billM100Repository.UpdateAsync(m100Obj, autoSave); if (m100Ret != null) { - if (m100Obj.ProductLine == "08") - { - //更新已解析状态时,只涉及门板记录 - WaitPrint mbRec = await _waitPrintRepository.GetAsync(itm => itm.M100Id == m100Ret.Id && itm.BusinessType == BusinessTypeEnum.MenBan); - ConvertWaitPrint(m100Ret, BusinessTypeEnum.MenBan, mbRec); - await _waitPrintRepository.UpdateAsync(mbRec); - } - else + //if (m100Obj.ProductLine == "08") + //{ + // //更新已解析状态时,只涉及门板、2条柱护板 + // WaitPrint mbRec = await _waitPrintRepository.GetAsync(itm => itm.M100Id == m100Ret.Id && itm.BusinessType == BusinessTypeEnum.MenBan); + // ConvertWaitPrint(m100Ret, BusinessTypeEnum.MenBan, mbRec); + // await _waitPrintRepository.UpdateAsync(mbRec); + //} + //else + //{ + // WaitPrint mbRec = await _waitPrintRepository.GetAsync(itm => itm.M100Id == m100Ret.Id && itm.BusinessType == BusinessTypeEnum.MenBan); + // ConvertWaitPrint(m100Ret, BusinessTypeEnum.MenBan, mbRec); + // await _waitPrintRepository.UpdateAsync(mbRec); + //} + + //更新已解析状态时,只涉及门板、不涉及柱护板【柱护板一对一解析成功】 + List wpLst = await _waitPrintRepository.GetListAsync(itm => itm.M100Id == m100Ret.Id && itm.BusinessType == BusinessTypeEnum.MenBan); + foreach (var wp in wpLst) { - WaitPrint mbRec = await _waitPrintRepository.GetAsync(itm => itm.M100Id == m100Ret.Id && itm.BusinessType == BusinessTypeEnum.MenBan); - ConvertWaitPrint(m100Ret, BusinessTypeEnum.MenBan, mbRec); - await _waitPrintRepository.UpdateAsync(mbRec); + wp.AssemblyID = m100Ret.AssemblyID; + wp.BillStatus = m100Ret.BillStatus; } + await _waitPrintRepository.UpdateManyAsync(wpLst, autoSave); + + return m100Ret; } return null; @@ -220,5 +231,49 @@ namespace WY.NewJit.MsgCheck Dictionary> ret = m100Lst.ToDictionary(itm => itm.Id, itm2 => itm2.BillM100Parts); return ret; } + + /// + /// 根据M100插入或更新未打印表,【未知总成重新解析时调用】 + /// + /// + /// + public async Task InsertOrUpdateWaitPrintByM100(BillM100 m100Obj, bool autoSave = false) + { + ObjectResultDto ret = new ObjectResultDto(true, ""); + List wpLst = await _waitPrintRepository.GetListAsync(itm => itm.VIN == m100Obj.VIN && itm.BusinessType == BusinessTypeEnum.MenBan); + bool hasData = wpLst.Count > 0; + if (hasData) //未打印表有数据 + { + foreach (WaitPrint wp in wpLst) + { + wp.AssemblyID = m100Obj.AssemblyID; + wp.BillStatus = m100Obj.BillStatus; + } + await _waitPrintRepository.UpdateManyAsync(wpLst, autoSave); + } + else //未打印表没有数据 + { + WaitPrint[] wpArr; + if (m100Obj.ProductLine == "08") + { + WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan); + //WaitPrint zhbOtherRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.OtherZhuHuBan); + //WaitPrint zhbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.AC_ZhuHuBan); + //wpArr = new WaitPrint[3] { mbRec, zhbOtherRec, zhbRec }; + wpArr = new WaitPrint[1] { mbRec }; + } + else + { + WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan); + wpArr = new WaitPrint[1] { mbRec }; + } + foreach (WaitPrint wp in wpArr) + { + wp.PrintType = PrintTypeEnum.ReplenishPrint; + } + await _waitPrintRepository.InsertManyAsync(wpArr, autoSave); //插入未打印表 + } + return ret; + } } } diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Job.ConsoleApp/Properties/launchSettings.json b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Job.ConsoleApp/Properties/launchSettings.json index 55741d0..33504c9 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Job.ConsoleApp/Properties/launchSettings.json +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Job.ConsoleApp/Properties/launchSettings.json @@ -1,8 +1,8 @@ { - //"profiles": { - // "WSL": { - // "commandName": "WSL2", - // "distributionName": "" - // } - //} + "profiles": { + "WSL": { + "commandName": "WSL2", + "distributionName": "" + } + } } \ No newline at end of file diff --git a/vue/src/router/index.js b/vue/src/router/index.js index 012c1f6..3624ac6 100644 --- a/vue/src/router/index.js +++ b/vue/src/router/index.js @@ -64,10 +64,11 @@ export const constantRoutes = [ }, { path: '/login', - component: () => import('@/views/login/index'), + //component: () => import('@/views/login/index'), //component: () => import('@/views/pg-fis/basedate/partSwitch'), //?? one //component: () => import('@/views/pg-fis/basedate/assemblyCfg'), //?? one //component: () => import('@/views/pg-fis/basedate/m100Online/normalPritIndex.vue'), + component: () => import('@/views/pg-fis/basedate/alreadyPrint/index.vue'), hidden: true }, { diff --git a/vue/src/router/modules/fisprint.js b/vue/src/router/modules/fisprint.js index 14273fd..00971bc 100644 --- a/vue/src/router/modules/fisprint.js +++ b/vue/src/router/modules/fisprint.js @@ -35,7 +35,17 @@ const pgfisPrint = { //roles: ['SettleAccount.Reports'], icon: '结算对比' } - } + }, + { + path: '/pg-already-print', + component: () => import('@/views/pg-fis/basedate/alreadyPrint/index.vue'), + name: 'alreadyPrint',//命名路由 + meta: { + title: '已打印信息', + //roles: ['SettleAccount.Reports'], + icon: '客户零件' + } + }, ] } diff --git a/vue/src/views/pg-fis/basedate/alreadyPrint/detail.vue b/vue/src/views/pg-fis/basedate/alreadyPrint/detail.vue new file mode 100644 index 0000000..8f84588 --- /dev/null +++ b/vue/src/views/pg-fis/basedate/alreadyPrint/detail.vue @@ -0,0 +1,354 @@ + + + + + + + + diff --git a/vue/src/views/pg-fis/basedate/alreadyPrint/index.vue b/vue/src/views/pg-fis/basedate/alreadyPrint/index.vue new file mode 100644 index 0000000..468b6ab --- /dev/null +++ b/vue/src/views/pg-fis/basedate/alreadyPrint/index.vue @@ -0,0 +1,974 @@ + + + + + + + + + + diff --git a/vue/src/views/pg-fis/basedate/m100Online/budaMB.vue b/vue/src/views/pg-fis/basedate/m100Online/budaMB.vue index e07b1dc..1d773d5 100644 --- a/vue/src/views/pg-fis/basedate/m100Online/budaMB.vue +++ b/vue/src/views/pg-fis/basedate/m100Online/budaMB.vue @@ -474,6 +474,8 @@ export default { if (this.customerInfo.productLine != "") { inputParam.productLine = this.customerInfo.productLine; } + inputParam.businessType = this.customerInfo.BusinessType; + inputParam.printType = 2; console.log('replenish-print-list方法输入参数:' + JSON.stringify(this.listQuery)); this.$axios