using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization.Formatters.Soap;
using System.Data;
using System.Xml.Serialization;
using Mesnac.Action.ChemicalWeighing.Entity;
using System.Configuration;
namespace Mesnac.Action.ChemicalWeighing
{
///
/// 小料称量系统全局常量和变量和方法
///
public class Global
{
#region 协议头常量
///
/// 协议头常量
///
public class ProtocalHeader
{
}
#endregion
#region 系统全局变量
///
/// 系统全局变量
///
public class PublicVar
{
#region 字段定义
private bool _chemicalWeighingPlcOnlineFlag = false;
private bool _localPlanIsRefresh = false;
private List _lstRubCtrl = new List();
#endregion
#region 单例实现
private static PublicVar instance;
public static PublicVar Instance
{
get
{
if (instance == null)
{
instance = new PublicVar();
}
return instance;
}
}
private PublicVar()
{
}
#endregion
#region 应用配置变量
///
/// Socket通信侦听的IP地址
///
public readonly string ListenServerIP = Mesnac.Basic.AppConfigHelper.GetAppSettingValue("ListenServerIP", "127.0.0.1");
///
/// Socket通讯侦听的端口号
///
public readonly int Port = Mesnac.Basic.AppConfigHelper.GetAppSettingValue("Port", 6666);
#endregion
#region RunSchema配置项
///
/// 单机/网络:0为单机,1为网络
///
public Mesnac.Action.Base.BaseAction.NetTypes NetType
{
get
{
int intNetType = Mesnac.Basic.RunSchema.Instance.GetConfigValue("NetType", 0);
if (intNetType == 0)
{
return Base.BaseAction.NetTypes.Local;
}
else
{
return Base.BaseAction.NetTypes.Net;
}
}
}
///
/// 网络服务器连接检测模式:0-网络库检测,1-Ping检测
///
public int CheckConnectMode
{
get
{
int checkConnectMode = Mesnac.Basic.RunSchema.Instance.GetConfigValue("CheckConnectMode", 1);
return checkConnectMode;
}
}
///
/// 网络数据库服务器IP地址
///
public string NetDbServerIP
{
get
{
string netDbServerIP = Mesnac.Basic.RunSchema.Instance.GetConfigValue("NetDbServerIP", String.Empty);
return netDbServerIP;
}
}
///
/// 当前机台编号
///
public string EquipCode
{
get
{
string equipCode = Mesnac.Basic.RunSchema.Instance.GetConfigValue("EquipCode", "01001");
return equipCode;
}
}
///
/// 是否开启本地测试,一旦开启,则在配方下传、报表存盘时会增加支持测试的逻辑处理
///
public bool IsLocalTest
{
get
{
return Mesnac.Basic.RunSchema.Instance.GetConfigValue("IsLocalTest", false);
}
}
///
/// PLC交互最大超时次数(每次500毫秒)
///
public int MaxReadPlcCount
{
get
{
return Mesnac.Basic.RunSchema.Instance.GetConfigValue("MaxReadPlcCount", 10);
}
}
///
/// PLC交互时,清除请求信号前等待的时间,单位(毫秒)默认0秒,主要是方便PLC调试
///
public int ClearRequestSleep
{
get
{
return Mesnac.Basic.RunSchema.Instance.GetConfigValue("ClearRequestSleep", 0);
}
}
///
/// 消息窗口显示模式,0-显示3秒自动关闭,1-手动关闭
///
public int MessageDialogMode
{
get
{
return Mesnac.Basic.RunSchema.Instance.GetConfigValue("MessageDialogMode", 0);
}
}
///
/// 计划执行方式:0为单个执行,1为连续执行
///
public int PlanExecuteType
{
get
{
return Mesnac.Basic.RunSchema.Instance.GetConfigValue("PlanExecuteType", 0);
}
}
///
/// 是否强制换班
///
public bool IsForceShift
{
get
{
return Mesnac.Basic.RunSchema.Instance.GetConfigValue("IsForceShift", false);
}
}
///
/// 是否保存密炼曲线至MSSQLServer数据库
///
public bool IsSaveMixCurveDataToMsSQL
{
get
{
return Mesnac.Basic.RunSchema.Instance.GetConfigValue("IsSaveMixCurveDataToMsSQL", true);
}
}
///
/// 是否保存开炼曲线至MSSQL数据库
///
public bool IsSaveMillCurveDataToMsSQL
{
get
{
return Mesnac.Basic.RunSchema.Instance.GetConfigValue("IsSaveMillCurveDataToMsSQL", true);
}
}
///
/// 是否保存密炼曲线至InfluxDb数据库
///
public bool IsSaveMixCurveDataToInfluxDb
{
get
{
return Mesnac.Basic.RunSchema.Instance.GetConfigValue("IsSaveMixCurveDataToInfluxDb", false);
}
}
///
/// 是否保存开炼曲线至InfluxDb数据库,请先正确配置InfluxDb数据库信息
///
public bool IsSaveMillCurveDataToInfluxDb
{
get
{
return Mesnac.Basic.RunSchema.Instance.GetConfigValue("IsSaveMillCurveDataToInfluxDb", false);
}
}
///
/// 保存同一配方的最大版本数
///
public int SaveRecipeVersionMaxCount
{
get
{
return Mesnac.Basic.RunSchema.Instance.GetConfigValue("SaveRecipeVersionMaxCount", 5);
}
}
///
/// 默认小数精度,即保留几位小数
///
public int DefaultPrecision
{
get
{
return Mesnac.Basic.RunSchema.Instance.GetConfigValue("DefaultPrecision", 3);
}
}
///
/// 配方下传模式:0:非交互,直接下传;1:交互
///
public int PlcDownloadMode
{
get
{
return Mesnac.Basic.RunSchema.Instance.GetConfigValue("PlcDownloadMode", 0);
}
}
#endregion
#region 系统常量定义
///
/// 登录业务GUID
///
public readonly string LoginGUID = "CD72C0AB64BB4F81824C22A4A4BED295";
///
/// 配方数据导出路径
///
public readonly string RecipeExportPath = System.IO.Path.Combine(ICSharpCode.Core.FileUtility.ApplicationRootPath, "Data", "RecipeDataExport");
#endregion
#region 系统属性定义
///
/// 机台计划刷新标识,在刷新机台计划时设置为true,在更新计划状态后设置为false
///
public bool LocalPlanIsRefresh
{
get
{
return this._localPlanIsRefresh;
}
set
{
this._localPlanIsRefresh = value;
}
}
#endregion
#region 属性定义
///
/// 项目名称
///
public string ProjectWizardName { get; set; }
///
/// 小料称量PLC在线标志
///
public bool ChemicalWeighingPlcOnlineFlag
{
get { return _chemicalWeighingPlcOnlineFlag; }
set { _chemicalWeighingPlcOnlineFlag = value; }
}
///
/// 要展示的报警信息List
///
public List AlarmStrList = new List();
///
/// 监控画面是否刷新显示标识(主屏监控画面)
///
public bool isFlashFlag = false;
///
/// 监控画面是否刷新显示标识(扩展屏监控画面)
///
public bool isFlashFlagExtend = false;
///
/// 测试时所用变量(测试用)
///
public int alarmNumCount = 0;
///
/// 扫码枪条码开始截取位置(三元现场未用到)
///
public int ScanCodeStrStart = 0;
///
/// 扫码枪条码结束截取位置(三元现场未用到)
///
public int ScanCodeStrEnd = 10;
///
/// 手动秤启用标志
///
public bool ManualWeightFlag = false;
///
/// 下传计划的物料信息
///
public List currentListPmt_weigh = new List();
///
/// 下传小料计划的物料信息 -2023-06-27
///
public List currentListxl_weigh = new List();
///
/// 班次编号
///
public int globalShiftID = 0 ;
#endregion
}
#endregion
}
}