wanggang 1 year ago
parent
commit
49b6664d87
  1. 17
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs
  2. 13
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs
  3. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiService.cs
  4. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/SettleAccount.Domain.Shared.csproj
  5. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_SA.cs
  6. 50
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs
  7. 4371
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719090654_20230719-4.Designer.cs
  8. 45
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719090654_20230719-4.cs
  9. 5
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  10. 162
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs
  11. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Dispatcher/JobDispatcher.cs
  12. 266
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs

17
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs

@ -163,4 +163,21 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public string GroupNum { get; set; } public string GroupNum { get; set; }
} }
/// <summary>
/// Pub结算与发运对比请求
/// </summary>
public class PubSaSeCompareRequestDto
{
/// <summary>
/// 期间
/// </summary>
[Display(Name = "期间")]
[Required(ErrorMessage = "{0}不能为空")]
public string Version { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public EnumBusinessType BusinessType { get; set; }
}
} }

13
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs

@ -42,6 +42,9 @@ public class PUB_SA_DETAIL_SERVICE : SettleAccountApplicationBase<PUB_SA_DETAIL>
/// </summary> /// </summary>
private readonly INormalEfCoreRepository<PUB_SA, Guid> _pubSaRepository; private readonly INormalEfCoreRepository<PUB_SA, Guid> _pubSaRepository;
/// <summary>
/// 任务服务
/// </summary>
private readonly TaskJobService _taskJobService; private readonly TaskJobService _taskJobService;
/// <summary> /// <summary>
@ -103,12 +106,14 @@ public class PUB_SA_DETAIL_SERVICE : SettleAccountApplicationBase<PUB_SA_DETAIL>
/// Pub结算与发运比对 /// Pub结算与发运比对
/// </summary> /// </summary>
[HttpPost] [HttpPost]
public async Task<string> PubSaSeCompare(string version) public async Task<string> PubSaSeCompare(PubSaSeCompareRequestDto pubSaSeCompareRequestDto)
{ {
List<CustomCondition> customConditionList = new List<CustomCondition>(); List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty }); customConditionList.Add(new CustomCondition() { Name = "Version", Value = pubSaSeCompareRequestDto.Version });
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "结算与开票数据对比" }); customConditionList.Add(new CustomCondition() { Name = "BusinessType", Value = pubSaSeCompareRequestDto.BusinessType.ToString() });
var _taskid = await _taskJobService.ExportEnqueueAsync("Pub结算与发运核对汇总表", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(PubSaSeCompareExportService), customConditionList, (rs) =>
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "结算与发运数据对比" });
var _taskid = await _taskJobService.ExportEnqueueAsync("Pub结算与发运核对汇总表", ExportExtentsion.Excel, pubSaSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(PubSaSeCompareExportService), customConditionList, (rs) =>
{ {
Console.WriteLine("TaskJob 回调了"); Console.WriteLine("TaskJob 回调了");
}); });

1
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiService.cs

