using Monitor.LogService; using Module.Socket.Tool; using BatCharging.Model; namespace BatCharging.Service { /// /// 基础参数值 /// public class CmnChargerParam { #region 随机数 /// /// 循环时用的随机数值 /// public static UInt16 _CYS_SEQ_NUM = 0; /// /// 鉴权随时数 /// public static byte _RANDOM_NUM = 0; /// /// 计算循环用UInt16随机数值 /// /// public static UInt16 GetUInt16SeqNum() { if (CmnChargerParam._CYS_SEQ_NUM < 65535) { CmnChargerParam._CYS_SEQ_NUM += 1; } else { CmnChargerParam._CYS_SEQ_NUM = 1; } return _CYS_SEQ_NUM; } /// /// 计算Byte随机数值 /// /// public static byte GetByteRandomNum() { if (CmnChargerParam._RANDOM_NUM < 255) { CmnChargerParam._RANDOM_NUM += 1; } else { CmnChargerParam._RANDOM_NUM = 1; } return CmnChargerParam._RANDOM_NUM; } #endregion 随时数 public static ChargerMgrTool _CHR00TCPCLIENT = new ChargerMgrTool(); /// /// 设置消息发送到充电机的日志 /// /// 发送类型名称 /// 发送的字节数组 public static void SetSendMsgToCharing01Log(string sendType, byte[] contents) { string strTemp = DateTime.Now.ToString("HH:mm:ss fff") + "\r\n"; for (int i = 0; i < contents.Length; i++) { strTemp += contents[i].ToString("X2").PadLeft(2, '0') + " "; } Log.LogInstance.WriteLog(sendType + "-" + strTemp, LogType.Run, "MessageLogCharing01"); } /// /// 设置消息发送到充电机的日志 /// /// 发送类型名称 /// 发送的字节数组 public static void SetSendMsgToCharing02Log(string sendType, byte[] contents) { string strTemp = DateTime.Now.ToString("HH:mm:ss fff") + "\r\n"; for (int i = 0; i < contents.Length; i++) { strTemp += contents[i].ToString("X2").PadLeft(2, '0') + " "; } Log.LogInstance.WriteLog(sendType + "-" + strTemp, LogType.Run, "MessageLogCharing02"); } /// /// 设置消息发送到充电机的日志 /// /// 发送类型名称 /// 发送的字节数组 public static void SetSendMsgToCharing03Log(string sendType, byte[] contents) { string strTemp = DateTime.Now.ToString("HH:mm:ss fff") + "\r\n"; for (int i = 0; i < contents.Length; i++) { strTemp += contents[i].ToString("X2").PadLeft(2, '0') + " "; } Log.LogInstance.WriteLog(sendType + "-" + strTemp, LogType.Run, "MessageLogCharing03"); } /// /// 设置消息发送到充电机的日志 /// /// 发送类型名称 /// 发送的字节数组 public static void SetSendMsgToCharing04Log(string sendType, byte[] contents) { string strTemp = DateTime.Now.ToString("HH:mm:ss fff") + "\r\n"; for (int i = 0; i < contents.Length; i++) { strTemp += contents[i].ToString("X2").PadLeft(2, '0') + " "; } Log.LogInstance.WriteLog(sendType + "-" + strTemp, LogType.Run, "MessageLogCharing04"); } /// /// 设置消息发送到充电机的日志 /// /// 发送类型名称 /// 发送的字节数组 public static void SetSendMsgToCharing05Log(string sendType, byte[] contents) { string strTemp = DateTime.Now.ToString("HH:mm:ss fff") + "\r\n"; for (int i = 0; i < contents.Length; i++) { strTemp += contents[i].ToString("X2").PadLeft(2, '0') + " "; } Log.LogInstance.WriteLog(sendType + "-" + strTemp, LogType.Run, "MessageLogCharing05"); } /// /// 设置消息发送到充电机的日志 /// /// 发送类型名称 /// 发送的字节数组 public static void SetSendMsgToCharing06Log(string sendType, byte[] contents) { string strTemp = DateTime.Now.ToString("HH:mm:ss fff") + "\r\n"; for (int i = 0; i < contents.Length; i++) { strTemp += contents[i].ToString("X2").PadLeft(2, '0') + " "; } Log.LogInstance.WriteLog(sendType + "-" + strTemp, LogType.Run, "MessageLogCharing06"); } /// /// 设置消息发送到充电机的日志 /// /// 发送类型名称 /// 发送的字节数组 public static void SetSendMsgToCharing07Log(string sendType, byte[] contents) { string strTemp = DateTime.Now.ToString("HH:mm:ss fff") + "\r\n"; for (int i = 0; i < contents.Length; i++) { strTemp += contents[i].ToString("X2").PadLeft(2, '0') + " "; } Log.LogInstance.WriteLog(sendType + "-" + strTemp, LogType.Run, "MessageLogCharing07"); } } }