From 2e9e1621f7f4721d9a39b846cb557251421f46c8 Mon Sep 17 00:00:00 2001 From: Administrator Date: Thu, 3 Feb 2022 21:33:49 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../appsettings.Development.json | 10 +++++----- .../host/SettleAccount.HttpApi.Host/appsettings.json | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json index c8c74e7f..2ebe764a 100644 --- a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json +++ b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json @@ -7,11 +7,11 @@ // "SettleAccountService": "Server=LAPTOP-V3U07C2O;Database=SettleAccountService;user id=sa;Password=1q2w!@#;" //}, "ConnectionStrings": { - //"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1", - //"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService1;user id=sa;Password=1;" - "Default": "Server=192.168.0.67;Database=ABP;User ID=sa;Password=Microsoft2008;", - "SettleAccountService": "Server=192.168.0.67;Database=SettleAccountService;user id=sa;password=Microsoft2008;", - "Wms": "Server=192.168.0.63;Database=CPAT_WMS;user id=sa;password=Microsoft2008;" + "Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1", + "SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService;user id=sa;Password=1;" + //"Default": "Server=192.168.0.67;Database=ABP;User ID=sa;Password=Microsoft2008;", + //"SettleAccountService": "Server=192.168.0.67;Database=SettleAccountService;user id=sa;password=Microsoft2008;", + //"Wms": "Server=192.168.0.63;Database=CPAT_WMS;user id=sa;password=Microsoft2008;" }, "Logging": { "LogLevel": { diff --git a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json index e947ac2e..16ea5788 100644 --- a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json +++ b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json @@ -7,11 +7,11 @@ // "SettleAccountService": "Server=LAPTOP-V3U07C2O;Database=SettleAccountService1;user id=sa;Password=1q2w!@#;" //}, "ConnectionStrings": { - //"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1", - //"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService1;user id=sa;Password=1;", - "Default": "Server=192.168.0.67;Database=ABP;User ID=sa;Password=Microsoft2008;", - "SettleAccountService": "Server=192.168.0.67;Database=SettleAccountService;user id=sa;password=Microsoft2008;", - "Wms": "Server=192.168.0.63;Database=CPAT_WMS;user id=sa;password=Microsoft2008;" + "Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1", + "SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService;user id=sa;Password=1;" + //"Default": "Server=192.168.0.67;Database=ABP;User ID=sa;Password=Microsoft2008;", + //"SettleAccountService": "Server=192.168.0.67;Database=SettleAccountService;user id=sa;password=Microsoft2008;", + //"Wms": "Server=192.168.0.63;Database=CPAT_WMS;user id=sa;password=Microsoft2008;" }, "Logging": { From 5ae4d61858042491dc5b7c95f1f24ff87dc96907 Mon Sep 17 00:00:00 2001 From: Administrator Date: Thu, 3 Feb 2022 21:34:12 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/WMS/WMSJitAppService.cs | 4 ++ .../Entities/WMS/WMSKanbanAppService.cs | 8 ++- .../Entities/WMS/WMSKanbanExtendAppService.cs | 8 ++- .../Entities/WMS/WMSSharePart90AppService.cs | 16 +++-- .../Entities/WMS/WMSSharePartAppService.cs | 14 ++++- .../Entities/WMS/TaskList.cs | 60 ++++++++++++++++--- .../Report/ErpPartDapperRepository.cs | 2 +- .../Report/KanbanUnSettledDapperRepository.cs | 2 +- 8 files changed, 92 insertions(+), 22 deletions(-) diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs index 2ce0f9a4..546d28dc 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs @@ -128,6 +128,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts GuidGenerator.Create() , string.Empty , itm.Qty + ,itm.Price + ,itm.Amt ); _lsCopy.Add(_detail); } @@ -382,6 +384,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts GuidGenerator.Create() ,string.Empty , itm.Qty + ,itm.Price + ,itm.Amt ); _lsCopy.Add(_detail); } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs index 8933c639..938bba97 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs @@ -533,7 +533,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts string.Empty, _billNum, 0, - 0 + 0, + itm.InvoicePrice + ,itm.InvoiceAmt ); @@ -686,7 +688,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts itm.BillNum, GuidGenerator.Create() , string.Empty - , itm.Qty + , itm.Qty, + itm.Price, + itm.Amt ); _lsCopy.Add(_detail); } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanExtendAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanExtendAppService.cs index 448558ff..9dac590d 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanExtendAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanExtendAppService.cs @@ -184,7 +184,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS string.Empty, itm.BillNum, itm.State, - itm.RealityNumber + itm.RealityNumber, + itm.Price, + itm.Amt ); return new PagedResultDto(totalCount, entities); @@ -265,7 +267,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS string.Empty, _billNum, 0, - 0 + 0, + itm.InvoicePrice, + itm.InvoiceAmt ); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs index 981d3533..faf93fa6 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs @@ -175,7 +175,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS itm.Remark, itm.Qty, tm1 == null ? 0 : tm1.Qty, - itm.OutPutQty != 0 ? itm.OutPutQty : itm.Qty + itm.OutPutQty != 0 ? itm.OutPutQty : itm.Qty, + itm.Price, + itm.Amt ); @@ -244,7 +246,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS string.Empty, p.Qty, p.StockQty, - p.Qty + p.Qty, + p.Price, + p.Amt )); _lst.AddRange(_list.ToArray()); } @@ -291,7 +295,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS string.Empty, p.Qty, p.StockQty, - p.Qty + p.Qty, + p.Price, + p.Amt )).ToList(); await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum == _billNum); @@ -469,7 +475,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS , string.Empty , itm.Qty , 0 - , itm.Qty + , itm.Qty, + itm.Price, + itm.Amt ); _lsCopy.Add(_detail); } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs index 401548ba..67c2cde0 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs @@ -170,7 +170,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts itm.Remark, itm.Qty, tm1 == null ? 0 : tm1.Qty, - itm.OutPutQty + itm.OutPutQty, + itm.Price, + itm.Amt ); @@ -240,7 +242,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts string.Empty, p.Qty, p.StockQty, - p.Qty + p.Qty, + p.Price, + p.Amt )); _lst.AddRange(_list.ToArray()); } @@ -287,7 +291,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts string.Empty, p.Qty, p.StockQty, - p.Qty + p.Qty, + p.Price, + p.Amt )).ToList(); await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum == _billNum); @@ -485,6 +491,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts , itm.Qty , 0 , itm.Qty + ,itm.Price + ,itm.Amt ); _lsCopy.Add(_detail); } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs index e71ec430..9b0c6eed 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs @@ -97,7 +97,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS - public WmsJitOutPutDetial(Guid id, string wmsBillNum, string kennCode, string chassisNumber, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode,string billNum,Guid taskId,string remark,decimal qty):base(id) + public WmsJitOutPutDetial(Guid id, string wmsBillNum, string kennCode, string chassisNumber, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode,string billNum,Guid taskId,string remark,decimal qty, decimal price, decimal amt) :base(id) { Id = id; WmsBillNum = wmsBillNum; @@ -117,10 +117,12 @@ namespace Win.Sfs.SettleAccount.Entities.WMS TaskId = taskId; Remark = remark; Qty = qty; + Amt = amt; + Price = price; } - + public void SetData(Guid guid,string output,string input,string extend1,string extend2,string version,Guid taskid) { @@ -142,7 +144,13 @@ namespace Win.Sfs.SettleAccount.Entities.WMS public string InPut { set; get; } [ImporterHeader(Name = "状态")] public int State { get; set; } + [ImporterHeader(Name = "开票单价")] + + public decimal Price { set; get; } + [ImporterHeader(Name = "开票金额")] + public decimal Amt { set; get; } + [ImporterHeader(Name = "开票单价",IsIgnore =true)] /// /// 扩展字段1 /// @@ -242,7 +250,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS { } - public WmsKanbanOutPutDetial(Guid id, string wmsBillNum, string kanban, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId,string remark,decimal qty) + public WmsKanbanOutPutDetial(Guid id, string wmsBillNum, string kanban, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId,string remark,decimal qty, decimal price, decimal amt) { Id = id; WmsBillNum = wmsBillNum; @@ -261,8 +269,13 @@ namespace Win.Sfs.SettleAccount.Entities.WMS TaskId = taskId; Remark = remark; Qty = qty; - + Price = price; + Amt = amt; + } + + + public void SetData(Guid id,string remark,string wmsbillnum,string version,Guid taskId) { Id = id; @@ -270,8 +283,6 @@ namespace Win.Sfs.SettleAccount.Entities.WMS WmsBillNum = wmsbillnum; Version = version; TaskId = taskId; - - } // 交货单号 实际发货日期 KENN号 底盘号 物料号 物料描述 客户物料 组件组物料 组件组物料描述 物料组(车型) 定价 金额 结算平台未结数量 大众R3未结数量 差异金额 差异数量 漏结标识 漏结期间 说明 @@ -323,6 +334,12 @@ namespace Win.Sfs.SettleAccount.Entities.WMS [ImporterHeader(Name = "任务", IsIgnore = true)] public Guid TaskId { set; get; } + [ImporterHeader(Name = "开票单价")] + + public decimal Price { set; get; } + [ImporterHeader(Name = "开票金额")] + public decimal Amt { set; get; } + } @@ -364,7 +381,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS - public WmsWithOutKanbanOutPutDetial(Guid id ,string type, string sapMaterialCode, string materialDesc, string version, string isBack, string remark, decimal qty, decimal sockQty, decimal outputQty, string extend,string billnum,int state,decimal realqty):base(id) + public WmsWithOutKanbanOutPutDetial(Guid id ,string type, string sapMaterialCode, string materialDesc, string version, string isBack, string remark, decimal qty, decimal sockQty, decimal outputQty, string extend,string billnum,int state,decimal realqty, decimal price, decimal amt) :base(id) { Type = type; SapMaterialCode = sapMaterialCode; @@ -381,8 +398,12 @@ namespace Win.Sfs.SettleAccount.Entities.WMS BillNum = billnum; State = state; RealityNumber = realqty; + Price = price; + Amt = amt; } + + [ImporterHeader(Name = "单据类型")] public string Type { set; get; } [ImporterHeader(Name = "物料号")] @@ -409,6 +430,11 @@ namespace Win.Sfs.SettleAccount.Entities.WMS public string BillNum { set; get; } [ImporterHeader(Name = "状态", IsIgnore = true)] public int State { set; get; } + [ImporterHeader(Name = "开票单价")] + + public decimal Price { set; get; } + [ImporterHeader(Name = "开票金额")] + public decimal Amt { set; get; } } @@ -1389,7 +1415,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS { } - public WmsSharePartOutPutDetial(Guid id, string wmsBillNum, string orderBillNum, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, decimal stockQty, decimal outputQty) + public WmsSharePartOutPutDetial(Guid id, string wmsBillNum, string orderBillNum, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, decimal stockQty, decimal outputQty, decimal price, decimal amt) { Id = id; WmsBillNum = wmsBillNum; @@ -1410,8 +1436,11 @@ namespace Win.Sfs.SettleAccount.Entities.WMS Qty = qty; StockQty = stockQty; OutPutQty = outputQty; + Price = price; + Amt = amt; } + public void SetId(Guid id) { @@ -1476,6 +1505,11 @@ namespace Win.Sfs.SettleAccount.Entities.WMS [ImporterHeader(Name = "出库数量", IsIgnore = true)] public decimal OutPutQty { set; get; } + [ImporterHeader(Name = "开票单价")] + + public decimal Price { set; get; } + [ImporterHeader(Name = "开票金额")] + public decimal Amt { set; get; } } @@ -1652,7 +1686,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS { } - public WmsSharePart90OutPutDetial(Guid id, string wmsBillNum, string orderBillNum, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, decimal stockQty, decimal outputQty) + public WmsSharePart90OutPutDetial(Guid id, string wmsBillNum, string orderBillNum, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, decimal stockQty, decimal outputQty, decimal price, decimal amt) { Id = id; WmsBillNum = wmsBillNum; @@ -1673,8 +1707,11 @@ namespace Win.Sfs.SettleAccount.Entities.WMS Qty = qty; StockQty = stockQty; OutPutQty = outputQty; + Price = price; + Amt = amt; } + public void SetId(Guid id) { @@ -1740,6 +1777,11 @@ namespace Win.Sfs.SettleAccount.Entities.WMS [ImporterHeader(Name = "任务代码", IsIgnore = true)] public Guid TaskId { set; get; } + [ImporterHeader(Name = "开票单价")] + + public decimal Price { set; get; } + [ImporterHeader(Name = "开票金额")] + public decimal Amt { set; get; } } diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs index 10ecbb45..27c88554 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs @@ -50,7 +50,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } else { - _materialList = DbConnection.Query("select * from set_material").ToList(); + _materialList = DbConnection.Query("select max(Id) Factory,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc,EstimateTypeDesc,EstimateType ").ToList(); } if (CacheManager.CachePriceList != null) { diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs index 46b06e8e..741e8a54 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs @@ -36,7 +36,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report public decimal InvoiceQty { get; set; } [ExporterHeader(DisplayName ="发货数量")] public decimal Qty { get; set; } - [ExporterHeader(DisplayName = "金额")] + [ExporterHeader(DisplayName = "开票金额")] public decimal InvoiceAmt { get; set; } [ExporterHeader(DisplayName = "开票单价")] public decimal InvoicePrice { get; set; } From be3761bbc97fe05c0edf2941ad00c7fa1236e7a9 Mon Sep 17 00:00:00 2001 From: Administrator Date: Mon, 7 Feb 2022 08:55:12 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SettleAccounts/SettleAccountAppService.cs | 3 + .../Entities/SettleAccountEntityBase.cs | 4 + .../InvoiceSettledDiffs/InvoiceSettledDiff.cs | 106 ++++++ .../Report/ErpPartDapperRepository.cs | 3 + ...nvoiceSettledDetailDiffDapperRepository.cs | 358 ++++++------------ ...nvoiceSettledDetailDiffDapperRepository.cs | 1 + .../SettleAccounts/SettleAccountRepository.cs | 1 + .../Report/SettleDoorPanelExportService.cs | 1 + .../SettleAccountImportService.cs | 7 + 9 files changed, 234 insertions(+), 250 deletions(-) diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs index fdf24732..0d851ea4 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs @@ -276,6 +276,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts [Route("ExcelImport-PG")] [DisableRequestSizeLimit] [Authorize(SettleAccountPermissions.SettleAccounts.Create)] + [UnitOfWork(false)] public async Task SettleAccountUploadExcelImportTH([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode, string factory) { @@ -302,6 +303,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts }); + + return _taskid; } /// diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettleAccountEntityBase.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettleAccountEntityBase.cs index 7794e52e..402376f7 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettleAccountEntityBase.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettleAccountEntityBase.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using Win.Sfs.SettleAccount.Entities.Materials; using Win.Sfs.SettleAccount.Entities.Prices; +using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs; namespace Win.Sfs.SettleAccount.Entities { @@ -13,6 +14,9 @@ namespace Win.Sfs.SettleAccount.Entities { public static List CacheMaterials { set; get; } public static List CachePriceList { set; get; } + + + public static List CacheInvoiceSettledDetailDiff { set; get; } } public interface ISettleAccountEntityBase diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/InvoiceSettledDiffs/InvoiceSettledDiff.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/InvoiceSettledDiffs/InvoiceSettledDiff.cs index b43d41d6..7f0aa3dd 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/InvoiceSettledDiffs/InvoiceSettledDiff.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/InvoiceSettledDiffs/InvoiceSettledDiff.cs @@ -1,4 +1,5 @@ using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; using System; using System.Collections.Generic; using System.Linq; @@ -8,6 +9,111 @@ using Win.Sfs.Shared.DomainBase; namespace Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs { + + [ExcelExporter(MaxRowNumberOnASheet = 900000)] + public class InvoiceSettledDetailDiff + : ReportDetailBase + { + //public InvoiceSettledDetailDiff(string wmsBillNum, DateTime cP5Time, string kENNCode, string chassisNumber, string wmsState, string sapMaterialCode, string materialDesc, string materialCode, string parentSapMaterialCode, string parentMaterialDesc, string materialGroup, decimal price, decimal amt, decimal qty, decimal settledQty, DateTime cP7Time, decimal diffSettleFisQty, decimal diffSettleInvQty, decimal invoiceQty, decimal invoicePrice, decimal invocieAmt, decimal settleAmt, decimal diffPrice) + //{ + // WmsBillNum = wmsBillNum; + // CP5Time = cP5Time; + // KENNCode = kENNCode; + // ChassisNumber = chassisNumber; + // WmsState = wmsState; + // SapMaterialCode = sapMaterialCode; + // MaterialDesc = materialDesc; + // MaterialCode = materialCode; + // ParentSapMaterialCode = parentSapMaterialCode; + // ParentMaterialDesc = parentMaterialDesc; + // MaterialGroup = materialGroup; + // Price = price; + // Amt = amt; + // Qty = qty; + // SettledQty = settledQty; + // CP7Time = cP7Time; + // DiffSettleFisQty = diffSettleFisQty; + // DiffSettleInvQty = diffSettleInvQty; + // InvoiceQty = invoiceQty; + // InvoicePrice = invoicePrice; + // InvocieAmt = invocieAmt; + // SettleAmt = settleAmt; + // DiffPrice = diffPrice; + //} + + [ExporterHeader(DisplayName = "交货单号")] + public override string WmsBillNum { set; get; } + [ExporterHeader(DisplayName = "实际发货日期", Format = "yyyy-MM-dd")] + public override DateTime CP5Time { set; get; } + [ExporterHeader(DisplayName = "KENN号")] + public override string KENNCode { set; get; } + [ExporterHeader(DisplayName = "底盘号")] + public override string ChassisNumber { set; get; } + [ExporterHeader(DisplayName = "交货状态")] + public override string WmsState { set; get; } + [ExporterHeader(DisplayName = "物料号")] + public override string SapMaterialCode { set; get; } + [ExporterHeader(DisplayName = "物料描述")] + public override string MaterialDesc { set; get; } + [ExporterHeader(DisplayName = "客户物料")] + public override string MaterialCode { set; get; } + [ExporterHeader(DisplayName = "组件组物料")] + public override string ParentSapMaterialCode { set; get; } + [ExporterHeader(DisplayName = "组件组物料描述")] + public override string ParentMaterialDesc { set; get; } + [ExporterHeader(DisplayName = "物料组(车型)")] + public override string MaterialGroup { set; get; } + [ExporterHeader(DisplayName = "定价")] + public override decimal Price { set; get; } + [ExporterHeader(DisplayName = "金额")] + public override decimal Amt { set; get; } + //发运数量 + [ExporterHeader(DisplayName = "M100数量")] + public decimal Qty { set; get; } + //结算数量 + [ExporterHeader(DisplayName = "结算数量")] + public decimal SettledQty { set; get; } + //结算日期 + [ExporterHeader(DisplayName = "结算日期", Format = "yyyy-MM-dd")] + public override DateTime CP7Time { set; get; } + //结算与发货差异 + [ExporterHeader(DisplayName = "结算与发货差异")] + public decimal DiffSettleFisQty { set; get; } + //结算与开票差异 + [ExporterHeader(DisplayName = "结算与开票差异")] + public decimal DiffSettleInvQty { set; get; } + //开票数量 + [ExporterHeader(DisplayName = "开票数量")] + public decimal InvoiceQty { set; get; } + //开票单价 + [ExporterHeader(DisplayName = "开票单价")] + public override decimal InvoicePrice { set; get; } + //开票金额 + [ExporterHeader(DisplayName = "开票金额")] + public decimal InvoiceAmt { set; get; } + //结算金额 + [ExporterHeader(DisplayName = "结算金额")] + public decimal SettleAmt { set; get; } + //单价差异 + [ExporterHeader(DisplayName = "单价差异")] + public decimal DiffPrice { set; get; } + + [ExporterHeader(DisplayName = "结算实际数量", IsIgnore = true)] + public decimal SettleReadyQty { set; get; } + + [ExporterHeader(DisplayName = "版本", IsIgnore = true)] + public string Version { set; get; } + //总金额差异 + //[ExporterHeader(DisplayName = "总金额差异")] + //public decimal AmtDiffPrice { set; get; } + + + + + + } + + public class InvoiceSettledDiff: FullAuditedAggregateRootBase { public InvoiceSettledDiff() diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs index 27c88554..728edbbb 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs @@ -47,6 +47,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report if (CacheManager.CacheMaterials != null) { _materialList = CacheManager.CacheMaterials; + _materialList= CacheManager.CacheMaterials.GroupBy(p => new { p.MaterialCode }).Select(p => p.FirstOrDefault()).ToList(); } else { @@ -55,6 +56,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report if (CacheManager.CachePriceList != null) { _priceList = CacheManager.CachePriceList; + _priceList = CacheManager.CachePriceList.GroupBy(p => new { p.SapErpPartCode }).Select(p => p.FirstOrDefault()).ToList(); + } else { diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs index 7847dfe6..619713a6 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs @@ -9,109 +9,13 @@ using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories.Dapper; using Volo.Abp.EntityFrameworkCore; +using Win.Sfs.SettleAccount.Entities; using Win.Sfs.SettleAccount.Reports; +using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs; namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report { - [ExcelExporter(MaxRowNumberOnASheet = 900000)] - public class InvoiceSettledDetailDiff - : ReportDetailBase - { - //public InvoiceSettledDetailDiff(string wmsBillNum, DateTime cP5Time, string kENNCode, string chassisNumber, string wmsState, string sapMaterialCode, string materialDesc, string materialCode, string parentSapMaterialCode, string parentMaterialDesc, string materialGroup, decimal price, decimal amt, decimal qty, decimal settledQty, DateTime cP7Time, decimal diffSettleFisQty, decimal diffSettleInvQty, decimal invoiceQty, decimal invoicePrice, decimal invocieAmt, decimal settleAmt, decimal diffPrice) - //{ - // WmsBillNum = wmsBillNum; - // CP5Time = cP5Time; - // KENNCode = kENNCode; - // ChassisNumber = chassisNumber; - // WmsState = wmsState; - // SapMaterialCode = sapMaterialCode; - // MaterialDesc = materialDesc; - // MaterialCode = materialCode; - // ParentSapMaterialCode = parentSapMaterialCode; - // ParentMaterialDesc = parentMaterialDesc; - // MaterialGroup = materialGroup; - // Price = price; - // Amt = amt; - // Qty = qty; - // SettledQty = settledQty; - // CP7Time = cP7Time; - // DiffSettleFisQty = diffSettleFisQty; - // DiffSettleInvQty = diffSettleInvQty; - // InvoiceQty = invoiceQty; - // InvoicePrice = invoicePrice; - // InvocieAmt = invocieAmt; - // SettleAmt = settleAmt; - // DiffPrice = diffPrice; - //} - - [ExporterHeader(DisplayName = "交货单号")] - public override string WmsBillNum { set; get; } - [ExporterHeader(DisplayName = "实际发货日期", Format = "yyyy-MM-dd")] - public override DateTime CP5Time { set; get; } - [ExporterHeader(DisplayName = "KENN号")] - public override string KENNCode { set; get; } - [ExporterHeader(DisplayName = "底盘号")] - public override string ChassisNumber { set; get; } - [ExporterHeader(DisplayName = "交货状态")] - public override string WmsState { set; get; } - [ExporterHeader(DisplayName = "物料号")] - public override string SapMaterialCode { set; get; } - [ExporterHeader(DisplayName = "物料描述")] - public override string MaterialDesc { set; get; } - [ExporterHeader(DisplayName = "客户物料")] - public override string MaterialCode { set; get; } - [ExporterHeader(DisplayName = "组件组物料")] - public override string ParentSapMaterialCode { set; get; } - [ExporterHeader(DisplayName = "组件组物料描述")] - public override string ParentMaterialDesc { set; get; } - [ExporterHeader(DisplayName = "物料组(车型)")] - public override string MaterialGroup { set; get; } - [ExporterHeader(DisplayName = "定价")] - public override decimal Price { set; get; } - [ExporterHeader(DisplayName = "金额") ] - public override decimal Amt { set; get; } - //发运数量 - [ExporterHeader(DisplayName = "M100数量")] - public decimal Qty { set; get; } - //结算数量 - [ExporterHeader(DisplayName = "结算数量")] - public decimal SettledQty { set; get; } - //结算日期 - [ExporterHeader(DisplayName = "结算日期", Format = "yyyy-MM-dd")] - public override DateTime CP7Time { set; get; } - //结算与发货差异 - [ExporterHeader(DisplayName = "结算与发货差异")] - public decimal DiffSettleFisQty{ set; get; } - //结算与开票差异 - [ExporterHeader(DisplayName = "结算与开票差异")] - public decimal DiffSettleInvQty { set; get; } - //开票数量 - [ExporterHeader(DisplayName = "开票数量")] - public decimal InvoiceQty { set; get; } - //开票单价 - [ExporterHeader(DisplayName = "开票单价")] - public override decimal InvoicePrice { set; get; } - //开票金额 - [ExporterHeader(DisplayName = "开票金额")] - public decimal InvoiceAmt { set; get; } - //结算金额 - [ExporterHeader(DisplayName = "结算金额")] - public decimal SettleAmt { set; get; } - //单价差异 - [ExporterHeader(DisplayName = "单价差异")] - public decimal DiffPrice { set; get; } - - [ExporterHeader(DisplayName = "结算实际数量",IsIgnore =true)] - public decimal SettleReadyQty { set; get; } - //总金额差异 - //[ExporterHeader(DisplayName = "总金额差异")] - //public decimal AmtDiffPrice { set; get; } - - - - - - } + /// /// 2.大众发票与结算核对明细表-准时化 /// @@ -123,163 +27,117 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } public virtual List GetInvoiceSettledDetailDiffReportList(string version, string materialCode, string begin, string end ,string cp7begin,string cp7end,string kennCode,string chassisNumber,string materialGroup) { - List _list = new List(); - - string condition = " where 1=1 "; - - - //if (!string.IsNullOrEmpty(materialCode)) - //{ - - // condition += string.Format(" and d.MaterialCode in ({0}) ", materialCode); - //} - if (!string.IsNullOrEmpty(begin)) + + if (CacheManager.CacheMaterials != null && CacheManager.CacheInvoiceSettledDetailDiff.Count(p => p.Version == version)>0) { - condition += string.Format(" and a.BeginTime>='{0}' ", begin); + _list = CacheManager.CacheInvoiceSettledDetailDiff.Where(p=>p.Version==version).ToList(); + _list= _list.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList(); } - if (!string.IsNullOrEmpty(end)) + else { - condition += string.Format(" and a.BeginTime<='{0}' ", end); - } - if (!string.IsNullOrEmpty(cp7begin)) - { - condition += string.Format(" and B.cp7>='{0}' ", cp7begin); - } - if (!string.IsNullOrEmpty(cp7end)) - { - condition += string.Format(" and B.cp7<='{0}' ", cp7end); - } - //if (!string.IsNullOrEmpty(kennCode)) - //{ - // condition += string.Format(" and B.kenncode='{0}' ", kennCode); - //} - //if (!string.IsNullOrEmpty(chassisNumber)) - //{ - // condition += string.Format(" and B.chassisNumber='{0}' ", chassisNumber); - //} - //if (!string.IsNullOrEmpty(materialGroup)) - //{ - // condition += string.Format(" B.chassisNumber='{0}' ", materialGroup); - //} - - - -// string str= "SELECT\n" + -//" temp1.*,\n" + -//" TEMP2.Price,(\n" + -//" Isnull( temp2.Price, 0 ) * isnull( temp1.Qty, 0 )) Amt \n" + -//"FROM\n" + -//" (\n" + -//" SELECT\n" + -//" b.YEAR,\n" + -//" isnull( a.OrderBillNum, b.Kenncode ) kennocode,\n" + -//" b.MaterialCode,\n" + -//" b.Model,\n" + -//" isnull( a.ChassisNumber, b.ChassisNumber ) ChassisNumber,\n" + -//" isnull( a.Qty, 0 ) Qty,\n" + -//" isnull( a.BeginTime, b.CP5A ) CP5Time,\n" + -//" a.ChassisNumber2,\n" + -//" B.CP7 CP7Time,\n" + -//" isnull( a.QTY, b.Qty ) SettledQty,\n" + -//" a.ErpMaterialCode ParentSapMaterialCode,\n" + -//" isnull( a.WMSState, '' ) WMSState,\n" + -//" isnull( a.WMSBillNum, '' ) WMSBillNum,\n" + -//" d.MaterialCode SapMaterialCode,\n" + -//" d.MaterialDesc MaterialDesc,\n" + -//" d.EstimateTypeDesc MaterialGroup,\n" + -//" e.MaterialDesc ParentMaterialDesc,\n" + -//" c.InvoicePrice,\n" + -//" Round( c.InvoicePrice * isnull( a.QTY, b.Qty ), 2 ) InvoiceAmt,\n" + -//" Round( c.InvoicePrice * isnull( a.QTY, b.Qty ), 2 ) SettleAmt,\n" + -//" isnull( a.Qty, 0 ) - IsNull( B.Qty, 0 ) DiffSettleFisQty,\n" + -//" 0 DiffSettleInvQty,\n" + -//" isnull( a.QTY, b.Qty ) InvoiceQty \n" + -//" FROM\n" + -//" ( SELECT * FROM Set_Settle b WHERE b.Version = '{0}' ) b\n" + -//" LEFT JOIN Set_fis a ON b.ChassisNumber = a.ChassisNumber2 \n" + -//" AND b.KENNCode = a.KENNCode \n" + -//" AND b.MaterialCode = a.ItemCode\n" + -//" LEFT JOIN ( SELECT SUM( amt )/ SUM( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) c ON b.MaterialCode = c.MaterialCode\n" + -//" LEFT JOIN set_material d ON b.MaterialCode = d.CustomerPartCode\n" + -//" LEFT JOIN set_material e ON a.ErpMaterialCode = e.MaterialCode \n" + -//" ) TEMP1\n" + -//" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) AND type = 10 ) TEMP2 ON TEMP1.SapMaterialCode = TEMP2.MaterialCode" - - - - - - - - - - - - - - - - - - - - - string str = - "SELECT\n" + -" temp1.*,\n" + -" TEMP2.Price,(\n" + -" Isnull( temp2.Price, 0 ) * isnull( temp1.Qty, 0 )) Amt \n" + -"FROM\n" + -" (\n" + -" SELECT\n" + -" b.YEAR,\n" + -" a.OrderBillNum Kenncode,\n" + -" b.MaterialCode,\n" + -" b.Model,\n" + -" a.ChassisNumber,\n" + -" a.Qty,\n" + -" a.BeginTime CP5Time,\n" + -" a.ChassisNumber2,\n" + -" B.CP7 CP7Time,\n" + -" a.QTY SettledQty,\n" + -" a.ErpMaterialCode ParentSapMaterialCode,\n" + -" a.WMSState,\n" + -" a.WMSBillNum,\n" + -" d.MaterialCode SapMaterialCode,\n" + -" d.MaterialDesc MaterialDesc,\n" + -" d.EstimateTypeDesc MaterialGroup,\n" + -" e.MaterialDesc ParentMaterialDesc,\n" + -" c.InvoicePrice,\n" + -" Round( c.InvoicePrice * a.qty,2 ) InvoiceAmt,\n" + -" Round( c.InvoicePrice * a.Qty,2 ) SettleAmt,\n" + -" 0 DiffSettleFisQty,\n" + -" 0 DiffSettleInvQty, \n" + -" a.Qty InvoiceQty ,\n" + -" IsNull( B.Qty, 0 ) SettleReadyQty \n" + -" FROM\n" + -" ( SELECT * FROM Set_Settle b WHERE b.Version = '{0}' ) b\n" + -" INNER JOIN Set_fis a ON b.ChassisNumber = a.ChassisNumber2 \n" + -" AND b.KENNCode = a.KENNCode \n" + -" AND b.MaterialCode = a.ItemCode\n" + -" LEFT JOIN ( SELECT SUM( amt )/ SUM( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) c ON a.ItemCode = c.MaterialCode\n" + -" LEFT JOIN set_material d ON a.ItemCode = d.CustomerPartCode\n" + -" LEFT JOIN (select max(Id) Id,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc) e ON a.ErpMaterialCode = e.MaterialCode {1} \n" + -" ) TEMP1\n" + -" LEFT JOIN (\n" + -" SELECT\n" + -" Price,\n" + -" MaterialCode \n" + -" FROM\n" + -" Set_PriceList \n" + -" WHERE\n" + -" version = ( SELECT Max( Version ) FROM Set_PriceList ) and type=10 ) TEMP2 ON TEMP1.SapMaterialCode = TEMP2.MaterialCode"; - var _sql = string.Format(str, version,condition); - - var _query = DbConnection.Query(_sql, null, null, true, 1200, null); - _list=_query.ToList(); + string isExistSql = string.Format("SELECT count(1) lincount FROM [Set_Settle1] WITH(SNAPSHOT) where Version = '{0}'", version); + int _count = DbConnection.ExecuteScalar(isExistSql); + + string condition = " where 1=1 "; + if (!string.IsNullOrEmpty(begin)) + { + condition += string.Format(" and a.BeginTime>='{0}' ", begin); + } + if (!string.IsNullOrEmpty(end)) + { + condition += string.Format(" and a.BeginTime<='{0}' ", end); + } + if (!string.IsNullOrEmpty(cp7begin)) + { + condition += string.Format(" and B.cp7>='{0}' ", cp7begin); + } + if (!string.IsNullOrEmpty(cp7end)) + { + condition += string.Format(" and B.cp7<='{0}' ", cp7end); + } + + + string tablestr = (_count == 0) ? + " ( SELECT * FROM Set_Settle b WHERE b.Version = '{0}' ) b\n" : + + " (SELECT count(1) lincount FROM [Set_Settle1] WITH(SNAPSHOT) where Version = '{0}') b \n"; + + + + + + string str = + "SELECT\n" + + string.Format(" '{0}' version ,\n",version)+ + " temp1.*,\n" + + " TEMP2.Price,(\n" + + " Isnull( temp2.Price, 0 ) * isnull( temp1.Qty, 0 )) Amt \n" + + "FROM\n" + + " (\n" + + " SELECT\n" + + " b.YEAR,\n" + + " a.OrderBillNum Kenncode,\n" + + " b.MaterialCode,\n" + + " b.Model,\n" + + " a.ChassisNumber,\n" + + " a.Qty,\n" + + " a.BeginTime CP5Time,\n" + + " a.ChassisNumber2,\n" + + " B.CP7 CP7Time,\n" + + " a.QTY SettledQty,\n" + + " a.ErpMaterialCode ParentSapMaterialCode,\n" + + " a.WMSState,\n" + + " a.WMSBillNum,\n" + + " d.MaterialCode SapMaterialCode,\n" + + " d.MaterialDesc MaterialDesc,\n" + + " d.EstimateTypeDesc MaterialGroup,\n" + + " e.MaterialDesc ParentMaterialDesc,\n" + + " c.InvoicePrice,\n" + + " Round( c.InvoicePrice * a.qty,2 ) InvoiceAmt,\n" + + " Round( c.InvoicePrice * a.Qty,2 ) SettleAmt,\n" + + " 0 DiffSettleFisQty,\n" + + " 0 DiffSettleInvQty, \n" + + " a.Qty InvoiceQty ,\n" + + " IsNull( B.Qty, 0 ) SettleReadyQty \n" + + " FROM\n" + + tablestr + + + " INNER JOIN Set_fis a ON b.ChassisNumber = a.ChassisNumber2 \n" + + " AND b.KENNCode = a.KENNCode \n" + + " AND b.MaterialCode = a.ItemCode\n" + + " LEFT JOIN ( SELECT SUM( amt )/ SUM( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) c ON a.ItemCode = c.MaterialCode\n" + + " LEFT JOIN set_material d ON a.ItemCode = d.CustomerPartCode\n" + + " LEFT JOIN (select max(Id) Id,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc) e ON a.ErpMaterialCode = e.MaterialCode {1} \n" + + " ) TEMP1\n" + + " LEFT JOIN (\n" + + " SELECT\n" + + " Price,\n" + + " MaterialCode \n" + + " FROM\n" + + " Set_PriceList \n" + + " WHERE\n" + + " version = ( SELECT Max( Version ) FROM Set_PriceList ) and type=10 ) TEMP2 ON TEMP1.SapMaterialCode = TEMP2.MaterialCode"; + var _sql = string.Format(str, version, condition); + + var _query = DbConnection.Query(_sql, null, null, true, 1200, null); + + _list = _query.ToList(); + + if (CacheManager.CacheMaterials != null && CacheManager.CacheInvoiceSettledDetailDiff.Count(p => p.Version == version) > 0) + { + _list = CacheManager.CacheInvoiceSettledDetailDiff.Where(p => p.Version == version).ToList(); + _list = _list.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList(); + } + else + { + CacheManager.CacheInvoiceSettledDetailDiff.AddRange(_list); + } + + + } return _list; } diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnInvoiceSettledDetailDiffDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnInvoiceSettledDetailDiffDapperRepository.cs index 5583ae47..1800c762 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnInvoiceSettledDetailDiffDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnInvoiceSettledDetailDiffDapperRepository.cs @@ -10,6 +10,7 @@ using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories.Dapper; using Volo.Abp.EntityFrameworkCore; using Win.Sfs.SettleAccount.Reports; +using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs; namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report { diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/SettleAccounts/SettleAccountRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/SettleAccounts/SettleAccountRepository.cs index 5f7f141f..621d17f0 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/SettleAccounts/SettleAccountRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/SettleAccounts/SettleAccountRepository.cs @@ -86,6 +86,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccount { } + public virtual bool Delete(string version) { try diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs index 5044e305..1fedcaca 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs @@ -10,6 +10,7 @@ using TaskJob.Interfaces; using Volo.Abp.BlobStoring; using Volo.Abp.DependencyInjection; using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs; using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; namespace SettleAccount.Job.Services.Report diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs index dc7876b4..dc1a6549 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs @@ -1,5 +1,6 @@ using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Excel; +using Microsoft.EntityFrameworkCore; using SettleAccount.Job.Services; using System; using System.Collections.Generic; @@ -11,6 +12,7 @@ using System.Threading.Tasks; using TaskJob.EventArgs; using TaskJob.Interfaces; using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; using Volo.Abp.Emailing; using Win.Sfs.SettleAccount; using Win.Sfs.SettleAccount.Entities.SettleAccounts; @@ -156,6 +158,11 @@ namespace TaskJob.Services _setls = _setls.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.KENNCode }).Select(p => p.FirstOrDefault()).ToList(); _repository.Insert(_setls); _versionRepository.Insert(_id, version, customerCode, customerCode); + + _repository.GetDbContext().Database.ExecuteSqlRaw( + "EXEC sp_settle_fis_update" + ); + return id.ToString(); } }