kazelee
2025-05-26 53d582ad41d8450b21045b2d862a532ecc57a9ba
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;
@@ -16,7 +18,7 @@
        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>
@@ -61,6 +63,11 @@
                Tasks = root.Tasks;
                ProductionLines = root.ProductionLines;
                ProdAgvSites = root.ProdAgvSite;
                foreach (var item in ProdAgvSites) {
                    AgvSite_ProdLineCodeMap.Add(item.Code, item.ProdId);
                }
            }   
            catch (FileNotFoundException) {
                LogHelper.Info("JSON 文件未找到");
@@ -87,12 +94,16 @@
        }
        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 +111,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 {
@@ -121,6 +137,7 @@
            public List<Area> Areas { get; set; }
            public List<Task> Tasks { get; set; }
            public List<ProductionLine> ProductionLines { get; set; }
            public List<ProdAgvSite> ProdAgvSite { get; set; }
        }
        public class Task {
@@ -128,6 +145,8 @@
            public List<string> StartAreas { get; set; }
            public List<string> EndAreas { get; set; }
        }
    }
    public class AreaName {