From e888a838ed670ac41cdb4a87eb42ec4bb87afbff Mon Sep 17 00:00:00 2001 From: 44673626 <44673626@qq.com> Date: Wed, 1 Dec 2021 09:05:11 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=97=A8=E6=9D=BF=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReportServices/ReportMakeService.cs | 30 ++++++ .../SettleAccount.Application.xml | 11 ++ .../Report/SettleDoorPanelDapperRepository.cs | 102 ++++++++++++++++++ .../Report/SettleDoorPanelExportService.cs | 45 ++++++++ 4 files changed, 188 insertions(+) create mode 100644 src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleDoorPanelDapperRepository.cs create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs index 1428f8d6..ea52854f 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs @@ -74,6 +74,36 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices } #region 派格大众看板-备件结算报表 + + /// + /// 大众准时化结算门板价格差异比对报表 + /// + /// 客户物料号 + /// 版本 + /// + /// 厂内物料号 + /// 物料组 + /// + [HttpGet] + [Route("SettleDoorPanel")] + [DisableRequestSizeLimit] + + public async Task SettledKanBanWithCode( string materialCode, string version, string customerCode, string sapCode, string estimateTypeDesc) + { + + List customConditionList = new List(); + customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); + customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = customerCode ?? string.Empty }); + customConditionList.Add(new CustomCondition() { Name = "SAPCode", Value = sapCode ?? string.Empty }); + customConditionList.Add(new CustomCondition() { Name = "EstimateTypeDesc", Value = estimateTypeDesc ?? string.Empty }); + customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众准时化结算门板价格差异比对报表" }); + customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = materialCode ?? string.Empty }); + + var _taskid = await _service.ExportEnqueueAsync("大众准时化结算门板价格差异比对报表", ExportExtentsion.Excel, CurrentUser, typeof(SettleKBWithCodeExportService), customConditionList, (rs) => + { + }); + return _taskid; + } /// /// 有条码看板结算核对 /// diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml index 620c8b9c..49163f8d 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml @@ -2406,6 +2406,17 @@ 仓储接口 缓存 + + + 大众准时化结算门板价格差异比对报表 + + 客户物料号 + 版本 + + 厂内物料号 + 物料组 + + 有条码看板结算核对 diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleDoorPanelDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleDoorPanelDapperRepository.cs new file mode 100644 index 00000000..7cfd4435 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleDoorPanelDapperRepository.cs @@ -0,0 +1,102 @@ +using Dapper; +using Magicodes.ExporterAndImporter.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories.Dapper; +using Volo.Abp.EntityFrameworkCore; + +namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report +{ + public class SettleDoorPanelDapperRepository : DapperRepository, ITransientDependency + { + public SettleDoorPanelDapperRepository(IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { } + + + public virtual List GetSettleDoorPanelReportList(string estimateTypeDesc, string version, string sapCode, string matialCode) + { + string sqlString = "SELECT\n" + + " * ,\n" + + " ISNULL( Price - InvoicePrice, 0 ) AS InvoiceDiffPrice --单价差异\n" + + " \n" + + "FROM\n" + + " (\n" + + " SELECT\n" + + " c.EstimateTypeDesc,--物料组(车型)\n" + + " a.MaterialCode,--物料代码\n" + + " c.MaterialCode AS SAPCode,--厂内零件号\n" + + " c.CustomerPartCode,--客户物料\n" + + " c.MaterialDesc,--物料描述\n" + + " d.InvoicePrice \n" + + " FROM\n" + + " Set_Settle AS a\n" + + " INNER JOIN Set_fis AS b ON a.KENNCode= b.KENNCode \n" + + " AND a.ChassisNumber= b.ChassisNumber2 \n" + + " AND a.MaterialCode= b.ItemCode\n" + + " LEFT JOIN Set_material AS c ON a.MaterialCode= c.CustomerPartCode\n" + + " LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) d ON a.MaterialCode= d.MaterialCode \n" + + " WHERE\n" + + " b.Version= '{0}' \n" + + " ) TEMP1\n" + + " LEFT JOIN ( SELECT Price, --定价\n" + + " MaterialCode --厂内物料号\n" + + " FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SAPCode= TEMP2.MaterialCode \n" + + "WHERE\n" + + " 1=1 "; + string addwhere = string.Empty; + string addSqlStr = string.Format(sqlString, version); + if (!string.IsNullOrEmpty(estimateTypeDesc)) + { + addwhere += string.Format(" AND EstimateTypeDesc LIKE '{0}%' ", estimateTypeDesc); + } + else if (!string.IsNullOrEmpty(sapCode)) + { + addwhere += string.Format(" AND SAPCode LIKE '{0}%' ", sapCode); + } + else if (!string.IsNullOrEmpty(matialCode)) + { + addwhere += string.Format(" AND MaterialCode LIKE '{0}%' ", matialCode); + } + string _sql = string.Format(addSqlStr, addwhere); + //string _sql = string.Format(sqlString, version); + var _query = DbConnection.Query(_sql, null, null, true, 1200, null); + return _query.ToList(); + + } + + } + + /// + /// 大众看板有条码报表 + /// + //[ExcelExporter(Name = "未结明细", AutoFitAllColumn = true, MaxRowNumberOnASheet = 500000)] + public class SettleDoorPanelExport + { + [ExporterHeader(DisplayName = "物料组(车型)")] + public string EstimateTypeDesc { set; get; } + + [ExporterHeader(DisplayName = "物料号")] + public string SAPCode { set; get; } + + [ExporterHeader(DisplayName = "客户物料")] + public string MaterialCode { set; get; } + + [ExporterHeader(DisplayName = "物料描述")] + public string MaterialDesc { set; get; } + + [ExporterHeader(DisplayName = "开票单价")] + public decimal InvoicePrice { set; get; } + + [ExporterHeader(DisplayName = "定价")] + public decimal Price { set; get; } + + [ExporterHeader(DisplayName = "单价差异")] + public decimal InvoiceDiffPrice { set; get; } + + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs new file mode 100644 index 00000000..32ab2b96 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TaskJob.EventArgs; +using TaskJob.Interfaces; +using Volo.Abp.DependencyInjection; +using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; + +namespace SettleAccount.Job.Services.Report +{ + public class SettleDoorPanelExportService : ITransientDependency, IExportJob + { + private readonly SettleDoorPanelDapperRepository _dapper; + private readonly OutputService _outputService; + + public SettleDoorPanelExportService(SettleDoorPanelDapperRepository dapper, OutputService outputService) + { + _dapper = dapper; + _outputService = outputService; + } + + //public virtual List GetSettleDoorPanelReportList(string purchaseOrderNo, string version, string sapCode, string matialCode) + public string ExportFile(Guid id, List exportName, List p_list) + { + var estimateTypeDesc = p_list.Where(p => p.Name == "EstimateTypeDesc").FirstOrDefault().Value; + var sapCode = p_list.Where(p => p.Name == "SAPCode").FirstOrDefault().Value; + var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value; + var customerPartCode = p_list.Where(p => p.Name == "CustomerPartCode").FirstOrDefault().Value; + + var beginTime = p_list.Where(p => p.Name == "BegingTime").FirstOrDefault().Value; + var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value; + + + var _list = _dapper.GetSettleDoorPanelReportList(estimateTypeDesc, version, sapCode, customerPartCode); + + _outputService.Export(id, string.Format("大众看板结算与交货核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _list); + + return id.ToString(); + } + + + } +} From 1e6ac28b74fc1c8a58e11013390cee461224759d Mon Sep 17 00:00:00 2001 From: 44673626 <44673626@qq.com> Date: Wed, 1 Dec 2021 09:18:11 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=97=A8=E6=9D=BF=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reports/ReportServices/ReportMakeService.cs | 4 ++-- .../SettleAccount.Application/SettleAccount.Application.xml | 2 +- .../Services/Report/SettleDoorPanelExportService.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs index ea52854f..c54e43aa 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs @@ -88,7 +88,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices [Route("SettleDoorPanel")] [DisableRequestSizeLimit] - public async Task SettledKanBanWithCode( string materialCode, string version, string customerCode, string sapCode, string estimateTypeDesc) + public async Task SettleDoorPanel( string materialCode, string version, string customerCode, string sapCode, string estimateTypeDesc) { List customConditionList = new List(); @@ -99,7 +99,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "大众准时化结算门板价格差异比对报表" }); customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = materialCode ?? string.Empty }); - var _taskid = await _service.ExportEnqueueAsync("大众准时化结算门板价格差异比对报表", ExportExtentsion.Excel, CurrentUser, typeof(SettleKBWithCodeExportService), customConditionList, (rs) => + var _taskid = await _service.ExportEnqueueAsync("大众准时化结算门板价格差异比对报表", ExportExtentsion.Excel, CurrentUser, typeof(SettleDoorPanelExportService), customConditionList, (rs) => { }); return _taskid; diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml index 49163f8d..386ffa17 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml @@ -2406,7 +2406,7 @@ 仓储接口 缓存 - + 大众准时化结算门板价格差异比对报表 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 32ab2b96..2c7668f6 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs @@ -35,7 +35,7 @@ namespace SettleAccount.Job.Services.Report var _list = _dapper.GetSettleDoorPanelReportList(estimateTypeDesc, version, sapCode, customerPartCode); - _outputService.Export(id, string.Format("大众看板结算与交货核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _list); + _outputService.Export(id, string.Format("大众看板结算与交货核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _list); return id.ToString(); } From 459074740a7dbbf5a999921785f001ddf8141a53 Mon Sep 17 00:00:00 2001 From: 44673626 <44673626@qq.com> Date: Wed, 1 Dec 2021 09:21:43 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Report/SettleDoorPanelExportService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2c7668f6..2c7abf2f 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs @@ -35,7 +35,7 @@ namespace SettleAccount.Job.Services.Report var _list = _dapper.GetSettleDoorPanelReportList(estimateTypeDesc, version, sapCode, customerPartCode); - _outputService.Export(id, string.Format("大众看板结算与交货核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _list); + _outputService.Export(id, string.Format("大众准时化结算门板价格差异比对报表_{0}.xlsx", Guid.NewGuid().ToString()), _list); return id.ToString(); }