From 6b9801e47304eac1640cf737ef6bc039ff104dd1 Mon Sep 17 00:00:00 2001 From: kazelee <1847801760@qq.com> Date: 星期一, 23 六月 2025 17:17:39 +0800 Subject: [PATCH] 删除冗余的注释和功能,优化部分代码 --- util/Settings.cs | 108 ++++++++++++++++++++++++++++------------------------- 1 files changed, 57 insertions(+), 51 deletions(-) diff --git a/util/Settings.cs b/util/Settings.cs index 70de35d..6e5fc9b 100644 --- a/util/Settings.cs +++ b/util/Settings.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.IO; +using HH.WCS.Mobox3.DSZSH.util; + using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -10,22 +12,17 @@ { public static string WebApiUrl { get; set; } public static string NdcApiUrl { get; set; } + public static string ErpApiUrl { get; set; } // ERP 鍙嶉鎺ュ彛URL public static string SqlServer { get; set; } public static string TcpServerIp { get; set; } public static int TcpServerPort { get; set; } public static List<Config.Area> Areas { get; set; } = new List<Config.Area>(); - public static List<Config.Task> Tasks { get; set; } = new List<Config.Task>(); public static List<Config.ProductionLine> ProductionLines { get; set; } = new List<Config.ProductionLine>(); - + public static List<Config.ProdAgvSite> ProdAgvSites { get; set; } = new List<Config.ProdAgvSite>(); /// <summary> /// 搴撳尯瀛楀吀锛堝姞杞藉悗灏变笉鍙橈級 /// </summary> public static Dictionary<string, List<string>> AreaMap { get; set; } = new Dictionary<string, List<string>>(); - - /// <summary> - /// 浠诲姟瀛楀吀锛堝姞杞藉悗灏变笉鍙橈級 - /// </summary> - public static Dictionary<string, Config.Task> TaskMap { get; set; } = new Dictionary<string, Config.Task>(); public static Dictionary<string, int> AgvSite_ProdLineCodeMap { get; set; } = new Dictionary<string, int>(); @@ -35,9 +32,6 @@ // 閽堝 Areas 杩涜杞崲锛氬皢 Config 鐨�List 鍔犺浇鍒�Dict 涓� LoadAreas(); - - // 閽堝 Tasks 杩涜杞崲 - LoadTasks(); } private static void LoadJson() { @@ -54,12 +48,17 @@ WebApiUrl = root.WebApiUrl; NdcApiUrl = root.NdcApiUrl; + ErpApiUrl = root.ErpApiUrl; SqlServer = root.SqlServer; TcpServerIp = root.TcpServerIp; TcpServerPort = root.TcpServerPort; Areas = root.Areas; - Tasks = root.Tasks; ProductionLines = root.ProductionLines; + + ProdAgvSites = root.ProdAgvSite; + foreach (var item in ProdAgvSites) { + AgvSite_ProdLineCodeMap.Add(item.Code, item.ProdId); + } } catch (FileNotFoundException) { @@ -80,19 +79,17 @@ } } - private static void LoadTasks() { - foreach (var task in Tasks) { - TaskMap.Add(task.Name, task); - } - } - private static void LoadProdLines() { - foreach (var prod in ProductionLines) { - - } + //var db = new SqlHelper<object>().GetInstance(); + //for (int i = 0; i < ProductionLines.Count; i++) { + // var line = ProductionLines[i]; + // // 閫氳繃OnLoc OffLoc鎵惧埌AGVsite鐒跺悗鍐欏叆瀛楀吀 + //} } } + + // [Convert JSON to C# Classes Online - Json2CSharp Toolkit](https://json2csharp.com/) public class Config { @@ -100,6 +97,11 @@ public class Area { public string Name { get; set; } public List<string> Codes { get; set; } + } + + public class ProdAgvSite { + public string Code { get; set; } + public int ProdId { get; set; } } public class ProductionLine { @@ -115,53 +117,57 @@ public class Root { public string WebApiUrl { get; set; } public string NdcApiUrl { get; set; } + public string ErpApiUrl { get; set; } public string SqlServer { get; set; } public string TcpServerIp { get; set; } public int TcpServerPort { get; set; } public List<Area> Areas { get; set; } - public List<Task> Tasks { get; set; } - public List<ProductionLine> ProductionLines { get; set; } - } - public class Task { - public string Name { get; set; } - public List<string> StartAreas { get; set; } - public List<string> EndAreas { get; set; } + public List<ProductionLine> ProductionLines { get; set; } + public List<ProdAgvSite> ProdAgvSite { get; set; } } } + public class AreaName { - public const string 鍖呰鍖�= "鍖呰鍖�; - public const string 鎿嶄綔鍖�= "鎿嶄綔鍖�; + public const string B鍖呰鍖�= "鍖呰鍖�; + public const string K绌虹鎿嶄綔鍖�= "绌虹鎿嶄綔鍖�; + public const string M婊$鎿嶄綔鍖�= "婊$鎿嶄綔鍖�; - public const string 绌烘墭瀛樻斁鍖�= "绌烘墭瀛樻斁鍖�; + public const string K绌烘墭瀛樻斁鍖�= "绌烘墭瀛樻斁鍖�; + public const string K绌虹璐ф灦鍖�= "绌虹璐ф灦鍖�; + public const string M婊℃墭璐ф灦鍖�= "婊℃墭璐ф灦鍖�; + public const string M婊$璐ф灦鍖�= "婊$璐ф灦鍖�; - public const string 璐ф灦鍖�= "璐ф灦鍖�; - public const string 绌虹瀛樻斁鍖�= "绌虹瀛樻斁鍖�; - public const string 婊℃墭瀛樻斁鍖�= "婊℃墭瀛樻斁鍖�; - public const string 婊$瀛樻斁鍖�= "婊$瀛樻斁鍖�; + public const string C鎶芥鍖�= "鎶芥鍖�; + public const string C鎶芥寮傚父鍖�= "鎶芥寮傚父鍖�; - public const string 浜哄伐_AGV鎺ラ┏鍖�= "浜哄伐-AGV鎺ラ┏鍖�; - public const string 绌烘墭鐩樻帴椹冲尯 = "绌烘墭鐩樻帴椹冲尯"; - public const string 绌虹鎺ラ┏鍖�= "绌虹鎺ラ┏鍖�; + public const string K绌烘墭鍏ュ簱鎺ラ┏鍖�= "绌烘墭鍏ュ簱鎺ラ┏鍖�; + public const string K绌虹鍏ュ簱鎺ラ┏鍖�= "绌虹鍏ュ簱鎺ラ┏鍖�; + + public const string Q姹借溅鍑哄簱鍖�= "姹借溅鍑哄簱鍖�; + public const string H鐏溅鍑哄簱鍖�= "鐏溅鍑哄簱鍖�; + public const string Q姹借溅澶囪揣鍖�= "姹借溅澶囪揣鍖�; + public const string H鐏溅澶囪揣鍖�= "鐏溅澶囪揣鍖�; } public class TaskName { - public const string 濂借繍绠盻婊$涓嬬嚎鍏ュ簱 = "濂借繍绠�婊$涓嬬嚎鍏ュ簱"; - public const string 濂借繍绠盻绌虹涓婄嚎 = "濂借繍绠�绌虹涓婄嚎"; - public const string 濂借繍绠盻绌虹鍏ュ簱 = "濂借繍绠�绌虹鍏ュ簱"; - public const string 濂借繍绠盻绌虹缁戝畾 = "濂借繍绠�绌虹缁戝畾"; - public const string 鎴愬搧鑳跺嚭搴�= "鎴愬搧鑳跺嚭搴�; - public const string 鎵樼洏_婊℃墭涓嬬嚎鍏ュ簱 = "鎵樼洏-婊℃墭涓嬬嚎鍏ュ簱"; - public const string 鎵樼洏_绌烘墭涓婄嚎 = "鎵樼洏-绌烘墭涓婄嚎"; - public const string 鎵樼洏_绌烘墭鍏ュ簱 = "鎵樼洏-绌烘墭鍏ュ簱"; - public const string 鎵樼洏_绌烘墭缁戝畾 = "鎵樼洏-绌烘墭缁戝畾"; - public const string 鎶芥_涓嶅悎鏍肩Щ搴�= "鎶芥-涓嶅悎鏍肩Щ搴�; - public const string 鎶芥_鍑哄簱 = "鎶芥-鍑哄簱"; - public const string 鎶芥_鍚堟牸鍥炲簱 = "鎶芥-鍚堟牸鍥炲簱"; - public const string 绉诲簱 = "绉诲簱"; - public const string 灏剧鍥炲簱 = "灏剧鍥炲簱"; + public const string H濂借繍绠盻婊$涓嬬嚎鍏ュ簱 = "濂借繍绠�婊$涓嬬嚎鍏ュ簱"; + public const string H濂借繍绠盻绌虹涓婄嚎 = "濂借繍绠�绌虹涓婄嚎"; + public const string H濂借繍绠盻绌虹鍏ュ簱 = "濂借繍绠�绌虹鍏ュ簱"; + public const string C鎴愬搧鑳跺嚭搴�= "鎴愬搧鑳跺嚭搴�; + + public const string T鎵樼洏_婊℃墭涓嬬嚎鍏ュ簱 = "鎵樼洏-婊℃墭涓嬬嚎鍏ュ簱"; + public const string T鎵樼洏_绌烘墭涓婄嚎 = "鎵樼洏-绌烘墭涓婄嚎"; + public const string T鎵樼洏_绌烘墭鍏ュ簱 = "鎵樼洏-绌烘墭鍏ュ簱"; + + public const string C鎶芥_涓嶅悎鏍肩Щ搴�= "鎶芥-涓嶅悎鏍肩Щ搴�; + public const string C鎶芥_鍑哄簱 = "鎶芥-鍑哄簱"; + public const string C鎶芥_鍚堟牸鍥炲簱 = "鎶芥-鍚堟牸鍥炲簱"; + + public const string Y绉诲簱 = "绉诲簱"; + public const string W灏剧鍥炲簱 = "灏剧鍥炲簱"; } } -- Gitblit v1.9.1