You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

374 lines
12 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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