diff --git a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs index 6e1f4e56..7dafe92b 100644 --- a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs +++ b/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(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()) diff --git a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs index 92ea8a19..4171f5f1 100644 --- a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs +++ b/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(); - + services.Configure(options => + { + // Set the limit to 256 MB + options.Limits.MaxRequestBodySize = 268435456; + }); + //上传文件大小限制IIS设置 + services.Configure(options => + { + options.MaxRequestBodySize = 268435456; + + }); + } public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) { app.InitializeApplication(); } + + + + } } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs index 36753d32..84fc50eb 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs @@ -49,8 +49,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts /// /// 大众准时化结算明细导入-R3已结 /// - [Authorize(SettleAccountPermissions.SettleAccounts.Default)] - //[AllowAnonymous] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + [AllowAnonymous] [Route("api/settleaccount/SettleAccount")] public class SettleAccountAppService : SettleAccountApplicationBase, ISettleAccountAppService { @@ -99,7 +99,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts [HttpPost] [Route("testImport")] [DisableRequestSizeLimit] - [Authorize(SettleAccountPermissions.SettleAccounts.Default)] + [UnitOfWork(false)] public async Task 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 SettleAccountUploadExcelImportTH([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode, string factory) { List customConditionList = new List(); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Jobs/TaskJobService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Jobs/TaskJobService.cs index 833b0678..d4b1eab4 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Jobs/TaskJobService.cs +++ b/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; diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/ERPDto/PriceQtyDiffDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/ERPDto/PriceQtyDiffDto.cs index a3e6deff..53eb29b9 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/ERPDto/PriceQtyDiffDto.cs +++ b/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; } - - - diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/FISes/FIS.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/FISes/FIS.cs index da53b1a2..0a6f1396 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/FISes/FIS.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/FISes/FIS.cs @@ -17,7 +17,7 @@ namespace Win.Sfs.SettleAccount.FISes public Guid ParentId { get; set; } /// - /// 开始时间 + /// 实际发货日期 /// public DateTime BeginTime { set; get; } @@ -127,8 +127,26 @@ namespace Win.Sfs.SettleAccount.FISes /// public string ErpMaterialCode { set; get; } + /// + /// M100状态 + /// + public string WMSState { set; get; } + /// + /// WMS出库单据号 + /// + public string WMSBillNum { set; get; } + + public string UnSettleVersion { set; get; } + + //public string WMSBillNumber { set; get; } + + /// + /// 账期 + /// + public DateTime AccountDate { set; get; } + public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version, Guid parentId) { Period = peroid; diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/UnSettle/UnSettleDetailReport.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/UnSettle/UnSettleDetailReport.cs new file mode 100644 index 00000000..915baa30 --- /dev/null +++ b/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; } + + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/ReportDetailBase.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/ReportDetailBase.cs new file mode 100644 index 00000000..286b9e81 --- /dev/null +++ b/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; } + + + + + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs new file mode 100644 index 00000000..ff33ff8f --- /dev/null +++ b/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, ITransientDependency + { + //ERP总成开票报表 + public UnSettledDetailDapperRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + + } + + public virtual List 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(_sql); + + return _query.ToList(); + } + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs new file mode 100644 index 00000000..aee9218d --- /dev/null +++ b/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 exportName, List 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(id, _first, _list); + return id.ToString(); + + } + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs index 310e0278..06a00ba9 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs +++ b/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 fileName, List realfileName, List 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 _errorList = new List(); - var checkList = new List(); //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(); } }