Esempio n. 1
0
        /// <summary>
        /// 根据名称以及模组获得对应信息
        /// </summary>
        /// <param name="module"></param>
        /// <param name="feederName"></param>
        /// <returns></returns>
        public FeederConfig GetFeederConfig(Module module, string feederName)
        {
            FeederConfig config = new FeederConfig();
            SerializableHelper <FeederConfig> helper = new SerializableHelper <FeederConfig>(config);

            return(helper.DeJsonSerialize(PathDefine.sPathFeeder + $"{CommonHelper.GetEnumDescription(typeof(Module), module)}//{feederName}.json"));
        }
Esempio n. 2
0
        public static bool Load()
        {
            if (!File.Exists(PathDefine.sPathConfigure + "Feeder.json"))
            {
                FeederDefine.Instance.Init();
                return(true);
            }
            SerializableHelper <FeederDefine> helper = new SerializableHelper <FeederDefine>();
            var temp = helper.DeJsonSerialize(PathDefine.sPathConfigure + "Feeder.json");

            if (temp != null)
            {
                FeederDefine.Instance = temp;
            }
            else
            {
                return(false);
            }

            for (Module module = Module.Front; module <= Module.After; ++module)
            {
                for (Feeder feeder = Feeder.Left; feeder <= Feeder.Right; ++feeder)
                {
                    if (FeederDefine.Instance.InstallFeederName[module][feeder] != string.Empty)
                    {
                        FeederDefine.Instance[module, feeder] = FeederDefine.Instance.GetFeederConfig(module,
                                                                                                      FeederDefine.Instance.InstallFeederName[module][feeder]);
                    }
                }
            }
            return(true);
        }
Esempio n. 3
0
        public static void Load()
        {
            SerializableHelper <PressSensorHelper> helper = new SerializableHelper <PressSensorHelper>();

            PressSensorHelper.Instance = helper.DeJsonSerialize(Variable.sPath_Configure + "PressSensor.json");
            if (PressSensorHelper.Instance == null)
            {
                PressSensorHelper.Instance = new PressSensorHelper();
            }
        }
Esempio n. 4
0
        public static void Load()
        {
            SerializableHelper <List <ServiceItem> > helper = new SerializableHelper <List <ServiceItem> >();
            var list = helper.DeJsonSerialize(Variable.sPath_Configure + "耗材管控.cfg");

            if (list != null)
            {
                SerivceMonitorHelper.Instance.MonitorList = list;
            }
        }
        /// <summary>
        ///  只有程序加载的第一次可以使用
        /// </summary>
        public static void Load()
        {
            SerializableHelper <ReportHelper> helper = new SerializableHelper <ReportHelper>();
            var temp = helper.DeJsonSerialize(PathDefine.sPathReport + "Report.json");

            CreatePath(DateTime.Now);

            if (temp != null)
            {
                ReportHelper.Instance = temp;
            }
            ReportHelper.Instance[Module.Front] = LoadReport(Module.Front, DateTime.Now);
            ReportHelper.Instance[Module.After] = LoadReport(Module.After, DateTime.Now);
        }
Esempio n. 6
0
        public static void Load()
        {
            SerializableHelper <PressHelper> helper = new SerializableHelper <PressHelper>();

            PressHelper.Instance = helper.DeJsonSerialize(PathDefine.sPressConfigure + "PressConfig.json");
            if (PressHelper.Instance == null)
            {
                PressHelper.Instance = new PressHelper();
            }

            if (PressHelper.Instance.Sensors.Count == 0)
            {
                PressHelper.Instance.Sensors.Add(Module.Front, new PressSensor());
                PressHelper.Instance.Sensors.Add(Module.After, new PressSensor());
            }
        }
        private static MachineStatistic LoadReport(Module module, DateTime time)
        {
            bool isCurDay = true;
            bool isDay    = true;

            if (time.Hour < ReportHelper.Instance.DayShfitTime.Hours) // 上一天的夜班
            {
                isDay    = false;
                isCurDay = false;
            }
            else if (time.Hour >= ReportHelper.Instance.DayShfitTime.Hours &&
                     time.Hour < ReportHelper.Instance.NightShfitTime.Hours)
            {
            }
            else if (time.Hour >= ReportHelper.Instance.NightShfitTime.Hours)
            {
                isDay = false;
            }

            string ss     = isDay ? "白班" : "夜班";
            var    curDay = time;

            if (!isCurDay)
            {
                curDay = time.AddDays(-1);
            }

            var sP = $"{ReportHelper.Instance.ReportPath}{curDay.ToString("yyyy-MM-dd")}\\{module}\\{ss}.txt";

            if (File.Exists(sP))
            {
                SerializableHelper <MachineStatistic> szHelper = new SerializableHelper <MachineStatistic>();
                var rep = szHelper.DeJsonSerialize(sP);
                if (rep != null)
                {
                    return(rep);
                }
                else
                {
                    return(new MachineStatistic(DateTime.Now));
                }
            }

            return(new MachineStatistic(DateTime.Now));
        }
        public static bool Load()
        {
            if (!File.Exists(Variable.sPath_Configure + "//机械校验.json"))
            {
                return(true);
            }

            SerializableHelper <HardwareOrgHelper> helper = new SerializableHelper <HardwareOrgHelper>();
            var temp = helper.DeJsonSerialize(Variable.sPath_Configure + "//机械校验.json");

            if (temp != null)
            {
                HardwareOrgHelper.Instance = temp;
            }
            else
            {
                return(false);
            }
            return(true);
        }
        public static bool Load()
        {
            if (!File.Exists(PathDefine.sPathConfigure + "Speed.json"))
            {
                SpeedDefine.Instance.Init();
                return(true);
            }
            SerializableHelper <SpeedDefine> helper = new SerializableHelper <SpeedDefine>();
            var temp = helper.DeJsonSerialize(PathDefine.sPathConfigure + "Speed.json");

            if (temp != null)
            {
                SpeedDefine.Instance = temp;
            }
            else
            {
                return(false);
            }
            return(true);
        }
Esempio n. 10
0
        private CountClassification LoadTotal(string path, int hour)
        {
            SerializableHelper <CountClassification> helper = new SerializableHelper <CountClassification>();

            return(helper.DeJsonSerialize($"{path}//{hour}.json"));
        }
        public static MylarLabel Load(string labelName)
        {
            SerializableHelper <MylarLabel> helper = new SerializableHelper <MylarLabel>();

            return(helper.DeJsonSerialize(PathDefine.sPathLabel + $"{labelName}.json"));
        }
        public static void Load()
        {
            SerializableHelper <Dictionary <uint, NozzleOffsetShceme> > helper = new SerializableHelper <Dictionary <uint, NozzleOffsetShceme> >();

            Items = helper.DeJsonSerialize("./Configure/NozzleOffsetItem.json");
        }
        public static SuckConfig Load(string path)
        {
            SerializableHelper <SuckConfig> helper = new SerializableHelper <SuckConfig>();

            return(helper.DeJsonSerialize(path));
        }