Browse Source

更新版本号

master
zhaoxinyu 9 months ago
parent
commit
3800aee4ac
  1. 98
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/EdiWmsDiffSerice.cs
  2. 55
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  3. 13
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs
  4. 100
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/BalanceSum/BalanceSumDapperRepository.cs

98
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/EdiWmsDiffSerice.cs

@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Magicodes.ExporterAndImporter.Excel;
using Shouldly;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Uow;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
{
public class EdiWmsDiffService :BASE_SERVICE, ITransientDependency, IExportJob
{
protected readonly EdiWmsDapperRepository _dapper;
private readonly IBlobContainer<MyFileContainer> _fileContainer;
public EdiWmsDiffService(IBlobContainer<MyFileContainer> fileContainer, EdiWmsDapperRepository dapper, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager) : base(excelImportService, snowflakeIdGenerator, commonManager)
{
_dapper = dapper;
_fileContainer = fileContainer;
}
[UnitOfWork(false)]
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{
var _filename = exportName.FirstOrDefault();
var year = property.Where(p => p.Name == "Year").FirstOrDefault().Value;
var list = _dapper.GetEdiWms();
ExcelExporter _exporter = new ExcelExporter();//导出Excel
var result = _exporter.Append(list.ToList(), "BBAC业务EDI发运对比表")
//.SeparateBySheet()
//.Append(_reversels.ToList(), "有发货无结算对比")
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(_filename, result.Result, true);
return id.ToString();
}
}
public class HBPOEdiWmsDiffService : BASE_SERVICE, ITransientDependency, IExportJob
{
protected readonly EdiWmsDapperRepository _dapper;
private readonly IBlobContainer<MyFileContainer> _fileContainer;
public HBPOEdiWmsDiffService(IBlobContainer<MyFileContainer> fileContainer, EdiWmsDapperRepository dapper, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager) : base(excelImportService, snowflakeIdGenerator, commonManager)
{
_dapper = dapper;
_fileContainer = fileContainer;
}
[UnitOfWork(false)]
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{
var _filename = exportName.FirstOrDefault();
var year = property.Where(p => p.Name == "Year").FirstOrDefault().Value;
var list = _dapper.GetHBPOEdiWms();
ExcelExporter _exporter = new ExcelExporter();//导出Excel
var result = _exporter.Append(list.ToList(), "HBPO业务EDI发运对比表")
//.SeparateBySheet()
//.Append(_reversels.ToList(), "有发货无结算对比")
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(_filename, result.Result, true);
return id.ToString();
}
}
}

55
code/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs

@ -74,6 +74,61 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
}
[HttpPost]
[DisableRequestSizeLimit]
/// <summary>
/// 差异对比EDI和WMS
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<string> GetBBACWmsEdiDiff()
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Year", Value = DateTime.Now.Year.ToString() });
var _taskid = await _service.ExportEnqueueAsync("EDI发运对比", ExportExtentsion.Excel, DateTime.Now.Year.ToString(), string.Empty, CurrentUser, typeof(EdiWmsDiffService), customConditionList, (rs) =>
{
}).ConfigureAwait(false);
return _taskid;
}
[HttpPost]
[DisableRequestSizeLimit]
/// <summary>
/// 差异对比EDI和WMS
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<string> GetHBPOWmsEdiDiff()
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Year", Value = DateTime.Now.Year.ToString() });
var _taskid = await _service.ExportEnqueueAsync("EDI发运对比", ExportExtentsion.Excel, DateTime.Now.Year.ToString(), string.Empty, CurrentUser, typeof(HBPOEdiWmsDiffService), customConditionList, (rs) =>
{
}).ConfigureAwait(false);
return _taskid;
}
}
public class BalanceSumVersionDto

13
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs

