Browse Source

更新版本

FoShanPG
Administrator 3 years ago
parent
commit
41c542d14a
  1. 23
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettledPartAndErpPartPriceDiffs/SettledPartAndErpPartPriceDiff.cs
  2. 4
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettledPartAndErpPartPriceDiffRepository.cs
  3. 33
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettledPartAndErpPartPriceDiffExportService.cs

23
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettledPartAndErpPartPriceDiffs/SettledPartAndErpPartPriceDiff.cs

@ -9,8 +9,8 @@ namespace Win.Sfs.SettleAccount.Reports.SettledPartAndErpPartPriceDiffs
{
public class SettledPartAndErpPartPriceDiff
{
[ExporterHeader(DisplayName = "版本号")]
public string Version{ set; get; }
//[ExporterHeader(DisplayName = "版本号")]
//public string Version{ set; get; }
//[ExporterHeader(DisplayName ="物料编号")]
//public string MaterialCode { set; get; }
@ -19,11 +19,26 @@ namespace Win.Sfs.SettleAccount.Reports.SettledPartAndErpPartPriceDiffs
[ExporterHeader(DisplayName = "ERP物料编号")]
public string ErpMaterialCode { set; get; }
[ExporterHeader(DisplayName = "Bom成价格")]
[ExporterHeader(DisplayName = "Bom成价格")]
public decimal Price { set; get; }
[ExporterHeader(DisplayName = "总成价")]
[ExporterHeader(DisplayName = "总成价")]
public decimal SumPrice { get; set; }
[ExporterHeader(DisplayName = "差额")]
public decimal DiffPrice { get; set; }
}
public class PartCodeDiff
{
[ExporterHeader(DisplayName = "组成组零件")]
public string ErpMaterialCode {set;get;}
[ExporterHeader(DisplayName = "Sap零件号")]
public string SettleMaterialCode {set;get;}
[ExporterHeader(DisplayName = "客户零件号")]
public string ShipMaterailCode {set;get;}
[ExporterHeader(DisplayName = "物料描述")]
public string MaterialDesc {set;get;}
[ExporterHeader(DisplayName = "物料组车型")]
public string EstimateTypeDesc { set; get; }
}
}

4
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettledPartAndErpPartPriceDiffRepository.cs

@ -58,7 +58,7 @@ namespace Win.Sfs.SettleAccount.Repository.Report
return _query.ToList();
}
public virtual List<SettledPartAndErpPartPriceDiff> GetDiffDetailReport(string year, string customcode, string version)
public virtual List<PartCodeDiff> GetDiffDetailReport(string year, string customcode, string version)
{
string sqlString = "select a.ErpMaterialCode,SettleMaterialCode,a.ShipMaterailCode,d.MaterialDesc,d.EstimateTypeDesc from\n" +
" Set_MaterialRelationshipDetail_pg a left join\n" +
@ -78,7 +78,7 @@ namespace Win.Sfs.SettleAccount.Repository.Report
" where b.MaterialCode is null";
string _sql = string.Format(sqlString, version, customcode);
var _query = DbConnection.Query<SettledPartAndErpPartPriceDiff>(_sql, null, null, true, 1200, null);
var _query = DbConnection.Query<PartCodeDiff>(_sql, null, null, true, 1200, null);
//var _query = _db.Query<SettledPartAndErpPartPriceDiff>();
return _query.ToList();
}

33
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettledPartAndErpPartPriceDiffExportService.cs

@ -1,11 +1,15 @@
using System;
using Magicodes.ExporterAndImporter.Excel;
using Shouldly;
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.BlobStoring;
using Volo.Abp.DependencyInjection;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Reports.SettledPartAndErpPartPriceDiffs;
using Win.Sfs.SettleAccount.Repository.Report;
@ -16,11 +20,16 @@ namespace SettleAccount.Job.Services.Report
private readonly SettledPartAndErpPartPriceDiffRepository _dapper;
private readonly OutputService _outputService;
private readonly IBlobContainer<MyFileContainer> _fileContainer;
public SettledPartAndErpPartPriceDiffExportService(SettledPartAndErpPartPriceDiffRepository dapper, OutputService outputService)
public SettledPartAndErpPartPriceDiffExportService(SettledPartAndErpPartPriceDiffRepository dapper,
IBlobContainer<MyFileContainer> fileContainer,
OutputService outputService)
{
_dapper = dapper;
_outputService = outputService;
_fileContainer = fileContainer;
}
@ -31,7 +40,25 @@ namespace SettleAccount.Job.Services.Report
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var customerCode = p_list.Where(p => p.Name == "CustomerCode").FirstOrDefault().Value;
var _list= _dapper.GetDiffReport(DateTime.Now.Year.ToString(), customerCode, version);
_outputService.Export<SettledPartAndErpPartPriceDiff>(id,string.Format("Bom定价对比_{0}.xlsx",Guid.NewGuid().ToString()), _list);
var _childList= _dapper.GetDiffDetailReport(DateTime.Now.Year.ToString(), customerCode, version);
var _filename = exportName.FirstOrDefault();
ExcelExporter _exporter = new ExcelExporter();//导出Excel
var result = _exporter
.Append(_list, "BOM价格对比明细")
.SeparateBySheet()
.Append(_childList, "无价格零件")
.SeparateBySheet()
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(_filename, result.Result, true);
//_outputService.Export<SettledPartAndErpPartPriceDiff>(id,string.Format("Bom定价对比_{0}.xlsx",Guid.NewGuid().ToString()), _list);
return id.ToString();
}

Loading…
Cancel
Save