yunfeng.liu 3 years ago
parent
commit
e53346005f
  1. 7
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnInterface.cs
  2. 23
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettledPartAndErpPartPriceDiffs/SettledPartAndErpPartPriceDiff.cs
  3. 3
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpSumOutputDapperRepository.cs
  4. 6
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettledPartAndErpPartPriceDiffRepository.cs
  5. 33
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettledPartAndErpPartPriceDiffExportService.cs

7
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsUnInterface.cs

@ -158,13 +158,10 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
[HttpPost] [HttpPost]
[Route("SyncSap")] [Route("SyncSap")]
[UnitOfWork(false)]
virtual public async Task<bool> OutputAsync(WmsRequestDetailReportDto input) virtual public async Task<bool> OutputAsync(WmsRequestDetailReportDto input)
{ {
if (string.IsNullOrEmpty(input.Version))
{
}
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version }); input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version });
var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, int.MaxValue, var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, int.MaxValue,
0, true); 0, true);

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

@ -9,8 +9,8 @@ namespace Win.Sfs.SettleAccount.Reports.SettledPartAndErpPartPriceDiffs
{ {
public class SettledPartAndErpPartPriceDiff public class SettledPartAndErpPartPriceDiff
{ {
[ExporterHeader(DisplayName = "版本号")] //[ExporterHeader(DisplayName = "版本号")]
public string Version{ set; get; } //public string Version{ set; get; }
//[ExporterHeader(DisplayName ="物料编号")] //[ExporterHeader(DisplayName ="物料编号")]
//public string MaterialCode { set; get; } //public string MaterialCode { set; get; }
@ -19,11 +19,26 @@ namespace Win.Sfs.SettleAccount.Reports.SettledPartAndErpPartPriceDiffs
[ExporterHeader(DisplayName = "ERP物料编号")] [ExporterHeader(DisplayName = "ERP物料编号")]
public string ErpMaterialCode { set; get; } public string ErpMaterialCode { set; get; }
[ExporterHeader(DisplayName = "Bom成价格")] [ExporterHeader(DisplayName = "Bom成价格")]
public decimal Price { set; get; } public decimal Price { set; get; }
[ExporterHeader(DisplayName = "总成价")] [ExporterHeader(DisplayName = "总成价")]
public decimal SumPrice { get; set; } public decimal SumPrice { get; set; }
[ExporterHeader(DisplayName = "差额")] [ExporterHeader(DisplayName = "差额")]
public decimal DiffPrice { get; set; } 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; }
}
} }

3
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpSumOutputDapperRepository.cs

@ -9,6 +9,7 @@ using System.Threading.Tasks;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories.Dapper; using Volo.Abp.Domain.Repositories.Dapper;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.Entities; using Win.Sfs.SettleAccount.Entities;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
@ -165,7 +166,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
} }
[UnitOfWork(false)]
public virtual void InsertWmsSum(List<WmsDetailReport> p_list,string version,DateTime accountDate) public virtual void InsertWmsSum(List<WmsDetailReport> p_list,string version,DateTime accountDate)

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

@ -58,7 +58,7 @@ namespace Win.Sfs.SettleAccount.Repository.Report
return _query.ToList(); 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" + string sqlString = "select a.ErpMaterialCode,SettleMaterialCode,a.ShipMaterailCode,d.MaterialDesc,d.EstimateTypeDesc from\n" +
" Set_MaterialRelationshipDetail_pg a left join\n" + " Set_MaterialRelationshipDetail_pg a left join\n" +
@ -68,7 +68,7 @@ namespace Win.Sfs.SettleAccount.Repository.Report
" MaterialCode \n" + " MaterialCode \n" +
" FROM\n" + " FROM\n" +
" Set_PriceList \n" + " Set_PriceList \n" +
" WHERE\n" + " WHERE\n" +
" version = ( SELECT Max( Version ) FROM Set_PriceList ) and type=10 )\n" + " version = ( SELECT Max( Version ) FROM Set_PriceList ) and type=10 )\n" +
" b on a.SettleMaterialCode=b.MaterialCode \n" + " b on a.SettleMaterialCode=b.MaterialCode \n" +
" left join \n" + " left join \n" +
@ -78,7 +78,7 @@ namespace Win.Sfs.SettleAccount.Repository.Report
" where b.MaterialCode is null"; " where b.MaterialCode is null";
string _sql = string.Format(sqlString, version, customcode); 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>(); //var _query = _db.Query<SettledPartAndErpPartPriceDiff>();
return _query.ToList(); 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.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using TaskJob.EventArgs; using TaskJob.EventArgs;
using TaskJob.Interfaces; using TaskJob.Interfaces;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Reports.SettledPartAndErpPartPriceDiffs; using Win.Sfs.SettleAccount.Reports.SettledPartAndErpPartPriceDiffs;
using Win.Sfs.SettleAccount.Repository.Report; using Win.Sfs.SettleAccount.Repository.Report;
@ -16,11 +20,16 @@ namespace SettleAccount.Job.Services.Report
private readonly SettledPartAndErpPartPriceDiffRepository _dapper; private readonly SettledPartAndErpPartPriceDiffRepository _dapper;
private readonly OutputService _outputService; 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; _dapper = dapper;
_outputService = outputService; _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 version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var customerCode = p_list.Where(p => p.Name == "CustomerCode").FirstOrDefault().Value; var customerCode = p_list.Where(p => p.Name == "CustomerCode").FirstOrDefault().Value;
var _list= _dapper.GetDiffReport(DateTime.Now.Year.ToString(), customerCode, version); 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(); return id.ToString();
} }

Loading…
Cancel
Save