@ -97,6 +97,19 @@ namespace Win.Sfs.SettleAccount
return implementationFactory.GetService<BalanceSumService>();
}
if (key.Equals(typeof(EdiWmsDiffService).FullName))
{
return implementationFactory.GetService<EdiWmsDiffService>();
}
if (key.Equals(typeof(HBPOEdiWmsDiffService).FullName))
{
return implementationFactory.GetService<HBPOEdiWmsDiffService>();
}
else
{
throw new ArgumentException($"Not Support key:{key}");

100
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/BalanceSum/BalanceSumDapperRepository.cs

@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Dapper;
using Magicodes.ExporterAndImporter.Core;
using NPOI.HPSF;
using SettleAccount.Domain.BQ;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories.Dapper;
@ -13,6 +15,31 @@ using Win.Sfs.SettleAccount.Entities.BQ.Temp;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
public class EdiWms
{
[ExporterHeader(DisplayName = "生产码", IsBold = true)]
public string PN { set; get; }
[ExporterHeader(DisplayName = "客户零件号", IsBold = true)]
public string LU { set; get; }
[ExporterHeader(DisplayName = "发运时间", IsBold = true, Format = "yyyy-MM-dd")]
public DateTime? BillTime { set; get; }
[ExporterHeader(DisplayName = "订单日期", IsBold = true, Format = "yyyy-MM-dd")]
public DateTime? EDITime { set; get; }
[ExporterHeader(DisplayName = "发运数量", IsBold = true)]
public decimal ShippingQty { set; get; }
[ExporterHeader(DisplayName = "EDI数量", IsBold = true)]
public decimal EdiQty { set; get; }
[ExporterHeader(DisplayName = "差异数量", IsBold = true)]
public decimal DiffQty { set; get; }
[ExporterHeader(DisplayName = "状态", IsBold = true)]
public string State { set; get; }
}
public class BalanceSum
{
@ -463,5 +490,78 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
public class EdiWmsDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{
public EdiWmsDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
/// <summary>
/// 获取库存余额汇总
/// </summary>
/// <param name="p_year"></param>
/// <returns></returns>
public virtual List<EdiWms> GetEdiWms()
{
var sql =
"select * from (\n" +
"select\n" +
"ISNULL(a.PN,b.PN) PN,\n" +
"ISNULL(a.LU,a.LU) LU,A.BillTime,\n" +
"B.EDITime,\n" +
"ISNULL(A.qty,0) ShippingQty,\n" +
"ISNULL(b.qty,0) EdiQty ,\n" +
"case when ISNULL(A.qty,0) >ISNULL(b.qty,0) then '发运比EDI多'\n" +
"when ISNULL(A.qty,0) <ISNULL(b.qty,0) then '发运比EDI少'\n" +
"END State\n" +
"from\n" +
"(select PN,LU,CustomerPartCodeNoSpace,sum(Qty) qty ,MAX(BillTime) BillTime from Set_BBAC_SE_DETAIL where BusinessType=1 group by PN,CustomerPartCodeNoSpace,LU) a full join\n" +
"(select PN,LU,CustomerPartCodeNoSpace,sum(Qty) qty ,MAX(CreationTime) EDITime from Set_BBAC_SE_EDI group by PN,CustomerPartCodeNoSpace,LU) b on a.PN=b.PN and a.CustomerPartCodeNoSpace=b.CustomerPartCodeNoSpace\n" +
"WHERE A.qty<>B.qty ) temp order by EDITime,BillTime\n";
var entities = DbConnection.Query<EdiWms>(sql, null, null, false, 1200, null).ToList();
foreach(var itm in entities)
{
itm.DiffQty = itm.ShippingQty - itm.EdiQty;
}
return entities.ToList();
}
/// <summary>
/// 获取库存余额汇总
/// </summary>
/// <param name="p_year"></param>
/// <returns></returns>
public virtual List<EdiWms> GetHBPOEdiWms()
{
var sql =
"select * from (\n" +
"select\n" +
"ISNULL(a.PN,b.PN) PN,\n" +
"ISNULL(a.LU,a.LU) LU,A.BillTime,\n" +
"B.EDITime,\n" +
"ISNULL(A.qty,0) ShippingQty,\n" +
"ISNULL(b.qty,0) EdiQty ,\n" +
"case when ISNULL(A.qty,0) >ISNULL(b.qty,0) then '发运比EDI多'\n" +
"when ISNULL(A.qty,0) <ISNULL(b.qty,0) then '发运比EDI少'\n" +
"END State\n" +
"from\n" +
"(select PN,LU,CustomerPartCodeNoSpace,sum(Qty) qty ,MAX(BillTime) BillTime from Set_HBPO_SE_DETAIL where BusinessType=2 group by PN,CustomerPartCodeNoSpace,LU) a full join\n" +
"(select PN,LU,CustomerPartCodeNoSpace,sum(Qty) qty ,MAX(CreationTime) EDITime from Set_HBPO_SE_EDI group by PN,CustomerPartCodeNoSpace,LU) b on a.PN=b.PN and a.CustomerPartCodeNoSpace=b.CustomerPartCodeNoSpace\n" +
"WHERE A.qty<>B.qty ) temp order by EDITime,BillTime\n";
var entities = DbConnection.Query<EdiWms>(sql, null, null, false, 1200, null).ToList();
foreach (var itm in entities)
{
itm.DiffQty = itm.ShippingQty - itm.EdiQty;
}
return entities.ToList();
}
}
}

Loading…
Cancel
Save