@ -19,6 +19,7 @@ public interface IVmiService : IApplicationService, ITransientDependency, IJobSe
IQueryable<VmiBalance> Query(); IQueryable<VmiBalance> Query();
} }
[ApiExplorerSettings(IgnoreApi = true)]
[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")] [Route("api/settleaccount/[controller]/[action]")]
public class VmiService : IVmiService public class VmiService : IVmiService

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/SettleAccount.Domain.Shared.csproj

@ -34,4 +34,8 @@
<Content Remove="Localization\SettleAccount\*.json" /> <Content Remove="Localization\SettleAccount\*.json" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Enums\" />
</ItemGroup>
</Project> </Project>

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_SA.cs

@ -111,6 +111,12 @@ public class PUB_SA_DETAIL:SA_BASE
//[Display(Name = "结算分组")] //[Display(Name = "结算分组")]
//public string GroupNum { get; set; } = null!; //public string GroupNum { get; set; } = null!;
/// <summary>
/// 业务分类
/// </summary>
[Display(Name = "业务分类")]
public EnumBusinessType BusinessType { get; set; }
public PUB_SA_DETAIL(Guid guid, string keyCode, int version, string billNum, string lU, string pN, string site, decimal qty, decimal price, string invGroupNum, DateTime settleDate, string extend1, string extend2, string extend3, string groupNum) public PUB_SA_DETAIL(Guid guid, string keyCode, int version, string billNum, string lU, string pN, string site, decimal qty, decimal price, string invGroupNum, DateTime settleDate, string extend1, string extend2, string extend3, string groupNum)
{ {
Id=guid; Id=guid;

50
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs

@ -0,0 +1,50 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
namespace Win.Sfs.SettleAccount.Reports;
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class PubSaSeCompareDiff
{
/// <summary>
/// 零件号
/// </summary>
[ExporterHeader(DisplayName = "零件号")]
public string SeLU { set; get; }
/// <summary>
/// 生产号
/// </summary>
[ExporterHeader(DisplayName = "生产号")]
public string SePN { set; get; }
/// <summary>
/// 零件号
/// </summary>
[ExporterHeader(DisplayName = "零件号")]
public string SaLU { set; get; }
/// <summary>
/// 生产号
/// </summary>
[ExporterHeader(DisplayName = "生产号")]
public string SaPN { set; get; }
/// <summary>
/// 结算数量
/// </summary>
[ExporterHeader(DisplayName = "结算数量")]
public decimal SaQty { set; get; }
/// <summary>
/// 发运数量
/// </summary>
[ExporterHeader(DisplayName = "发运数量")]
public decimal SeQty { set; get; }
/// <summary>
/// 差异数量
/// </summary>
[ExporterHeader(DisplayName = "差异数量")]
public decimal DiffQty { set; get; }
}

4371
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719090654_20230719-4.Designer.cs

File diff suppressed because it is too large

45
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719090654_20230719-4.cs

@ -0,0 +1,45 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202307194 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("a6d57042-e087-421e-a086-dfb34c6bfe80"));
migrationBuilder.AddColumn<int>(
name: "BusinessType",
table: "Set_PUB_SA_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.InsertData(
table: "Set_JobItem",
columns: new[] { "Id", "ConcurrencyStamp", "Cron", "IsRunning", "Name", "Service" },
values: new object[] { new Guid("6efe1947-a242-4d20-b633-20b0f716a782"), null, "0 0 8 26 *", false, "库存快照", "Win.Sfs.SettleAccount.Entities.BQ.VmiService" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6efe1947-a242-4d20-b633-20b0f716a782"));
migrationBuilder.DropColumn(
name: "BusinessType",
table: "Set_PUB_SA_DETAIL");
migrationBuilder.InsertData(
table: "Set_JobItem",
columns: new[] { "Id", "ConcurrencyStamp", "Cron", "IsRunning", "Name", "Service" },
values: new object[] { new Guid("a6d57042-e087-421e-a086-dfb34c6bfe80"), null, "0 0 8 26 *", false, "库存快照", "Win.Sfs.SettleAccount.Entities.BQ.VmiService" });
}
}
}

5
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

@ -2843,6 +2843,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<int>("BusinessType")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken() .IsConcurrencyToken()
.HasMaxLength(50) .HasMaxLength(50)
@ -3316,7 +3319,7 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasData( b.HasData(
new new
{ {
Id = new Guid("a6d57042-e087-421e-a086-dfb34c6bfe80"), Id = new Guid("6efe1947-a242-4d20-b633-20b0f716a782"),
Cron = "0 0 8 26 *", Cron = "0 0 8 26 *",
IsRunning = false, IsRunning = false,
Name = "库存快照", Name = "库存快照",

162
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs

@ -0,0 +1,162 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Dapper;
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;
/// <summary>
/// Pub结算与发运对比Dapper仓储
/// </summary>
public class PubSaSeCompareDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{
public PubSaSeCompareDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider)
{
}
/// <summary>
/// 获取差异
/// </summary>
public virtual List<PubSaSeCompareDiff> GetDetailDiffReportList(string version, string businessType)
{
string strSqlText = @$"
SELECT
A.LU SeLU,
A.PN SePN,
SeQty,
B.LU SaLU,
B.PN SaPN,
SaQty,
(SaQty - SeQty) DiffQty
FROM
(SELECT SUM(QTY) SeQty, LU, PN FROM Set_PUB_SE_DETAIL WHERE GROUP BY LU, PN) A
FULL JOIN (SELECT SUM(QTY) SaQty, LU, PN FROM Set_PUB_SA_DETAIL GROUP BY LU, PN) B ON A.LU= B.LU AND A.PN= B.PN
";
return DbConnection.Query<PubSaSeCompareDiff>(strSqlText, null, null, true, 1200, null).ToList();
}
public virtual List<InvoiceSettledDetailDiff> GetInvoiceSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string cp7begin, string cp7end, string kennCode, string chassisNumber, string materialGroup)
{
List<InvoiceSettledDetailDiff> _list = new List<InvoiceSettledDetailDiff>();
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
{
//string isExistSql = string.Format("SELECT count(1) lincount FROM [Set_Settle_RAM] WITH(SNAPSHOT) where Version = '{0}'", version);
//int _count = DbConnection.ExecuteScalar<int>(isExistSql);
int _count = 0;
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 * FROM [Set_Settle_RAM] 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" +
" a.UnSettleVersion \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<InvoiceSettledDetailDiff>(_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
{
if (CacheManager.CacheInvoiceSettledDetailDiff == null)
{
CacheManager.CacheInvoiceSettledDetailDiff = new List<InvoiceSettledDetailDiff>();
}
CacheManager.CacheInvoiceSettledDetailDiff.AddRange(_list);
}
}
return _list;
}
}

2
code/src/Modules/SettleAccount/src/SettleAccount.Job/Dispatcher/JobDispatcher.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;

266
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs

@ -1,8 +1,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Magicodes.ExporterAndImporter.Excel;
using System.Linq;
using TaskJob.EventArgs; using TaskJob.EventArgs;
using TaskJob.Interfaces; using TaskJob.Interfaces;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.Shared.RepositoryBase;
using SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
using Shouldly;
using Volo.Abp.BlobStoring;
namespace SettleAccount.Job.Services.Report namespace SettleAccount.Job.Services.Report
{ {
@ -11,14 +19,270 @@ namespace SettleAccount.Job.Services.Report
/// </summary> /// </summary>
public class PubSaSeCompareExportService: ITransientDependency, IExportJob public class PubSaSeCompareExportService: ITransientDependency, IExportJob
{ {
public PubSaSeCompareExportService() { } /// <summary>
/// Pub结算明细仓储
/// </summary>
private readonly INormalEfCoreRepository<PUB_SA_DETAIL, Guid> _pubSaDetailRepository;
/// <summary>
/// Pub发运数据仓储
/// </summary>
private readonly INormalEfCoreRepository<PUB_SE_DETAIL, Guid> _pubSeDetailRepository;
private readonly PubSaSeCompareDapperRepository _pubSaSeCompareDapperRepository;
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// 构造
/// </summary>
public PubSaSeCompareExportService(INormalEfCoreRepository<PUB_SA_DETAIL, Guid> pubSaDetailRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository,
PubSaSeCompareDapperRepository pubSaSeCompareDapperRepository,
IBlobContainer<MyFileContainer> fileContainer)
{
_pubSaDetailRepository = pubSaDetailRepository;
_pubSeDetailRepository = pubSeDetailRepository;
_pubSaSeCompareDapperRepository = pubSaSeCompareDapperRepository;
_fileContainer = fileContainer;
}
/// <summary> /// <summary>
/// 导出 /// 导出
/// </summary> /// </summary>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property) public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{ {
var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value;
var businessType = property.Where(t => t.Name == "BusinessType").FirstOrDefault().Value;
var filename = exportName.FirstOrDefault();
var pubSaSeCompareDiffs = _pubSaSeCompareDapperRepository.GetDetailDiffReportList(version, businessType);
ExcelExporter excelExporter = new ExcelExporter();
var result = excelExporter
.Append(pubSaSeCompareDiffs, "差异明细表")
.SeparateBySheet()
.Append(pubSaSeCompareDiffs, "数量差异汇总表")
.SeparateBySheet()
.Append(pubSaSeCompareDiffs, "按物料价格差异明细表")
.SeparateBySheet()
.Append(pubSaSeCompareDiffs, "差异汇总验证表")
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(filename, result.Result, true);
return id.ToString();
//结算
//var _lsSum = _ls.GroupBy(p => new { p.MaterialCode, p.SapMaterialCode, p.MaterialGroup, p.InvoicePrice }).Select(p => new UnInvoiceSettledDetailSum
//{
// MaterialCode = p.Key.MaterialCode,
// SapMaterailCode = p.Key.SapMaterialCode,
// MaterialGroup = p.Key.MaterialGroup,
// SettleQty = p.Sum(itm => itm.SettledQty),
// FisQty = 0,
// DiffQty = -p.Sum(itm => itm.SettledQty),
// Price = p.Key.InvoicePrice,
// DiffAmt = p.Sum(itm => itm.SettledQty) * p.Key.InvoicePrice
//}).ToList();
//var _sumTotal = new UnInvoiceSettledDetailSum()
//{
// SettleQty = _lsSum.Sum(p => p.SettleQty),
// DiffQty = _lsSum.Sum(p => p.DiffQty),
// Price = _lsSum.Sum(p => p.Price),
// DiffAmt = _lsSum.Sum(p => p.DiffAmt)
//};
//_lsSum.Add(_sumTotal);
//var _ls1 = DiffPrice(id, exportName, p_list);
//var report1List = _ls1.Where(p => p.DiffPrice != 0).GroupBy(p => new { p.MaterialGroup, p.MaterialCode, p.MaterialDesc, p.Price, p.InvoicePrice, p.DiffPrice, p.SapMaterialCode })
// .Select(t => new SettleDoorPanelExport { MaterialGroup = t.FirstOrDefault().MaterialGroup, MaterialCode = t.FirstOrDefault().MaterialCode, MaterialDesc = t.FirstOrDefault().MaterialDesc, Price = t.FirstOrDefault().Price, InvoicePrice = t.FirstOrDefault().InvoicePrice, InvoiceDiffPrice = t.FirstOrDefault().DiffPrice, SAPCode = t.FirstOrDefault().SapMaterialCode }).ToList();
//var report2List = _ls1.Where(p => p.DiffPrice != 0).Select(p => new { p.MaterialGroup, DiffAmt = p.DiffPrice * p.Qty }).GroupBy(p => new { p.MaterialGroup }).Select(p => new SettleDoorPanelSumExport { MaterialGroup = p.Key.MaterialGroup, InvoiceDiffPrice = p.Sum(itm => itm.DiffAmt), Version = version });
//var list1 = LSettleSum(id, exportName, p_list);
//var report1 = report2List.ToList();
//foreach (var itm in list1)
//{
// itm.MaterialGroup = itm.MaterialGroup + "(漏结)";
//}
//report1.AddRange(list1);
//ExcelExporter _exporter = new ExcelExporter();//导出Excel
//var result = _exporter
//.Append(_ls, "差异明细表")
//.SeparateBySheet()
//.Append(_lsSum, "数量差异汇总表")
//.SeparateBySheet()
//.Append(report1List, "按物料价格差异明细表")
//.SeparateBySheet()
//.Append(report1, "差异汇总验证表")
//.ExportAppendDataAsByteArray();
//result.ShouldNotBeNull();
//_fileContainer.SaveAsync(_filename, result.Result, true);
////_outputService.Export<InvoiceSettledDetailDiff>(id, string.Format("大众结算未发运核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _ls);
//return id.ToString();
return this.GetType().FullName; return this.GetType().FullName;
} }
/// <summary>
/// 导出
/// </summary>
public string ExportFile333(Guid id, List<string> exportName, List<CustomCondition> property)
{
return "";
// var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value;
// var _filename = exportName.FirstOrDefault();
// var _ls = _dapperRepository.GetDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber, materialGroup);
// var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
// foreach (var itm in _ls)
// {
// itm.InvoiceAmt = Math.Round(itm.InvoiceQty * itm.InvoicePrice, 2);
// itm.DiffPrice = itm.Price - itm.InvoicePrice;
// itm.DiffSettleFisQty = itm.SettledQty;
// }
// _ls = _ls.OrderBy(p => p.ChassisNumber).ThenBy(p => p.KENNCode).ThenBy(p => p.SapMaterialCode).ToList();
// if (!string.IsNullOrEmpty(materialGroup))
// {
// var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.MaterialGroup)).ToList();
// }
// }
// if (!string.IsNullOrEmpty(kenncode))
// {
// var _groupList = kenncode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.KENNCode)).ToList();
// }
// }
// if (!string.IsNullOrEmpty(chassisNumber))
// {
// var _groupList = chassisNumber.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.ChassisNumber)).ToList();
// }
// }
// if (!string.IsNullOrEmpty(sapCode))
// {
// var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList();
// }
// }
// if (!string.IsNullOrEmpty(materialCode))
// {
// var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.MaterialCode)).ToList();
// }
// }
// var _checkList = _erpdapperRepository.GetErrorBillList();
// var query = from itm in _ls
// join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum }
//equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1
// from tm1 in temp1.DefaultIfEmpty()
// where tm1 == null
// select itm;
// _ls = query.ToList();
// var _lsSum = _ls.GroupBy(p => new { p.MaterialCode, p.SapMaterialCode, p.MaterialGroup, p.InvoicePrice }).Select(p => new UnInvoiceSettledDetailSum
// {
// MaterialCode = p.Key.MaterialCode,
// SapMaterailCode = p.Key.SapMaterialCode,
// MaterialGroup = p.Key.MaterialGroup,
// SettleQty = p.Sum(itm => itm.SettledQty),
// FisQty = 0,
// DiffQty = -p.Sum(itm => itm.SettledQty),
// Price = p.Key.InvoicePrice,
// DiffAmt = p.Sum(itm => itm.SettledQty) * p.Key.InvoicePrice
// }).ToList();
// var _sumTotal = new UnInvoiceSettledDetailSum()
// {
// SettleQty = _lsSum.Sum(p => p.SettleQty),
// DiffQty = _lsSum.Sum(p => p.DiffQty),
// Price = _lsSum.Sum(p => p.Price),
// DiffAmt = _lsSum.Sum(p => p.DiffAmt)
// };
// _lsSum.Add(_sumTotal);
// var _ls1 = DiffPrice(id, exportName, p_list);
// var report1List = _ls1.Where(p => p.DiffPrice != 0).GroupBy(p => new { p.MaterialGroup, p.MaterialCode, p.MaterialDesc, p.Price, p.InvoicePrice, p.DiffPrice, p.SapMaterialCode })
// .Select(t => new SettleDoorPanelExport { MaterialGroup = t.FirstOrDefault().MaterialGroup, MaterialCode = t.FirstOrDefault().MaterialCode, MaterialDesc = t.FirstOrDefault().MaterialDesc, Price = t.FirstOrDefault().Price, InvoicePrice = t.FirstOrDefault().InvoicePrice, InvoiceDiffPrice = t.FirstOrDefault().DiffPrice, SAPCode = t.FirstOrDefault().SapMaterialCode }).ToList();
// var report2List = _ls1.Where(p => p.DiffPrice != 0).Select(p => new { p.MaterialGroup, DiffAmt = p.DiffPrice * p.Qty }).GroupBy(p => new { p.MaterialGroup }).Select(p => new SettleDoorPanelSumExport { MaterialGroup = p.Key.MaterialGroup, InvoiceDiffPrice = p.Sum(itm => itm.DiffAmt), Version = version });
// var list1 = LSettleSum(id, exportName, p_list);
// var report1 = report2List.ToList();
// foreach (var itm in list1)
// {
// itm.MaterialGroup = itm.MaterialGroup + "(漏结)";
// }
// report1.AddRange(list1);
// ExcelExporter _exporter = new ExcelExporter();//导出Excel
// var result = _exporter
// .Append(_ls, "差异明细表")
// .SeparateBySheet()
// .Append(_lsSum, "数量差异汇总表")
// .SeparateBySheet()
// .Append(report1List, "按物料价格差异明细表")
// .SeparateBySheet()
// .Append(report1, "差异汇总验证表")
// .ExportAppendDataAsByteArray();
// result.ShouldNotBeNull();
// _fileContainer.SaveAsync(_filename, result.Result, true);
// //_outputService.Export<InvoiceSettledDetailDiff>(id, string.Format("大众结算未发运核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _ls);
// return id.ToString();
}
} }
} }

Loading…
Cancel
Save