Browse Source

更新版本

branch_ccpg_220107
Administrator 3 years ago
parent
commit
b3dddb924b
  1. 11
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs
  2. 19
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs
  3. 8
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs
  4. 3
      src/Modules/SettleAccount/src/SettleAccount.Application/Jobs/TaskJobService.cs
  5. 68
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/ERPDto/PriceQtyDiffDto.cs
  6. 20
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/FISes/FIS.cs
  7. 27
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/UnSettle/UnSettleDetailReport.cs
  8. 39
      src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/ReportDetailBase.cs
  9. 118
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs
  10. 48
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs
  11. 18
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs

11
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs

@ -148,7 +148,12 @@ namespace Win.Sfs.SettleAccount
// options.DefaultTimeout = 864000; //10 days (as seconds)
//});
context.Services.Configure<FormOptions>(x =>
{
x.ValueLengthLimit = int.MaxValue;
x.MultipartBodyLengthLimit = int.MaxValue;
x.MemoryBufferThreshold = int.MaxValue;
});
}
@ -451,6 +456,10 @@ namespace Win.Sfs.SettleAccount
app.UseAbpSerilogEnrichers();
app.UseConfiguredEndpoints();
AsyncHelper.RunSync(async () =>
{
using (var scope = context.ServiceProvider.CreateScope())

19
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs

@ -1,6 +1,8 @@
using System;
using System.Configuration;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -11,12 +13,27 @@ namespace Win.Sfs.SettleAccount
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<SettleAccountHttpApiHostModule>();
services.Configure<KestrelServerOptions>(options =>
{
// Set the limit to 256 MB
options.Limits.MaxRequestBodySize = 268435456;
});
//上传文件大小限制IIS设置
services.Configure<IISServerOptions>(options =>
{
options.MaxRequestBodySize = 268435456;
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
app.InitializeApplication();
}
}
}

8
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs

@ -49,8 +49,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
/// <summary>
/// 大众准时化结算明细导入-R3已结
/// </summary>
[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
//[AllowAnonymous]
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
[AllowAnonymous]
[Route("api/settleaccount/SettleAccount")]
public class SettleAccountAppService : SettleAccountApplicationBase<SettleAccount>, ISettleAccountAppService
{
@ -99,7 +99,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
[HttpPost]
[Route("testImport")]
[DisableRequestSizeLimit]
[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
[UnitOfWork(false)]
public async Task<string> testUploadBeginInvoke([FromForm] IFormFileCollection files)
{
@ -119,7 +119,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
[HttpPost]
[Route("ExcelImport-PG")]
[DisableRequestSizeLimit]
[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
public async Task<string> SettleAccountUploadExcelImportTH([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode, string factory)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();

3
src/Modules/SettleAccount/src/SettleAccount.Application/Jobs/TaskJobService.cs

@ -231,7 +231,6 @@ namespace Win.Sfs.SettleAccount.Entities.TaskJobs
ServiceName=_serviceName,
InputConditions=customConditions
};
var _taskId=await _backgroundJobManager.EnqueueAsync(args,BackgroundJobPriority.Normal, TimeSpan.FromSeconds(3));
await _mng.ChangeTaskIdAsync(guid, _taskId);
args.TaskId = _taskId;
@ -239,7 +238,6 @@ namespace Win.Sfs.SettleAccount.Entities.TaskJobs
{
action(args);
}
return _taskId;
}
@ -272,7 +270,6 @@ namespace Win.Sfs.SettleAccount.Entities.TaskJobs
}
);
}
fileNameList.Add(getFileName);
}
var _serviceName = moudle.FullName;

68
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/ERPDto/PriceQtyDiffDto.cs

@ -10,48 +10,38 @@ namespace Win.Sfs.SettleAccount.Entities.ERPDto
public class PriceQtyDiffDto
{
//[ExporterHeader(DisplayName="物流发货单号")]
//[ExporterHeader(DisplayName="实际发货日期")]
//[ExporterHeader(DisplayName="M100交货状态")]
//[ExporterHeader(DisplayName="KENN号")]
//[ExporterHeader(DisplayName="底盘号")]
//[ExporterHeader(DisplayName="物料号")]
//[ExporterHeader(DisplayName="物料描述")]
//[ExporterHeader(DisplayName="客户物料")]
//[ExporterHeader(DisplayName="组件组物料")]
//[ExporterHeader(DisplayName="组件组物料描述")]
//[ExporterHeader(DisplayName="物料组(车型)")]
//[ExporterHeader(DisplayName="M100交货数量")]
//[ExporterHeader(DisplayName="定价")]
//[ExporterHeader(DisplayName="金额")]
//[ExporterHeader(DisplayName="结算数量")]
//[ExporterHeader(DisplayName="结算日期")]
//[ExporterHeader(DisplayName="结算与发货差异")]
//[ExporterHeader(DisplayName="结算与开票差异")]
//[ExporterHeader(DisplayName="开票数量")]
//[ExporterHeader(DisplayName="开票单价")]
//[ExporterHeader(DisplayName="开票金额")]
//[ExporterHeader(DisplayName="结算金额")]
//[ExporterHeader(DisplayName="单价差异")]
//[ExporterHeader(DisplayName="总金额差异")]
//[ExporterHeader(DisplayName="财务结算出库单号")]
//[ExporterHeader(DisplayName="SAP开票单号")]
//[ExporterHeader(DisplayName="漏结标识")]
[ExporterHeader(DisplayName = "结算件编码")]
public string {set;get;}
[ExporterHeader(DisplayName = "描述 ")]
public string {set;get;}
[ExporterHeader(DisplayName = "Qad出库数量")]
public string Qad出库数量 {set;get;}
[ExporterHeader(DisplayName = "大众结算数")]
public string {set;get;}
[ExporterHeader(DisplayName = "量差")]
public string {set;get;}
[ExporterHeader(DisplayName = "量差金额")]
public string {set;get;}
[ExporterHeader(DisplayName = "结算单价")]
public string {set;get;}
[ExporterHeader(DisplayName = "结算单价")]
public string {set;get;}
[ExporterHeader(DisplayName = "单价差")]
public string { set; get; }
[ExporterHeader(DisplayName = "发票金额合计")]
public string {set;get;}
[ExporterHeader(DisplayName = "转化后QAD金额")]
public string QAD金额 {set;get;}
[ExporterHeader(DisplayName = "合计差")]
public string {set;get;}
[ExporterHeader(DisplayName = "价差")]
public string {set;get;}
[ExporterHeader(DisplayName = "是否价差")]
public string { set; get; }
[ExporterHeader(DisplayName = "是否量差")]
public string { set; get; }
[ExporterHeader(DisplayName = "产品类")]
public string { set; get; }
[ExporterHeader(DisplayName = "车型")]
public string { set; get; }

20
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/FISes/FIS.cs

@ -17,7 +17,7 @@ namespace Win.Sfs.SettleAccount.FISes
public Guid ParentId { get; set; }
/// <summary>
/// 开始时间
/// 实际发货日期
/// </summary>
public DateTime BeginTime { set; get; }
@ -127,8 +127,26 @@ namespace Win.Sfs.SettleAccount.FISes
/// </summary>
public string ErpMaterialCode { set; get; }
/// <summary>
/// M100状态
/// </summary>
public string WMSState { set; get; }
/// <summary>
/// WMS出库单据号
/// </summary>
public string WMSBillNum { set; get; }
public string UnSettleVersion { set; get; }
//public string WMSBillNumber { set; get; }
/// <summary>
/// 账期
/// </summary>
public DateTime AccountDate { set; get; }
public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version, Guid parentId)
{
Period = peroid;

27
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/UnSettle/UnSettleDetailReport.cs

@ -0,0 +1,27 @@
using Magicodes.ExporterAndImporter.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Win.Sfs.SettleAccount.Reports;
namespace Win.Sfs.SettleAccount.Entities.UnSettle
{
public class UnSettleDetailReport:ReportDetailBase
{
[ExporterHeader(DisplayName = "结算平台未结数量 ")]
public decimal Qty { set; get; }
[ExporterHeader(DisplayName = "定价 ")]
public decimal Price { set; get; }
[ExporterHeader(DisplayName = "金额 ")]
public decimal Amt { set; get; }
[ExporterHeader(DisplayName = "漏结标识 ")]
public string Flag { set; get; }
[ExporterHeader(DisplayName = "漏结期间 ")]
public string UNSettleVersion { set; get; }
[ExporterHeader(DisplayName = "说明 ")]
public string Remark { set; get; }
}
}

39
src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/ReportDetailBase.cs

@ -0,0 +1,39 @@
using Magicodes.ExporterAndImporter.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Win.Sfs.SettleAccount.Reports
{
public class ReportDetailBase
{
[ExporterHeader(DisplayName = "交货单号 ")]
public string WmsBillNum { set; get; }
[ExporterHeader(DisplayName = "实际发货日期 ")]
public DateTime CP5Time { set; get; }
[ExporterHeader(DisplayName = "KENN号")]
public string KENNCode { set; get; }
[ExporterHeader(DisplayName = "底盘号")]
public string ChassisNumber { set; get; }
[ExporterHeader(DisplayName = "M100交货状态 ")]
public string WmsState { set; get; }
[ExporterHeader(DisplayName = "物料号")]
public string SapMaterialCode { set; get; }
[ExporterHeader(DisplayName = "物料描述 ")]
public string MaterialDesc { set; get; }
[ExporterHeader(DisplayName = "客户物料 ")]
public string MaterialCode { set; get; }
[ExporterHeader(DisplayName = "组件组物料 ")]
public string ParentMaterialCode { set; get; }
[ExporterHeader(DisplayName = "组件组物料描述 ")]
public string ParentMaterialDesc { set; get; }
[ExporterHeader(DisplayName = "物料组(车型) ")]
public string MaterialGroup { set; get; }
}
}

118
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs

@ -0,0 +1,118 @@
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;
using Win.Sfs.SettleAccount.Entities.FISes;
using Dapper;
using Win.Sfs.SettleAccount.FISes;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report.ExportDto;
using Win.Sfs.SettleAccount.Entities.UnSettle;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
public class UnSettledDetailDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{
//ERP总成开票报表
public UnSettledDetailDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public virtual List<UnSettleDetailReport> GetDiffReport(string year, string begin, string end, string customcode, string version,string materialCode,string materialGroup,string sapCode)
{
string str = string.Empty;
if (!string.IsNullOrEmpty(begin))
{
str += string.Format(" and beginTime>'{0}' ",begin);
}
if (!string.IsNullOrEmpty(end))
{
str += string.Format(" and beginTime<'{0}' ", end);
}
if (!string.IsNullOrEmpty(materialCode))
{
str += string.Format(" and MaterialCode='{0}' ", materialCode);
}
if (!string.IsNullOrEmpty(materialGroup))
{
str += string.Format(" and MaterialGroup='{0}' ", materialGroup);
}
if (!string.IsNullOrEmpty(sapCode))
{
str += string.Format(" and MaterialGroup='{0}' ", materialGroup);
}
var sqlString =
" SELECT\n" +
" A.*,\n" +
" C.Price,\n" +
" ISNULL( A.QTY, 0 )* ISNULL( C.Price, 0 ) AMT \n" +
"FROM\n" +
" (\n" +
" SELECT DISTINCT\n" +
" '' WMSState,\n" +
" '' UnSettleVersion,\n" +
" '' WMSBillNum,\n" +
" BeginTime CP5Time,\n" +
" ErpMaterialCode MaterialCode,\n" +
" ChassisNumber,\n" +
" KENNCode,\n" +
" 1 QTY,\n" +
" ErpMaterialCode ParentMaterialCode,\n" +
" '' FLAG \n" +
" FROM\n" +
" Set_fis \n" +
" WHERE\n" +
" 1 = 1 \n" +
" AND STATE = 0 {0} UNION ALL\n" +
" SELECT\n" +
" WMSState,\n" +
" UnSettleVersion,\n" +
" WMSBillNum,\n" +
" BeginTime CP5Time,\n" +
" ItemCode MaterialCode,\n" +
" ChassisNumber,\n" +
" KENNCode,\n" +
" QTY,\n" +
" ErpMaterialCode,\n" +
" '' FLAG \n" +
" FROM\n" +
" [Set_fis] \n" +
" WHERE\n" +
" 1 = 1 \n" +
" AND STATE = 0 {0} UNION ALL\n" +
" SELECT\n" +
" WMSState,\n" +
" UnSettleVersion,\n" +
" WMSBillNum,\n" +
" BeginTime CP5Time,\n" +
" ItemCode MaterialCode,\n" +
" ChassisNumber,\n" +
" KENNCode,\n" +
" QTY,\n" +
" ErpMaterialCode,\n" +
" 'L' FLAG \n" +
" FROM\n" +
" [Set_fis] \n" +
" WHERE\n" +
" 1 = 1 \n" +
" AND STATE = 4 {0}\n" +
" ) A\n" +
" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) ) C ON a.MaterialCode = c.MaterialCode";
string _sql = string.Format(sqlString, version);
;
var _query = DbConnection.Query<UnSettleDetailReport>(_sql);
return _query.ToList();
}
}
}

48
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs

@ -0,0 +1,48 @@
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.Entities.UnSettle;
using Win.Sfs.SettleAccount.FISes;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report.ExportDto;
namespace SettleAccount.Job.Services.Report
{
public class UnsettledDetailReportService : ITransientDependency, IExportJob
{
private readonly UnSettledDetailDapperRepository _dapper;
private readonly OutputService _outputService;
public UnsettledDetailReportService(UnSettledDetailDapperRepository dapper, OutputService outputService)
{
_dapper = dapper;
_outputService = outputService;
}
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var _first = exportName.FirstOrDefault();
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var customerCode = p_list.Where(p => p.Name == "CustomerCode").FirstOrDefault().Value;
var materailCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
var sapcode = p_list.Where(p => p.Name == "SapMaterialCode").FirstOrDefault().Value;
var begin = p_list.Where(p => p.Name == "Begin").FirstOrDefault().Value;
var end = p_list.Where(p => p.Name == "End").FirstOrDefault().Value;
//var cp7begin = p_list.Where(p => p.Name == "CP7Begin").FirstOrDefault().Value;
//var cp7end = p_list.Where(p => p.Name == "CP7End").FirstOrDefault().Value;
var _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), DateTime.Parse(begin), DateTime.Parse(end), customerCode, version);
_outputService.Export<UnSettleDetailReport>(id, _first, _list);
return id.ToString();
}
}
}

