diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json index 6ad52926..d1d9af5c 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json @@ -3,9 +3,9 @@ "CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088" }, "ConnectionStrings": { - "Default": "Server=dev.ccwin-in.com,13326;Database=BJABP;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True", + "Default": "Server=dev.ccwin-in.com,13326;Database=BJABP;User ID=sa;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True", //"SettleAccountService": "Server=dev.ccwin-in.com,13326;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;", - "SettleAccountService": "Server=dev.ccwin-in.com,13326;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;", + "SettleAccountService": "Server=dev.ccwin-in.com,13326;Database=BQ_SA;User ID=sa;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;", "ExChangeCenterService": "Server=dev.ccwin-in.com,13326;Database=ExChangeCenter;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;", "WMSBJBMPT": "Server=dev.ccwin-in.com,6208;Database=WMS_BJBMPT_2;User ID=sa;Password=ChangkeTec@2021;Trusted_Connection=False;TrustServerCertificate=True;", "questdb": "host=dev.ccwin-in.com;port=10580;username=admin;password=quest;database=vmi;ServerCompatibilityMode=NoTypeLoading;" diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs index 54186de2..9a6d3b95 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs @@ -97,9 +97,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ INormalEfCoreRepository codeRepository, INormalEfCoreRepository vmiBalanceSumDetailRepository, INormalEfCoreRepository balanceSumRepository, - - - IBlobContainer fileContainer, Volo.Abp.ObjectMapping.IObjectMapper maper, IHubContext hubContext, @@ -178,7 +175,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ } /// - /// 定时备份:0 0 8 26 * ? + /// 定时备份:0 0 8 26 * ?(作废) /// [HttpPost("invoke")] [DisableValidation] @@ -188,7 +185,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ { try { - Invoke(_serviceProvider).Wait(); + // Invoke(_serviceProvider).Wait(); return new JsonResult(new { Code = 200, Message = "备份成功" }); } catch (Exception ex) @@ -330,7 +327,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ } /// - /// 快照列表 + /// 快照列表(作废) /// [HttpPost] public ListResultDto Snapshot() @@ -343,26 +340,28 @@ namespace Win.Sfs.SettleAccount.Entities.BQ } /// - /// 2.时点库存查询 + /// 2.时点库存查询(作废) /// [HttpPost] public async Task> Backup(BackupListRequest input) { - var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService"); - var options = new DbContextOptionsBuilder().UseSqlServer(connectionString).Options; - using var db = new SettleAccountDbContext(options); - var name = input.Name; - var sql = $"select * from {name}"; - var query = db.Set().FromSqlRaw(sql); - var filters = input.Filters.ToLambda(); - if (input.Filters.Count > 0) - { - query = query.Where(input.Filters.ToLambda()); - } - var totalCount = query.Count(); - query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting); - var entities = await query.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync().ConfigureAwait(false); - return new PagedResultDto(totalCount, entities); + var entities=new List(); + + //var connectionString = this._serviceProvider.GetRequiredService().GetConnectionString("SettleAccountService"); + //var options = new DbContextOptionsBuilder().UseSqlServer(connectionString).Options; + //using var db = new SettleAccountDbContext(options); + //var name = input.Name; + //var sql = $"select * from {name}"; + //var query = db.Set().FromSqlRaw(sql); + //var filters = input.Filters.ToLambda(); + //if (input.Filters.Count > 0) + //{ + // query = query.Where(input.Filters.ToLambda()); + //} + //var totalCount = query.Count(); + //query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting); + //var entities = await query.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync().ConfigureAwait(false); + return new PagedResultDto(1, entities); } /// @@ -770,36 +769,40 @@ namespace Win.Sfs.SettleAccount.Entities.BQ /// /// [HttpPost] - public async Task ImportSE(List files, EnumBusinessType businessType) + public async Task ImportSE(IFormFileCollection files , EnumBusinessType businessType) { try { + + ExportImporter _exportImporter = new ExportImporter(); + var dtos = await _exportImporter.UploadExcelImport(files, _excelImportService).ConfigureAwait(false); + var logList = _maper.Map, List>(dtos); using var ms = new MemoryStream(); - var file = files.FirstOrDefault(); - await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false); - var data = ms.ToArray(); - var tupleList = this.ImportInternal(data); - if (tupleList.Any(o => o.Item2.Count > 0)) - { - using var workbook = new XLWorkbook(new MemoryStream(data)); - var ws = workbook.Worksheets.FirstOrDefault(); - var header = ws.Row(1); - var errorIndex = ws.ColumnsUsed().Count() + 1; - header.Cell(errorIndex).Value = "提示信息"; - for (int i = 0; i < ws.RowsUsed().Count() - 1; i++) - { - ws.Row(i + 2).Cell(errorIndex).Value = string.Join(',', tupleList[i].Item2.Select(o => o.ErrorMessage)); - } - SetStyle(ws); - using var stream = new MemoryStream(); - workbook.SaveAs(stream); - stream.Seek(0, SeekOrigin.Begin); - var fileName = $"{file.Name}_错误信息.xlsx"; - await this._fileContainer.SaveAsync(fileName, stream, true).ConfigureAwait(false); - return new JsonResult(new { code = 400, message = "输入异常", fileName }); - } - var logList = tupleList.Select(o => o.Item1).ToList(); - logList.AsParallel().ForEach(Update); + //var file = files.FirstOrDefault(); + //await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false); + //var data = ms.ToArray(); + //var tupleList = this.ImportInternal(data); + //if (tupleList.Any(o => o.Item2.Count > 0)) + //{ + // using var workbook = new XLWorkbook(new MemoryStream(data)); + // var ws = workbook.Worksheets.FirstOrDefault(); + // var header = ws.Row(1); + // var errorIndex = ws.ColumnsUsed().Count() + 1; + // header.Cell(errorIndex).Value = "提示信息"; + // for (int i = 0; i < ws.RowsUsed().Count() - 1; i++) + // { + // ws.Row(i + 2).Cell(errorIndex).Value = string.Join(',', tupleList[i].Item2.Select(o => o.ErrorMessage)); + // } + // SetStyle(ws); + // using var stream = new MemoryStream(); + // workbook.SaveAs(stream); + // stream.Seek(0, SeekOrigin.Begin); + // var fileName = $"{file.Name}_错误信息.xlsx"; + // await this._fileContainer.SaveAsync(fileName, stream, true).ConfigureAwait(false); + // return new JsonResult(new { code = 400, message = "输入异常", fileName }); + //} + //var logList = tupleList.Select(o => o.Item1).ToList(); + // logList.AsParallel().ForEach(Update); if (businessType == EnumBusinessType.JisBBAC) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs index 89925e11..8f2b57dd 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs @@ -58,15 +58,20 @@ namespace Win.Sfs.SettleAccount.Entities.BQ return (DateTime.Now - now).TotalMinutes; } - + /// + /// 作废 + /// + /// + /// [NonAction] [DisableValidation] + public async Task Invoke(IServiceProvider serviceProvider) { await semaphoreSlim.WaitAsync().ConfigureAwait(false); try { - await InvokeInternal(serviceProvider).ConfigureAwait(false); + //await InvokeInternal(serviceProvider).ConfigureAwait(false); } finally { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs index 7c30f74c..c0e8dada 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs @@ -173,7 +173,7 @@ namespace Win.Sfs.SettleAccount CreateMapHBPO_PD(); CreateMapHBPO_PD_DETAIL(); - + CreateMapVimLog(); CreateMapPUB_PD(); CreateMapPUB_PD_DETAIL(); CreateMapINVOICE_WAIT_DETAIL_EXTEND(); @@ -1008,6 +1008,15 @@ namespace Win.Sfs.SettleAccount } + private void CreateMapVimLog() + { + CreateMap().ReverseMap(); + } + + + + + /// /// PUB发运单 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs index ca090611..83868786 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs @@ -171,4 +171,121 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi public string ReMark { get; set; } } + public class VimLogImportDTO + { + [ImporterHeader(Name = "厂内零件号")] + [Required(ErrorMessage = "{0}是必填项")] + public string RealPartCode { get; set; }//原始 + + [ImporterHeader(Name = "客户零件号")] + [Required(ErrorMessage = "{0}是必填项")] + public string CustPartCode { get; set; } + + [ImporterHeader(Name = "生产码类型")] + public string CodeType { get; set; } + + [ImporterHeader(Name = "发货类型")] + public EnumDeliverBjBmpBillType? DeliverBillType { get; set; } + + [ImporterHeader(Name = "数量")] + [Required(ErrorMessage = "{0}是必填项")] + public decimal Qty { get; set; } + + [ImporterHeader(Name = "发运日期")] + [Required(ErrorMessage = "{0}是必填项")] + public DateTime? BillTime { get; set; } + + [ImporterHeader(Name = "订单日期")] + [Required(ErrorMessage = "{0}是必填项")] + public DateTime? AssembleData { get; set; } + + [ImporterHeader(Name = "ERP库位")] + [Required(ErrorMessage = "{0}是必填项")] + public string ErpToLoc { get; set; } + + [ImporterHeader(Name = "EDI顺序号")] + public string Seq { get; set; } + + [ImporterHeader(Name = "客户订单号")] + public string OrderNum { get; set; } + + [ImporterHeader(Name = "塑件唯一码")] + public string UniqueCode { get; set; } + + [ImporterHeader(Name = "EDI总成号")] + public string MatchNumber { get; set; } + + [ImporterHeader(Name = "PJIS生产顺序号")] + public string PjsNum { get; set; } + + [ImporterHeader(Name = "实际生产码")] + public string RealCode { get; set; } + + [ImporterHeader(Name = "配置码")] + public string Configcode { get; set; } + + [ImporterHeader(Name = "工厂")] + public string factory { get; set; } + + [ImporterHeader(Name = "发货子类型")] + [Required(ErrorMessage = "{0}是必填项")] + public EnumDeliverSubBillType? DeliverSubBillType { get; set; } + + [ImporterHeader(Name = "EDI订单生产码")] + public string VinCode { get; set; } + + [ImporterHeader(Name = "结算生产码")] + public string SettlementVinCode { get; set; } + + [ImporterHeader(Name = "结算厂内生产码")] + public string SettlementPartCode { get; set; } + + [ImporterHeader(Name = "是否补货")] + public bool? IsReplenished { get; set; } + + [ImporterHeader(Name = "备注")] + public string ReMark { get; set; } + + [ImporterHeader(Name = "库存事务分类")] + [Required(ErrorMessage = "{0}是必填项")] + public VmiLogType LogType { get; set; } + + [ImporterHeader(Name = "变动单号")] + public string ChangedNumber { get; set; } + + [ImporterHeader(Name = "变动时间")] + public DateTime ChangedTime { get; set; } + + [ImporterHeader(Name = "变动类型")] + [Required(ErrorMessage = "{0}是必填项")] + public VmiType ChangedType { get; set; } + + //[ImporterHeader(Name = "变动人")] + //public string ChangedBy { get; set; } + + [ImporterHeader(Name = "库存变动")] + public decimal ChangedQty { get; set; } + + //[ImporterHeader(Name = "版本")] + //public int Version { get; set; } + //public string ConcurrencyStamp { get; set; } + + //[ImporterHeader(Name = "创建时间")] + //public DateTime CreatedTime { get; set; } + + //[ImporterHeader(Name = "更新时间")] + //public DateTime UpdatedTime { get; set; } = DateTime.Now; + + + + + + } + + + + + + + }