From a50c18dd8722065881cc6fbd0e1af9d4670b16cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Tue, 15 Aug 2023 13:45:18 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs | 2 - .../Bases/ADJ_SERVICE.cs | 121 +- .../Bases/BA_SERVICE.cs | 65 + .../Entities/BQ/BBAC_BA_SERVICE.cs | 315 +++- .../Entities/BQ/BBAC_CAN_SA_SERVICE.cs | 2 +- .../Entities/BQ/HBPO_BA_SERVICE.cs | 295 +++- .../Entities/BQ/PUB_BA_SERVICE.cs | 299 +++- .../Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs | 5 +- .../Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs | 11 + .../Entities/BQ/Managers/INV_MNG.cs | 32 +- .../Entities/BQ/Managers/INV_MNG_EXT.cs | 1284 +++++++++++++++++ .../Entities/BQ/Managers/PUB_CAN_SA_MNG.cs | 11 + .../Entities/BQ/Temp/TempClass.cs | 23 + 13 files changed, 2394 insertions(+), 71 deletions(-) create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs index 0fea4691..434afff1 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs @@ -83,8 +83,6 @@ public class PUB_ADJ_DETAIL_IMP_DTO [ImporterHeader(Name = "厂内零件号")] public string PartCode { get; set; } - - [ImporterHeader(Name = "标识号")] public string PN { get; set; } [ImporterHeader(Name = "数量")] diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs index bce2a72e..2ba35ed6 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs @@ -21,6 +21,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExportReports; +using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Bases; @@ -34,18 +35,21 @@ public class ADJ_SERVICE : BASE_SERVICE protected readonly INormalEfCoreRepository _repository; protected readonly BaseDomainService _baseDomainService; protected readonly INormalEfCoreRepository _invRepository; - + protected readonly INormalEfCoreRepository _relRepository; + public ADJ_SERVICE( INormalEfCoreRepository repository, BaseDomainService baseDomainService, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, - INormalEfCoreRepository invRepository + INormalEfCoreRepository invRepository, + INormalEfCoreRepository relRepository ) : base(excelImportService, snowflakeIdGenerator, commonManager) { + _relRepository = relRepository; _invRepository = invRepository; _repository = repository; _baseDomainService = baseDomainService; @@ -64,6 +68,7 @@ public class ADJ_SERVICE : BASE_SERVICE var dtos = ObjectMapper.Map, List>(entitys); return new PagedResultDto(totalCount, dtos); } + /// /// 导入文件 /// @@ -81,10 +86,11 @@ public class ADJ_SERVICE : BASE_SERVICE { throw new BusinessException("8989", "导入数据记录为0条"); } - var invs=result.Select(p => p.OldInvBillNum).ToList();//所有发票号 - var deletels = _repository.Where(p =>invs.Contains(p.OldInvBillNum) ).ToList();//所有关联发票号的调整表 - var invlist= _invRepository.Where(p => invs.Contains(p.InvbillNum)).ToList();//所有发票 - var dlists= deletels.Where(p=>string.IsNullOrEmpty(p.InvBillNum)).ToList();//所有新发票号不为空的调整记录 + var relation = _relRepository.ToList(); + var invs = result.Select(p => p.OldInvBillNum).ToList();//所有发票号 + var deletels = _repository.Where(p => invs.Contains(p.OldInvBillNum)).ToList();//所有关联发票号的调整表 + var invlist = _invRepository.Where(p => invs.Contains(p.InvbillNum)).ToList();//所有发票 + var dlists = deletels.Where(p => string.IsNullOrEmpty(p.InvBillNum)).ToList();//所有新发票号不为空的调整记录 foreach (var itm in dlists) { errorList.Add(new ErrorExportDto() { ItemCode = $"{itm.LU}", Message = $"客户零件号{itm.LU}标识号{itm.PN}下线日期{itm.SettleDate}记录已经被重新开票,新发票号为:{itm.InvBillNum}" }); @@ -112,13 +118,14 @@ public class ADJ_SERVICE : BASE_SERVICE } var query = from itm in entityList join itm1 in invlist - on itm.InvBillNum equals itm1.InvbillNum + on itm.InvBillNum equals itm1.InvbillNum + join itm2 in relation on itm.LU equals itm2.SettleMaterialCode select new PUB_ADJ_DETAIL( id: GuidGenerator.Create(), keyCode: itm.PN + itm.LU, version: itm.Version, settleBillNum: itm.SettleBillNum, - lU: itm.LU, + lU: itm2.ErpMaterialCode, pN: itm.PN, site: itm.Site, qty: itm.Qty, @@ -130,13 +137,107 @@ public class ADJ_SERVICE : BASE_SERVICE groupNum: itm.GroupNum, oldinv: itm.InvBillNum, inv: string.Empty, - partcode:itm.PartCode + partcode: itm.PartCode + + + - ); await _repository.DbContext.BulkDeleteAsync(deletels);//删除发票下所有调整明细 await _repository.DbContext.BulkInsertAsync(query.ToList()); return ApplicationConsts.SuccessStr; } + + + + + + + + + + + + + + /// + /// 导入文件 + /// + /// + /// + /// + [HttpPost] + [DisableRequestSizeLimit] + public async Task CheckImport(List p_list) + { + List errorList = new List(); + //ExportImporter _exportImporter = new ExportImporter(); + //var result = await _exportImporter.UploadExcelImport(files, _excelImportService); + //if (result.Count == 0) + //{ + // throw new BusinessException("8989", "导入数据记录为0条"); + //} + // var invs= p_list.Select(p => p.InvBillNum).ToList();//所有发票号 + //var deletels = _repository.Where(p =>invs.Contains(p.OldInvBillNum) ).ToList();//所有关联发票号的调整表 + // var invlist= _invRepository.Where(p => invs.Contains(p.InvbillNum)).ToList();//所有旧发票 + // var dlists= deletels.Where(p=>string.IsNullOrEmpty(p.InvBillNum)).ToList();//所有新发票号不为空的调整记录 + //foreach (var itm in dlists) + //{ + // errorList.Add(new ERR_EXP_DTO() { ItemCode = $"{itm.LU}", Message = $"客户零件号{itm.LU}标识号{itm.PN}下线日期{itm.SettleDate}记录已经被重新开票,新发票号为:{itm.InvBillNum}" }); + //} + //var first = deletels.FirstOrDefault(); + //if (!string.IsNullOrEmpty(first.InvBillNum)) + //{ + // throw new BusinessException("8989", $"调整记录已经生成新发票号:{first.InvBillNum}"); + //} + var entityList = ObjectMapper.Map, List>(p_list); + var codelist = entityList.Select(p => p.LU).ToList(); + var errors = await _baseDomainService.CheckBase(codelist, new BASE_CONF() { IsRelationShip = true }); + foreach (var itm in errors) + { + errorList.Add( + new ERR_EXP_DTO() { ItemCode = $"{itm}", Message = $"[客户零件关系表]不存在客户零件号{itm}" }); + } + var errorEntitylist = await _baseDomainService.CheckPriceList(entityList); + if (errorEntitylist.Count > 0) + { + foreach (var itm in errorEntitylist) + { + errorList.Add(new ERR_EXP_DTO() { ItemCode = $"{itm.LU}", Message = $"客户零件号{itm.LU}标识号{itm.PN}下线日期{itm.SettleDate}不存在价格单记录" }); + } + } + if (errorList.Count > 0) + { + return await ExportErrorReportAsync(errorList); + } + //var query = from itm in entityList + // join itm1 in invlist + // on itm.InvBillNum equals itm1.InvbillNum + // select new PUB_ADJ_DETAIL( + // id: GuidGenerator.Create(), + // keyCode: itm.PN + itm.LU, + // version: itm.Version, + // settleBillNum: itm.SettleBillNum, + // lU: itm.LU, + // pN: itm.PN, + // site: itm.Site, + // qty: itm.Qty, + // extend1: string.Empty, + // price: 0, + // invGroupNum: itm1.InvGroupNum, + // settleDate: itm.SettleDate, + // businessType: itm1.BusinessType, + // groupNum: itm.GroupNum, + // oldinv: itm.InvBillNum, + // inv: string.Empty, + // partcode:itm.PartCode + + + // ); + //await _repository.DbContext.BulkDeleteAsync(deletels);//删除发票下所有调整明细 + //await _repository.DbContext.BulkInsertAsync(query.ToList()); + return ApplicationConsts.SuccessStr; + } + } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs index 28de6d76..038f321a 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs @@ -322,6 +322,71 @@ namespace Win.Sfs.SettleAccount.Bases throw new BusinessException("8989", "生成失败,请检查调整表和旧发票内容"); } + + /// + /// hbpo、jit、备件等 + /// + /// 可结算明细列表 + /// 版本号 + /// 发票分组 + /// 原发票号 + protected async Task> ReissueSecInvoiceExtend(List p_list, List p_adjlist, List p_tmplist, int p_version, string p_parentInvBillNum) where TDetail : SA_CAN_BASE + { + var ls = await _invMng.ReissueSecInvoiceExtend(p_list, p_adjlist, p_tmplist, p_parentInvBillNum, p_version); + if (ls.Count>0) + { + return ls; + } + + throw new BusinessException("8989", "生成失败,请检查调发票整表和旧发票内容"); + + + } + + /// + /// 第一次开票 + /// + /// + /// + /// + /// + /// 要作废的发票号 + /// + /// + protected async Task> ReissueFirstInvoiceExtend(List p_list, List p_adjlist, List dtos, int p_version, string p_parentInvBillNum) where TDetail : SA_CAN_BASE + { + var ls = await _invMng.ReissueFirstInvoiceExtend(p_list, p_adjlist, dtos, p_parentInvBillNum, p_version); + if (ls.Count>0) + { + return ls; + } + throw new BusinessException("8989", "生成失败,请检查调整表和旧发票内容"); + + } + + + + + + + + + + + + + + + + + + + + + + + + /// /// 校验规则 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs index d08525e8..2f8d7b73 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs @@ -1,4 +1,5 @@ +using DocumentFormat.OpenXml.Spreadsheet; using EFCore.BulkExtensions; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -12,6 +13,7 @@ using System.Text; using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Application.Services; +using Volo.Abp.ObjectMapping; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Bases; @@ -65,18 +67,152 @@ namespace Win.Sfs.SettleAccount.Entities.BQ /// public override async Task ReissueInvoice(string p_invbillnum) { - var mappingList= await GetMapGroupAsync(p_invbillnum);//发票对应结算分组 - if (mappingList != null && mappingList.Count() > 0) + //var mappingList= await GetMapGroupAsync(p_invbillnum);//发票对应结算分组 + //if (mappingList != null && mappingList.Count() > 0) + //{ + var version = int.Parse(DateTime.Now.ToString("yyyymm")); + //var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组 + var inv = await GetInvoiceGroupByInvBillNum(p_invbillnum); + + var settle = await _bbacMng.GetMainAsync(inv.InvGroupNum); + + if (settle == null) { - var version=int.Parse(DateTime.Now.ToString("yyyymm")); - var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组 - var inv= await GetInvoiceGroupByInvBillNum(p_invbillnum); + throw new UserFriendlyException($"选择发票:{p_invbillnum}对应的可结算单不在请检查!"); + + } + + version = settle.Version; + if (inv != null) + { + if (inv.InvoiceState == InvoiceBillState.报废) + { + throw new UserFriendlyException($"选择发票:{p_invbillnum}状态为报废状态不能重开!"); + } + if (inv.State == SettleBillState.商务已审核 || inv.State == SettleBillState.已开票) + { + throw new UserFriendlyException($"选择发票:{p_invbillnum}状态在财务审核后可以报废重开,之前不能重开可以退回!"); + } + + var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件 + var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细 + if (adjlist != null && adjlist.Count() > 0) + { + foreach (var itm in adjlist) + { + bbaclist.Add(new BBAC_CAN_SA_DETAIL( + guid: itm.Id, + keyCode: itm.KeyCode, + version: itm.Version, + billNum: itm.InvGroupNum, + settleBillNum: itm.SettleBillNum, + lU: itm.LU, + pN: itm.PN, + site: itm.Site, + qty: itm.Qty, + price: itm.Price, + category: itm.BusinessType, + isReturn: itm.Qty > 0 ? false : true, + settleDate: itm.SettleDate, + groupNum: itm.GroupNum, + invGroupNum: itm.InvGroupNum, + contactid: itm.Extend1,//生产号 + invbillnum: string.Empty, + partcode: itm.PartCode + )); + } + } + var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据 + var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); + //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); + //var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算 + var priceList = _priceRepository.ToList();//价格单 + var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType); + if (errorList.Count() > 0) + { + return await ExportErrorReportAsync(errorList); + } + var dto1s = ObjectMapper.Map, List>(entitys); + var q = from d in dto1s + join p in priceList on d.PartCode equals p.LU + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号 + select new TEMP_CAN_SA_DETAIL + { + Id = d.Id, + SettleBillNum = d.SettleBillNum, + Site = d.Site, + Version = d.Version, + Price = p.Price, + BillNum = d.BillNum, + SettleDate = d.SettleDate, + InvGroupNum = d.InvGroupNum, + LU = d.LU, + MaterialDesc = d.MaterialDesc, + PN = d.PN, + Qty = d.Qty, + GroupNum = d.GroupNum, + Amt = Math.Round(d.Qty * p.Price, 2), + ContractDocID = d.ContractDocID, + BeginDate = p.BeginTime, + EndDate = p.EndTime, + PartCode = d.PartCode + + }; + var dtos = q.ToList(); + if (dtos != null && dtos.Count > 0) + { + if (p_invbillnum.Substring(0, 3) == "INV")//一次开票重开 + { + await ReissueFirstInvoice(bbaclist, adjlist, dtos, version, p_invbillnum); + } + else//二次开票 + { + await ReissueSecInvoice(bbaclist, adjlist, dtos, version, p_invbillnum); + } + } + } + else + { + throw new UserFriendlyException($"不存发票号为:{p_invbillnum}发票"); + } + //} + //else + //{ + // throw new UserFriendlyException( $"不存发票号:{p_invbillnum}对应的结算分组号"); + //} + return ApplicationConsts.SuccessStr; + } + + [HttpPost] + /// + /// 发票重开 + /// + /// + /// + public virtual async Task ReissueInvoiceExtend(List p_list) + { + + + var adjlist = ObjectMapper.Map, List>(p_list); + if (adjlist == null && adjlist.Count == 0) + { + throw new UserFriendlyException($"调整表无数据!"); + } + var first = p_list.FirstOrDefault(); + var invbillnum = first.InvBillNum; + //var mappingList= await GetMapGroupAsync(p_invbillnum);//发票对应结算分组 + //if (mappingList != null && mappingList.Count() > 0) + //{ + var version=int.Parse(DateTime.Now.ToString("yyyymm")); + //var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组 + var inv= await GetInvoiceGroupByInvBillNum(invbillnum); var settle =await _bbacMng.GetMainAsync(inv.InvGroupNum); if(settle==null) { - throw new BusinessException("8989", $"选择发票:{p_invbillnum}对应的可结算单不在请检查!"); + throw new UserFriendlyException( $"选择发票:{invbillnum}对应的可结算单不在请检查!"); + } version=settle.Version; @@ -84,10 +220,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ { if (inv.InvoiceState == InvoiceBillState.报废) { - throw new BusinessException("8989", $"选择发票:{p_invbillnum}状态为报废状态不能重开!"); + throw new UserFriendlyException( $"选择发票:{invbillnum}状态为报废状态不能重开!"); + } + if (inv.State == SettleBillState.商务已审核 || inv.State == SettleBillState.已开票) + { + throw new UserFriendlyException( $"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前不能重开可以退回!"); } - var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum, gList);//结算分组对应结算零件 - var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细 + + var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件 + // var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细 if (adjlist != null && adjlist.Count() > 0) { foreach (var itm in adjlist) @@ -153,26 +294,166 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var dtos = q.ToList(); if (dtos != null && dtos.Count > 0) { - if (p_invbillnum.Substring(0, 3) == "INV")//一次开票重开 + if (invbillnum.Substring(0, 3) == "INV")//一次开票重开 { - await ReissueFirstInvoice(bbaclist,adjlist,dtos,version, p_invbillnum); + await ReissueFirstInvoice(bbaclist,adjlist,dtos,version, invbillnum); } else//二次开票 { - await ReissueSecInvoice(bbaclist,adjlist,dtos,version, p_invbillnum); + await ReissueSecInvoice(bbaclist,adjlist,dtos,version, invbillnum); } } } else { - throw new BusinessException("8989", $"不存发票号为:{p_invbillnum}发票"); + throw new UserFriendlyException( $"不存发票号为:{invbillnum}发票"); } - } - else + //} + //else + //{ + // throw new UserFriendlyException( $"不存发票号:{p_invbillnum}对应的结算分组号"); + //} + return ApplicationConsts.SuccessStr; + } + + [HttpPost] + /// + /// 发票重开列表 + /// + /// + /// + public virtual async Task> ReissueInvoiceList(List p_list) + { + List ls = new List(); + + var adjlist=ObjectMapper.Map, List>(p_list); + if (adjlist == null && adjlist.Count==0) { - throw new BusinessException("8989", $"不存发票号:{p_invbillnum}对应的结算分组号"); + throw new UserFriendlyException($"调整表无数据!"); } - return ApplicationConsts.SuccessStr; + var first = p_list.FirstOrDefault(); + var invbillnum = first.InvBillNum; + //var mappingList = await GetMapGroupAsync(invbillnum);//发票对应结算分组 + //if (mappingList != null && mappingList.Count() > 0) + //{ + var version = int.Parse(DateTime.Now.ToString("yyyymm")); + //var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组 + var inv = await GetInvoiceGroupByInvBillNum(invbillnum); + + var settle = await _bbacMng.GetMainAsync(inv.InvGroupNum); + + if (settle == null) + { + throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!"); + } + version = settle.Version; + if (inv != null) + { + if (inv.InvoiceState == InvoiceBillState.报废) + { + throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!"); + } + if (inv.State == SettleBillState.商务已审核 || inv.State == SettleBillState.已开票) + { + throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!"); + } + + var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件 + //var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细 + if (adjlist != null && adjlist.Count() > 0) + { + foreach (var itm in adjlist) + { + bbaclist.Add(new BBAC_CAN_SA_DETAIL( + guid: itm.Id, + keyCode: itm.KeyCode, + version: itm.Version, + billNum: itm.InvGroupNum, + settleBillNum: itm.SettleBillNum, + lU: itm.LU, + pN: itm.PN, + site: itm.Site, + qty: itm.Qty, + price: itm.Price, + category: itm.BusinessType, + isReturn: itm.Qty > 0 ? false : true, + settleDate: itm.SettleDate, + groupNum: itm.GroupNum, + invGroupNum: itm.InvGroupNum, + contactid: itm.Extend1,//生产号 + invbillnum: string.Empty, + partcode: itm.PartCode + )); + } + } + var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据 + var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); + + var priceList = _priceRepository.ToList();//价格单 + //var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType); + //if (errorList.Count() > 0) + //{ + // return await ExportErrorReportAsync(errorList); + //} + var dto1s = ObjectMapper.Map, List>(entitys); + var q = from d in dto1s + join p in priceList on d.PartCode equals p.LU + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号 + select new TEMP_CAN_SA_DETAIL + { + Id = d.Id, + SettleBillNum = d.SettleBillNum, + Site = d.Site, + Version = d.Version, + Price = p.Price, + BillNum = d.BillNum, + SettleDate = d.SettleDate, + InvGroupNum = d.InvGroupNum, + LU = d.LU, + MaterialDesc = d.MaterialDesc, + PN = d.PN, + Qty = d.Qty, + GroupNum = d.GroupNum, + Amt = Math.Round(d.Qty * p.Price, 2), + ContractDocID = d.ContractDocID, + BeginDate = p.BeginTime, + EndDate = p.EndTime, + PartCode = d.PartCode + + }; + var dtos = q.ToList(); + if (dtos != null && dtos.Count > 0) + { + if (invbillnum.Substring(0, 3) == "INV")//一次开票重开 + { + var entities=await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum); + + ls= ObjectMapper.Map, List>(entities); + + + } + else//二次开票 + { + var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum); + ls=ObjectMapper.Map, List>(entities); + + } + } + } + else + { + throw new UserFriendlyException($"不存发票号为:{invbillnum}发票"); + } + //} + //else + //{ + // throw new UserFriendlyException($"不存发票号:{p_invbillnum}对应的结算分组号"); + //} + return ls; + } + + + } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs index d37068a0..98e2ef67 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs @@ -159,7 +159,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ } else { - throw new BusinessException("8989", string.Format("{0}不存在该可结算单号", input.BillNum)); + throw new UserFriendlyException(string.Format("{0}不存在该可结算单号", input.BillNum)); } return ApplicationConsts.SuccessStr; } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs index 95b97db3..0472def5 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs @@ -56,25 +56,29 @@ namespace Win.Sfs.SettleAccount.Entities.BQ /// public override async Task ReissueInvoice(string p_invbillnum) { - var mappingList = await GetMapGroupAsync(p_invbillnum);//发票对应结算分组 - if (mappingList != null && mappingList.Count() > 0) - { + //var mappingList = await GetMapGroupAsync(p_invbillnum);//发票对应结算分组 + //if (mappingList != null && mappingList.Count() > 0) + //{ var version = int.Parse(DateTime.Now.ToString("yyyymm")); - var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组 + //var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组 var inv = await GetInvoiceGroupByInvBillNum(p_invbillnum); var settle = await _hbpoMng.GetMainAsync(inv.InvGroupNum); if (settle == null) { - throw new BusinessException("8989", $"选择发票:{p_invbillnum}对应的可结算单不在请检查!"); + throw new UserFriendlyException( $"选择发票:{p_invbillnum}对应的可结算单不存在请检查!"); } version = settle.Version; if (inv != null) { if (inv.InvoiceState == InvoiceBillState.报废) { - throw new BusinessException("8989", $"选择发票:{p_invbillnum}状态为报废状态不能重开!"); + throw new UserFriendlyException( $"选择发票:{p_invbillnum}状态为报废状态不能重开!"); + } + if (inv.State == SettleBillState.商务已审核 || inv.State == SettleBillState.已开票) + { + throw new UserFriendlyException( $"选择发票:{p_invbillnum}状态在财务审核后可以报废重开,之前请退回重开!"); } - var hbpolist = await _hbpoMng.GetContainsAsync(inv.InvbillNum, gList);//结算分组对应结算零件 + var hbpolist = await _hbpoMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件 var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细 if (adjlist != null && adjlist.Count > 0) { @@ -150,15 +154,288 @@ namespace Win.Sfs.SettleAccount.Entities.BQ } else { - throw new BusinessException("8989", $"不存发票号为:{p_invbillnum}发票"); + throw new UserFriendlyException( $"不存发票号为:{p_invbillnum}发票"); + } + //} + //else + //{ + // throw new UserFriendlyException( $"不存发票号:{p_invbillnum}对应的结算分组号"); + //} + return ApplicationConsts.SuccessStr; + } + + [HttpPost] + /// + /// 发票重开 + /// + /// + /// + public virtual async Task ReissueInvoiceExtend(List p_list) + { + + var adjlist = ObjectMapper.Map, List>(p_list); + if (adjlist == null && adjlist.Count == 0) + { + throw new UserFriendlyException($"调整表无数据!"); + } + var first = p_list.FirstOrDefault(); + var invbillnum = first.InvBillNum; + + + //var mappingList = await GetMapGroupAsync(p_invbillnum);//发票对应结算分组 + //if (mappingList != null && mappingList.Count() > 0) + //{ + var version = int.Parse(DateTime.Now.ToString("yyyymm")); + //var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组 + var inv = await GetInvoiceGroupByInvBillNum(invbillnum); + var settle = await _hbpoMng.GetMainAsync(inv.InvGroupNum); + if (settle == null) + { + throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不存在请检查!"); + } + version = settle.Version; + if (inv != null) + { + if (inv.InvoiceState == InvoiceBillState.报废) + { + throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!"); + } + if (inv.State == SettleBillState.商务已审核 || inv.State == SettleBillState.已开票) + { + throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!"); + } + var hbpolist = await _hbpoMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件 + // var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细 + if (adjlist != null && adjlist.Count > 0) + { + foreach (var itm in adjlist) + { + hbpolist.Add(new HBPO_CAN_SA_DETAIL( + guid: GuidGenerator.Create(), + keyCode: itm.KeyCode, + version: itm.Version, + billNum: itm.InvGroupNum, + settleBillNum: itm.SettleBillNum, + lU: itm.LU, + pN: itm.PN, + site: itm.Site, + qty: itm.Qty, + price: itm.Price, + businessType: itm.BusinessType, + settleDate: itm.SettleDate, + groupNum: itm.GroupNum, + invGroupNum: itm.InvGroupNum, + invbillnum: string.Empty, + partcode: itm.PartCode + )); + } + } + var entitys = hbpolist;//合并库存调整单和就发票可结算明细数据 + var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); + //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); + //var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算 + var priceList = _priceRepository.ToList();//价格单 + var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType); + if (errorList.Count() > 0) + { + return await ExportErrorReportAsync(errorList); + } + // var dto1s = ObjectMapper.Map, List>(entitys); + var q = from d in entitys + join p in priceList on d.PartCode equals p.LU + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime + select new TEMP_CAN_SA_DETAIL + { + SettleBillNum = d.SettleBillNum, + Site = d.Site, + Version = d.Version, + Price = p.Price, + BillNum = d.BillNum, + SettleDate = d.SettleDate, + InvGroupNum = d.InvGroupNum, + LU = d.LU, + // MaterialDesc = d.MaterialDesc, + PN = d.PN, + Qty = d.Qty, + GroupNum = d.GroupNum, + Amt = Math.Round(d.Qty * p.Price, 2), + ContractDocID = "n", + BeginDate = p.BeginTime, + EndDate = p.EndTime, + PartCode = d.PartCode + }; + var dtos = q.ToList(); + if (dtos != null && dtos.Count > 0) + { + if (invbillnum.Substring(0, 3) == "INV")//一次开票重开 + { + await ReissueFirstInvoice(hbpolist, adjlist, dtos, version, invbillnum); + + } + else//二次开票 + { + await ReissueSecInvoice(hbpolist, adjlist, dtos, version, invbillnum); + } } } else { - throw new BusinessException("8989", $"不存发票号:{p_invbillnum}对应的结算分组号"); + throw new UserFriendlyException($"不存发票号为:{invbillnum}发票"); } + //} + //else + //{ + // throw new UserFriendlyException( $"不存发票号:{p_invbillnum}对应的结算分组号"); + //} return ApplicationConsts.SuccessStr; } + + + + + + [HttpPost] + /// 发票重开列表 + /// + /// + /// + public virtual async Task> ReissueInvoiceList( List p_list) + { + List ls = new List(); + + var adjlist = ObjectMapper.Map, List>(p_list); + if (adjlist == null && adjlist.Count == 0) + { + throw new UserFriendlyException($"调整表无数据!"); + } + var first = p_list.FirstOrDefault(); + var invbillnum = first.InvBillNum; + + //var mappingList = await GetMapGroupAsync(invbillnum);//发票对应结算分组 + //if (mappingList != null && mappingList.Count() > 0) + //{ + var version = int.Parse(DateTime.Now.ToString("yyyymm")); + //var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组 + var inv = await GetInvoiceGroupByInvBillNum(invbillnum); + + var settle = await _hbpoMng.GetMainAsync(inv.InvGroupNum); + + if (settle == null) + { + throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!"); + } + version = settle.Version; + if (inv != null) + { + if (inv.InvoiceState == InvoiceBillState.报废) + { + throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!"); + } + if (inv.State == SettleBillState.商务已审核 || inv.State == SettleBillState.已开票) + { + throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!"); + } + + var bbaclist = await _hbpoMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件 + //var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细 + if (adjlist != null && adjlist.Count() > 0) + { + foreach (var itm in adjlist) + { + bbaclist.Add(new HBPO_CAN_SA_DETAIL( + guid: itm.Id, + keyCode: itm.KeyCode, + version: itm.Version, + billNum: itm.InvGroupNum, + settleBillNum: itm.SettleBillNum, + lU: itm.LU, + pN: itm.PN, + site: itm.Site, + qty: itm.Qty, + price: itm.Price, + businessType: itm.BusinessType, + + settleDate: itm.SettleDate, + groupNum: itm.GroupNum, + invGroupNum: itm.InvGroupNum, + + invbillnum: string.Empty, + partcode: itm.PartCode + )); + } + } + var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据 + var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); + + var priceList = _priceRepository.ToList();//价格单 + //var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType); + //if (errorList.Count() > 0) + //{ + // return await ExportErrorReportAsync(errorList); + //} + var dto1s = ObjectMapper.Map, List>(entitys); + var q = from d in dto1s + join p in priceList on d.PartCode equals p.LU + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号 + select new TEMP_CAN_SA_DETAIL + { + Id = d.Id, + SettleBillNum = d.SettleBillNum, + Site = d.Site, + Version = d.Version, + Price = p.Price, + BillNum = d.BillNum, + SettleDate = d.SettleDate, + InvGroupNum = d.InvGroupNum, + LU = d.LU, + MaterialDesc = d.MaterialDesc, + PN = d.PN, + Qty = d.Qty, + GroupNum = d.GroupNum, + Amt = Math.Round(d.Qty * p.Price, 2), + ContractDocID = "N", + BeginDate = p.BeginTime, + EndDate = p.EndTime, + PartCode = d.PartCode + + }; + var dtos = q.ToList(); + if (dtos != null && dtos.Count > 0) + { + if (invbillnum.Substring(0, 3) == "INV")//一次开票重开 + { + var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum); + + ls = ObjectMapper.Map, List>(entities); + + + } + else//二次开票 + { + var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum); + ls = ObjectMapper.Map, List>(entities); + + } + } + } + else + { + throw new UserFriendlyException($"不存发票号为:{invbillnum}发票"); + } + //} + //else + //{ + // throw new UserFriendlyException($"不存发票号:{invbillnum}对应的结算分组号"); + //} + return ls; + + } + + + + + + } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs index 62c492dc..9212088a 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs @@ -15,6 +15,7 @@ using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Constant; +using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Temp; using Win.Sfs.SettleAccount.Entities.Prices; @@ -43,6 +44,138 @@ namespace Win.Sfs.SettleAccount.Entities.BQ } + /// + /// 提交发票 + /// + /// + /// + /// + /// + [HttpPost] + public virtual async Task ReissueInvoiceExtend(List p_list) + { + var first = p_list.FirstOrDefault(); + var invbillnum = first.InvBillNum; + + List ls = new List(); + var adjlist = ObjectMapper.Map, List>(p_list); + if (adjlist == null && adjlist.Count == 0) + { + throw new UserFriendlyException($"调整表无数据!"); + } + //var mappingList = await GetMapGroupAsync(p_invbillnum);//发票对应结算分组 + //if (mappingList != null && mappingList.Count() > 0) + //{ + var version = int.Parse(DateTime.Now.ToString("yyyymm")); + //var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组 + var inv = await GetInvoiceGroupByInvBillNum(invbillnum); + + var settle = await _pubMng.GetMainAsync(inv.InvGroupNum); + + if (settle == null) + { + throw new BusinessException("8989", $"选择发票:{invbillnum}对应的可结算单不在请检查!"); + } + version = settle.Version; + if (inv != null) + { + if (inv.InvoiceState == InvoiceBillState.报废) + { + throw new BusinessException("8989", $"选择发票:{invbillnum}状态为报废状态不能重开!"); + } + if (inv.State == SettleBillState.商务已审核 || inv.State == SettleBillState.已开票) + { + throw new BusinessException("8989", $"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前不能重开可以退回!"); + } + var publist = await _pubMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件 + //var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细 + if (adjlist != null && adjlist.Count() > 0) + { + foreach (var itm in adjlist) + { + publist.Add(new PUB_CAN_SA_DETAIL( + guid: GuidGenerator.Create(), + keyCode: itm.KeyCode, + version: itm.Version, + billNum: itm.InvGroupNum, + settleBillNum: itm.SettleBillNum, + lU: itm.LU, + pN: itm.PN, + site: itm.Site, + qty: itm.Qty, + price: itm.Price, + businessType: itm.BusinessType, + settleDate: itm.SettleDate, + groupNum: itm.GroupNum, + invGroupNum: itm.InvGroupNum, + invbillnum: string.Empty, + partcode: itm.PartCode + + + )); + } + } + var entitys = publist;//合并库存调整单和就发票可结算明细数据 + var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); + //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); + //var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算 + + var priceList = _priceRepository.ToList();//价格单 + var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType); + if (errorList.Count > 0) + { + return await ExportErrorReportAsync(errorList); + } + // var dto1s = ObjectMapper.Map, List>(entitys); + var q = from d in entitys + join p in priceList on d.PartCode equals p.LU + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime + select new TEMP_CAN_SA_DETAIL + { + SettleBillNum = d.SettleBillNum, + Site = d.Site, + Version = d.Version, + Price = p.Price, + BillNum = d.BillNum, + SettleDate = d.SettleDate, + InvGroupNum = d.InvGroupNum, + LU = d.LU, + // MaterialDesc = d.MaterialDesc, + PN = d.PN, + Qty = d.Qty, + GroupNum = d.GroupNum, + Amt = Math.Round(d.Qty * p.Price, 2), + ContractDocID = "n", + BeginDate = p.BeginTime, + EndDate = p.EndTime, + PartCode = d.PartCode + + }; + var dtos = q.ToList(); + if (dtos != null && dtos.Count > 0) + { + if (invbillnum.Substring(0, 3) == "INV")//一次开票重开 + { + await ReissueFirstInvoice(publist, adjlist, dtos, version, invbillnum); + } + else//二次开票 + { + await ReissueSecInvoice(publist, adjlist, dtos, version, invbillnum); + } + } + } + else + { + throw new BusinessException("8989", $"不存发票号为:{invbillnum}发票"); + } + //} + //else + //{ + // throw new BusinessException("8989", $"不存发票号:{p_invbillnum}对应的结算分组号"); + //} + return ApplicationConsts.SuccessStr; + } + @@ -55,11 +188,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ public override async Task ReissueInvoice(string p_invbillnum) { - var mappingList = await GetMapGroupAsync(p_invbillnum);//发票对应结算分组 - if (mappingList != null && mappingList.Count() > 0) - { + //var mappingList = await GetMapGroupAsync(p_invbillnum);//发票对应结算分组 + //if (mappingList != null && mappingList.Count() > 0) + //{ var version = int.Parse(DateTime.Now.ToString("yyyymm")); - var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组 + //var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组 var inv = await GetInvoiceGroupByInvBillNum(p_invbillnum); var settle = await _pubMng.GetMainAsync(inv.InvGroupNum); @@ -75,7 +208,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ { throw new BusinessException("8989", $"选择发票:{p_invbillnum}状态为报废状态不能重开!"); } - var publist = await _pubMng.GetContainsAsync(inv.InvbillNum, gList);//结算分组对应结算零件 + if (inv.State == SettleBillState.商务已审核 || inv.State == SettleBillState.已开票) + { + throw new BusinessException("8989", $"选择发票:{p_invbillnum}状态在财务审核后可以报废重开,之前不能重开可以退回!"); + } + var publist = await _pubMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件 var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细 if (adjlist != null && adjlist.Count() > 0) { @@ -156,12 +293,156 @@ namespace Win.Sfs.SettleAccount.Entities.BQ { throw new BusinessException("8989", $"不存发票号为:{p_invbillnum}发票"); } - } - else + //} + //else + //{ + // throw new BusinessException("8989", $"不存发票号:{p_invbillnum}对应的结算分组号"); + //} + return ApplicationConsts.SuccessStr; + } + [HttpPost] + /// 发票重开列表 + /// + /// + /// + public virtual async Task> ReissueInvoiceList(List p_list) + { + + var first=p_list.FirstOrDefault(); + var invbillnum=first.InvBillNum; + + List ls = new List(); + var adjlist = ObjectMapper.Map, List>(p_list); + if (adjlist == null && adjlist.Count == 0) { - throw new BusinessException("8989", $"不存发票号:{p_invbillnum}对应的结算分组号"); + throw new UserFriendlyException($"调整表无数据!"); } - return ApplicationConsts.SuccessStr; + + //var mappingList = await GetMapGroupAsync(invbillnum);//发票对应结算分组 + //if (mappingList != null && mappingList.Count() > 0) + //{ + var version = int.Parse(DateTime.Now.ToString("yyyymm")); + //var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组 + var inv = await GetInvoiceGroupByInvBillNum(invbillnum); + + var settle = await _pubMng.GetMainAsync(inv.InvGroupNum); + + if (settle == null) + { + throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!"); + } + version = settle.Version; + if (inv != null) + { + if (inv.InvoiceState == InvoiceBillState.报废) + { + throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!"); + } + if (inv.State == SettleBillState.商务已审核 || inv.State == SettleBillState.已开票) + { + throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!"); + } + + var bbaclist = await _pubMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件 + //var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细 + if (adjlist != null && adjlist.Count() > 0) + { + foreach (var itm in adjlist) + { + bbaclist.Add(new PUB_CAN_SA_DETAIL( + guid: itm.Id, + keyCode: itm.KeyCode, + version: itm.Version, + billNum: itm.InvGroupNum, + settleBillNum: itm.SettleBillNum, + lU: itm.LU, + pN: itm.PN, + site: itm.Site, + qty: itm.Qty, + price: itm.Price, + businessType: itm.BusinessType, + + settleDate: itm.SettleDate, + groupNum: itm.GroupNum, + invGroupNum: itm.InvGroupNum, + + invbillnum: string.Empty, + partcode: itm.PartCode + )); + } + } + var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据 + var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); + + var priceList = _priceRepository.ToList();//价格单 + //var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType); + //if (errorList.Count() > 0) + //{ + // return await ExportErrorReportAsync(errorList); + //} + var dto1s = ObjectMapper.Map, List>(entitys); + var q = from d in dto1s + join p in priceList on d.PartCode equals p.LU + where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号 + select new TEMP_CAN_SA_DETAIL + { + Id = d.Id, + SettleBillNum = d.SettleBillNum, + Site = d.Site, + Version = d.Version, + Price = p.Price, + BillNum = d.BillNum, + SettleDate = d.SettleDate, + InvGroupNum = d.InvGroupNum, + LU = d.LU, + MaterialDesc = d.MaterialDesc, + PN = d.PN, + Qty = d.Qty, + GroupNum = d.GroupNum, + Amt = Math.Round(d.Qty * p.Price, 2), + ContractDocID = "N", + BeginDate = p.BeginTime, + EndDate = p.EndTime, + PartCode = d.PartCode + + }; + var dtos = q.ToList(); + if (dtos != null && dtos.Count > 0) + { + if (invbillnum.Substring(0, 3) == "INV")//一次开票重开 + { + var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum); + + ls = ObjectMapper.Map, List>(entities); + + + } + else//二次开票 + { + var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum); + ls = ObjectMapper.Map, List>(entities); + + } + } + } + else + { + throw new UserFriendlyException($"不存发票号为:{invbillnum}发票"); + } + //} + //else + //{ + // throw new UserFriendlyException($"不存发票号:{invbillnum}对应的结算分组号"); + //} + return ls; + } + + + + + + + } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs index 2647e5d8..8087e393 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs @@ -253,7 +253,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers return await _detailRepository.Where(p =>p.InvbillNum== p_invbillnum && p_list.Contains(p.GroupNum)).ToListAsync(); } - + public virtual async Task> GetContainsAsync(string p_invbillnum) + { + return await _detailRepository.Where(p => p.InvbillNum == p_invbillnum).ToListAsync(); + } /// /// 通过发票号获取结算数据 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs index 44735d1a..a907f7fa 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs @@ -263,6 +263,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers return await _detailRepository.Where(p => p.InvbillNum == p_invbillnum && p_list.Contains(p.GroupNum)).ToListAsync(); } + /// + /// 获取发票对应结算分组所有零件 + /// + /// + /// + public virtual async Task> GetContainsAsync(string p_invbillnum) + { + return await _detailRepository.Where(p => p.InvbillNum == p_invbillnum).ToListAsync(); + } + + /// /// 通过发票号获取结算数据 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs index 9c57a9de..f1f17945 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs @@ -28,7 +28,7 @@ using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ.Managers { - public class INV_MNG : DomainService + public partial class INV_MNG : DomainService { //private readonly INormalEfCoreRepository _canRepository; private readonly INormalEfCoreRepository _repository; @@ -1385,6 +1385,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers ); invlist.Add(invbill); } + + + + + await _repository.DbContext.BulkInsertAsync(invlist); await _repository.DbContext.BulkInsertAsync(groupList); await _repository.DbContext.BulkInsertAsync(detailList); @@ -1900,10 +1905,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers switch (inv.BusinessType) { case EnumBusinessType.MaiDanJianHBPO: - invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true); + invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true); break; case EnumBusinessType.MaiDanJianBBAC: - invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true); + invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true); break; case EnumBusinessType.ZhiGongJianBBAC: invlist = await JITInvoice(p_list, p_adjlist, dtos, new List(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true);//重开可以变多张发票 @@ -1926,23 +1931,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers } - - - - - //if (inv.BusinessType == EnumBusinessType.MaiDanJianHBPO) - //{ - // invlist = await MakeInvoice(p_list,p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true); - //} - //if (inv.BusinessType == EnumBusinessType.BeiJian) - //{ - // invlist = await BJInvoice(p_list, p_adjlist, dtos, new List(), p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true); - //} - //else - //{ - // invlist = await FirstInvoice(p_list, p_adjlist, dtos, new List(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);//重开可以变多张发票 - //} - if (invlist.Count == 0) { return false; @@ -2239,10 +2227,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers switch (inv.BusinessType) { case EnumBusinessType.MaiDanJianHBPO: - invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, false); + invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, false); break; case EnumBusinessType.MaiDanJianBBAC: - invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, false); + invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, false); break; case EnumBusinessType.ZhiGongJianBBAC: invlist = await JITInvoice(p_list, p_adjlist, dtos, new List(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType,false);//重开可以变多张发票 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs new file mode 100644 index 00000000..e9af0582 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs @@ -0,0 +1,1284 @@ +using EFCore.BulkExtensions; +using EmptyFiles; +using Hangfire; +using Microsoft.AspNetCore.SignalR; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.EntityFrameworkCore; +using NPOI.SS.Formula.Functions; +using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; +using SettleAccount.Bases; +using SettleAccount.Domain.BQ; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Security.Policy; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Auditing; +using Volo.Abp.Data; +using Volo.Abp.Domain.Entities; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Domain.Services; +using Win.Sfs.SettleAccount.Bases; +using Win.Sfs.SettleAccount.Entities.BQ.Temp; +using Win.Sfs.SettleAccount.Entities.Prices; +using Win.Sfs.Shared.RepositoryBase; + +namespace Win.Sfs.SettleAccount.Entities.BQ.Managers +{ + public partial class INV_MNG : DomainService + { + + + /// + /// hbpo、jit、备件等 + /// + /// 可结算明细列表 + /// 版本号 + /// 发票分组 + /// 原发票号 + public async Task> SecInvoiceExtend(List p_list, List p_ajdlist, List dtos, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType) + where TDetail : SA_CAN_BASE + + { + var detailList = new List(); + List _invls = new List(); + var groups1 = dtos.GroupBy(p => new {p.PartCode, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV + { + PartCode=p.Key.PartCode, + LU = p.Key.LU, + Amt = p.Sum(itm => itm.Amt), + Qty = p.Sum(itm => itm.Qty), + ContractDocID = p.Key.ContractDocID, + Price = p.Key.Price, + BeginDate = p.Key.BeginDate, + EndDate = p.Key.EndDate + }).ToList();//汇总记录不出现重复值 + var groups = dtos.GroupBy(p => new {p.PartCode, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV + { + PartCode = p.Key.PartCode, + LU = p.Key.LU, + Amt = p.Sum(itm => itm.Amt), + Qty = p.Sum(itm => itm.Qty), + Price = p.Key.Price, + ContractDocID = p.Key.ContractDocID, + BeginDate = p.Key.BeginDate, + EndDate = p.Key.EndDate + }).ToList();//汇总记录不出现重复值 + Dictionary> invoiceMap = new Dictionary>();//发票和发票明细关系 + foreach (var group in groups) + { + int i = groups1.Count(p => p.LU == group.LU + && p.PartCode==group.PartCode + && p.BeginDate == group.BeginDate + && p.EndDate == group.EndDate + && p.ContractDocID == group.ContractDocID + ); + if (i > 0) + { + string invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("CINV"); + List tempList = new List(); + decimal sum = group.Amt;//初始合计金额 + int partCount = 0; + foreach (var group1 in groups1) + { + if (group.LU == group1.LU + && group.PartCode == group1.PartCode + && group.BeginDate == group1.BeginDate + && group.EndDate == group1.EndDate + && group1.ContractDocID == group.ContractDocID + ) + { + tempList.Add(group1); + partCount++;//符合条件加入到零件中 + continue; + } + partCount++; + if (partCount > 30) + { + continue; + } + if (sum > 10000000) + { + break; + } + sum += group1.Amt; + tempList.Add(group1); + } + invoiceMap.Add(invoiceBillNum, tempList); + var query = from itm in groups1 //更新分组 + join itm1 in tempList + on new { itm.LU, itm.BeginDate, itm.EndDate, itm.ContractDocID ,itm.PartCode} + equals new { itm1.LU, itm1.BeginDate, itm1.EndDate, itm1.ContractDocID,itm1.PartCode } into temp + from tm in temp + where tm == null + select new TMEP_INV + { + LU = itm.LU, + Amt = itm.Amt, + Qty = itm.Qty, + BeginDate = itm.BeginDate, + ContractDocID = itm.ContractDocID, + EndDate = itm.EndDate + }; + groups1 = query.ToList(); + } + } + if (invoiceMap.Count > 0) + { + + var groupList = new List(); + var notDetialList = new List(); + + var invlist = new List(); + var salist = new List(); + var adjlist = new List(); + foreach (var group in invoiceMap) + { + var key = group.Key;//发票票号 + var ls = group.Value;//发票明细 + + //反向查找结算数据 + var query = from itm in dtos + join itm1 in ls + on new { itm.LU,itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU,itm1.PartCode, itm1.BeginDate, itm1.EndDate } + join itm2 in p_list on new { itm.PartCode,itm.PN, itm.SettleDate } equals new { itm2.PartCode,itm2.PN, itm2.SettleDate } + select itm2; + foreach (var itm in query) + { + itm.InvbillNum = key; + salist.Add(itm); + } + if (!string.IsNullOrEmpty(p_parentInvBillNum)) + { + //反向查找调整数据 + var query1 = from itm in dtos + join itm1 in ls + on new { itm.LU,itm.PartCode ,itm.BeginDate, itm.EndDate } equals new { itm1.LU,itm1.PartCode, itm1.BeginDate, itm1.EndDate } + join itm2 in p_ajdlist on new { itm.PartCode, itm.PN, itm.SettleDate } equals new { itm2.PartCode, itm2.PN, itm2.SettleDate } + select itm2; + + foreach (var itm in query1) + { + itm.InvBillNum = key; + adjlist.Add(itm); + } + + } + + List < INVOICE_WAIT_DETAIL > _entityDetailList = new List(); + foreach (var detail in ls) + { + _entityDetailList.Add( + new INVOICE_WAIT_DETAIL( + guid: GuidGenerator.Create(), + version: p_version, + invbillNum: key, + invGroupNum: p_InvGroupNum, + lU: detail.LU, + qty: detail.Qty, + bussiessType: businessType, + amt: detail.Amt, + pRICE: detail.Price, + extend1: string.Empty, + extend2: string.Empty, + beginDate: detail.BeginDate, + endDate: detail.EndDate, + partcode:detail.PartCode + )); + } + if (_entityDetailList.Count > 0) + { + detailList.AddRange(_entityDetailList); + } + decimal amt = detailList.Sum(k => k.Amt); + decimal txtAmt = Math.Round(detailList.Sum(k => k.Amt), 2); + + var contractList = ls.Select(p => p.ContractDocID).Distinct(); + var _groupList = dtos.Where(p => contractList.Contains(p.ContractDocID)).GroupBy(p => new { p.GroupNum }) + .Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }).Distinct(); + //var _groupList = dtos.GroupBy(p => new { p.GroupNum }) + // .Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }).Distinct(); + List group1 = new List(); + + foreach (var en in _groupList) + { + group1.Add( + new INVOICE_MAP_GROUP( + guid: GuidGenerator.Create(), + version: p_version, + invbillNum: key, + invGroupNum: p_InvGroupNum, + settleGroupNum: en.GroupNum, + amt: en.Amt, + extend1: string.Empty, + extend2: string.Empty)); + } + if (group1.Count > 0) + { + groupList.AddRange(group1); + } + + var invbill = new INVOICE_GRP + (guid: GuidGenerator.Create(), + realnvBillNum: string.Empty, + invbillNum: key, + amt: amt, + taxAmt: txtAmt, + fileName: string.Empty, + businessType: businessType, + invGroupNum: p_InvGroupNum, + state: SettleBillState.已开票, + invoiceBillState: InvoiceBillState.正常, + tax: 0, + parent: p_parentInvBillNum, + preTaxDiff: 0, + taxDiff: 0, + clientCode: string.Empty, + realAmt: 0 + ); + invlist.Add(invbill); + } + + + //await _repository.DbContext.BulkInsertAsync(invlist); + //await _repository.DbContext.BulkInsertAsync(groupList); + //await _repository.DbContext.BulkInsertAsync(detailList); + //if(salist.Count>0) + //{ + // await _repository.DbContext.BulkUpdateAsync(salist); + //} + //if (adjlist.Count > 0) + //{ + // await _repository.DbContext.BulkUpdateAsync(adjlist); + //} + + //await _repository.DbContext.BulkInsertAsync(notDetialList); + //_invls = invlist.Select(p => p.InvbillNum).ToList(); + } + return detailList; + + } + + public async Task> FirstInvoiceExtend(List p_list, List p_adjlist, List dtos, List p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType) + where TDetail : SA_CAN_BASE + { + List _invls = new List(); + var detailList = new List(); + var _query = dtos.GroupBy(p => new { p.GroupNum }).Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }); + Dictionary dic = new Dictionary();//原本 + Dictionary copyDic = new Dictionary();//变换数组副本 + foreach (var itm in _query.ToList()) + { + dic.Add(itm.GroupNum, itm.Amt); + copyDic.Add(itm.GroupNum, itm.Amt); + } + Dictionary> invoiceMap = new Dictionary>(); + foreach (var itm in dic) + { + string invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("INV"); + List invoiceGroupNumList = new List();//每个发票对应的结算分组号 + List List = new List(); + decimal sum = itm.Value;//初始分组合计金额 + // List luList = dtos.Where(p => p.GroupNum == itm.Key).Select(p => p.LU).Distinct().ToList(); //初始LU种类 + if (copyDic.ContainsKey(itm.Key) == true)//是否存在分组 + { + foreach (var _itm1 in copyDic) + { + if (itm.Key == _itm1.Key)//相同结算分组项不计算,已初始化 + { + invoiceGroupNumList.Add(itm.Key); + continue; + } + //var grouplist = dtos.Where(p => p.GroupNum == _itm1.Key).Select(p => p.LU).Distinct().ToList();//每项LU种类 + //luList.AddRange(grouplist); + //luList = luList.Distinct().ToList(); + //if (luList.Count > 20)//累加零件不超过20种 + //{ + // continue; + //} + sum += _itm1.Value; + if (sum > 10000000) + { + break; + } + invoiceGroupNumList.Add(_itm1.Key);//所有条件都满足添加发票和结算分组对应关系 + } + invoiceMap.Add(invoiceBillNum, invoiceGroupNumList);//记录发票对应关系 + foreach (var rem in invoiceGroupNumList)//移除 + { + copyDic.Remove(rem); + } + } + } + if (invoiceMap.Keys.Count > 0) + { + + var groupList = new List(); + var notDetialList = new List(); + + var invlist = new List(); + var salist = new List(); + var adjlist = new List(); + + foreach (var itm in invoiceMap)//分组影响和 + { + var key = itm.Key;//发票票号 + var ls = itm.Value;//结算分组号列表 + //反向查找结算数据 + var invdetails = p_list.Where(p => ls.Contains(p.GroupNum)).ToList(); + foreach (var detail in invdetails) + { + detail.InvbillNum = key; + salist.Add(detail); + } + if (!string.IsNullOrEmpty(p_parentInvBillNum)) + { + //反向查找调整数据 + var adjdetails = p_adjlist.Where(p => ls.Contains(p.GroupNum)).ToList(); + foreach (var detail in adjdetails) + { + detail.InvBillNum = key; + adjdetails.Add(detail); + } + } + + var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }) + .Select(itm => new + { + PartCode = itm.Key.PartCode, + InvGroupNum = itm.Key.InvGroupNum, + LU = itm.Key.PartCode, + ContactDocID = itm.Key.ContractDocID, + Price = itm.Key.Price, + Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2), + Qty = itm.Sum(k => k.Qty), + BeginDate = itm.Key.BeginDate, + EndDate = itm.Key.EndDate + }) + .ToList(); + decimal amt = detailDtos.Sum(k => k.Amt); + decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); + var mapList = new List(); + foreach (var groupnum in ls) + { + mapList.Add(new INVOICE_MAP_GROUP( + guid: GuidGenerator.Create(), + version: p_version, + invbillNum: key, + invGroupNum: p_InvGroupNum, + settleGroupNum: groupnum, + amt: 0, + extend1: string.Empty, + extend2: string.Empty + ) + ); + } + if (mapList.Count > 0) + { + groupList.AddRange(mapList); + } + List _entityDetailList = new List(); + foreach (var detail in detailDtos) + { + _entityDetailList.Add( + new INVOICE_WAIT_DETAIL( + guid: GuidGenerator.Create(), + version: p_version, + invbillNum: key, + invGroupNum: p_InvGroupNum, + lU: detail.LU, + qty: detail.Qty, + bussiessType: businessType, + amt: detail.Amt, + pRICE: detail.Price, + extend1: string.Empty, + extend2: string.Empty, + beginDate: detail.BeginDate, + endDate: detail.EndDate, + partcode: detail.PartCode + )); + } + if (_entityDetailList.Count > 0) + { + detailList.AddRange(_entityDetailList); + } + var innotls = new List(); + if (p_notlist != null && p_notlist.Count > 0) + { + var notls = p_notlist.GroupBy(p => new { p.GroupNum, p.LU }).Select(p => new { GroupNum = p.Key.GroupNum, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty) }); + foreach (var nitm in notls) + { + innotls.Add(new INVOICE_NOT_SETTLE( + guid: GuidGenerator.Create(), + version: p_version, + invGroupNum: p_InvGroupNum, + settleGroupNum: nitm.GroupNum, + lU: string.Empty, + lU1: nitm.LU, + extend1: string.Empty, + extend2: string.Empty, + qty: nitm.Qty + )); + } + if (innotls.Count > 0) + { + notDetialList.AddRange(innotls); + } + } + var invbill = new INVOICE_GRP + (guid: GuidGenerator.Create(), + realnvBillNum: string.Empty, + invbillNum: key, + amt: amt, + taxAmt: txtAmt, + fileName: string.Empty, + businessType: businessType, + invGroupNum: p_InvGroupNum, + state: SettleBillState.已开票, + invoiceBillState: InvoiceBillState.正常, + tax: 0, + parent: string.Empty, + preTaxDiff: 0, + taxDiff: 0, + clientCode: string.Empty, + realAmt: 0 + ); + invlist.Add(invbill); + } + //await _repository.DbContext.BulkInsertAsync(invlist); + //await _repository.DbContext.BulkInsertAsync(groupList); + //await _repository.DbContext.BulkInsertAsync(detailList); + + //if (salist.Count > 0) + //{ + // await _repository.DbContext.BulkUpdateAsync(salist); + //} + //if (adjlist.Count > 0) + //{ + // await _repository.DbContext.BulkUpdateAsync(adjlist); + //} + //if (notDetialList.Count > 0) + //{ + // await _repository.DbContext.BulkInsertAsync(notDetialList); + //} + //_invls = invlist.Select(p => p.InvbillNum).ToList(); + } + + return detailList; + } + /// + /// hbpojis + /// + /// 可结算明细列表 + /// 版本号 + /// 发票分组 + /// 原发票号 + public async Task> MakeInvoiceExtend(List details,List p_adjlist, List dtos, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType, bool p_first) where TDetail : SA_CAN_BASE + { + List _invls = new List(); + var detailList = new List(); + var groups1 = dtos.GroupBy(p => new { p.PartCode,p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV + { + PartCode=p.Key.PartCode, + LU = p.Key.LU, + Amt = p.Sum(itm => itm.Amt), + Qty = p.Sum(itm => itm.Qty), + ContractDocID = p.Key.ContractDocID, + Price = p.Key.Price, + BeginDate = p.Key.BeginDate, + EndDate = p.Key.EndDate + }).ToList();//汇总记录不出现重复值 + var groups = dtos.GroupBy(p => new {p.PartCode, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV + { + PartCode=p.Key.PartCode, + LU = p.Key.LU, + Amt = p.Sum(itm => itm.Amt), + Qty = p.Sum(itm => itm.Qty), + Price = p.Key.Price, + ContractDocID = p.Key.ContractDocID, + BeginDate = p.Key.BeginDate, + EndDate = p.Key.EndDate + }).ToList();//汇总记录不出现重复值 + Dictionary> invoiceMap = new Dictionary>();//发票和发票明细关系 + foreach (var group in groups) + { + int i = groups1.Count(p => p.LU == group.LU + && p.PartCode==group.PartCode + && p.BeginDate == group.BeginDate + && p.EndDate == group.EndDate + && p.ContractDocID == group.ContractDocID + ); + if (i > 0) + { + string invoiceBillNum = string.Empty; + if (p_first == true) + { + invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("INV"); + } + else + { + invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("CINV"); + } + List tempList = new List(); + decimal sum = group.Amt;//初始合计金额 + int partCount = 0; + foreach (var group1 in groups1) + { + if (group.LU == group1.LU + && group.BeginDate == group1.BeginDate + && group.EndDate == group1.EndDate + && group1.ContractDocID == group.ContractDocID + && group1.PartCode== group1.PartCode + ) + { + tempList.Add(group1); + partCount++;//符合条件加入到零件中 + continue; + } + partCount++; + if (partCount > 30) + { + continue; + } + if (sum > 10000000) + { + break; + } + sum += group1.Amt; + tempList.Add(group1); + } + invoiceMap.Add(invoiceBillNum, tempList);//每张发票的明细记录 + var query = from itm in groups1 + join itm1 in tempList + on new { itm.LU, itm.BeginDate, itm.EndDate, itm.ContractDocID ,itm.PartCode} + equals new { itm1.LU, itm1.BeginDate, itm1.EndDate, itm1.ContractDocID,itm1.PartCode } into temp + from tm in temp + where tm == null + select new TMEP_INV + { + PartCode= itm.PartCode, + LU = itm.LU, + Amt = itm.Amt, + Qty = itm.Qty, + BeginDate = itm.BeginDate, + ContractDocID = itm.ContractDocID, + EndDate = itm.EndDate + }; + groups1 = query.ToList(); + } + } + if (invoiceMap.Count > 0) + { + var groupList = new List(); + var notDetialList = new List(); + + var invlist = new List(); + var salist = new List(); + var adjlist = new List(); + foreach (var group in invoiceMap) + { + var key = group.Key;//发票票号 + var ls = group.Value;//发票明细 + + //更新结算记录更新 + var query = from itm in dtos + join itm1 in ls + on new { LU=itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.BeginDate, itm1.EndDate } + join itm2 in details on new { itm.LU,itm.PartCode,itm.PN, itm.SettleDate } equals new { itm2.LU,itm2.PartCode,itm2.PN,itm2.SettleDate } + select itm2; + foreach (var itm in query) + { + itm.InvbillNum = key; + salist.Add(itm); + } + if (!string.IsNullOrEmpty(p_parentInvBillNum))//发票作废开票 + { + var query1 = from itm in dtos + join itm1 in ls + on new {LU= itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.BeginDate, itm1.EndDate } + join itm2 in p_adjlist on new { itm.LU, itm.SettleDate } equals new { itm2.LU, itm2.SettleDate } + select itm2; + + foreach (var itm in query1) + { + itm.InvBillNum = key; + adjlist.Add(itm); + } + } + + List _entityDetailList = new List(); + foreach (var detail in ls) + { + _entityDetailList.Add( + new INVOICE_WAIT_DETAIL( + guid: GuidGenerator.Create(), + version: p_version, + invbillNum: key, + invGroupNum: p_InvGroupNum, + lU: detail.LU, + qty: detail.Qty, + bussiessType: businessType, + amt: detail.Amt, + pRICE: detail.Price, + extend1: string.Empty, + extend2: string.Empty, + beginDate: detail.BeginDate, + endDate: detail.EndDate, + partcode:detail.PartCode + + )); + } + if (_entityDetailList.Count > 0) + { + detailList.AddRange(_entityDetailList); + } + decimal amt = detailList.Sum(k => k.Amt); + decimal txtAmt = Math.Round(detailList.Sum(k => k.Amt), 2); + + + + var invbill = new INVOICE_GRP + (guid: GuidGenerator.Create(), + realnvBillNum: string.Empty, + invbillNum: key, + amt: amt, + taxAmt: txtAmt, + fileName: string.Empty, + businessType: businessType, + invGroupNum: p_InvGroupNum, + state: SettleBillState.已开票, + invoiceBillState: InvoiceBillState.正常, + tax: 0, + parent: p_parentInvBillNum, + preTaxDiff:0, + taxDiff:0, + clientCode:string.Empty, + realAmt:0 + + ); + invlist.Add(invbill); + } + //await _repository.DbContext.BulkInsertAsync(invlist); + ////await _repository.DbContext.BulkInsertAsync(groupList); + //await _repository.DbContext.BulkInsertAsync(detailList); + //if (salist.Count > 0) + //{ + // await _repository.DbContext.BulkUpdateAsync(salist); + //} + //if (adjlist.Count > 0) + //{ + // await _repository.DbContext.BulkUpdateAsync(adjlist); + //} + //await _repository.DbContext.BulkInsertAsync(notDetialList); + //_invls = invlist.Select(p => p.InvbillNum).ToList(); + } + return detailList; + } + /// + /// 第一次开票 + /// + /// + /// + /// + /// + /// + /// + /// + public async Task> JITInvoiceExtend(List p_list,List p_adjlist, List dtos, List p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType,bool p_first) + where TDetail:SA_CAN_BASE + { + List _invls = new List(); + var detailList = new List(); + var _query = dtos.GroupBy(p => new { p.GroupNum }).Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }); + Dictionary dic = new Dictionary();//原本 + Dictionary copyDic = new Dictionary();//变换数组副本 + foreach (var itm in _query.ToList()) + { + dic.Add(itm.GroupNum, itm.Amt); + copyDic.Add(itm.GroupNum, itm.Amt); + } + Dictionary> invoiceMap = new Dictionary>(); + foreach (var itm in dic) + { + string invoiceBillNum = string.Empty; + if (p_first == true) + { + invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("INV"); + } + else + { + invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("CINV"); + } + + List invoiceGroupNumList = new List();//每个发票对应的结算分组号 + List List = new List(); + decimal sum = itm.Value;//初始分组合计金额 + // List luList = dtos.Where(p => p.GroupNum == itm.Key).Select(p => p.LU).Distinct().ToList(); //初始LU种类 + if (copyDic.ContainsKey(itm.Key) == true)//是否存在分组 + { + foreach (var _itm1 in copyDic) + { + if (itm.Key == _itm1.Key)//相同结算分组项不计算,已初始化 + { + invoiceGroupNumList.Add(itm.Key); + continue; + } + //var grouplist = dtos.Where(p => p.GroupNum == _itm1.Key).Select(p => p.LU).Distinct().ToList();//每项LU种类 + //luList.AddRange(grouplist); + //luList = luList.Distinct().ToList(); + //if (luList.Count > 20)//累加零件不超过20种 + //{ + // continue; + //} + sum += _itm1.Value; + if (sum > 10000000) + { + break; + } + invoiceGroupNumList.Add(_itm1.Key);//所有条件都满足添加发票和结算分组对应关系 + } + invoiceMap.Add(invoiceBillNum, invoiceGroupNumList);//记录发票对应关系 + foreach (var rem in invoiceGroupNumList)//移除 + { + copyDic.Remove(rem); + } + } + } + if (invoiceMap.Keys.Count > 0) + { + + var groupList = new List(); + var notDetialList = new List(); + + var invlist = new List(); + var salist = new List(); + var adjlist = new List(); + + foreach (var itm in invoiceMap)//分组影响和 + { + var key = itm.Key;//发票票号 + var ls = itm.Value;//结算分组号列表 + //反向查找结算数据 + var invdetails = p_list.Where(p => ls.Contains(p.GroupNum)).ToList(); + foreach (var detail in invdetails) + { + detail.InvbillNum = key; + salist.Add(detail); + } + if (!string.IsNullOrEmpty(p_parentInvBillNum)) + { + //反向查找调整数据 + var adjdetails = p_adjlist.Where(p => ls.Contains(p.GroupNum)).ToList(); + foreach (var detail in adjdetails) + { + detail.InvBillNum = key; + adjdetails.Add(detail); + } + } + + var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }) + .Select(itm => new + { + PartCode=itm.Key.PartCode, + InvGroupNum = itm.Key.InvGroupNum, + LU = itm.Key.PartCode, + ContactDocID = itm.Key.ContractDocID, + Price = itm.Key.Price, + Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2), + Qty = itm.Sum(k => k.Qty), + BeginDate = itm.Key.BeginDate, + EndDate = itm.Key.EndDate + }) + .ToList(); + decimal amt = detailDtos.Sum(k => k.Amt); + decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); + var mapList = new List(); + foreach (var groupnum in ls) + { + mapList.Add(new INVOICE_MAP_GROUP( + guid: GuidGenerator.Create(), + version: p_version, + invbillNum: key, + invGroupNum: p_InvGroupNum, + settleGroupNum: groupnum, + amt: 0, + extend1: string.Empty, + extend2: string.Empty + ) + ); + } + if (mapList.Count > 0) + { + groupList.AddRange(mapList); + } + List _entityDetailList = new List(); + foreach (var detail in detailDtos) + { + _entityDetailList.Add( + new INVOICE_WAIT_DETAIL( + guid: GuidGenerator.Create(), + version: p_version, + invbillNum: key, + invGroupNum: p_InvGroupNum, + lU: detail.LU, + qty: detail.Qty, + bussiessType: businessType, + amt: detail.Amt, + pRICE: detail.Price, + extend1: string.Empty, + extend2: string.Empty, + beginDate: detail.BeginDate, + endDate: detail.EndDate, + partcode:detail.PartCode + )); + } + if (_entityDetailList.Count > 0) + { + detailList.AddRange(_entityDetailList); + } + var innotls = new List(); + if (p_notlist != null && p_notlist.Count > 0) + { + var notls = p_notlist.GroupBy(p => new { p.GroupNum, p.LU }).Select(p => new { GroupNum = p.Key.GroupNum, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty) }); + foreach (var nitm in notls) + { + innotls.Add(new INVOICE_NOT_SETTLE( + guid: GuidGenerator.Create(), + version: p_version, + invGroupNum: p_InvGroupNum, + settleGroupNum: nitm.GroupNum, + lU: string.Empty, + lU1: nitm.LU, + extend1: string.Empty, + extend2: string.Empty, + qty: nitm.Qty + )); + } + if (innotls.Count > 0) + { + notDetialList.AddRange(innotls); + } + } + var invbill = new INVOICE_GRP + (guid: GuidGenerator.Create(), + realnvBillNum: string.Empty, + invbillNum: key, + amt: amt, + taxAmt: txtAmt, + fileName: string.Empty, + businessType: businessType, + invGroupNum: p_InvGroupNum, + state: SettleBillState.已开票, + invoiceBillState: InvoiceBillState.正常, + tax: 0, + parent: string.Empty, + preTaxDiff: 0, + taxDiff: 0, + clientCode: string.Empty, + realAmt: 0 + ); + invlist.Add(invbill); + } + //await _repository.DbContext.BulkInsertAsync(invlist); + //await _repository.DbContext.BulkInsertAsync(groupList); + //await _repository.DbContext.BulkInsertAsync(detailList); + + //if(salist.Count>0) + //{ + // await _repository.DbContext.BulkUpdateAsync(salist); + //} + //if (adjlist.Count > 0) + //{ + // await _repository.DbContext.BulkUpdateAsync(adjlist); + //} + //if (notDetialList.Count > 0) + //{ + // await _repository.DbContext.BulkInsertAsync(notDetialList); + //} + //_invls = invlist.Select(p => p.InvbillNum).ToList(); + } + + return detailList; + } + + /// + /// 重开一次开票 + /// + /// + /// + /// + /// + /// + public async Task> ReissueFirstInvoiceExtend(List p_list,List p_adjlist, List dtos, string p_OldInvBillNum, int p_version) + where TDetail:SA_CAN_BASE + { + List invlist = new List(); + if (!string.IsNullOrEmpty(p_OldInvBillNum)) + { + + var inv = await GetInvoiceAsync(p_OldInvBillNum); + if (inv == null) + { + + throw new UserFriendlyException( $"找不到选择要重开发票号{p_OldInvBillNum}不能重开"); + } + if (inv.InvoiceState == InvoiceBillState.报废) + { + throw new UserFriendlyException($"选择要重开发票号{p_OldInvBillNum}已经作废不能重开"); + } + inv.InvoiceState = InvoiceBillState.报废; + + + + switch (inv.BusinessType) + { + case EnumBusinessType.MaiDanJianHBPO: + invlist = await MakeInvoiceExtend(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true); + break; + case EnumBusinessType.MaiDanJianBBAC: + invlist = await MakeInvoiceExtend(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true); + break; + case EnumBusinessType.ZhiGongJianBBAC: + invlist = await JITInvoiceExtend(p_list, p_adjlist, dtos, new List(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true);//重开可以变多张发票 + break; + case EnumBusinessType.ZhiGongJianHBPO: + invlist = await JITInvoiceExtend(p_list, p_adjlist, dtos, new List(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true);//重开可以变多张发票 + break; + case EnumBusinessType.BeiJian: + invlist = await BJInvoiceExtend(p_list, p_adjlist, dtos, new List(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true); + break; + case EnumBusinessType.JisBBAC: + invlist = await FirstInvoiceExtend(p_list, p_adjlist, dtos, new List(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);//重开可以变多张发票 + break; + case EnumBusinessType.JisHBPO: + invlist = await FirstInvoiceExtend(p_list, p_adjlist, dtos, new List(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);//重开可以变多张发票 + break; + case EnumBusinessType.YinDuJian: + invlist = await JITInvoiceExtend(p_list, p_adjlist, dtos, new List(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true);//重开可以变多张发票 + break; + + } + + } + return invlist; + + + + } + + public async Task> BJInvoiceExtend(List p_list, List p_adjlist, List dtos, List p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType,bool p_first=true) + where TDetail : SA_CAN_BASE + { + List _invls = new List(); + var detailList = new List(); + var _query = dtos.GroupBy(p => new { p.GroupNum }).Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }); + Dictionary dic = new Dictionary();//原本 + Dictionary copyDic = new Dictionary();//变换数组副本 + foreach (var itm in _query.ToList()) + { + dic.Add(itm.GroupNum, itm.Amt); + copyDic.Add(itm.GroupNum, itm.Amt); + } + Dictionary> invoiceMap = new Dictionary>(); + foreach (var itm in dic) + { + string invoiceBillNum = string.Empty; + if (p_first == true) + { + invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("INV"); + } + else + { + invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("CINV"); + } + + List invoiceGroupNumList = new List();//每个发票对应的结算分组号 + List List = new List(); + decimal sum = itm.Value;//初始分组合计金额 + // List luList = dtos.Where(p => p.GroupNum == itm.Key).Select(p => p.LU).Distinct().ToList(); //初始LU种类 + if (copyDic.ContainsKey(itm.Key) == true)//是否存在分组 + { + foreach (var _itm1 in copyDic) + { + if (itm.Key == _itm1.Key)//相同结算分组项不计算,已初始化 + { + invoiceGroupNumList.Add(itm.Key); + continue; + } + //var grouplist = dtos.Where(p => p.GroupNum == _itm1.Key).Select(p => p.LU).Distinct().ToList();//每项LU种类 + //luList.AddRange(grouplist); + //luList = luList.Distinct().ToList(); + //if (luList.Count > 20)//累加零件不超过20种 + //{ + // continue; + //} + sum += _itm1.Value; + if (sum > 10000000) + { + break; + } + invoiceGroupNumList.Add(_itm1.Key);//所有条件都满足添加发票和结算分组对应关系 + } + invoiceMap.Add(invoiceBillNum, invoiceGroupNumList);//记录发票对应关系 + foreach (var rem in invoiceGroupNumList)//移除 + { + copyDic.Remove(rem); + } + } + } + if (invoiceMap.Keys.Count > 0) + { + + var groupList = new List(); + var notDetialList = new List(); + + var invlist = new List(); + var salist = new List(); + var adjlist = new List(); + + foreach (var itm in invoiceMap)//分组影响和 + { + var key = itm.Key;//发票票号 + var ls = itm.Value;//结算分组号列表 + //反向查找结算数据 + var invdetails = p_list.Where(p => ls.Contains(p.GroupNum)).ToList(); + foreach (var detail in invdetails) + { + detail.InvbillNum = key; + salist.Add(detail); + } + if (!string.IsNullOrEmpty(p_parentInvBillNum)) + { + //反向查找调整数据 + var adjdetails = p_adjlist.Where(p => ls.Contains(p.GroupNum)).ToList(); + foreach (var detail in adjdetails) + { + detail.InvBillNum = key; + adjdetails.Add(detail); + } + } + + var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }) + .Select(itm => new + { + PartCode = itm.Key.PartCode, + InvGroupNum = itm.Key.InvGroupNum, + LU = itm.Key.PartCode, + ContactDocID = itm.Key.ContractDocID, + Price = itm.Key.Price, + Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2), + Qty = itm.Sum(k => k.Qty), + BeginDate = itm.Key.BeginDate, + EndDate = itm.Key.EndDate + }) + .ToList(); + + var query = from inv1 in invdetails + join dto1 in dtos on + new { inv1.LU, inv1.PN } equals new { dto1.LU, dto1.PN } + select new + { + PartCode = inv1.PartCode, + InvGroupNum = inv1.InvGroupNum, + LU = inv1.LU, + GroupNum=inv1.GroupNum, + Price = inv1.Price, + Amt = dto1.Amt, + Qty = dto1.Qty, + BeginDate = dto1.BeginDate, + EndDate = dto1.EndDate, + DeliveryNumber = inv1.GetProperty("DeliveryNumber", ""),//交货号 + InvoiceNumber = inv1.GetProperty("InvoiceNumber", ""),//发票号 + VendorCode = inv1.GetProperty("VendorCode", ""),//供应商代码 + VendorName = inv1.GetProperty("VendorName", ""),//供应商名称 + PurchaseOrderNumber = inv1.GetProperty("PurchaseOrderNumber", ""),//采购订单号 + DeliveryIndexNumber = inv1.GetProperty("DeliveryIndexNumber", ""),//交付索引号 + PartName = inv1.GetProperty("PartName", ""),//零件名称 + }; + + decimal amt = detailDtos.Sum(k => k.Amt); + decimal txtAmt = Math.Round(detailDtos.Sum(k => k.Amt), 2); + var mapList = new List(); + foreach (var groupnum in ls) + { + mapList.Add(new INVOICE_MAP_GROUP( + guid: GuidGenerator.Create(), + version: p_version, + invbillNum: key, + invGroupNum: p_InvGroupNum, + settleGroupNum: groupnum, + amt: 0, + extend1: string.Empty, + extend2: string.Empty + ) + ); + } + if (mapList.Count > 0) + { + groupList.AddRange(mapList); + } + List _entityDetailList = new List(); + foreach (var detail in query.ToList()) + { + + var entity = new INVOICE_WAIT_DETAIL( + guid: GuidGenerator.Create(), + version: p_version, + invbillNum: key, + invGroupNum: p_InvGroupNum, + lU: detail.LU, + qty: detail.Qty, + bussiessType: businessType, + amt: detail.Amt, + pRICE: detail.Price, + extend1: detail.GroupNum, + extend2: string.Empty, + beginDate: detail.BeginDate, + endDate: detail.EndDate, + partcode: detail.PartCode); + entity.SetProperty("DeliveryNumber", detail.DeliveryIndexNumber);//交货号 + entity.SetProperty("VendorCode", detail.VendorCode);//供应商代码 + entity.SetProperty("VendorName", detail.VendorName);//供应商名称 + entity.SetProperty("PurchaseOrderNumber", "");//采购订单号 + entity.SetProperty("DeliveryIndexNumber", "");//交付索引号 + entity.SetProperty("PartName", "");//零件名称 + + _entityDetailList.Add( entity + + ); + } + if (_entityDetailList.Count > 0) + { + detailList.AddRange(_entityDetailList); + } + //var innotls = new List(); + //if (p_notlist != null && p_notlist.Count > 0) + //{ + // var notls = p_notlist.GroupBy(p => new { p.GroupNum, p.LU }).Select(p => new { GroupNum = p.Key.GroupNum, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty) }); + // foreach (var nitm in notls) + // { + // innotls.Add(new INVOICE_NOT_SETTLE( + // guid: GuidGenerator.Create(), + // version: p_version, + // invGroupNum: p_InvGroupNum, + // settleGroupNum: nitm.GroupNum, + // lU: string.Empty, + // lU1: nitm.LU, + // extend1: string.Empty, + // extend2: string.Empty, + // qty: nitm.Qty + // )); + // } + // if (innotls.Count > 0) + // { + // notDetialList.AddRange(innotls); + // } + //} + var invbill = new INVOICE_GRP + (guid: GuidGenerator.Create(), + realnvBillNum: string.Empty, + invbillNum: key, + amt: amt, + taxAmt: txtAmt, + fileName: string.Empty, + businessType: businessType, + invGroupNum: p_InvGroupNum, + state: SettleBillState.已开票, + invoiceBillState: InvoiceBillState.正常, + tax: 0, + parent: string.Empty, + preTaxDiff: 0, + taxDiff: 0, + clientCode: string.Empty, + realAmt: 0 + ); + invlist.Add(invbill); + } + //await _repository.DbContext.BulkInsertAsync(invlist); + //await _repository.DbContext.BulkInsertAsync(groupList); + //await _repository.DbContext.BulkInsertAsync(detailList); + + //if (salist.Count > 0) + //{ + // await _repository.DbContext.BulkUpdateAsync(salist); + //} + //if (adjlist.Count > 0) + //{ + // await _repository.DbContext.BulkUpdateAsync(adjlist); + //} + //if (notDetialList.Count > 0) + //{ + // await _repository.DbContext.BulkInsertAsync(notDetialList); + //} + //_invls = invlist.Select(p => p.InvbillNum).ToList(); + } + + return detailList; + } + /// + /// 重开二次开票 + /// + /// + /// + /// + /// + /// + public async Task> ReissueSecInvoiceExtend(List p_list, List p_adjlist, List dtos, string p_OldInvBillNum, int p_version) + where TDetail : SA_CAN_BASE + { + List invlist = new List(); + if (!string.IsNullOrEmpty(p_OldInvBillNum)) + { + var inv = await GetInvoiceAsync(p_OldInvBillNum); + if (inv == null) + { + + throw new BusinessException("8989", $"找不到选择要重开发票号{p_OldInvBillNum}不能重开"); + } + if (inv.InvoiceState == InvoiceBillState.报废) + { + throw new BusinessException("8989", $"选择要重开发票号{p_OldInvBillNum}已经作废不能重开"); + } + inv.InvoiceState = InvoiceBillState.报废; + + + + switch (inv.BusinessType) + { + case EnumBusinessType.MaiDanJianHBPO: + invlist = await MakeInvoiceExtend(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, false); + break; + case EnumBusinessType.MaiDanJianBBAC: + invlist = await MakeInvoiceExtend(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, false); + break; + case EnumBusinessType.ZhiGongJianBBAC: + invlist = await JITInvoiceExtend(p_list, p_adjlist, dtos, new List(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, false);//重开可以变多张发票 + break; + case EnumBusinessType.ZhiGongJianHBPO: + invlist = await JITInvoiceExtend(p_list, p_adjlist, dtos, new List(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, false);//重开可以变多张发票 + break; + case EnumBusinessType.BeiJian: + invlist = await BJInvoiceExtend(p_list, p_adjlist, dtos, new List(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, false); + break; + case EnumBusinessType.JisBBAC: + invlist = await SecInvoiceExtend(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType); + break; + case EnumBusinessType.JisHBPO: + invlist = await SecInvoiceExtend(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType); + break; + case EnumBusinessType.YinDuJian: + invlist = await JITInvoiceExtend(p_list, p_adjlist, dtos, new List(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, false);//重开可以变多张发票 + break; + + } + + + } + return invlist; + + } + } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_CAN_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_CAN_SA_MNG.cs index 3ee1cd84..6ae5ec15 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_CAN_SA_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_CAN_SA_MNG.cs @@ -255,6 +255,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers } + /// + /// 获取发票对应结算分组所有零件 + /// + /// + /// + public virtual async Task> GetContainsAsync(string p_invbillnum) + { + return await _detailRepository.Where(p => p.InvbillNum == p_invbillnum).ToListAsync(); + } + + /// /// 通过发票号获取结算数据 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Temp/TempClass.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Temp/TempClass.cs index 5837ceb3..99369b3e 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Temp/TempClass.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Temp/TempClass.cs @@ -5,6 +5,8 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using SettleAccount.Bases; +using SettleAccount.Domain.BQ; +using Volo.Abp.Application.Dtos; namespace Win.Sfs.SettleAccount.Entities.BQ.Temp; public class TMEP_INV @@ -27,6 +29,27 @@ public class TMEP_INV /// public DateTime EndDate { get; set; } } +public class INVOICE_GRP_DETAIL +{ + /// + /// 发票明细 + /// + public List INVOICE_DETAIL { get; set; } + /// + /// 发票和结算分组对应关系 + /// + public List INVOICE_MAP_GROUP { get; set; } + + /// + /// 发票调整明细 + /// + public List ADJ_DETAIL { get; set; } + +} + + + + public class TEMP_CAN_SA_DETAIL { From 701fa2ec1e63a191d0c7da0b44ac7f654a7ecbf6 Mon Sep 17 00:00:00 2001 From: mahao Date: Tue, 15 Aug 2023 13:49:39 +0800 Subject: [PATCH 2/3] =?UTF-8?q?EF=E8=BF=81=E7=A7=BBBBAC=E3=80=81HBPO?= =?UTF-8?q?=E5=8F=91=E8=BF=90=E6=95=B0=E6=8D=AE=E8=A1=A8=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/BQ/PUB_SA_SERVICE.cs | 1 - .../Entities/BQ/Syncs/BBACSeSyncAppService.cs | 26 +- .../Entities/BQ/Syncs/BeiSeSyncAppService.cs | 5 +- .../Entities/BQ/Syncs/HBPOSeSyncAppService.cs | 18 +- .../Entities/BQ/Syncs/JitSeSyncAppService.cs | 23 +- .../BQ/Syncs/YinDuSeSyncAppService.cs | 5 +- .../BQ/Syncs/ZhiGongBBACSeSyncAppService.cs | 5 +- .../BQ/Syncs/ZhiGongHBPOSeSyncAppService.cs | 5 +- ...ttleAccountApplicationAutoMapperProfile.cs | 21 +- .../Entities/BQ/BBAC_SE_DETAIL.cs | 199 +- .../Entities/BQ/HBPO_SE_DETAIL.cs | 201 +- .../Managers/MaterialRelationshipManager.cs | 42 + .../20230815054853_20230815-3.Designer.cs | 5503 +++++++++++++++++ .../Migrations/20230815054853_20230815-3.cs | 368 ++ .../SettleAccountDbContextModelSnapshot.cs | 98 +- 15 files changed, 6320 insertions(+), 200 deletions(-) create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/MaterialRelationshipManager.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815054853_20230815-3.Designer.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815054853_20230815-3.cs diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs index de1c8c62..9ff57b96 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs @@ -155,7 +155,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase [HttpPost] public async Task> GetListAsync(PUB_SARequestDto input) { - input.Filters.Add(new FilterCondition("BusinessType", input.BusinessType.ToString(), EnumFilterAction.Equal, EnumFilterLogic.And)); var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true); var totalCount = await _repository.GetCountByFilterAsync(input.Filters); var dtos = ObjectMapper.Map, List>(entities); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs index 66125ae7..d9df6905 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs @@ -8,8 +8,10 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; using Volo.Abp.Application.Services; +using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.EntityFrameworkCore; +using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; @@ -36,17 +38,29 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService /// private readonly INormalEfCoreRepository _bbacSeDetailRepository; + /// + /// 客户零件关系仓储 + /// + private readonly INormalEfCoreRepository _materialRelationshipRepository; + + /// + /// 客户零件关系领域 + /// + private readonly MaterialRelationshipManager _materialRelationshipManager; + /// /// 构造 /// public BBACSeSyncAppService( WMSBJBMPTDbContext wmsBJBMPTContext, INormalEfCoreRepository syncPositionFlagRepository, - INormalEfCoreRepository bbacSeDetailRepository) + INormalEfCoreRepository bbacSeDetailRepository, + MaterialRelationshipManager materialRelationshipManager) { _wmsBJBMPTContext = wmsBJBMPTContext; _syncPositionFlagRepository = syncPositionFlagRepository; _bbacSeDetailRepository = bbacSeDetailRepository; + _materialRelationshipManager = materialRelationshipManager; } [ApiExplorerSettings(IgnoreApi = true)] @@ -73,7 +87,7 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService var EnumDeliverSubBillTypes = GetDeliverSubBillTypes(); Expression> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType); - var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName); + var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName).ConfigureAwait(false); if (syncPositionFlag != null) { predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType); @@ -85,6 +99,10 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService var bbacSeDetails = ObjectMapper.Map, List>(wmsSeRecords); if (bbacSeDetails.Any()) { + //客户零件号和厂内零件号 + var materialRelationships = bbacSeDetails.GroupBy(t => new { t.LU, t.PartCode }).Select(t => new MaterialRelationship(GuidGenerator.Create(), t.Key.LU, "", t.Key.PartCode, "")); + await _materialRelationshipManager.AddNewMaterialRelationships(materialRelationships).ConfigureAwait(false); + bbacSeDetails.ForEach(bbacSeDetail => { bbacSeDetail.KeyCode = bbacSeDetail.PN + bbacSeDetail.LU; @@ -131,6 +149,10 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService var bbacSeDetails = ObjectMapper.Map, List>(wmsRecords); if (bbacSeDetails.Any()) { + //客户零件号和厂内零件号 + var materialRelationships = bbacSeDetails.GroupBy(t => new { t.LU, t.PartCode }).Select(t => new MaterialRelationship(GuidGenerator.Create(), t.Key.LU, "", t.Key.PartCode, "")); + await _materialRelationshipManager.AddNewMaterialRelationships(materialRelationships).ConfigureAwait(false); + bbacSeDetails.ForEach(bbacSeDetail => bbacSeDetail.KeyCode = bbacSeDetail.PN + bbacSeDetail.LU); await _bbacSeDetailRepository.InsertManyAsync(bbacSeDetails); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BeiSeSyncAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BeiSeSyncAppService.cs index 7f0e780f..01bba453 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BeiSeSyncAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BeiSeSyncAppService.cs @@ -4,8 +4,10 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; +using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.EntityFrameworkCore; +using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; @@ -24,8 +26,9 @@ public class BeiSeSyncAppService : JitSeSyncAppService, IJobService WMSBJBMPTDbContext wmsBJBMPTContext, INormalEfCoreRepository syncPositionFlagRepository, INormalEfCoreRepository pubSeDetailRepository, + MaterialRelationshipManager materialRelationshipManager, VmiAppService vmiService - ) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, vmiService) + ) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, materialRelationshipManager, vmiService) { base.SeSyncConfigInfo = new SeSyncConfig() { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs index 5934ffa8..0b4bf49d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs @@ -9,8 +9,10 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; using Volo.Abp.Application.Services; +using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.EntityFrameworkCore; +using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; @@ -42,6 +44,11 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService /// private readonly INormalEfCoreRepository _pubSeDetailRepository; + /// + /// 客户零件关系领域 + /// + private readonly MaterialRelationshipManager _materialRelationshipManager; + /// /// 构造 /// @@ -49,12 +56,14 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService WMSBJBMPTDbContext wmsBJBMPTContext, INormalEfCoreRepository syncPositionFlagRepository, INormalEfCoreRepository hbpoSeDetailRepository, - INormalEfCoreRepository pubSeDetailRepository) + INormalEfCoreRepository pubSeDetailRepository, + MaterialRelationshipManager materialRelationshipManager) { _wmsBJBMPTContext = wmsBJBMPTContext; _syncPositionFlagRepository = syncPositionFlagRepository; _hbpoSeDetailRepository = hbpoSeDetailRepository; _pubSeDetailRepository = pubSeDetailRepository; + _materialRelationshipManager = materialRelationshipManager; } [ApiExplorerSettings(IgnoreApi = true)] @@ -186,6 +195,13 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService /// private async Task SaveSeDataAsync(List hbpoSeDetails, List maiDanHBPOSeDetails) { + //客户零件号和厂内零件号 + var hbpoSeLuRePartCodes = hbpoSeDetails.Select(t => new { t.LU, t.PartCode }); + var maiDanHBPOSeLuRePartCodes = maiDanHBPOSeDetails.Select(t => new { t.LU, t.PartCode }); + var luRePartCodes = hbpoSeLuRePartCodes.Union(maiDanHBPOSeLuRePartCodes); + var materialRelationships = luRePartCodes.GroupBy(t => new { t.LU, t.PartCode }).Select(t => new MaterialRelationship(GuidGenerator.Create(), t.Key.LU, "", t.Key.PartCode, "")); + await _materialRelationshipManager.AddNewMaterialRelationships(materialRelationships).ConfigureAwait(false); + hbpoSeDetails.ForEach(hbpoSeDetail => hbpoSeDetail.KeyCode = hbpoSeDetail.PN + hbpoSeDetail.LU); maiDanHBPOSeDetails.ForEach(maiDanHBPOSeDetail => { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs index 93bb25d0..769a9307 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs @@ -7,9 +7,11 @@ using Coravel.Invocable; using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; using Volo.Abp.Application.Services; +using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.MaterialRelationships; +using Win.Sfs.Shared.CurrentBranch; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; @@ -36,9 +38,9 @@ public class JitSeSyncAppService : ApplicationService, IInvocable private readonly INormalEfCoreRepository _pubSeDetailRepository; /// - /// 客户零件关系仓储 + /// 客户零件关系领域 /// - private readonly INormalEfCoreRepository _materialRelationshipRepository; + private readonly MaterialRelationshipManager _materialRelationshipManager; private readonly IVmiService _vmiService; @@ -49,11 +51,13 @@ public class JitSeSyncAppService : ApplicationService, IInvocable WMSBJBMPTDbContext wmsBJBMPTContext, INormalEfCoreRepository syncPositionFlagRepository, INormalEfCoreRepository pubSeDetailRepository, + MaterialRelationshipManager materialRelationshipManager, VmiAppService vmiService) { _wmsBJBMPTContext = wmsBJBMPTContext; _syncPositionFlagRepository = syncPositionFlagRepository; _pubSeDetailRepository = pubSeDetailRepository; + _materialRelationshipManager = materialRelationshipManager; _vmiService = vmiService; } @@ -88,20 +92,15 @@ public class JitSeSyncAppService : ApplicationService, IInvocable var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_OTHER_RECORD.Where(predicate).OrderBy(b => b.UID).ToList(); var pubSeDetails = ObjectMapper.Map, List>(wmsSeRecords); - pubSeDetails.RemoveAll(t => !string.IsNullOrEmpty(t.LU) || !string.IsNullOrEmpty(t.PartCode)); + pubSeDetails.RemoveAll(t => string.IsNullOrEmpty(t.LU) || string.IsNullOrEmpty(t.PartCode)); if (pubSeDetails.Any()) { //客户零件号和厂内零件号 - var luRePartCodes = pubSeDetails.Select(t => new { t.LU, t.PartCode }); - - var haveLuRePartCodes = (await _materialRelationshipRepository.GetListAsync(t => luRePartCodes.Contains(new { LU = t.ErpMaterialCode, PartCode = t.SettleMaterialCode })).ConfigureAwait(false)).Select(t => new { LU = t.ErpMaterialCode, PartCode = t.SettleMaterialCode }); - - var noHaveLuRePartCodes = luRePartCodes.Except(haveLuRePartCodes); - - if (noHaveLuRePartCodes.Any()) + var luRePartCodes = pubSeDetails.Select(t => new { t.LU, t.PartCode }).Distinct().ToList(); + if (luRePartCodes.Any()) { - var materialRelationships = noHaveLuRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.LU, "", t.PartCode, "")); - await _materialRelationshipRepository.InsertManyAsync(materialRelationships).ConfigureAwait(false); + var materialRelationships = luRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.LU, "", t.PartCode, businessType.ToString())); + await _materialRelationshipManager.AddNewMaterialRelationships(materialRelationships).ConfigureAwait(false); } pubSeDetails.ForEach(t => diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs index b78f51fd..a39dbfcb 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs @@ -4,8 +4,10 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; +using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.EntityFrameworkCore; +using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; @@ -24,8 +26,9 @@ public class YinDuSeSyncAppService : JitSeSyncAppService, IJobService WMSBJBMPTDbContext wmsBJBMPTContext, INormalEfCoreRepository syncPositionFlagRepository, INormalEfCoreRepository pubSeDetailRepository, + MaterialRelationshipManager materialRelationshipManager, VmiAppService vmiService - ) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, vmiService) + ) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, materialRelationshipManager, vmiService) { base.SeSyncConfigInfo = new SeSyncConfig() { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongBBACSeSyncAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongBBACSeSyncAppService.cs index 3a2c28cb..819983f7 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongBBACSeSyncAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongBBACSeSyncAppService.cs @@ -4,8 +4,10 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; +using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.EntityFrameworkCore; +using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; @@ -24,8 +26,9 @@ public class ZhiGongBBACSeSyncAppService : JitSeSyncAppService, IJobService WMSBJBMPTDbContext wmsBJBMPTContext, INormalEfCoreRepository syncPositionFlagRepository, INormalEfCoreRepository pubSeDetailRepository, + MaterialRelationshipManager materialRelationshipManager, VmiAppService vmiService - ) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, vmiService) + ) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, materialRelationshipManager, vmiService) { base.SeSyncConfigInfo = new SeSyncConfig() { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongHBPOSeSyncAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongHBPOSeSyncAppService.cs index 02234922..4b520b64 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongHBPOSeSyncAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongHBPOSeSyncAppService.cs @@ -4,8 +4,10 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; +using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.EntityFrameworkCore; +using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; @@ -24,8 +26,9 @@ public class ZhiGongHBPOSeSyncAppService : JitSeSyncAppService, IJobService WMSBJBMPTDbContext wmsBJBMPTContext, INormalEfCoreRepository syncPositionFlagRepository, INormalEfCoreRepository pubSeDetailRepository, + MaterialRelationshipManager materialRelationshipManager, VmiAppService vmiService - ) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, vmiService) + ) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, materialRelationshipManager, vmiService) { base.SeSyncConfigInfo = new SeSyncConfig() { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs index 6fcd5af4..f9780bb9 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs @@ -1129,27 +1129,27 @@ namespace Win.Sfs.SettleAccount private void CreateMapSeSync() { CreateMap() - .ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum)) - .ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.RealPartCode)) - .ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.DeliverCode)) - .ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime)) + .ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.Seq)) + .ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.MatchNumber)) + .ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.UniqueCode)) + .ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData)) .ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime)) .ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum)) .ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode)) .ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode)) .ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty)); CreateMap() - .ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum)) - .ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.RealPartCode)) - .ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.DeliverCode)) - .ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime)) + .ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.Seq)) + .ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.MatchNumber)) + .ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.UniqueCode)) + .ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData)) .ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime)) .ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum)) .ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode)) .ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode)) .ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty)); CreateMap() - .ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime)) + .ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData)) .ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime)) .ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum)) .ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode)) @@ -1188,7 +1188,8 @@ namespace Win.Sfs.SettleAccount .ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData)) .ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime)) .ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum)) - .ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode)) + //.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode)) + .ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode)) .ForMember(x => x.PN, y => y.MapFrom(d => d.BillNum)) .ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty)); } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs index 8e7ca83d..3dc4d02e 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs @@ -1,7 +1,9 @@ using System; +using System.ComponentModel; using System.ComponentModel.DataAnnotations; using SettleAccount.Bases; using Win.Sfs.SettleAccount; +using Win.Sfs.SettleAccount.Entities.BQ.Syncs; namespace SettleAccount.Domain.BQ; @@ -46,157 +48,196 @@ public class BBAC_SE_DETAIL:SE_BASE //[Display(Name = "Wms发货单号")] //public string WmsBillNum { get; set; } = null!; - /// - /// 单据编号 + /// JIT订单号 /// - [Display(Name = "单据编号")] - public string Num { get; set; } - + [Display(Name = "JIT订单号")] + [DisplayName("JIT订单号")] + public string JISNum { get; set; } /// - /// 发货时间 + /// JIT排序生产码 /// - [Display(Name = "发货时间")] - public DateTime BillTime { get; set; } - + [Display(Name = "JIT排序生产码")] + public string VinCode { get; set; } /// - /// 发货人 + /// JIT排序生产码类型 /// - [Display(Name = "发货人")] - public string Oper { get; set; } - + [Display(Name = "JIT排序生产码类型")] + public string CodeType { get; set; } /// - /// 排序单号 + /// 订单零件号 /// - [Display(Name = "排序单号")] - public string OrderNum { get; set; } - + [Display(Name = "订单零件号")] + public string PartCode { get; set; } + /// + /// 订单零件号 + /// + [Display(Name = "订单零件号")] + public string RealPartCode { get; set; } + /// + /// 批次 + /// + [Display(Name = "批次")] + public string Batch { get; set; } + /// + /// 客户零件号 + /// + [Display(Name = "客户零件号")] + public string CustPartCode { get; set; } /// /// 订单序号 /// [Display(Name = "订单序号")] public string Seq { get; set; } - /// - /// 实际生产码 + /// 订单时间 /// - [Display(Name = "实际生产码")] - public string RealCode { get; set; } - + [Display(Name = "订单时间")] + public DateTime AssembleData { get; set; } /// - /// 订单生产码 + /// 发货条码 /// - [Display(Name = "订单生产码")] - public string VinCode { get; set; } - + [Display(Name = "发货条码")] + public string DeliverCode { get; set; } /// - /// 生产码类型 + /// 发货单号 /// - [Display(Name = "生产码类型")] - public string CodeType { get; set; } - + [Display(Name = "发货单号")] + public string BillNum { get; set; } /// - /// 实际零件号 + /// 发货时间 /// - [Display(Name = "实际零件号")] - public string RealPartCode { get; set; } - + [Display(Name = "发货时间")] + public DateTime? BillTime { get; set; } /// - /// 零件号 + /// 发货人 /// - [Display(Name = "零件号")] - public string PartCode { get; set; } - + [Display(Name = "发货人")] + public string Oper { get; set; } /// - /// 批次 + /// 客户位置 /// - [Display(Name = "批次")] - public string Batch { get; set; } - + [Display(Name = "客户位置")] + public string Position { get; set; } + /// + /// 工厂 + /// + [Display(Name = "工厂")] + public string Factory { get; set; } /// /// MES配置码 /// [Display(Name = "MES配置码")] public string MESConfigCode { get; set; } - - /// - /// 来源库位 - /// - [Display(Name = "来源库位")] - public string FromLoc { get; set; } - /// /// 目标库位 /// [Display(Name = "目标库位")] public string ToLoc { get; set; } - /// - /// 参照订单生产码 + /// 单据类型 /// - [Display(Name = "参照订单生产码")] - public string RefVinCode { get; set; } - + public EnumBillType BillType { get; set; } /// - /// 单据性质 + /// 子单据类型 /// - [Display(Name = "单据性质")] - public string BillCharacter { get; set; } - + [Display(Name = "子单据类型")] + public EnumSubBillType SubBillType { get; set; } /// - /// 发货关联单号 + /// 事务类型 /// - [Display(Name = "发货关联单号")] - public string RefBillNum { get; set; } - + [Display(Name = "事务类型")] + public EnumDelTransType TransType { get; set; } /// - /// Erp目标库位 + /// 发运主类型 /// - [Display(Name = "Erp目标库位")] - public string ErpToLoc { get; set; } - + [Display(Name = "发运主类型")] + public EnumDeliverBjBmpBillType DeliverBillType { get; set; } + /// + /// 发运子类型 + /// + [Display(Name = "发运子类型")] + public EnumDeliverSubBillType DeliverSubBillType { get; set; } + /// + /// 单据性质 + /// + [Display(Name = "单据性质")] + public string BillCharacter { get; set; } /// /// 原生产码 /// [Display(Name = "原生产码")] public string OrigiCode { get; set; } - + /// + /// 描述 + /// + [Display(Name = "描述")] + public string PartDesc { get; set; } /// /// 备注 /// [Display(Name = "备注")] public string Remark { get; set; } - + /// + /// 业务类型 + /// + [Display(Name = "业务类型")] + public EnumProTpe ProType { get; set; } + /// + /// JIS排序单号 + /// + [Display(Name = "JIS排序单号")] + public string OrderNum { get; set; } + /// + /// JIS实际生产码 + /// + [Display(Name = "JIS实际生产码")] + public string RealCode { get; set; } + /// + /// 来源库位 + /// + [Display(Name = "来源库位")] + public string FromLoc { get; set; } + /// + /// 参照订单生产码 + /// + [Display(Name = "参照订单生产码")] + public string RefVinCode { get; set; } + /// + /// 发货关联单号 + /// + [Display(Name = "发货关联单号")] + public string RefBillNum { get; set; } + /// + /// Erp目标库位 + /// + [Display(Name = "Erp目标库位")] + public string ErpToLoc { get; set; } /// /// 塑件唯一码 /// [Display(Name = "塑件唯一码")] public string UniqueCode { get; set; } - /// /// PJS顺序号 /// [Display(Name = "PJS顺序号")] public string PjsNum { get; set; } - /// /// 虚拟小总成 /// [Display(Name = "虚拟小总成")] public string MatchNumber { get; set; } - /// - /// 发货条码 + /// 状态 /// - [Display(Name = "发货条码")] - public string DeliverCode { get; set; } - + [Display(Name = "状态")] + public EnumBillState State { get; set; } /// - /// 客户位置 + /// 创建时间 /// - [Display(Name = "客户位置")] - public string Position { get; set; } - + [Display(Name = "创建时间")] + public DateTime CreateTime { get; set; } /// /// 是否有EDI数据 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_DETAIL.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_DETAIL.cs index 3d25eee2..c3cd5209 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_DETAIL.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_DETAIL.cs @@ -2,8 +2,8 @@ using SettleAccount.Bases; using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; - - +using Win.Sfs.SettleAccount; +using Win.Sfs.SettleAccount.Entities.BQ.Syncs; namespace SettleAccount.Domain.BQ; @@ -42,157 +42,196 @@ public class HBPO_SE_DETAIL :SE_BASE //[Display(Name = "Wms发货单号")] //public string WmsBillNum { get; set; } = null!; - /// - /// 单据编号 + /// JIT订单号 /// - [Display(Name = "单据编号")] - public string Num { get; set; } - + [Display(Name = "JIT订单号")] + [DisplayName("JIT订单号")] + public string JISNum { get; set; } /// - /// 发货时间 + /// JIT排序生产码 /// - [Display(Name = "发货时间")] - public DateTime BillTime { get; set; } - + [Display(Name = "JIT排序生产码")] + public string VinCode { get; set; } /// - /// 发货人 + /// JIT排序生产码类型 /// - [Display(Name = "发货人")] - public string Oper { get; set; } - + [Display(Name = "JIT排序生产码类型")] + public string CodeType { get; set; } /// - /// 排序单号 + /// 订单零件号 /// - [Display(Name = "排序单号")] - public string OrderNum { get; set; } - + [Display(Name = "订单零件号")] + public string PartCode { get; set; } + /// + /// 订单零件号 + /// + [Display(Name = "订单零件号")] + public string RealPartCode { get; set; } + /// + /// 批次 + /// + [Display(Name = "批次")] + public string Batch { get; set; } + /// + /// 客户零件号 + /// + [Display(Name = "客户零件号")] + public string CustPartCode { get; set; } /// /// 订单序号 /// [Display(Name = "订单序号")] public string Seq { get; set; } - /// - /// 实际生产码 + /// 订单时间 /// - [Display(Name = "实际生产码")] - public string RealCode { get; set; } - + [Display(Name = "订单时间")] + public DateTime AssembleData { get; set; } /// - /// 订单生产码 + /// 发货条码 /// - [Display(Name = "订单生产码")] - public string VinCode { get; set; } - + [Display(Name = "发货条码")] + public string DeliverCode { get; set; } /// - /// 生产码类型 + /// 发货单号 /// - [Display(Name = "生产码类型")] - public string CodeType { get; set; } - + [Display(Name = "发货单号")] + public string BillNum { get; set; } /// - /// 实际零件号 + /// 发货时间 /// - [Display(Name = "实际零件号")] - public string RealPartCode { get; set; } - + [Display(Name = "发货时间")] + public DateTime? BillTime { get; set; } /// - /// 零件号 + /// 发货人 /// - [Display(Name = "零件号")] - public string PartCode { get; set; } - + [Display(Name = "发货人")] + public string Oper { get; set; } /// - /// 批次 + /// 客户位置 /// - [Display(Name = "批次")] - public string Batch { get; set; } - + [Display(Name = "客户位置")] + public string Position { get; set; } + /// + /// 工厂 + /// + [Display(Name = "工厂")] + public string Factory { get; set; } /// /// MES配置码 /// [Display(Name = "MES配置码")] public string MESConfigCode { get; set; } - - /// - /// 来源库位 - /// - [Display(Name = "来源库位")] - public string FromLoc { get; set; } - /// /// 目标库位 /// [Display(Name = "目标库位")] public string ToLoc { get; set; } - /// - /// 参照订单生产码 + /// 单据类型 /// - [Display(Name = "参照订单生产码")] - public string RefVinCode { get; set; } - + public EnumBillType BillType { get; set; } /// - /// 单据性质 + /// 子单据类型 /// - [Display(Name = "单据性质")] - public string BillCharacter { get; set; } - + [Display(Name = "子单据类型")] + public EnumSubBillType SubBillType { get; set; } /// - /// 发货关联单号 + /// 事务类型 /// - [Display(Name = "发货关联单号")] - public string RefBillNum { get; set; } - + [Display(Name = "事务类型")] + public EnumDelTransType TransType { get; set; } /// - /// Erp目标库位 + /// 发运主类型 /// - [Display(Name = "Erp目标库位")] - public string ErpToLoc { get; set; } - + [Display(Name = "发运主类型")] + public EnumDeliverBjBmpBillType DeliverBillType { get; set; } + /// + /// 发运子类型 + /// + [Display(Name = "发运子类型")] + public EnumDeliverSubBillType DeliverSubBillType { get; set; } + /// + /// 单据性质 + /// + [Display(Name = "单据性质")] + public string BillCharacter { get; set; } /// /// 原生产码 /// [Display(Name = "原生产码")] public string OrigiCode { get; set; } - + /// + /// 描述 + /// + [Display(Name = "描述")] + public string PartDesc { get; set; } /// /// 备注 /// [Display(Name = "备注")] public string Remark { get; set; } - + /// + /// 业务类型 + /// + [Display(Name = "业务类型")] + public EnumProTpe ProType { get; set; } + /// + /// JIS排序单号 + /// + [Display(Name = "JIS排序单号")] + public string OrderNum { get; set; } + /// + /// JIS实际生产码 + /// + [Display(Name = "JIS实际生产码")] + public string RealCode { get; set; } + /// + /// 来源库位 + /// + [Display(Name = "来源库位")] + public string FromLoc { get; set; } + /// + /// 参照订单生产码 + /// + [Display(Name = "参照订单生产码")] + public string RefVinCode { get; set; } + /// + /// 发货关联单号 + /// + [Display(Name = "发货关联单号")] + public string RefBillNum { get; set; } + /// + /// Erp目标库位 + /// + [Display(Name = "Erp目标库位")] + public string ErpToLoc { get; set; } /// /// 塑件唯一码 /// [Display(Name = "塑件唯一码")] public string UniqueCode { get; set; } - /// /// PJS顺序号 /// [Display(Name = "PJS顺序号")] public string PjsNum { get; set; } - /// /// 虚拟小总成 /// [Display(Name = "虚拟小总成")] public string MatchNumber { get; set; } - /// - /// 发货条码 + /// 状态 /// - [Display(Name = "发货条码")] - public string DeliverCode { get; set; } - + [Display(Name = "状态")] + public EnumBillState State { get; set; } /// - /// 客户位置 + /// 创建时间 /// - [Display(Name = "客户位置")] - public string Position { get; set; } - + [Display(Name = "创建时间")] + public DateTime CreateTime { get; set; } /// /// 是否有EDI数据 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/MaterialRelationshipManager.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/MaterialRelationshipManager.cs new file mode 100644 index 00000000..0400a179 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/MaterialRelationshipManager.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; +using Win.Sfs.SettleAccount.MaterialRelationships; +using Win.Sfs.Shared.RepositoryBase; + +namespace Win.Sfs.SettleAccount.Entities.BQ.Managers; +/// +/// 客户零件关系 +/// +public class MaterialRelationshipManager : DomainService +{ + /// + /// 客户零件关系仓储 + /// + private readonly INormalEfCoreRepository _materialRelationshipRepository; + + public MaterialRelationshipManager(INormalEfCoreRepository materialRelationshipRepository) + { + _materialRelationshipRepository = materialRelationshipRepository; + } + + /// + /// 添加零件关系 + /// + public async Task AddNewMaterialRelationships(IEnumerable materialRelationships) + { + //客户零件号和厂内零件号 + var luRePartCodes = materialRelationships.Select(t => new { t.ErpMaterialCode, t.SettleMaterialCode }).Distinct().ToList(); + var haveLuRePartCodes = materialRelationships.Join(_materialRelationshipRepository, + a => new { a.ErpMaterialCode, a.SettleMaterialCode }, + b => new { b.ErpMaterialCode, b.SettleMaterialCode }, + (a, b) => a).ToList(); + var noHaveLuRePartCodes = materialRelationships.Except(haveLuRePartCodes).ToList(); + if (noHaveLuRePartCodes.Any()) + { + await _materialRelationshipRepository.InsertManyAsync(noHaveLuRePartCodes).ConfigureAwait(false); + } + } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815054853_20230815-3.Designer.cs b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815054853_20230815-3.Designer.cs new file mode 100644 index 00000000..6e7b996d --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815054853_20230815-3.Designer.cs @@ -0,0 +1,5503 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Win.Sfs.SettleAccount; + +namespace Win.Sfs.SettleAccount.Migrations +{ + [DbContext(typeof(SettleAccountDbContext))] + [Migration("20230815054853_20230815-3")] + partial class _202308153 + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.17") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_CAN_SA", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("SettleBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Site") + .HasColumnType("nvarchar(max)"); + + b.Property("State") + .HasMaxLength(50) + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_BBAC_CAN_SA"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_CAN_SA_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContractDocID") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvbillNum") + .HasColumnType("nvarchar(max)"); + + b.Property("IsMaiDan") + .HasColumnType("bit"); + + b.Property("IsReturn") + .HasMaxLength(50) + .HasColumnType("bit"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SettleBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SettleDate") + .HasColumnType("datetime2"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_BBAC_CAN_SA_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_NOT_SA_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContractDocID") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsMaiDan") + .HasColumnType("bit"); + + b.Property("IsReturn") + .HasMaxLength(50) + .HasColumnType("bit"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SettleBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SettleDate") + .HasColumnType("datetime2"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_BBAC_NOT_SA_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_PD", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("SettleBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_BBAC_PD"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_PD_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Extend1") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend2") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend3") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend4") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("RELU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("REPN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SettleDate") + .HasColumnType("datetime2"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_BBAC_PD_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_SA", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DNBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Site") + .HasColumnType("nvarchar(max)"); + + b.Property("State") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_BBAC_SA"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_SA_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("Category") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsReturn") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SettleDate") + .HasColumnType("datetime2"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_BBAC_SA_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_SE_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssembleData") + .HasColumnType("datetime2"); + + b.Property("AssemblyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Batch") + .HasColumnType("nvarchar(max)"); + + b.Property("BeginDate") + .HasColumnType("datetime2"); + + b.Property("BillCharacter") + .HasColumnType("nvarchar(max)"); + + b.Property("BillNum") + .HasColumnType("nvarchar(max)"); + + b.Property("BillTime") + .HasColumnType("datetime2"); + + b.Property("BillType") + .HasColumnType("int"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("CodeType") + .HasColumnType("nvarchar(max)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustPartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DeliverBillType") + .HasColumnType("int"); + + b.Property("DeliverCode") + .HasColumnType("nvarchar(max)"); + + b.Property("DeliverSubBillType") + .HasColumnType("int"); + + b.Property("ErpToLoc") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Factory") + .HasColumnType("nvarchar(max)"); + + b.Property("FromLoc") + .HasColumnType("nvarchar(max)"); + + b.Property("InjectionCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsHaveEdiData") + .HasColumnType("bit"); + + b.Property("JISNum") + .HasColumnType("nvarchar(max)"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MESConfigCode") + .HasColumnType("nvarchar(max)"); + + b.Property("MatchNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("Oper") + .HasColumnType("nvarchar(max)"); + + b.Property("OrderNum") + .HasColumnType("nvarchar(max)"); + + b.Property("OrigiCode") + .HasColumnType("nvarchar(max)"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("PartDesc") + .HasColumnType("nvarchar(max)"); + + b.Property("PjsNum") + .HasColumnType("nvarchar(max)"); + + b.Property("Position") + .HasColumnType("nvarchar(max)"); + + b.Property("ProType") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("RealCode") + .HasColumnType("nvarchar(max)"); + + b.Property("RealPartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("RefBillNum") + .HasColumnType("nvarchar(max)"); + + b.Property("RefVinCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("Seq") + .HasColumnType("nvarchar(max)"); + + b.Property("SeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShippingDate") + .HasColumnType("datetime2"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("SubBillType") + .HasColumnType("int"); + + b.Property("ToLoc") + .HasColumnType("nvarchar(max)"); + + b.Property("TransType") + .HasColumnType("int"); + + b.Property("UniqueCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Version") + .HasColumnType("int"); + + b.Property("VinCode") + .HasColumnType("nvarchar(max)"); + + b.Property("WmsBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Set_BBAC_SE_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_SE_EDI", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssemblyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BeginDate") + .HasColumnType("datetime2"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Extend1") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend2") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend3") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend4") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("InjectionCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsHaveSeData") + .HasColumnType("bit"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Site") + .HasColumnType("nvarchar(max)"); + + b.Property("Version") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Set_BBAC_SE_EDI"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_SE_REPORT", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssemblyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BeginDate") + .HasColumnType("datetime2"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EDIQty") + .HasColumnType("decimal(18,2)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("InjectionCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShippingDate") + .HasColumnType("datetime2"); + + b.Property("Version") + .HasColumnType("int"); + + b.Property("WmsBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Set_BBAC_SE_REPORT"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_SE_SA_REPORT", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssemblyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Category") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustomerOfflineTime") + .HasColumnType("datetime2"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EDIQty") + .HasColumnType("decimal(18,2)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FixPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("InjectionCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MateType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MaterialDes") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MaterialNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PJISSeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SEQty") + .HasColumnType("decimal(18,2)"); + + b.Property("SeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShippingDate") + .HasColumnType("datetime2"); + + b.Property("Version") + .HasColumnType("int"); + + b.Property("WMSQty") + .HasColumnType("decimal(18,2)"); + + b.Property("WmsBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Set_BBAC_SE_SA_REPORT"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.HBPO_ADJ_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("OldInvBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SettleBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SettleDate") + .HasColumnType("datetime2"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_HBPO_ADJ_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.HBPO_CAN_SA", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("SettleBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Site") + .HasColumnType("nvarchar(max)"); + + b.Property("State") + .HasMaxLength(50) + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_HBPO_CAN_SA"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.HBPO_CAN_SA_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvbillNum") + .HasColumnType("nvarchar(max)"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SettleBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SettleDate") + .HasColumnType("datetime2"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_HBPO_CAN_SA_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.HBPO_NOT_SA_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SettleBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SettleDate") + .HasColumnType("datetime2"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_HBPO_NOT_SA_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.HBPO_PD", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("SettleBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_HBPO_PD"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.HBPO_PD_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Extend1") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend2") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend3") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend4") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("RELU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("REPN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SettleDate") + .HasColumnType("datetime2"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_HBPO_PD_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.HBPO_SA", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DNBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("RecordCount") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Site") + .HasColumnType("nvarchar(max)"); + + b.Property("State") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_HBPO_SA"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.HBPO_SA_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SettleDate") + .HasColumnType("datetime2"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_HBPO_SA_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.HBPO_SE_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssembleData") + .HasColumnType("datetime2"); + + b.Property("AssemblyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Batch") + .HasColumnType("nvarchar(max)"); + + b.Property("BeginDate") + .HasColumnType("datetime2"); + + b.Property("BillCharacter") + .HasColumnType("nvarchar(max)"); + + b.Property("BillNum") + .HasColumnType("nvarchar(max)"); + + b.Property("BillTime") + .HasColumnType("datetime2"); + + b.Property("BillType") + .HasColumnType("int"); + + b.Property("CodeType") + .HasColumnType("nvarchar(max)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustPartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DeliverBillType") + .HasColumnType("int"); + + b.Property("DeliverCode") + .HasColumnType("nvarchar(max)"); + + b.Property("DeliverSubBillType") + .HasColumnType("int"); + + b.Property("ErpToLoc") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Factory") + .HasColumnType("nvarchar(max)"); + + b.Property("FromLoc") + .HasColumnType("nvarchar(max)"); + + b.Property("InjectionCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsHaveEdiData") + .HasColumnType("bit"); + + b.Property("JISNum") + .HasColumnType("nvarchar(max)"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MESConfigCode") + .HasColumnType("nvarchar(max)"); + + b.Property("MatchNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("Oper") + .HasColumnType("nvarchar(max)"); + + b.Property("OrderNum") + .HasColumnType("nvarchar(max)"); + + b.Property("OrigiCode") + .HasColumnType("nvarchar(max)"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("PartDesc") + .HasColumnType("nvarchar(max)"); + + b.Property("PjsNum") + .HasColumnType("nvarchar(max)"); + + b.Property("Position") + .HasColumnType("nvarchar(max)"); + + b.Property("ProType") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("RealCode") + .HasColumnType("nvarchar(max)"); + + b.Property("RealPartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("RefBillNum") + .HasColumnType("nvarchar(max)"); + + b.Property("RefVinCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("Seq") + .HasColumnType("nvarchar(max)"); + + b.Property("SeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShippingDate") + .HasColumnType("datetime2"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("SubBillType") + .HasColumnType("int"); + + b.Property("ToLoc") + .HasColumnType("nvarchar(max)"); + + b.Property("TransType") + .HasColumnType("int"); + + b.Property("UniqueCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Version") + .HasColumnType("int"); + + b.Property("VinCode") + .HasColumnType("nvarchar(max)"); + + b.Property("WmsBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Set_HBPO_SE_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.HBPO_SE_EDI", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssemblyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BeginDate") + .HasColumnType("datetime2"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Extend1") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend2") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend3") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend4") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("InjectionCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsHaveSeData") + .HasColumnType("bit"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Site") + .HasColumnType("nvarchar(max)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_HBPO_SE_EDI"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.HBPO_SE_REPORT", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssemblyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BeginDate") + .HasColumnType("datetime2"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EDIQty") + .HasColumnType("decimal(18,2)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("InjectionCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShippingDate") + .HasColumnType("datetime2"); + + b.Property("Version") + .HasColumnType("int"); + + b.Property("WmsBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Set_HBPO_SE_REPORT"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.HBPO_SE_SA_REPORT", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssemblyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Category") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustomerOfflineTime") + .HasColumnType("datetime2"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EDIQty") + .HasColumnType("decimal(18,2)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FixPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("InjectionCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MateType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MaterialDes") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MaterialNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PJISSeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SEQty") + .HasColumnType("decimal(18,2)"); + + b.Property("SeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShippingDate") + .HasColumnType("datetime2"); + + b.Property("Version") + .HasColumnType("int"); + + b.Property("WMSQty") + .HasColumnType("decimal(18,2)"); + + b.Property("WmsBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Set_HBPO_SE_SA_REPORT"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.INVOICE_GRP", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Amt") + .HasColumnType("decimal(18,2)"); + + b.Property("BusinessType") + .HasMaxLength(50) + .HasColumnType("int"); + + b.Property("ClientCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FileName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvbillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvoiceState") + .HasColumnType("int"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ParentInvbillNum") + .HasColumnType("nvarchar(max)"); + + b.Property("PreTaxDiff") + .HasColumnType("decimal(18,2)"); + + b.Property("RealAmt") + .HasColumnType("decimal(18,2)"); + + b.Property("RealnvBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("Tax") + .HasColumnType("decimal(18,2)"); + + b.Property("TaxAmt") + .HasColumnType("decimal(18,2)"); + + b.Property("TaxDiff") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.ToTable("Set_INVOICE_GRP"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.INVOICE_MAP_GROUP", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Amt") + .HasColumnType("decimal(18,2)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Extend1") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend2") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvbillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("SettleGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_INVOICE_MAP_GROUP"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.INVOICE_NOT_SETTLE", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Extend1") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend2") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU1") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SettleGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_INVOICE_NOT_SETTLE"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.INVOICE_WAIT_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Amt") + .HasColumnType("decimal(18,2)"); + + b.Property("BeginDate") + .HasColumnType("datetime2"); + + b.Property("BussiessType") + .HasMaxLength(50) + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("Extend1") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend2") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvbillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PRICE") + .HasColumnType("decimal(18,2)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_INVOICE_WAIT_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.JIT_SE_SA_REPORT", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssemblyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Category") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustomerOfflineTime") + .HasColumnType("datetime2"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EDIQty") + .HasColumnType("decimal(18,2)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FixPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("InjectionCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MateType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MaterialDes") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MaterialNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PJISSeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SEQty") + .HasColumnType("decimal(18,2)"); + + b.Property("SeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShippingDate") + .HasColumnType("datetime2"); + + b.Property("Version") + .HasColumnType("int"); + + b.Property("WMSQty") + .HasColumnType("decimal(18,2)"); + + b.Property("WmsBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Set_JIT_SE_SA_REPORT"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.PUB_ADJ_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("Extend1") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("OldInvBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SettleBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SettleDate") + .HasColumnType("datetime2"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_PUB_ADJ_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.PUB_CAN_SA", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BusinessType") + .HasMaxLength(50) + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("SettleBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Site") + .HasColumnType("nvarchar(max)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_PUB_CAN_SA"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.PUB_CAN_SA_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BusinessType") + .HasMaxLength(50) + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvbillNum") + .HasColumnType("nvarchar(max)"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SettleBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SettleDate") + .HasColumnType("datetime2"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_PUB_CAN_SA_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.PUB_NOT_SA_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BusinessType") + .HasMaxLength(50) + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("Extend1") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend2") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend3") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SettleBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SettleDate") + .HasColumnType("datetime2"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_PUB_NOT_SA_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.PUB_PD", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("SettleBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_PUB_PD"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.PUB_PD_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BusinessType") + .HasMaxLength(50) + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Extend1") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend2") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend3") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend4") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InvGroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("RELU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("REPN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SettleDate") + .HasColumnType("datetime2"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_PUB_PD_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.PUB_SA", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("State") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_PUB_SA"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.PUB_SA_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("Extend1") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend2") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend3") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("GroupNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("SettleDate") + .HasColumnType("datetime2"); + + b.Property("Site") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Set_PUB_SA_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.PUB_SE_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssembleData") + .HasColumnType("datetime2"); + + b.Property("Batch") + .HasColumnType("nvarchar(max)"); + + b.Property("BeginDate") + .HasColumnType("datetime2"); + + b.Property("BillNum") + .HasColumnType("nvarchar(max)"); + + b.Property("BillTime") + .HasColumnType("datetime2"); + + b.Property("BillType") + .HasColumnType("int"); + + b.Property("BusinessType") + .HasMaxLength(50) + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustId") + .HasColumnType("nvarchar(max)"); + + b.Property("CustPartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DeliverBillType") + .HasColumnType("int"); + + b.Property("DeliverSubBillType") + .HasColumnType("int"); + + b.Property("DeliveryHose") + .HasColumnType("nvarchar(max)"); + + b.Property("DeliveryIndex") + .HasColumnType("nvarchar(max)"); + + b.Property("DnBillNum") + .HasColumnType("nvarchar(max)"); + + b.Property("DnBillTime") + .HasColumnType("datetime2"); + + b.Property("DnOper") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend1") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend2") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend3") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FromErpLocCode") + .HasColumnType("nvarchar(max)"); + + b.Property("FromHose") + .HasColumnType("nvarchar(max)"); + + b.Property("FromLocCode") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("KeyCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Oper") + .HasColumnType("nvarchar(max)"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ProType") + .HasColumnType("int"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("ShippingDate") + .HasColumnType("datetime2"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("SubBillType") + .HasColumnType("int"); + + b.Property("ToErpLocCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ToHose") + .HasColumnType("nvarchar(max)"); + + b.Property("ToLocCode") + .HasColumnType("nvarchar(max)"); + + b.Property("TransType") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("int"); + + b.Property("WmsBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Set_PUB_SE_DETAIL"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.PURCHASE_PRICE", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LU") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.ToTable("Set_PURCHASE_PRICE"); + }); + + modelBuilder.Entity("SettleAccount.Domain.BQ.TB_RePartsRelationship", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("ClientCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LU") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("RepLU") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Set_TB_RePartsRelationship"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Boms.Bom", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BomLevel") + .HasColumnType("int"); + + b.Property("BomType") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("BranchId") + .HasColumnType("uniqueidentifier"); + + b.Property("ChildItemCode") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ChildItemDesc") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("ChildItemUom") + .HasColumnType("nvarchar(max)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EffectiveTime") + .HasColumnType("datetime2"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExpireTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Factory") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IssuePosition") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("OperateProcess") + .HasColumnType("int"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("ParentItemCode") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ParentItemDesc") + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.Property("Period") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("ScrapPercent") + .HasColumnType("decimal(18,2)"); + + b.Property("Version") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Year") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.HasKey("Id"); + + b.HasIndex("ParentItemCode", "ChildItemCode", "Version") + .IsUnique() + .HasFilter("IsDeleted=0"); + + b.ToTable("Set_bom"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.BBAC_SEC_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Category") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustomerOfflineTime") + .HasColumnType("datetime2"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DiffQty") + .HasColumnType("decimal(18,2)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FixPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MateType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MaterialDes") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MaterialNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PJISSeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PrimitiveLU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ReplaceLU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SAQty") + .HasColumnType("decimal(18,2)"); + + b.Property("SEQty") + .HasColumnType("decimal(18,2)"); + + b.Property("SeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShippingDate") + .HasColumnType("datetime2"); + + b.Property("WmsBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Set_BBAC_SEC_DETAIL"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.HBPO_SEC_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Category") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustomerOfflineTime") + .HasColumnType("datetime2"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DiffQty") + .HasColumnType("decimal(18,2)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FixPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MateType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MaterialDes") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MaterialNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PJISSeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PrimitiveLU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ReplaceLU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SAQty") + .HasColumnType("decimal(18,2)"); + + b.Property("SEQty") + .HasColumnType("decimal(18,2)"); + + b.Property("SeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShippingDate") + .HasColumnType("datetime2"); + + b.Property("WmsBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Set_HBPO_SEC_DETAIL"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.PUB_SEC_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Category") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustomerOfflineTime") + .HasColumnType("datetime2"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DiffQty") + .HasColumnType("decimal(18,2)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FixPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MateType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MaterialDes") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MaterialNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PJISSeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PN") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PrimitiveLU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ReplaceLU") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SAQty") + .HasColumnType("decimal(18,2)"); + + b.Property("SEQty") + .HasColumnType("decimal(18,2)"); + + b.Property("SeqNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShippingDate") + .HasColumnType("datetime2"); + + b.Property("WmsBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Set_PUB_SEC_DETAIL"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Syncs.SyncPositionFlag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Position") + .HasColumnType("nvarchar(max)"); + + b.Property("TableName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Set_SyncPositionFlag"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.JobItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Cron") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("HeartBeat") + .HasColumnType("datetime2"); + + b.Property("IsDisabled") + .HasColumnType("bit"); + + b.Property("IsRunning") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Service") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Set_JobItem"); + + b.HasData( + new + { + Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"), + Cron = "0 0 8 26 *", + IsDisabled = false, + IsRunning = false, + Name = "库存快照", + Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAppService" + }, + new + { + Id = new Guid("d6d5e1d7-9326-ceea-eed4-fb4039e7ee68"), + Cron = "0 0/10 * * * ? ", + IsDisabled = false, + IsRunning = false, + Name = "BBAC发运数据同步", + Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BBACSeSyncAppService" + }, + new + { + Id = new Guid("d50400b0-b0d4-38d1-fcdf-b1e7ac1d3a68"), + Cron = "0 0/10 * * * ? ", + IsDisabled = false, + IsRunning = false, + Name = "HBPO发运数据同步", + Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.HBPOSeSyncAppService" + }, + new + { + Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"), + Cron = "0 0/10 * * * ? ", + IsDisabled = false, + IsRunning = false, + Name = "直供件BBAC发运同步", + Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongBBACSeSyncAppService" + }, + new + { + Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"), + Cron = "0 0/10 * * * ? ", + IsDisabled = false, + IsRunning = false, + Name = "直供件HBPO发运同步", + Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongHBPOSeSyncAppService" + }, + new + { + Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"), + Cron = "0 0/10 * * * ? ", + IsDisabled = false, + IsRunning = false, + Name = "备件发运同步", + Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BeiSeSyncAppService" + }, + new + { + Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"), + Cron = "0 0/10 * * * ? ", + IsDisabled = false, + IsRunning = false, + Name = "印度件发运同步", + Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.YinDuSeSyncAppService" + }); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.JobLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("End") + .HasColumnType("datetime2"); + + b.Property("Exception") + .HasColumnType("nvarchar(max)"); + + b.Property("Host") + .HasColumnType("nvarchar(max)"); + + b.Property("JobId") + .HasColumnType("uniqueidentifier"); + + b.Property("Start") + .HasColumnType("datetime2"); + + b.Property("Success") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("JobId"); + + b.ToTable("Set_JobLog"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiBalance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BackupTime") + .HasColumnType("datetime2"); + + b.Property("BillTime") + .HasColumnType("datetime2"); + + b.Property("BillType") + .HasColumnType("int"); + + b.Property("CodeType") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Configcode") + .HasColumnType("nvarchar(450)"); + + b.Property("CustomerPartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("DeliverTime") + .HasColumnType("datetime2"); + + b.Property("ErpToLoc") + .HasColumnType("nvarchar(450)"); + + b.Property("MatchNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("OrderNum") + .HasColumnType("nvarchar(450)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(450)"); + + b.Property("PjsNum") + .HasColumnType("nvarchar(max)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("ReMark") + .HasColumnType("nvarchar(max)"); + + b.Property("RealCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Seq") + .HasColumnType("nvarchar(max)"); + + b.Property("SubBillType") + .HasColumnType("int"); + + b.Property("UniqueCode") + .HasColumnType("nvarchar(max)"); + + b.Property("VinCode") + .HasColumnType("nvarchar(450)"); + + b.Property("factory") + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("BillType", "CodeType", "PartCode", "VinCode", "ErpToLoc", "OrderNum", "factory", "Configcode") + .IsUnique() + .HasFilter("[CodeType] IS NOT NULL AND [PartCode] IS NOT NULL AND [VinCode] IS NOT NULL AND [ErpToLoc] IS NOT NULL AND [OrderNum] IS NOT NULL AND [factory] IS NOT NULL AND [Configcode] IS NOT NULL"); + + b.ToTable("Set_VmiBalance"); + + b.HasData( + new + { + Id = new Guid("c085a562-1da9-4dd3-8e65-85e4518f1383"), + BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + BillType = 1, + ConcurrencyStamp = "4b83550d90bf425493e93dcd552a0bd1", + DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + ErpToLoc = "ErpToLoc", + OrderNum = "OrderNum", + PartCode = "PartCode", + Qty = 0m, + SubBillType = 0, + VinCode = "VinCode" + }); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BillTime") + .HasColumnType("datetime2"); + + b.Property("BillType") + .HasColumnType("int"); + + b.Property("ChangedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("ChangedNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("ChangedQty") + .HasColumnType("decimal(18,2)"); + + b.Property("ChangedTime") + .HasColumnType("datetime2"); + + b.Property("ChangedType") + .HasColumnType("int"); + + b.Property("CodeType") + .HasColumnType("nvarchar(max)"); + + b.Property("Configcode") + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerPartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("DeliverTime") + .HasColumnType("datetime2"); + + b.Property("ErpToLoc") + .HasColumnType("nvarchar(max)"); + + b.Property("GroupId") + .HasColumnType("nvarchar(max)"); + + b.Property("IsReplenished") + .HasColumnType("bit"); + + b.Property("LogType") + .HasColumnType("int"); + + b.Property("MatchNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("OrderNum") + .HasColumnType("nvarchar(max)"); + + b.Property("PartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("PartCode2") + .HasColumnType("nvarchar(max)"); + + b.Property("PjsNum") + .HasColumnType("nvarchar(max)"); + + b.Property("Qty") + .HasColumnType("decimal(18,2)"); + + b.Property("ReMark") + .HasColumnType("nvarchar(max)"); + + b.Property("RealCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Seq") + .HasColumnType("nvarchar(max)"); + + b.Property("SettlementVinCode") + .HasColumnType("nvarchar(max)"); + + b.Property("SubBillType") + .HasColumnType("int"); + + b.Property("UniqueCode") + .HasColumnType("nvarchar(max)"); + + b.Property("VinCode") + .HasColumnType("nvarchar(max)"); + + b.Property("factory") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Set_VmiLog"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiSnapshot", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Path") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Set_VmiSnapshot"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.Boms.BomVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BranchId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustomerCode") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Factory") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Period") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Year") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.HasKey("Id"); + + b.ToTable("Set_bom_version"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.CodeSettings.CodeSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BranchId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Project") + .HasColumnType("nvarchar(max)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Set_CodeSetting"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.Controls.CentralizedControl", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BranchId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Period") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("State") + .HasColumnType("bit"); + + b.Property("Version") + .HasColumnType("nvarchar(max)"); + + b.Property("Year") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.HasKey("Id"); + + b.HasIndex("Year", "Period") + .IsUnique() + .HasFilter("IsDeleted=0"); + + b.ToTable("Set_control"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.Materials.Material", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BranchId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustomerPartCode") + .HasColumnType("nvarchar(max)"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("EstimateType") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("EstimateTypeDesc") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Factory") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MaterialCode") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("MaterialDesc") + .HasColumnType("nvarchar(max)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("Unit") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.HasKey("Id"); + + b.HasIndex("MaterialCode") + .IsUnique() + .HasFilter("IsDeleted=0"); + + b.ToTable("Set_material"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.Prices.PriceList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BeginTime") + .HasColumnType("datetime2"); + + b.Property("BranchId") + .HasColumnType("uniqueidentifier"); + + b.Property("BusinessType") + .HasColumnType("int"); + + b.Property("ClientCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContractNo") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustomerCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LU") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MaterialCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Set_PriceList"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.Prices.PriceListBJ", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BeginDate") + .HasColumnType("datetime2"); + + b.Property("BranchId") + .HasColumnType("uniqueidentifier"); + + b.Property("ClientCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContractNo") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("CustomerCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LU") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MaterialCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("Version") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Set_PriceListBJ"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.Prices.PriceListVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BranchId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Factory") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Period") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("Version") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Year") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Set_PriceListVersion"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.Prices.PriceListVersionBJ", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BranchId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Factory") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Period") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("Version") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Year") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Set_PriceListVersionBJ"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.TaskJob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ActionName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BranchId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("Creator") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DownFileName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Email") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("Error") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FileName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RealDownFileName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("RealFileName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("ServiceName") + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("State") + .HasColumnType("nvarchar(max)"); + + b.Property("TaskId") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Type") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Set_TaskJob"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.MaterialRelationships.MaterialRelationship", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AppraisalCategory") + .HasColumnType("nvarchar(max)"); + + b.Property("BranchId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ErpMaterialCode") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MaterialDesc") + .HasColumnType("nvarchar(max)"); + + b.Property("MaterialProperty") + .HasColumnType("nvarchar(max)"); + + b.Property("Remark") + .HasColumnType("nvarchar(max)"); + + b.Property("SettleMaterialCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ShipMaterailCode") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ErpMaterialCode") + .IsUnique() + .HasFilter("IsDeleted=0"); + + b.ToTable("Set_relationship"); + }); + + modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.JobLog", b => + { + b.HasOne("Win.Sfs.SettleAccount.Entities.BQ.Vmi.JobItem", "Job") + .WithMany() + .HasForeignKey("JobId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Job"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815054853_20230815-3.cs b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815054853_20230815-3.cs new file mode 100644 index 00000000..014e805a --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815054853_20230815-3.cs @@ -0,0 +1,368 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Win.Sfs.SettleAccount.Migrations +{ + public partial class _202308153 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "Set_VmiBalance", + keyColumn: "Id", + keyValue: new Guid("75ce4934-06de-4cac-a1f0-536935975b38")); + + migrationBuilder.RenameColumn( + name: "Num", + table: "Set_HBPO_SE_DETAIL", + newName: "PartDesc"); + + migrationBuilder.RenameColumn( + name: "Num", + table: "Set_BBAC_SE_DETAIL", + newName: "PartDesc"); + + migrationBuilder.AlterColumn( + name: "BillTime", + table: "Set_HBPO_SE_DETAIL", + type: "datetime2", + nullable: true, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AddColumn( + name: "AssembleData", + table: "Set_HBPO_SE_DETAIL", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AddColumn( + name: "BillNum", + table: "Set_HBPO_SE_DETAIL", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "BillType", + table: "Set_HBPO_SE_DETAIL", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "CreateTime", + table: "Set_HBPO_SE_DETAIL", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AddColumn( + name: "CustPartCode", + table: "Set_HBPO_SE_DETAIL", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "DeliverBillType", + table: "Set_HBPO_SE_DETAIL", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "DeliverSubBillType", + table: "Set_HBPO_SE_DETAIL", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "Factory", + table: "Set_HBPO_SE_DETAIL", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "JISNum", + table: "Set_HBPO_SE_DETAIL", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "ProType", + table: "Set_HBPO_SE_DETAIL", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "State", + table: "Set_HBPO_SE_DETAIL", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "SubBillType", + table: "Set_HBPO_SE_DETAIL", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "TransType", + table: "Set_HBPO_SE_DETAIL", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AlterColumn( + name: "BillTime", + table: "Set_BBAC_SE_DETAIL", + type: "datetime2", + nullable: true, + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AddColumn( + name: "AssembleData", + table: "Set_BBAC_SE_DETAIL", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AddColumn( + name: "BillNum", + table: "Set_BBAC_SE_DETAIL", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "BillType", + table: "Set_BBAC_SE_DETAIL", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "CreateTime", + table: "Set_BBAC_SE_DETAIL", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AddColumn( + name: "CustPartCode", + table: "Set_BBAC_SE_DETAIL", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "DeliverBillType", + table: "Set_BBAC_SE_DETAIL", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "DeliverSubBillType", + table: "Set_BBAC_SE_DETAIL", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "Factory", + table: "Set_BBAC_SE_DETAIL", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "JISNum", + table: "Set_BBAC_SE_DETAIL", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "ProType", + table: "Set_BBAC_SE_DETAIL", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "State", + table: "Set_BBAC_SE_DETAIL", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "SubBillType", + table: "Set_BBAC_SE_DETAIL", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "TransType", + table: "Set_BBAC_SE_DETAIL", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.InsertData( + table: "Set_VmiBalance", + columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" }, + values: new object[] { new Guid("c085a562-1da9-4dd3-8e65-85e4518f1383"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "4b83550d90bf425493e93dcd552a0bd1", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "Set_VmiBalance", + keyColumn: "Id", + keyValue: new Guid("c085a562-1da9-4dd3-8e65-85e4518f1383")); + + migrationBuilder.DropColumn( + name: "AssembleData", + table: "Set_HBPO_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "BillNum", + table: "Set_HBPO_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "BillType", + table: "Set_HBPO_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "CreateTime", + table: "Set_HBPO_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "CustPartCode", + table: "Set_HBPO_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "DeliverBillType", + table: "Set_HBPO_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "DeliverSubBillType", + table: "Set_HBPO_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "Factory", + table: "Set_HBPO_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "JISNum", + table: "Set_HBPO_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "ProType", + table: "Set_HBPO_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "State", + table: "Set_HBPO_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "SubBillType", + table: "Set_HBPO_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "TransType", + table: "Set_HBPO_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "AssembleData", + table: "Set_BBAC_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "BillNum", + table: "Set_BBAC_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "BillType", + table: "Set_BBAC_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "CreateTime", + table: "Set_BBAC_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "CustPartCode", + table: "Set_BBAC_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "DeliverBillType", + table: "Set_BBAC_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "DeliverSubBillType", + table: "Set_BBAC_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "Factory", + table: "Set_BBAC_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "JISNum", + table: "Set_BBAC_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "ProType", + table: "Set_BBAC_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "State", + table: "Set_BBAC_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "SubBillType", + table: "Set_BBAC_SE_DETAIL"); + + migrationBuilder.DropColumn( + name: "TransType", + table: "Set_BBAC_SE_DETAIL"); + + migrationBuilder.RenameColumn( + name: "PartDesc", + table: "Set_HBPO_SE_DETAIL", + newName: "Num"); + + migrationBuilder.RenameColumn( + name: "PartDesc", + table: "Set_BBAC_SE_DETAIL", + newName: "Num"); + + migrationBuilder.AlterColumn( + name: "BillTime", + table: "Set_HBPO_SE_DETAIL", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + oldClrType: typeof(DateTime), + oldType: "datetime2", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "BillTime", + table: "Set_BBAC_SE_DETAIL", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + oldClrType: typeof(DateTime), + oldType: "datetime2", + oldNullable: true); + + migrationBuilder.InsertData( + table: "Set_VmiBalance", + columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" }, + values: new object[] { new Guid("75ce4934-06de-4cac-a1f0-536935975b38"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "8e865c8947ea4381b1b48c3ee4d572b4", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null }); + } + } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs index 6947f732..48b9fdf2 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs @@ -611,6 +611,9 @@ namespace Win.Sfs.SettleAccount.Migrations .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); + b.Property("AssembleData") + .HasColumnType("datetime2"); + b.Property("AssemblyCode") .HasMaxLength(50) .HasColumnType("nvarchar(50)"); @@ -624,9 +627,15 @@ namespace Win.Sfs.SettleAccount.Migrations b.Property("BillCharacter") .HasColumnType("nvarchar(max)"); - b.Property("BillTime") + b.Property("BillNum") + .HasColumnType("nvarchar(max)"); + + b.Property("BillTime") .HasColumnType("datetime2"); + b.Property("BillType") + .HasColumnType("int"); + b.Property("BusinessType") .HasColumnType("int"); @@ -639,6 +648,9 @@ namespace Win.Sfs.SettleAccount.Migrations .HasColumnType("nvarchar(50)") .HasColumnName("ConcurrencyStamp"); + b.Property("CreateTime") + .HasColumnType("datetime2"); + b.Property("CreationTime") .HasColumnType("datetime2") .HasColumnName("CreationTime"); @@ -647,6 +659,9 @@ namespace Win.Sfs.SettleAccount.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("CreatorId"); + b.Property("CustPartCode") + .HasColumnType("nvarchar(max)"); + b.Property("DeleterId") .HasColumnType("uniqueidentifier") .HasColumnName("DeleterId"); @@ -655,9 +670,15 @@ namespace Win.Sfs.SettleAccount.Migrations .HasColumnType("datetime2") .HasColumnName("DeletionTime"); + b.Property("DeliverBillType") + .HasColumnType("int"); + b.Property("DeliverCode") .HasColumnType("nvarchar(max)"); + b.Property("DeliverSubBillType") + .HasColumnType("int"); + b.Property("ErpToLoc") .HasColumnType("nvarchar(max)"); @@ -665,6 +686,9 @@ namespace Win.Sfs.SettleAccount.Migrations .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); + b.Property("Factory") + .HasColumnType("nvarchar(max)"); + b.Property("FromLoc") .HasColumnType("nvarchar(max)"); @@ -681,6 +705,9 @@ namespace Win.Sfs.SettleAccount.Migrations b.Property("IsHaveEdiData") .HasColumnType("bit"); + b.Property("JISNum") + .HasColumnType("nvarchar(max)"); + b.Property("KeyCode") .HasMaxLength(50) .HasColumnType("nvarchar(50)"); @@ -703,9 +730,6 @@ namespace Win.Sfs.SettleAccount.Migrations b.Property("MatchNumber") .HasColumnType("nvarchar(max)"); - b.Property("Num") - .HasColumnType("nvarchar(max)"); - b.Property("Oper") .HasColumnType("nvarchar(max)"); @@ -722,12 +746,18 @@ namespace Win.Sfs.SettleAccount.Migrations b.Property("PartCode") .HasColumnType("nvarchar(max)"); + b.Property("PartDesc") + .HasColumnType("nvarchar(max)"); + b.Property("PjsNum") .HasColumnType("nvarchar(max)"); b.Property("Position") .HasColumnType("nvarchar(max)"); + b.Property("ProType") + .HasColumnType("int"); + b.Property("Qty") .HasColumnType("decimal(18,2)"); @@ -756,9 +786,18 @@ namespace Win.Sfs.SettleAccount.Migrations b.Property("ShippingDate") .HasColumnType("datetime2"); + b.Property("State") + .HasColumnType("int"); + + b.Property("SubBillType") + .HasColumnType("int"); + b.Property("ToLoc") .HasColumnType("nvarchar(max)"); + b.Property("TransType") + .HasColumnType("int"); + b.Property("UniqueCode") .HasColumnType("nvarchar(max)"); @@ -1758,6 +1797,9 @@ namespace Win.Sfs.SettleAccount.Migrations .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); + b.Property("AssembleData") + .HasColumnType("datetime2"); + b.Property("AssemblyCode") .HasMaxLength(50) .HasColumnType("nvarchar(50)"); @@ -1771,9 +1813,15 @@ namespace Win.Sfs.SettleAccount.Migrations b.Property("BillCharacter") .HasColumnType("nvarchar(max)"); - b.Property("BillTime") + b.Property("BillNum") + .HasColumnType("nvarchar(max)"); + + b.Property("BillTime") .HasColumnType("datetime2"); + b.Property("BillType") + .HasColumnType("int"); + b.Property("CodeType") .HasColumnType("nvarchar(max)"); @@ -1783,6 +1831,9 @@ namespace Win.Sfs.SettleAccount.Migrations .HasColumnType("nvarchar(50)") .HasColumnName("ConcurrencyStamp"); + b.Property("CreateTime") + .HasColumnType("datetime2"); + b.Property("CreationTime") .HasColumnType("datetime2") .HasColumnName("CreationTime"); @@ -1791,6 +1842,9 @@ namespace Win.Sfs.SettleAccount.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("CreatorId"); + b.Property("CustPartCode") + .HasColumnType("nvarchar(max)"); + b.Property("DeleterId") .HasColumnType("uniqueidentifier") .HasColumnName("DeleterId"); @@ -1799,9 +1853,15 @@ namespace Win.Sfs.SettleAccount.Migrations .HasColumnType("datetime2") .HasColumnName("DeletionTime"); + b.Property("DeliverBillType") + .HasColumnType("int"); + b.Property("DeliverCode") .HasColumnType("nvarchar(max)"); + b.Property("DeliverSubBillType") + .HasColumnType("int"); + b.Property("ErpToLoc") .HasColumnType("nvarchar(max)"); @@ -1809,6 +1869,9 @@ namespace Win.Sfs.SettleAccount.Migrations .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); + b.Property("Factory") + .HasColumnType("nvarchar(max)"); + b.Property("FromLoc") .HasColumnType("nvarchar(max)"); @@ -1825,6 +1888,9 @@ namespace Win.Sfs.SettleAccount.Migrations b.Property("IsHaveEdiData") .HasColumnType("bit"); + b.Property("JISNum") + .HasColumnType("nvarchar(max)"); + b.Property("KeyCode") .HasMaxLength(50) .HasColumnType("nvarchar(50)"); @@ -1847,9 +1913,6 @@ namespace Win.Sfs.SettleAccount.Migrations b.Property("MatchNumber") .HasColumnType("nvarchar(max)"); - b.Property("Num") - .HasColumnType("nvarchar(max)"); - b.Property("Oper") .HasColumnType("nvarchar(max)"); @@ -1866,12 +1929,18 @@ namespace Win.Sfs.SettleAccount.Migrations b.Property("PartCode") .HasColumnType("nvarchar(max)"); + b.Property("PartDesc") + .HasColumnType("nvarchar(max)"); + b.Property("PjsNum") .HasColumnType("nvarchar(max)"); b.Property("Position") .HasColumnType("nvarchar(max)"); + b.Property("ProType") + .HasColumnType("int"); + b.Property("Qty") .HasColumnType("decimal(18,2)"); @@ -1900,9 +1969,18 @@ namespace Win.Sfs.SettleAccount.Migrations b.Property("ShippingDate") .HasColumnType("datetime2"); + b.Property("State") + .HasColumnType("int"); + + b.Property("SubBillType") + .HasColumnType("int"); + b.Property("ToLoc") .HasColumnType("nvarchar(max)"); + b.Property("TransType") + .HasColumnType("int"); + b.Property("UniqueCode") .HasColumnType("nvarchar(max)"); @@ -4414,10 +4492,10 @@ namespace Win.Sfs.SettleAccount.Migrations b.HasData( new { - Id = new Guid("75ce4934-06de-4cac-a1f0-536935975b38"), + Id = new Guid("c085a562-1da9-4dd3-8e65-85e4518f1383"), BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), BillType = 1, - ConcurrencyStamp = "8e865c8947ea4381b1b48c3ee4d572b4", + ConcurrencyStamp = "4b83550d90bf425493e93dcd552a0bd1", DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), ErpToLoc = "ErpToLoc", OrderNum = "OrderNum", From 5a5ca9f39e544456eaeef5b36b29c9f201d54d61 Mon Sep 17 00:00:00 2001 From: mahao Date: Tue, 15 Aug 2023 15:27:56 +0800 Subject: [PATCH 3/3] =?UTF-8?q?Jis=E5=8F=91=E8=BF=90=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/BQ/Syncs/BBACSeSyncAppService.cs | 18 ++-- .../Entities/BQ/Syncs/HBPOSeSyncAppService.cs | 13 ++- .../BQ/Syncs/JisBBACSeEdiCompareAppService.cs | 72 ++++++++++---- .../BQ/Syncs/JisHBPOSeEdiCompareAppService.cs | 97 ++++++++++--------- .../Managers/MaterialRelationshipManager.cs | 3 +- .../Entities/BQ/Syncs/TM_BJBMPT_JIS_RECORD.cs | 10 +- .../Entities/BQ/Syncs/TM_BJBMPT_JIT_RECORD.cs | 11 +-- 7 files changed, 135 insertions(+), 89 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs index d9df6905..ae136f48 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs @@ -39,14 +39,14 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService private readonly INormalEfCoreRepository _bbacSeDetailRepository; /// - /// 客户零件关系仓储 + /// 客户零件关系领域 /// - private readonly INormalEfCoreRepository _materialRelationshipRepository; + private readonly MaterialRelationshipManager _materialRelationshipManager; /// - /// 客户零件关系领域 + /// 客户零件关系集合 /// - private readonly MaterialRelationshipManager _materialRelationshipManager; + private List _addMaterialRelationships; /// /// 构造 @@ -61,6 +61,7 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService _syncPositionFlagRepository = syncPositionFlagRepository; _bbacSeDetailRepository = bbacSeDetailRepository; _materialRelationshipManager = materialRelationshipManager; + _addMaterialRelationships = new List(); } [ApiExplorerSettings(IgnoreApi = true)] @@ -74,6 +75,11 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService { await SyncJitRecordAsync(); await SyncJisRecordAsync(); + if (_addMaterialRelationships.Any()) + { + _addMaterialRelationships = _addMaterialRelationships.GroupBy(t => new { t.ErpMaterialCode }).Select(t => t.First()).ToList(); + await _materialRelationshipManager.AddNewMaterialRelationships(_addMaterialRelationships).ConfigureAwait(false); + } } /// @@ -101,7 +107,7 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService { //客户零件号和厂内零件号 var materialRelationships = bbacSeDetails.GroupBy(t => new { t.LU, t.PartCode }).Select(t => new MaterialRelationship(GuidGenerator.Create(), t.Key.LU, "", t.Key.PartCode, "")); - await _materialRelationshipManager.AddNewMaterialRelationships(materialRelationships).ConfigureAwait(false); + _addMaterialRelationships.AddRange(materialRelationships); bbacSeDetails.ForEach(bbacSeDetail => { @@ -151,7 +157,7 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService { //客户零件号和厂内零件号 var materialRelationships = bbacSeDetails.GroupBy(t => new { t.LU, t.PartCode }).Select(t => new MaterialRelationship(GuidGenerator.Create(), t.Key.LU, "", t.Key.PartCode, "")); - await _materialRelationshipManager.AddNewMaterialRelationships(materialRelationships).ConfigureAwait(false); + _addMaterialRelationships.AddRange(materialRelationships); bbacSeDetails.ForEach(bbacSeDetail => bbacSeDetail.KeyCode = bbacSeDetail.PN + bbacSeDetail.LU); await _bbacSeDetailRepository.InsertManyAsync(bbacSeDetails); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs index 0b4bf49d..480740a9 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs @@ -49,6 +49,11 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService /// private readonly MaterialRelationshipManager _materialRelationshipManager; + /// + /// 客户零件关系集合 + /// + private List _addMaterialRelationships; + /// /// 构造 /// @@ -64,6 +69,7 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService _hbpoSeDetailRepository = hbpoSeDetailRepository; _pubSeDetailRepository = pubSeDetailRepository; _materialRelationshipManager = materialRelationshipManager; + _addMaterialRelationships = new List(); } [ApiExplorerSettings(IgnoreApi = true)] @@ -80,6 +86,11 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService { await SyncJitRecordAsync().ConfigureAwait(false); await SyncJisRecordAsync().ConfigureAwait(false); + if (_addMaterialRelationships.Any()) + { + _addMaterialRelationships = _addMaterialRelationships.GroupBy(t => new { t.ErpMaterialCode }).Select(t => t.First()).ToList(); + await _materialRelationshipManager.AddNewMaterialRelationships(_addMaterialRelationships).ConfigureAwait(false); + } } /// @@ -200,7 +211,7 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService var maiDanHBPOSeLuRePartCodes = maiDanHBPOSeDetails.Select(t => new { t.LU, t.PartCode }); var luRePartCodes = hbpoSeLuRePartCodes.Union(maiDanHBPOSeLuRePartCodes); var materialRelationships = luRePartCodes.GroupBy(t => new { t.LU, t.PartCode }).Select(t => new MaterialRelationship(GuidGenerator.Create(), t.Key.LU, "", t.Key.PartCode, "")); - await _materialRelationshipManager.AddNewMaterialRelationships(materialRelationships).ConfigureAwait(false); + _addMaterialRelationships.AddRange(materialRelationships); hbpoSeDetails.ForEach(hbpoSeDetail => hbpoSeDetail.KeyCode = hbpoSeDetail.PN + hbpoSeDetail.LU); maiDanHBPOSeDetails.ForEach(maiDanHBPOSeDetail => diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs index 17a8ada2..fbd80e37 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs @@ -3,7 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Coravel.Invocable; +using LinqToDB; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using SettleAccount.Domain.BQ; using Volo.Abp.Application.Services; @@ -16,6 +18,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; [ApiExplorerSettings(IgnoreApi = true)] public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable { + private readonly object _lockObj = new object(); private readonly IServiceProvider _serviceProvider; public JisBBACSeEdiCompareAppService(IServiceProvider serviceProvider) @@ -28,21 +31,39 @@ public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable /// public async Task Invoke() { - using var serviceScope = _serviceProvider.CreateScope(); - var db = serviceScope.ServiceProvider.GetRequiredService(); - - await HandDelEdiDataAsync().ConfigureAwait(false); + try + { + using var serviceScope = _serviceProvider.CreateScope(); + var db = serviceScope.ServiceProvider.GetRequiredService(); - var seDetailGroup = db.Set().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }); - var ediDetailGroup = db.Set().Where(t => t.IsDeleted == false && t.IsHaveSeData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }); - var keyCodes = seDetailGroup.Join(ediDetailGroup, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (se, edi) => new { se.PN, se.LU }); - var seDetails = db.Set().Where(t => keyCodes.Contains(new { t.PN, t.LU })); - var ediDetails = db.Set().Where(t => keyCodes.Contains(new { t.PN, t.LU })); - seDetails.ForEach(t => t.IsHaveEdiData = true); - ediDetails.ForEach(t => t.IsHaveSeData = true); - db.Set().UpdateRange(seDetails); - db.Set().UpdateRange(ediDetails); - await db.SaveChangesAsync().ConfigureAwait(false); + await HandDelEdiDataAsync().ConfigureAwait(false); + lock (_lockObj) + { + var seDetailGroup = db.Set().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }); + var ediDetailGroup = db.Set().Where(t => t.IsDeleted == false && t.IsHaveSeData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }); + var keyCodes = seDetailGroup.Join(ediDetailGroup, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (se, edi) => new { se.PN, se.LU }); + if (keyCodes.Any()) + { + var seDetails = db.Set().Join(keyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); + var ediDetails = db.Set().Join(keyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); + if (seDetails.Any()) + { + seDetails.ForEach(t => t.IsHaveEdiData = true); + db.Set().UpdateRange(seDetails); + } + if (ediDetails.Any()) + { + ediDetails.ForEach(t => t.IsHaveSeData = true); + db.Set().UpdateRange(ediDetails); + } + db.SaveChanges(); + } + } + } + catch (Exception) + { + throw; + } } /// @@ -61,12 +82,21 @@ public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable //Edi 删除的数据(有发运数据) var ediDelKeyCodes = db.Set().Where(t => t.IsDeleted == true && t.IsHaveSeData == true).Select(t => new { t.PN, t.LU }).Distinct(); - var seDetails = db.Set().Where(t => ediDelKeyCodes.Contains(new { t.PN, t.LU })); - var ediDetails = db.Set().Where(t => ediDelKeyCodes.Contains(new { t.PN, t.LU })); - seDetails.ForEach(t => t.IsHaveEdiData = false); - ediDetails.ForEach(t => t.IsHaveSeData = false); - db.Set().UpdateRange(seDetails); - db.Set().UpdateRange(ediDetails); - await db.SaveChangesAsync().ConfigureAwait(false); + if (ediDelKeyCodes.Any()) + { + var seDetails = db.Set().Join(ediDelKeyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); + var ediDetails = db.Set().Join(ediDelKeyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); + if (seDetails.Any()) + { + seDetails.ForEach(t => t.IsHaveEdiData = false); + db.Set().UpdateRange(seDetails); + } + if (ediDetails.Any()) + { + ediDetails.ForEach(t => t.IsHaveSeData = false); + db.Set().UpdateRange(ediDetails); + } + await db.SaveChangesAsync().ConfigureAwait(false); + } } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs index 42ff332f..3fce2653 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs @@ -20,6 +20,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; [ApiExplorerSettings(IgnoreApi = true)] public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable { + private readonly object _lockObj = new object(); private readonly IServiceProvider _serviceProvider; /// @@ -46,48 +47,39 @@ public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable /// public async Task Invoke() { - Debug.WriteLine($"执行了:{this.GetType()}"); - using var serviceScope = _serviceProvider.CreateScope(); - var db = serviceScope.ServiceProvider.GetRequiredService(); - - await HandDelEdiDataAsync().ConfigureAwait(false); - - var seDetailGroup = from se in db.Set() - where se.IsHaveEdiData == false - group se by new { se.PN, se.LU } - into a - select new { a.Key.PN, a.Key.LU }; - - var ediDetailGroup = from edi in db.Set() - where edi.IsDeleted == false && edi.IsHaveSeData == false - group edi by new { edi.PN, edi.LU } - into a - select new { a.Key.PN, a.Key.LU }; - - var keyCodes = from se in seDetailGroup - join edi in ediDetailGroup on new - { - se.PN, - se.LU - } equals new - { - edi.PN, - edi.LU - } - select new { se.PN, se.LU }; - - //var seDetailGroup2 = db.Set().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }); - //var ediDetailGroup2 = db.Set().Where(t => t.IsHaveSeData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }); - //var keyCodes2 = seDetailGroup2.Join(ediDetailGroup2, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (se, edi) => new { se.PN, se.LU }); - var seDetails = db.Set().Where(t => keyCodes.Contains(new { t.PN, t.LU })); - var ediDetails = db.Set().Where(t => keyCodes.Contains(new { t.PN, t.LU })); - seDetails.ForEach(t => t.IsHaveEdiData = true); - ediDetails.ForEach(t => t.IsHaveSeData = true); - db.Set().UpdateRange(seDetails); - db.Set().UpdateRange(ediDetails); - await db.SaveChangesAsync().ConfigureAwait(false); + try + { + using var serviceScope = _serviceProvider.CreateScope(); + var db = serviceScope.ServiceProvider.GetRequiredService(); - Debug.WriteLine($"处理数量:{keyCodes.Count()}"); + await HandDelEdiDataAsync().ConfigureAwait(false); + lock (_lockObj) + { + var seDetailGroup = db.Set().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }); + var ediDetailGroup = db.Set().Where(t => t.IsDeleted == false && t.IsHaveSeData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }); + var keyCodes = seDetailGroup.Join(ediDetailGroup, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (se, edi) => new { se.PN, se.LU }); + if (keyCodes.Any()) + { + var seDetails = db.Set().Join(keyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); + var ediDetails = db.Set().Join(keyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); + if (seDetails.Any()) + { + seDetails.ForEach(t => t.IsHaveEdiData = true); + db.Set().UpdateRange(seDetails); + } + if (ediDetails.Any()) + { + ediDetails.ForEach(t => t.IsHaveSeData = true); + db.Set().UpdateRange(ediDetails); + } + db.SaveChanges(); + } + } + } + catch (Exception) + { + throw; + } } /// @@ -100,12 +92,21 @@ public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable //Edi 删除的数据(有发运数据) var ediDelKeyCodes = db.Set().Where(t => t.IsDeleted == true && t.IsHaveSeData == true).Select(t => new { t.PN, t.LU }).Distinct(); - var seDetails = db.Set().Where(t => ediDelKeyCodes.Contains(new { t.PN, t.LU })); - var ediDetails = db.Set().Where(t => ediDelKeyCodes.Contains(new { t.PN, t.LU })); - seDetails.ForEach(t => t.IsHaveEdiData = false); - ediDetails.ForEach(t => t.IsHaveSeData = false); - db.Set().UpdateRange(seDetails); - db.Set().UpdateRange(ediDetails); - await db.SaveChangesAsync().ConfigureAwait(false); + if (ediDelKeyCodes.Any()) + { + var seDetails = db.Set().Join(ediDelKeyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); + var ediDetails = db.Set().Join(ediDelKeyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); + if (seDetails.Any()) + { + seDetails.ForEach(t => t.IsHaveEdiData = false); + db.Set().UpdateRange(seDetails); + } + if (ediDetails.Any()) + { + ediDetails.ForEach(t => t.IsHaveSeData = false); + db.Set().UpdateRange(ediDetails); + } + await db.SaveChangesAsync().ConfigureAwait(false); + } } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/MaterialRelationshipManager.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/MaterialRelationshipManager.cs index 0400a179..75072812 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/MaterialRelationshipManager.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/MaterialRelationshipManager.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Services; using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.Shared.RepositoryBase; @@ -29,7 +30,7 @@ public class MaterialRelationshipManager : DomainService { //客户零件号和厂内零件号 var luRePartCodes = materialRelationships.Select(t => new { t.ErpMaterialCode, t.SettleMaterialCode }).Distinct().ToList(); - var haveLuRePartCodes = materialRelationships.Join(_materialRelationshipRepository, + var haveLuRePartCodes = materialRelationships.Join(_materialRelationshipRepository.AsNoTracking(), a => new { a.ErpMaterialCode, a.SettleMaterialCode }, b => new { b.ErpMaterialCode, b.SettleMaterialCode }, (a, b) => a).ToList(); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIS_RECORD.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIS_RECORD.cs index 08fd2553..452748c8 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIS_RECORD.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIS_RECORD.cs @@ -35,8 +35,8 @@ public class TM_BJBMPT_JIS_RECORD [DisplayName("JIS生产码类型")] public string CodeType { get; set; } - [DisplayName("状态")] - public EnumBillState State { get; set; } + //[DisplayName("状态")] + //public EnumBillState State { get; set; } [DisplayName("订单零件号")] public string RealPartCode { get; set; } @@ -51,7 +51,7 @@ public class TM_BJBMPT_JIS_RECORD public string CustPartCode { get; set; } [DisplayName("数量")] - public decimal Qty { get; set; } + public decimal? Qty { get; set; } [DisplayName("发货单号")] public string BillNum { get; set; } @@ -60,7 +60,7 @@ public class TM_BJBMPT_JIS_RECORD public string MESConfigCode { get; set; } [DisplayName("订单时间")] - public DateTime AssembleData { get; set; } + public DateTime? AssembleData { get; set; } [DisplayName("来源库位")] public string FromLoc { get; set; } @@ -120,5 +120,5 @@ public class TM_BJBMPT_JIS_RECORD public string Position { get; set; } [DisplayName("创建时间")] - public DateTime CreateTime { get; set; } + public DateTime? CreateTime { get; set; } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIT_RECORD.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIT_RECORD.cs index fd21f5f9..67c6d5db 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIT_RECORD.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIT_RECORD.cs @@ -39,7 +39,7 @@ public class TM_BJBMPT_JIT_RECORD public string Seq { get; set; } [DisplayName("订单时间")] - public DateTime AssembleData { get; set; } + public DateTime? AssembleData { get; set; } [DisplayName("发货条码")] public string DeliverCode { get; set; } @@ -89,9 +89,6 @@ public class TM_BJBMPT_JIT_RECORD [DisplayName("原生产码")] public string OrigiCode { get; set; } - [DisplayName("描述")] - public string PartDesc { get; set; } - [DisplayName("备注")] public string Remark { get; set; } @@ -125,11 +122,11 @@ public class TM_BJBMPT_JIT_RECORD [DisplayName("虚拟小总成")] public string MatchNumber { get; set; } - [DisplayName("状态")] - public EnumBillState State { get; set; } + //[DisplayName("状态")] + //public EnumBillState State { get; set; } [DisplayName("创建时间")] - public DateTime CreateTime { get; set; } + public DateTime? CreateTime { get; set; } } public enum EnumProTpe