18
src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
@ -34,7 +35,6 @@ namespace TaskJob.Services
)
{
_service = service;
_inputService = inputService;
_repository = repository;
_versionRepository = versionRepository;
@ -42,8 +42,6 @@ namespace TaskJob.Services
public string ImportFile(Guid id, List<string> fileName, List<string> realfileName, List<CustomCondition> customConditions)
{
IExporter _excel = new ExcelExporter();
string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\";
var version = customConditions.Where(p => p.Name == "Version").FirstOrDefault().Value;
@ -60,12 +58,9 @@ namespace TaskJob.Services
{
try
{
var filePath = fileSavePath + itm;//获取到导入的excel
var exten = Path.GetExtension(fileSavePath);
List<string> _errorList = new List<string>();
var checkList = new List<ErrorExportDto>();
//var _chList = await _relrepository.GetAllAsync(GuidGenerator.Create(), true);
//var _chls = _chList.Select(p => p.SettleMaterialCode).Distinct();
@ -141,16 +136,11 @@ namespace TaskJob.Services
}
var _settleaccount = new Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount(Guid.NewGuid(), Guid.NewGuid(), dto.SettleYear, dto.KENNCode,
dto.ChassisNumber, dto.Model, dto.CP5A, dto.CP7,
dto.MaterialCode, dto.Qty, dto.SettlementID, dto.SettlementSupplier,
Regex.Replace(dto.MaterialCode, @"\s", ""), dto.Qty, dto.SettlementID, dto.SettlementSupplier,
DateTime.Now.Month.ToString(), dto.SettleYear, _id, version, DateTime.Now, Guid.NewGuid());
_setls.Add(_settleaccount);
}
}
#region
//var errorFileName = "错误文件.xlsx";
//checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("ERP物料号{0}底盘号 {1}有重复", "11111111111", "22222222222"), string.Empty));
@ -167,10 +157,6 @@ namespace TaskJob.Services
_setls = _setls.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.KENNCode }).Select(p => p.FirstOrDefault()).ToList();
_repository.Insert(_setls);
_versionRepository.Insert(_id, version, customerCode, customerCode);
return id.ToString();
}
}

Loading…
Cancel
Save