/// <summary> /// 获取配置信息 /// </summary> /// <returns></returns> public static AkSystemParamModel GetConfig() { AkSystemParamModel config = new AkSystemParamModel(); //单位时间、任务间隔时间 config.PerTime = AkDaoHelper.Instance_SystemParam.GetPerTime("3"); config.TaskTime = config.PerTime; int minLine; int maxLine; //小值、大值 AkDaoHelper.Instance_SystemParam.GetMinOrMaxinValue(out minLine, out maxLine, "4"); config.MinLine = minLine; config.MaxLine = maxLine; //早餐时段 config.BreakFast = AkDaoHelper.Instance_SystemParam.GetRepastTime("5"); //中餐时段 config.Lunch = AkDaoHelper.Instance_SystemParam.GetRepastTime("6"); //下午茶时段 config.AfternoonTea = AkDaoHelper.Instance_SystemParam.GetRepastTime("7"); //晚餐时段 config.Supper = AkDaoHelper.Instance_SystemParam.GetRepastTime("8"); return(config); }
/// <summary> /// 获取当前餐段阀值 /// </summary> /// <returns></returns> private int getCurThreshold() { int threshold = 0; AkThresholdModel model = AkDaoHelper.Instance_Threshold.GetNewThreshold(); if (model != null) { string curTime = DateTime.Now.ToString("HH:mm:ss"); AkSystemParamModel reastTime = AkConfig.SysParam; if (reastTime != null) { if (curTime.CompareTo(reastTime.BreakFast.StartTime) > 0 && curTime.CompareTo(reastTime.BreakFast.EndTime) < 0) { threshold = model.BreakFastValue; } else if (curTime.CompareTo(reastTime.Lunch.StartTime) > 0 && curTime.CompareTo(reastTime.Lunch.EndTime) < 0) { threshold = model.LunchValue; } else if (curTime.CompareTo(reastTime.AfternoonTea.StartTime) > 0 && curTime.CompareTo(reastTime.AfternoonTea.EndTime) < 0) { threshold = model.AfternoonTeaValue; } else if (curTime.CompareTo(reastTime.Supper.StartTime) > 0 && curTime.CompareTo(reastTime.Supper.EndTime) < 0) { threshold = model.SupperValue; } } } return(threshold); }
/// <summary> /// 获取配置信息 /// </summary> /// <returns></returns> public static AkSystemParamModel GetConfig() { AkSystemParamModel config = new AkSystemParamModel(); //单位时间、任务间隔时间 //config.PerTime = AkDaoHelper.Instance_SystemParam.GetPerTime("3"); //config.TaskTime = config.PerTime; int minLine; int maxLine; //小值、大值 //AkDaoHelper.Instance_SystemParam.GetMinOrMaxinValue(out minLine, out maxLine, "4"); //config.MinLine = minLine; //config.MaxLine = maxLine; //早餐时段 config.BreakFast = new AkRepastModel(); initDateTime(config.BreakFast, "06:00", "10:00"); ////中餐时段 config.Lunch = new AkRepastModel(); initDateTime(config.Lunch, "10:00", "14:00"); ////下午茶时段 config.AfternoonTea = new AkRepastModel(); initDateTime(config.AfternoonTea, "14:00", "17:00"); ////晚餐时段 config.Supper = new AkRepastModel(); initDateTime(config.Supper, "17:00", "22:00"); //早餐时段 config.BreakFast = AkDaoHelper.Instance_SystemParam.GetRepastTime("5"); //中餐时段 config.Lunch = AkDaoHelper.Instance_SystemParam.GetRepastTime("6"); //下午茶时段 config.AfternoonTea = AkDaoHelper.Instance_SystemParam.GetRepastTime("7"); //晚餐时段 config.Supper = AkDaoHelper.Instance_SystemParam.GetRepastTime("8"); //显示的屏幕 AkSystemParamModel model = new AkSystemParamModel(); AkDaoHelper.Instance_SystemParam.GetStation("9", ref model); config.StationA = model.StationA; config.StationB = model.StationB; config.StationC = model.StationC; config.StationD = model.StationD; config.Station = model.Station; return(config); }
/// <summary> /// 读取系统配置信息 /// </summary> public static void ReadParam() { if (!AkConfig.IsConnSuccess) { LogHelper.Error(typeof(Calculation) + ".Start Exception error=", "连接数据库失败"); return; } AkSettingModel model = FileHelper.Instance.Read(); SysParam = AkSysParamHelper.GetConfig(); PeriodNum = model.PeriodNum; UpdateNum = model.UpdateNum; }
public AkBase() { AkSystemParamModel model = AkConfig.SysParam; if (model.BreakFast != null) { AllRepast.Add(new AkRepastModel() { RepastType = 1, RepastName = "早餐", StartTime = model.BreakFast.StartTime, EndTime = model.BreakFast.EndTime }); } if (model.Lunch != null) { AllRepast.Add(new AkRepastModel() { RepastType = 2, RepastName = "午餐", StartTime = model.Lunch.StartTime, EndTime = model.Lunch.EndTime }); } if (model.AfternoonTea != null) { AllRepast.Add(new AkRepastModel() { RepastType = 3, RepastName = "下午茶", StartTime = model.AfternoonTea.StartTime, EndTime = model.AfternoonTea.EndTime }); } if (model.Supper != null) { AllRepast.Add(new AkRepastModel() { RepastType = 4, RepastName = "晚餐", StartTime = model.Supper.StartTime, EndTime = model.Supper.EndTime }); } }
/// <summary> /// 读取系统配置信息 /// </summary> public static void ReadParam() { SysParam = AkSysParamHelper.GetConfig(); }
/// <summary> /// 获取配置线 /// </summary> /// <returns></returns> public void GetStation(string type, ref AkSystemParamModel model) { StringBuilder sb = new StringBuilder(); string sql = "select shortname,chitname,longname,bohname from [CFCInStoreDB].[dbo].[Item] where item.number=" + type; var dt = SqlServerHelper.Instance.GetDataTable(AkConfig.ConnCFCInStoreDB, sql); if (dt != null && dt.Rows.Count > 0) { string strStation = string.Empty; //A屏 if (dt.Rows[0]["shortname"] != null && !string.IsNullOrEmpty(dt.Rows[0]["shortname"].ToString())) { strStation = dt.Rows[0]["shortname"].ToString(); model.StationA = int.Parse(strStation); sb.Append(strStation); } sb.Append(","); //B屏 if (dt.Rows[0]["chitname"] != null && !string.IsNullOrEmpty(dt.Rows[0]["chitname"].ToString())) { strStation = dt.Rows[0]["chitname"].ToString(); model.StationB = int.Parse(strStation); if (!string.IsNullOrEmpty(sb.ToString())) { sb.Append(strStation); } } sb.Append(","); //C屏 if (dt.Rows[0]["longname"] != null && !string.IsNullOrEmpty(dt.Rows[0]["longname"].ToString())) { strStation = dt.Rows[0]["longname"].ToString(); model.StationC = int.Parse(strStation); if (!string.IsNullOrEmpty(sb.ToString())) { sb.Append(strStation); } } sb.Append(","); //D屏 if (dt.Rows[0]["bohname"] != null && !string.IsNullOrEmpty(dt.Rows[0]["bohname"].ToString())) { strStation = dt.Rows[0]["bohname"].ToString(); model.StationD = int.Parse(strStation); if (!string.IsNullOrEmpty(sb.ToString())) { sb.Append(strStation); } } } if (!string.IsNullOrEmpty(sb.ToString())) { model.Station = sb.ToString(); } else { model.Station = "2,3"; model.StationA = 2; model.StationB = 3; } }