From 3bf222fa63a819b6d4fc1c27fd9a9cde43c56094 Mon Sep 17 00:00:00 2001 From: bairubing Date: Thu, 2 Jan 2025 09:59:31 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=8E=E9=AA=8C=E8=AF=81wbs=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/DataValidationService.cs | 170 +++++++++++++++++- 1 file changed, 163 insertions(+), 7 deletions(-) diff --git a/admin.net.pro/Admin.NET/Vistar.Application/Common/DataValidationService.cs b/admin.net.pro/Admin.NET/Vistar.Application/Common/DataValidationService.cs index b96527e..c6cdd5f 100644 --- a/admin.net.pro/Admin.NET/Vistar.Application/Common/DataValidationService.cs +++ b/admin.net.pro/Admin.NET/Vistar.Application/Common/DataValidationService.cs @@ -9,10 +9,13 @@ using DocumentFormat.OpenXml.Bibliography; using DocumentFormat.OpenXml.Drawing.Spreadsheet; using Furion.DependencyInjection; using Furion.DynamicApiController; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Server.IISIntegration; using NewLife; +using Qiniu.CDN; using RazorEngine; using RazorEngine.Compilation.ImpromptuInterface; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; @@ -20,6 +23,7 @@ using System.Text; using System.Threading.Tasks; using Vistar.Application.Entity; using Vistar.Application.SapService.Dto; +using Vistar.Application.Util; using static SKIT.FlurlHttpClient.Wechat.Api.Models.CgibinAccountGetAccountBasicInfoResponse.Types; namespace Vistar.Application.Common; @@ -243,11 +247,11 @@ public class DataValidationService : IDynamicApiController, ITransient { int lineNumber = 0; - if (objId==118) + if (objId == 118) { lineNumber = await _configurationDataRep.AsQueryable().Where(x => x.ParentGuid == recordGuid && x.isDeleted == false && x.ParentVersion == versionIndex && x.ConfigId == configId && x.isSuppressed == false && x.inContext == false).CountAsync(); } - + return lineNumber; } @@ -259,7 +263,7 @@ public class DataValidationService : IDynamicApiController, ITransient { await Task.Delay(0); // 生成一个新的Guid实例 - Guid guid = Guid.NewGuid(); + Guid guid = Guid.NewGuid(); // 将Guid转换为字符串形式 string uuidString = guid.ToString(); @@ -277,7 +281,7 @@ public class DataValidationService : IDynamicApiController, ITransient /// public async Task ComparativeVersion(long objId, string recordGuid, int newVersion, int olderVersion) { - string contrastResult =""; + string contrastResult = ""; if (objId == 137) { @@ -313,13 +317,13 @@ public class DataValidationService : IDynamicApiController, ITransient /// /// /// - public async Task ModifyInventoryInformation(string recordGuid,string code,long objectid,string Bdmng, string Labst, string ZwqslPo, string ZwqslPr, DateTime dateUpdated) + public async Task ModifyInventoryInformation(string recordGuid, string code, long objectid, string Bdmng, string Labst, string ZwqslPo, string ZwqslPr, DateTime dateUpdated) { - if (code=="S") + if (code == "S") { if (objectid == 137) { - var data = _obj137Rep.AsQueryable().Where(x => x.RecordGuid == recordGuid && x.deleted == false).OrderByDescending(x => x.idRecord).First(); + var data = _obj137Rep.AsQueryable().Where(x => x.RecordGuid == recordGuid && x.deleted == false).OrderByDescending(x => x.idRecord).First(); if (data != null) { await _obj137Rep.AsUpdateable().SetColumns(it => new Obj137 @@ -395,5 +399,157 @@ public class DataValidationService : IDynamicApiController, ITransient return "修改成功"; } + [AllowAnonymous] + public async Task cscscs1() + { + await Task.Delay(20000); + return "测试1执行时间" + DateTime.Now.ToString("HH:dd:ss"); + } + + [AllowAnonymous] + public async Task cscscs2() + { + await Task.Delay(20000); + return "测试2执行时间" + DateTime.Now.ToString("HH:dd:ss"); + } + + /// + /// SAP wbs状态 + /// + /// + /// + public async Task ProjProcStatus(string status) + { + await Task.Delay(0); + if (status == "进行中") + { + return "REL"; + } + if (status == "未启动") + { + return "CRTD"; + } + if (status == "暂停") + { + return "TECO"; + } + if (status == "已完成") + { + return "TEL"; + } + if (status == "已取消") + { + return "TECO"; + } + if (status == "删除") + { + return "DLFL"; + } + return status; + } + + + ///// + ///// 验证是否存在bom和工艺路线 + ///// + ///// + //public async Task> IsBomAndProcessRouteExist() + //{ + // //var materialData = await _obj137Rep.AsQueryable() + // // .Where(x => x.CheckedStatus == 0 && x.deleted == false && x.IsLatestVersion == true && (x._SWPDM_1202_SW_____ != "不展开" || x._SWPDM_1202_SW_____ == null) && (x.fld005534 == "A" || x.fld005534 == "M") && x._system_objConfigurationName == "默认" && !x.SWPDMFileName.Contains("SLDDRW")) + // // .ToListAsync(); + + // //查询需要同步的产品 + // var materialData = await _obj137Rep.AsQueryable() + // .Where(x => x.CheckedStatus == 0 && x.deleted == false && x.IsLatestVersion == true && x._system_objConfigurationName == "默认" && !x.SWPDMFileName.Contains("SLDDRW") && (x._SWPDM_1202_SW_____ != "不展开" || x._SWPDM_1202_SW_____ == null) && (x.fld005537 == "A" || x.fld005537 == "M")) + // .ToListAsync(); + + // //分组查询最大版本的物料 + // var groupedData = materialData.GroupBy(item => item.RecordGuid) + // .Select(group => group.OrderByDescending(item => item.VersionIndex).First()) + // .ToList(); + + // var output = new List(); + // var outputList = new List(); + + // var tasks = groupedData.Select(async item => + // { + // var versionIndex = item.VersionIndex; + // var processRouteData = await _configurationDataRep.CopyNew().AsQueryable() + // .Where(x => x.ConfigId == 8 && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == versionIndex).ToListAsync(); + // if (processRouteData.Count == 0) + // { + // await _obj137Rep.CopyNew().AsUpdateable() + // .SetColumns(it => new Obj137 + // { + // fld005534 = "N", + // }) + // .Where(it => it.idRecord == item.idRecord) + // .ExecuteCommandAsync(); + // var oub = new IsBomAndProcessRouteExistOutput + // { + // objId = 137, + // materialCode = item._System_objNBS, + // isSuccess = "刷新成功" + + // }; + + // outputList.Add(oub); + // return new IsBomAndProcessRouteExistOutput + // { + // objId = 137, + // materialCode = item._System_objNBS, + // isSuccess = "刷新成功" + // }; + // } + // return new IsBomAndProcessRouteExistOutput + // { + // objId = 137, + // materialCode = item._System_objNBS, + // isSuccess = "刷新失败" + // }; + // }); + // var bomStockInquiryOutput = await Task.WhenAll(tasks); + + // //foreach (var item in groupedData) + // //{ + // // // 获取版本号 + // // var versionIndex = item.VersionIndex; + // // //var bomData = await _configurationDataRep.AsQueryable() + // // // .Where(x => x.ConfigId == 8 && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == versionIndex && (x.fld005577 != "不包含" || x.fld005577 == null) && x.isSuppressed == false && x.inContext == false).ToListAsync(); + + // // //if (bomData.Count == 0) + // // //{ + // // // await _obj137Rep.AsUpdateable() + // // // .SetColumns(it => new Obj137 + // // // { + // // // fld005534 = "N", + // // // }) + // // // .Where(it => it.idRecord == item.idRecord) + // // // .ExecuteCommandAsync(); + // // // continue; + // // //} + + + // // var processRouteData = await _configurationDataRep.AsQueryable() + // // .Where(x => x.ConfigId == 9 && x.ParentGuid == item.RecordGuid && x.isDeleted == false && x.ParentVersion == versionIndex).ToListAsync(); + // // if (processRouteData.Count == 0) + // // { + // // await _obj137Rep.AsUpdateable() + // // .SetColumns(it => new Obj137 + // // { + // // fld005537 = "N", + // // }) + // // .Where(it => it.idRecord == item.idRecord) + // // .ExecuteCommandAsync(); + // // continue; + // // } + // //} + + + + + // return outputList; + //} }