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(); + } + + + } +}