Commit 3bfe3755 LN

bug修改

1 个父辈 ad5b7d80
此文件类型无法预览
...@@ -18,7 +18,7 @@ namespace OnlineStore.AssemblyLine ...@@ -18,7 +18,7 @@ namespace OnlineStore.AssemblyLine
{ {
internal partial class FrmEquipBase : FrmBase internal partial class FrmEquipBase : FrmBase
{ {
internal static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //internal static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
internal FrmEquipBase() internal FrmEquipBase()
{ {
InitializeComponent(); InitializeComponent();
......
...@@ -22,7 +22,7 @@ namespace OnlineStore.AssemblyLine ...@@ -22,7 +22,7 @@ namespace OnlineStore.AssemblyLine
{ {
internal partial class FrmIOStatus : FrmBase internal partial class FrmIOStatus : FrmBase
{ {
internal static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //internal static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
internal FrmIOStatus() internal FrmIOStatus()
{ {
Control.CheckForIllegalCrossThreadCalls = false; Control.CheckForIllegalCrossThreadCalls = false;
......
...@@ -20,7 +20,7 @@ namespace OnlineStore.AssemblyLine ...@@ -20,7 +20,7 @@ namespace OnlineStore.AssemblyLine
internal partial class FrmLineStore : Form internal partial class FrmLineStore : Form
{ {
internal static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //internal static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private LineBean lineBean = null; private LineBean lineBean = null;
private List<TabPage> tabPageList = new List<TabPage>(); private List<TabPage> tabPageList = new List<TabPage>();
private bool LoadOk = false; private bool LoadOk = false;
......
...@@ -44,7 +44,7 @@ namespace OnlineStore.AssemblyLine ...@@ -44,7 +44,7 @@ namespace OnlineStore.AssemblyLine
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow); public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
public const int SW_RESTORE = 9; public const int SW_RESTORE = 9;
public static IntPtr formhwnd; public static IntPtr formhwnd;
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion #endregion
...@@ -124,7 +124,7 @@ namespace OnlineStore.AssemblyLine ...@@ -124,7 +124,7 @@ namespace OnlineStore.AssemblyLine
static void LogUnhandledException(string type, string exceptionobj) static void LogUnhandledException(string type, string exceptionobj)
{ {
//这里可以进一步地写日志 //这里可以进一步地写日志
LOGGER.Error("【" + type + "】" + exceptionobj); LogUtil.error("【" + type + "】" + exceptionobj);
MessageBox.Show(exceptionobj, type); MessageBox.Show(exceptionobj, type);
LogUtil.error("【" + type + "】" + exceptionobj); LogUtil.error("【" + type + "】" + exceptionobj);
......
using log4net; using log4net;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary; using OnlineStore.DeviceLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -14,14 +15,14 @@ namespace StoreServer ...@@ -14,14 +15,14 @@ namespace StoreServer
{ {
public partial class LineStoreSystemService : ServiceBase public partial class LineStoreSystemService : ServiceBase
{ {
protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public LineStoreSystemService() public LineStoreSystemService()
{ {
InitializeComponent(); InitializeComponent();
} }
protected override void OnStart(string[] args) protected override void OnStart(string[] args)
{ {
LOGGER.Info(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "*************************Start."); LogUtil .info(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "*************************Start.");
//初始化料仓 //初始化料仓
// DeviceControl.isNoDeviceDebug = true; // DeviceControl.isNoDeviceDebug = true;
LineManager.Init(); LineManager.Init();
...@@ -32,7 +33,7 @@ namespace StoreServer ...@@ -32,7 +33,7 @@ namespace StoreServer
} }
else else
{ {
LOGGER.Info(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + " ,启动时未找到 .LineBean"); LogUtil.info(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + " ,启动时未找到 .LineBean");
} }
} }
protected override void OnStop() protected override void OnStop()
...@@ -44,7 +45,7 @@ namespace StoreServer ...@@ -44,7 +45,7 @@ namespace StoreServer
IOManager.instance.CloseAllDO(); IOManager.instance.CloseAllDO();
IOManager.instance.CloseAllConnection(); IOManager.instance.CloseAllConnection();
//AIManager.CloseConnect(); //AIManager.CloseConnect();
LOGGER.Info(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "*************************Stop."); LogUtil.info(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "*************************Stop.");
} }
} }
} }
...@@ -12,7 +12,7 @@ namespace OnlineStore.Common ...@@ -12,7 +12,7 @@ namespace OnlineStore.Common
{ {
public class ConfigAppSettings public class ConfigAppSettings
{ {
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static int seq = 1; private static int seq = 1;
...@@ -20,7 +20,7 @@ namespace OnlineStore.Common ...@@ -20,7 +20,7 @@ namespace OnlineStore.Common
{ {
if (seq.Equals(Int32.MaxValue)) if (seq.Equals(Int32.MaxValue))
{ {
LOGGER.Info("seq当前值:" + seq + ",重置seq=0"); LogUtil.info("seq当前值:" + seq + ",重置seq=0");
seq = 0; seq = 0;
} }
Interlocked.Increment(ref seq); Interlocked.Increment(ref seq);
...@@ -78,7 +78,7 @@ namespace OnlineStore.Common ...@@ -78,7 +78,7 @@ namespace OnlineStore.Common
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null) if (config.AppSettings.Settings[key] == null)
{ {
LOGGER.Error("未找到配置:" + key + ",请检查配置是否完整!"); LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return ""; return "";
} }
else else
...@@ -93,7 +93,7 @@ namespace OnlineStore.Common ...@@ -93,7 +93,7 @@ namespace OnlineStore.Common
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null) if (config.AppSettings.Settings[key] == null)
{ {
LOGGER.Error("未找到配置:" + key + ",请检查配置是否完整!"); LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a; return a;
} }
else else
...@@ -110,7 +110,7 @@ namespace OnlineStore.Common ...@@ -110,7 +110,7 @@ namespace OnlineStore.Common
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null) if (config.AppSettings.Settings[key] == null)
{ {
LOGGER.Error("未找到配置:" + key + ",请检查配置是否完整!"); LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a; return a;
} }
else else
...@@ -145,7 +145,7 @@ namespace OnlineStore.Common ...@@ -145,7 +145,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "SaveValue保存配置出错:AppKey=" + key + ",AppValue=" + value + ",",ex); LogUtil.error( "SaveValue保存配置出错:AppKey=" + key + ",AppValue=" + value + ",",ex);
} }
} }
...@@ -172,7 +172,7 @@ namespace OnlineStore.Common ...@@ -172,7 +172,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + ",",ex); LogUtil.error( "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + ",",ex);
} }
} }
...@@ -206,7 +206,7 @@ namespace OnlineStore.Common ...@@ -206,7 +206,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + ",",ex); LogUtil.error( "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + ",",ex);
} }
} }
} }
......
...@@ -111,13 +111,14 @@ namespace OnlineStore.Common ...@@ -111,13 +111,14 @@ namespace OnlineStore.Common
try try
{ {
var wc = new MyWebClient(timeOut); using (var wc = new MyWebClient(timeOut))
{
if (string.IsNullOrEmpty(wc.Headers["Content-Type"])) if (string.IsNullOrEmpty(wc.Headers["Content-Type"]))
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
wc.Encoding = encoding; wc.Encoding = encoding;
result = wc.UploadString(url, "POST", paramData); result = wc.UploadString(url, "POST", paramData);
//LogUtil.info(result); } //LogUtil.info(result);
} }
catch (WebException ex) catch (WebException ex)
{ {
...@@ -149,15 +150,17 @@ namespace OnlineStore.Common ...@@ -149,15 +150,17 @@ namespace OnlineStore.Common
try try
{ {
LogUtil.info( "HTTP GET FROM: " + url); LogUtil.info( "HTTP GET FROM: " + url);
var wc = new WebClient { Encoding = encoding }; using (var wc = new WebClient { Encoding = encoding })
{
var readStream = wc.OpenRead(url); var readStream = wc.OpenRead(url);
using (var sr = new StreamReader(readStream, encoding)) using (var sr = new StreamReader(readStream, encoding))
{ {
var result = sr.ReadToEnd(); var result = sr.ReadToEnd();
LogUtil.info( "receive << " + result); LogUtil.info("receive << " + result);
return result; return result;
} }
} }
}
catch (Exception e) catch (Exception e)
{ {
LogUtil.error("HTTP GET ERROR:" + e.Message, 102); LogUtil.error("HTTP GET ERROR:" + e.Message, 102);
......
...@@ -6,12 +6,13 @@ using System.Net; ...@@ -6,12 +6,13 @@ using System.Net;
using System.IO; using System.IO;
using log4net; using log4net;
using System.Text; using System.Text;
//using OnlineStore.Common;
namespace OnlineStore namespace OnlineStore
{ {
public class NetTCPServer public class NetTCPServer
{ {
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// TCP服务端监听 /// TCP服务端监听
...@@ -118,13 +119,13 @@ namespace OnlineStore ...@@ -118,13 +119,13 @@ namespace OnlineStore
NetworkStream ns = client.tcpClient.GetStream(); NetworkStream ns = client.tcpClient.GetStream();
StreamReader sr = new StreamReader(ns); StreamReader sr = new StreamReader(ns);
string str = sr.ReadLine(); string str = sr.ReadLine();
LOGGER.Info("读取到数据:"+str); OnlineStore.Common. LogUtil.info("读取到数据:"+str);
byte[] recdata = new byte[ns.EndRead(ar)]; byte[] recdata = new byte[ns.EndRead(ar)];
if (recdata.Length > 0) if (recdata.Length > 0)
{ {
//Array.Copy(client.Buffer, recdata, recdata.Length); //Array.Copy(client.Buffer, recdata, recdata.Length);
LOGGER.Info("读取到数据1111:" + Encoding.ASCII.GetString(recdata)); OnlineStore.Common. LogUtil.info("读取到数据1111:" + Encoding.ASCII.GetString(recdata));
//ns.BeginRead(client.Buffer, 0, client.Buffer.Length, new AsyncCallback(TCPCallBack), client); //ns.BeginRead(client.Buffer, 0, client.Buffer.Length, new AsyncCallback(TCPCallBack), client);
} }
else else
......
...@@ -13,7 +13,7 @@ namespace OnlineStore.Common ...@@ -13,7 +13,7 @@ namespace OnlineStore.Common
{ {
public class TcpClient public class TcpClient
{ {
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public delegate void HandleMessage(string message); public delegate void HandleMessage(string message);
private Socket m_clientSocket = null; private Socket m_clientSocket = null;
...@@ -84,7 +84,7 @@ namespace OnlineStore.Common ...@@ -84,7 +84,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "出错啦" + ex.ToString()); LogUtil.error( "出错啦" + ex.ToString());
return false; return false;
} }
} }
...@@ -109,12 +109,12 @@ namespace OnlineStore.Common ...@@ -109,12 +109,12 @@ namespace OnlineStore.Common
{ {
m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null); m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null);
onReceived = HandleMessage; onReceived = HandleMessage;
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " success!"); LogUtil.info( "Connect to " + serverIP + ":" + serverPort + " success!");
return true; return true;
} }
else else
{ {
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " fail!"); LogUtil.info( "Connect to " + serverIP + ":" + serverPort + " fail!");
} }
} }
catch (Exception ex) catch (Exception ex)
...@@ -133,7 +133,7 @@ namespace OnlineStore.Common ...@@ -133,7 +133,7 @@ namespace OnlineStore.Common
if (!connResult.IsCompleted || (!m_clientSocket.Connected)) if (!connResult.IsCompleted || (!m_clientSocket.Connected))
{ {
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " fail!"); LogUtil.info( "Connect to " + serverIP + ":" + serverPort + " fail!");
m_clientSocket.Close(); m_clientSocket.Close();
//处理连接不成功的动作 //处理连接不成功的动作
return false; return false;
...@@ -143,7 +143,7 @@ namespace OnlineStore.Common ...@@ -143,7 +143,7 @@ namespace OnlineStore.Common
//处理连接成功的动作 //处理连接成功的动作
m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null); m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null);
onReceived = HandleMessage; onReceived = HandleMessage;
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " success!"); LogUtil.info( "Connect to " + serverIP + ":" + serverPort + " success!");
return true; return true;
} }
} }
...@@ -165,17 +165,17 @@ namespace OnlineStore.Common ...@@ -165,17 +165,17 @@ namespace OnlineStore.Common
//Thread.Sleep(300); //Thread.Sleep(300);
m_clientSocket.Close(); m_clientSocket.Close();
//m_clientSocket = null; //m_clientSocket = null;
LogUtil.info(LOGGER, "Socket closed!"); LogUtil.info( "Socket closed!");
} }
else else
{ {
LogUtil.error(LOGGER, "No socket is running!"); LogUtil.error( "No socket is running!");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "close error :" + ex.ToString()); LogUtil.error( "close error :" + ex.ToString());
} }
} }
...@@ -190,7 +190,7 @@ namespace OnlineStore.Common ...@@ -190,7 +190,7 @@ namespace OnlineStore.Common
if (m_clientSocket != null && m_clientSocket.Connected) if (m_clientSocket != null && m_clientSocket.Connected)
{ {
m_clientSocket.Send(sendBuffer); m_clientSocket.Send(sendBuffer);
LogUtil.debug(LOGGER, "Send >> " + strSendData); LogUtil.debug( "Send >> " + strSendData);
} }
} }
/// <summary> /// <summary>
...@@ -200,11 +200,11 @@ namespace OnlineStore.Common ...@@ -200,11 +200,11 @@ namespace OnlineStore.Common
{ {
if (strSendData.StartsWith("save")) if (strSendData.StartsWith("save"))
{ {
LogUtil.debug(LOGGER, "发送数据:" + strSendData); LogUtil.debug( "发送数据:" + strSendData);
} }
else else
{ {
LogUtil.info(LOGGER, "发送数据:" + strSendData); LogUtil.info( "发送数据:" + strSendData);
} }
strSendData = strSendData + "\r\n"; strSendData = strSendData + "\r\n";
...@@ -214,7 +214,7 @@ namespace OnlineStore.Common ...@@ -214,7 +214,7 @@ namespace OnlineStore.Common
if (m_clientSocket != null && m_clientSocket.Connected) if (m_clientSocket != null && m_clientSocket.Connected)
{ {
m_clientSocket.Send(sendBuffer); m_clientSocket.Send(sendBuffer);
LogUtil.debug(LOGGER, "Send >> " + strSendData); LogUtil.debug( "Send >> " + strSendData);
} }
} }
private void ReceiveCallBack(IAsyncResult ar) private void ReceiveCallBack(IAsyncResult ar)
......
...@@ -12,7 +12,7 @@ namespace OnlineStore.Common ...@@ -12,7 +12,7 @@ namespace OnlineStore.Common
{ {
public class TcpServer public class TcpServer
{ {
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// 接受消息时的间隔 /// 接受消息时的间隔
/// </summary> /// </summary>
...@@ -45,7 +45,7 @@ namespace OnlineStore.Common ...@@ -45,7 +45,7 @@ namespace OnlineStore.Common
} }
} }
} }
LogUtil.info(LOGGER, iplist + "]"); LogUtil.info( iplist + "]");
} }
/// <summary> /// <summary>
...@@ -65,7 +65,7 @@ namespace OnlineStore.Common ...@@ -65,7 +65,7 @@ namespace OnlineStore.Common
m_serverThread = new Thread(new ThreadStart(ReceiveAccept)); m_serverThread = new Thread(new ThreadStart(ReceiveAccept));
m_serverThread.Start(); m_serverThread.Start();
LogUtil.info(LOGGER, " Server start listen : " + m_serverPort); LogUtil.info( " Server start listen : " + m_serverPort);
logLocalIp(); logLocalIp();
//this.AddRunningInfo(">> " + DateTime.Now.ToString() + " Server started."); //this.AddRunningInfo(">> " + DateTime.Now.ToString() + " Server started.");
...@@ -107,7 +107,7 @@ namespace OnlineStore.Common ...@@ -107,7 +107,7 @@ namespace OnlineStore.Common
client.ClientSocket = m_serverSocket.Accept(); client.ClientSocket = m_serverSocket.Accept();
IPEndPoint clientipe = (IPEndPoint)client.ClientSocket.RemoteEndPoint; IPEndPoint clientipe = (IPEndPoint)client.ClientSocket.RemoteEndPoint;
client.AddStr = clientipe.Address.ToString()+":"+clientipe.Port.ToString(); client.AddStr = clientipe.Address.ToString()+":"+clientipe.Port.ToString();
LogUtil.info(LOGGER, "["+serverPort+"]有新的客户端链接上:[" + client.AddStr+"]"); LogUtil.info( "["+serverPort+"]有新的客户端链接上:[" + client.AddStr+"]");
AcceptClientEvent?.Invoke(client); AcceptClientEvent?.Invoke(client);
receiveMessageDelegate = new ReceiveMessageDelegate(ReceiveMessages); receiveMessageDelegate = new ReceiveMessageDelegate(ReceiveMessages);
...@@ -115,7 +115,7 @@ namespace OnlineStore.Common ...@@ -115,7 +115,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "ReceiveAccept方法,客户端【"+client.AddStr+"】:" + ex.Message); LogUtil.error( "ReceiveAccept方法,客户端【"+client.AddStr+"】:" + ex.Message);
//throw new Exception(ex.Message); //throw new Exception(ex.Message);
} }
} }
...@@ -218,7 +218,7 @@ namespace OnlineStore.Common ...@@ -218,7 +218,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error(ex.ToString()); LogUtil.error(ex.ToString());
} }
} }
......
...@@ -12,7 +12,7 @@ namespace OnlineStore.Common ...@@ -12,7 +12,7 @@ namespace OnlineStore.Common
public class UdpServer public class UdpServer
{ {
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private Thread m_serverThread; private Thread m_serverThread;
private Socket udpServer; private Socket udpServer;
...@@ -37,7 +37,7 @@ namespace OnlineStore.Common ...@@ -37,7 +37,7 @@ namespace OnlineStore.Common
} }
} }
} }
LogUtil.info(LOGGER, iplist + "]"); LogUtil.info( iplist + "]");
} }
......
...@@ -196,7 +196,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -196,7 +196,7 @@ namespace OnlineStore.DeviceLibrary
//大料12号只能走1号2后皮带线 //大料12号只能走1号2后皮带线
// 料架的架位大料时,架位1 - 6,12号优先走1 / 2号皮带线, // 料架的架位大料时,架位1 - 6,12号优先走1 / 2号皮带线,
//7 - 11优先走3 / 4号皮带线 //7 - 11优先走3 / 4号皮带线
if (inoup.Equals(12)) if (inoup.rfidLoc.Equals(12))
{ {
// 大料12号只能走1号2后皮带线 // 大料12号只能走1号2后皮带线
mustLine = new List<int> { 1, 2 }; mustLine = new List<int> { 1, 2 };
......
...@@ -18,7 +18,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -18,7 +18,7 @@ namespace OnlineStore.DeviceLibrary
//public static uint DefaultDICount = 16; //public static uint DefaultDICount = 16;
//public static uint DefaultDOCount = 16; //public static uint DefaultDOCount = 16;
public readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //public readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public Dictionary<string, AIOBOX> AIOMap = new Dictionary<string, AIOBOX>(); public Dictionary<string, AIOBOX> AIOMap = new Dictionary<string, AIOBOX>();
public Dictionary<string, List<Box_Sta>> DIValueMap = new Dictionary<string, List<Box_Sta>>(); public Dictionary<string, List<Box_Sta>> DIValueMap = new Dictionary<string, List<Box_Sta>>();
...@@ -115,7 +115,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -115,7 +115,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception error) catch (Exception error)
{ {
LogUtil.error(LOGGER, "连接IO模块 " + logName + " 出错:" + error.ToString()); LogUtil.error( "连接IO模块 " + logName + " 出错:" + error.ToString());
} }
} }
...@@ -328,12 +328,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -328,12 +328,12 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(LOGGER, "WriteSingleDO出错 没有连接IO模块:" + ioIp); LogUtil.error( "WriteSingleDO出错 没有连接IO模块:" + ioIp);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错啦:", ex); LogUtil.error("AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错啦:", ex);
} }
} }
public override void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff, int mSeconds) public override void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff, int mSeconds)
...@@ -353,11 +353,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -353,11 +353,11 @@ namespace OnlineStore.DeviceLibrary
try try
{ {
aioBox.WriteDO(StartAddress, aioBox.ReverseStatus(currBox_Sta)); aioBox.WriteDO(StartAddress, aioBox.ReverseStatus(currBox_Sta));
LogUtil.debug(LOGGER, "**********定时回写入 IO [" + ioIp + "] [" + StartAddress + "]值" + aioBox.ReverseStatus(currBox_Sta) + "】:"); LogUtil.debug( "**********定时回写入 IO [" + ioIp + "] [" + StartAddress + "]值" + aioBox.ReverseStatus(currBox_Sta) + "】:");
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "**********定时回写入 出错:", ex); LogUtil.error( "**********定时回写入 出错:", ex);
} }
}; };
mytimer.AutoReset = false;//设置是否自动重启,即自动执行多次; mytimer.AutoReset = false;//设置是否自动重启,即自动执行多次;
...@@ -366,7 +366,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -366,7 +366,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(LOGGER, "AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错 没有连接IO模块:" + ioIp); LogUtil.error( "AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错 没有连接IO模块:" + ioIp);
} }
} }
catch (Exception ex) catch (Exception ex)
...@@ -494,7 +494,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -494,7 +494,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, " GetIOValue [" + configIO.IO_IP + "] [" + configIO.GetIOAddr() + "] 获取数据出错:", ex); LogUtil.error( " GetIOValue [" + configIO.IO_IP + "] [" + configIO.GetIOAddr() + "] 获取数据出错:", ex);
} }
return value; return value;
} }
......
...@@ -22,7 +22,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -22,7 +22,7 @@ namespace OnlineStore.DeviceLibrary
//public static ushort DefaultDILength = 16; //public static ushort DefaultDILength = 16;
//public static ushort DefaultDOLength = 16; //public static ushort DefaultDOLength = 16;
private static byte DefualtSlaveID = 255; private static byte DefualtSlaveID = 255;
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static Dictionary<string, MasterTcpClient> mastMap = new Dictionary<string, MasterTcpClient>(); public static Dictionary<string, MasterTcpClient> mastMap = new Dictionary<string, MasterTcpClient>();
public static Dictionary<string, List<KNDIO>> DIValueMap = new Dictionary<string, List<KNDIO>>(); public static Dictionary<string, List<KNDIO>> DIValueMap = new Dictionary<string, List<KNDIO>>();
public static Dictionary<string, List<KNDIO>> DOValueMap = new Dictionary<string, List<KNDIO>>(); public static Dictionary<string, List<KNDIO>> DOValueMap = new Dictionary<string, List<KNDIO>>();
...@@ -87,7 +87,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -87,7 +87,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception error) catch (Exception error)
{ {
LogUtil.error(LOGGER, "连接IO模块[" + ioIp + "]出错:" + error.ToString()); LogUtil.error( "连接IO模块[" + ioIp + "]出错:" + error.ToString());
} }
} }
public override void ReadAllDI(string ioIp, byte slaveId) public override void ReadAllDI(string ioIp, byte slaveId)
...@@ -122,7 +122,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -122,7 +122,7 @@ namespace OnlineStore.DeviceLibrary
// } // }
// catch (Exception ex) // catch (Exception ex)
// { // {
// LogUtil.error(LOGGER, "出错啦:",ex); // LogUtil.error( "出错啦:",ex);
// } // }
// return false; // return false;
//} //}
...@@ -144,14 +144,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -144,14 +144,14 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
ConnectionIP(io); ConnectionIP(io);
LogUtil.error(LOGGER, io + "当前没有连上,重连" + io); LogUtil.error( io + "当前没有连上,重连" + io);
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "出错啦:",ex); LogUtil.error( "出错啦:",ex);
} }
Thread.Sleep(1); Thread.Sleep(1);
} }
...@@ -175,7 +175,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -175,7 +175,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(LOGGER, "ReadMultipleDI出错 没有连接IO模块:" + ioIp); LogUtil.error( "ReadMultipleDI出错 没有连接IO模块:" + ioIp);
} }
} }
public static void ReadMultipleDO(string ioIp, byte slaveId, ushort StartAddress, ushort length) public static void ReadMultipleDO(string ioIp, byte slaveId, ushort StartAddress, ushort length)
...@@ -189,7 +189,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -189,7 +189,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(LOGGER, "ReadMultipleDO出错 没有连接IO模块:" + ioIp); LogUtil.error( "ReadMultipleDO出错 没有连接IO模块:" + ioIp);
} }
} }
//关闭所有的DO //关闭所有的DO
...@@ -235,7 +235,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -235,7 +235,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(LOGGER, "WriteMultipleDO 出错 没有连接IO模块:" + ioIp); LogUtil.error( "WriteMultipleDO 出错 没有连接IO模块:" + ioIp);
} }
} }
public override void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff) public override void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff)
...@@ -252,7 +252,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -252,7 +252,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(LOGGER, "WriteSingleDO 出错没有连接IO模块:" + ioIp); LogUtil.error( "WriteSingleDO 出错没有连接IO模块:" + ioIp);
} }
} }
...@@ -282,11 +282,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -282,11 +282,11 @@ namespace OnlineStore.DeviceLibrary
MBmaster.WriteSingleCoils(ID, StartAddress, newValue, slaveId); MBmaster.WriteSingleCoils(ID, StartAddress, newValue, slaveId);
KNDIO newIo = new KNDIO(ioIp, slaveId, StartAddress, newValue); KNDIO newIo = new KNDIO(ioIp, slaveId, StartAddress, newValue);
SaveDOValue(newIo, ioIp); SaveDOValue(newIo, ioIp);
LogUtil.info(LOGGER, "**********定时回写入 IO【" + ioIp + "," + StartAddress + ",值" + onOff + "】:"); LogUtil.info( "**********定时回写入 IO【" + ioIp + "," + StartAddress + ",值" + onOff + "】:");
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "**********定时回写入 出错:" ,ex); LogUtil.error( "**********定时回写入 出错:" ,ex);
} }
}; };
mytimer.AutoReset = false;//设置是否自动重启,即自动执行多次; mytimer.AutoReset = false;//设置是否自动重启,即自动执行多次;
...@@ -294,7 +294,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -294,7 +294,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(LOGGER, "WriteSingleDO出错 没有连接IO模块:" + ioIp); LogUtil.error( "WriteSingleDO出错 没有连接IO模块:" + ioIp);
} }
} }
...@@ -327,7 +327,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -327,7 +327,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "SaveDOValue出错:",ex); LogUtil.error( "SaveDOValue出错:",ex);
} }
} }
public override IO_VALUE GetDOValue(string ioIP, byte slaveId, ushort StartAddress) public override IO_VALUE GetDOValue(string ioIP, byte slaveId, ushort StartAddress)
...@@ -393,7 +393,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -393,7 +393,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "获取数据出错:",ex); LogUtil.error( "获取数据出错:",ex);
} }
return value; return value;
} }
...@@ -413,7 +413,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -413,7 +413,7 @@ namespace OnlineStore.DeviceLibrary
{ {
finalData = Convert.ToString(values[0], 2).PadLeft(DILength, '0'); finalData = Convert.ToString(values[0], 2).PadLeft(DILength, '0');
} }
LOGGER.Debug("IO模块【" + ioIp + "】收到DI上传:【" + finalData + "】"); LogUtil.debug ("IO模块【" + ioIp + "】收到DI上传:【" + finalData + "】");
if (finalData.Length >= DILength) if (finalData.Length >= DILength)
{ {
List<KNDIO> kndList = new List<KNDIO>(); List<KNDIO> kndList = new List<KNDIO>();
...@@ -444,7 +444,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -444,7 +444,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "SaveDIData出错:",ex); LogUtil.error( "SaveDIData出错:",ex);
//LOGGER.Error("处理接受数据出错:", ex); //LOGGER.Error("处理接受数据出错:", ex);
} }
} }
...@@ -532,7 +532,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -532,7 +532,7 @@ namespace OnlineStore.DeviceLibrary
switch (Func) switch (Func)
{ {
case 1: case 1:
LOGGER.Info("Read coils end:【" + reviceMsg + "】 "); LogUtil.info("Read coils end:【" + reviceMsg + "】 ");
SaveDOData(ioIp, SlaveId, values); SaveDOData(ioIp, SlaveId, values);
break; break;
case 2: case 2:
...@@ -553,7 +553,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -553,7 +553,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "处理接受数据出错:",ex); LogUtil.error( "处理接受数据出错:",ex);
//LOGGER.Error("处理接受数据出错:", ex); //LOGGER.Error("处理接受数据出错:", ex);
} }
} }
...@@ -580,7 +580,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -580,7 +580,7 @@ namespace OnlineStore.DeviceLibrary
default: default:
break; break;
} }
LOGGER.Error("接收数据出错:" +exc ); LogUtil.error("接收数据出错:" +exc );
//MessageBox.Show(exc, "Modbus slave exception"); //MessageBox.Show(exc, "Modbus slave exception");
} }
...@@ -605,7 +605,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -605,7 +605,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "出错啦:",ex); LogUtil.error( "出错啦:",ex);
} }
return false; return false;
} }
......
...@@ -16,7 +16,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -16,7 +16,7 @@ namespace OnlineStore.DeviceLibrary
public class MasterTcpClient public class MasterTcpClient
{ {
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Constants for access // Constants for access
private const byte fctReadCoil = 1; private const byte fctReadCoil = 1;
...@@ -137,7 +137,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -137,7 +137,7 @@ namespace OnlineStore.DeviceLibrary
connResult.AsyncWaitHandle.WaitOne(this.TimeOutTime, true); //等待2秒 connResult.AsyncWaitHandle.WaitOne(this.TimeOutTime, true); //等待2秒
if (!connResult.IsCompleted) if (!connResult.IsCompleted)
{ {
LogUtil.info(LOGGER, "Connect to " + ip + ":" + port + " fail!"); LogUtil.info( "Connect to " + ip + ":" + port + " fail!");
return; return;
} }
else else
...@@ -155,7 +155,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -155,7 +155,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (System.IO.IOException error) catch (System.IO.IOException error)
{ {
LogUtil.info(LOGGER, "Connect to " + ip + ":" + port + " fail!"); LogUtil.info( "Connect to " + ip + ":" + port + " fail!");
_connected = false; _connected = false;
throw (error); throw (error);
} }
...@@ -171,7 +171,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -171,7 +171,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("IO模块[" + IP + "]出错:",ex); LogUtil.error("IO模块[" + IP + "]出错:",ex);
} }
} }
...@@ -238,7 +238,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -238,7 +238,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.debug(LOGGER, clientipe.ToString() + "收到数据(无需分包):" + str); LogUtil.debug( clientipe.ToString() + "收到数据(无需分包):" + str);
ushort id = BitConverter.ToUInt16(rdata, 0); ushort id = BitConverter.ToUInt16(rdata, 0);
byte function = rdata[7]; byte function = rdata[7];
DataProcess(clientipe.ToString(), id, function, rdata); DataProcess(clientipe.ToString(), id, function, rdata);
...@@ -295,7 +295,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -295,7 +295,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (SocketException e) catch (SocketException e)
{ {
LogUtil.error(LOGGER, "IO模块[" + IP + "]接收数据出现错误:" + e.ToString()); LogUtil.error( "IO模块[" + IP + "]接收数据出现错误:" + e.ToString());
if (socketClient != null) if (socketClient != null)
{ {
socketClient.Close(); socketClient.Close();
...@@ -335,7 +335,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -335,7 +335,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "IO模块[" + IP + "]dispose出错:",ex); LogUtil.error( "IO模块[" + IP + "]dispose出错:",ex);
} }
socketClient.Close(); socketClient.Close();
} }
...@@ -515,7 +515,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -515,7 +515,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (socketClient == null) if (socketClient == null)
{ {
LOGGER.Error("发送数据时发现socketClient=null"); LogUtil.error("发送数据时发现socketClient=null");
return; return;
} }
IPEndPoint clientipe = (IPEndPoint)socketClient.RemoteEndPoint; IPEndPoint clientipe = (IPEndPoint)socketClient.RemoteEndPoint;
...@@ -537,7 +537,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -537,7 +537,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (SystemException error) catch (SystemException error)
{ {
LogUtil.error(LOGGER, "IO模块 WriteAsyncData出错:" + error.ToString()); LogUtil.error( "IO模块 WriteAsyncData出错:" + error.ToString());
CallException(id, write_data[7], excExceptionConnectionLost, tcpSocketReviceBuffer); CallException(id, write_data[7], excExceptionConnectionLost, tcpSocketReviceBuffer);
} }
} }
......
...@@ -123,8 +123,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -123,8 +123,8 @@ namespace OnlineStore.DeviceLibrary
bool findRightCode = false; bool findRightCode = false;
try try
{ {
bool result = Camera._cam.CaptureOnImage(cameraName, out ho_Image); ho_Image = Camera._cam.CaptureOnImage(cameraName );
if (!result || ho_Image == null) if ( ho_Image == null)
{ {
LogUtil.error(deviceName + " 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机"); LogUtil.error(deviceName + " 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName); CloseCamera(cameraName);
......
...@@ -11,7 +11,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -11,7 +11,7 @@ namespace OnlineStore.DeviceLibrary
{ {
public class LineServer public class LineServer
{ {
private static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //private static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static TcpServer tcpserver = null; private static TcpServer tcpserver = null;
public static bool IsStart = false; public static bool IsStart = false;
...@@ -209,7 +209,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -209,7 +209,7 @@ namespace OnlineStore.DeviceLibrary
} }
IsStart = true; IsStart = true;
tcpserver.Start(port); tcpserver.Start(port);
LogUtil.info(LOGGER, "流水线服务器在端口[" + port + "]监听!"); LogUtil.info( "流水线服务器在端口[" + port + "]监听!");
tcpserver.ReviceMsgEvent += tcp_ReviceMsgEvent; tcpserver.ReviceMsgEvent += tcp_ReviceMsgEvent;
} }
...@@ -227,7 +227,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -227,7 +227,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "关闭 监听出错:",ex); LogUtil.error( "关闭 监听出错:",ex);
} }
} }
public static bool UpdateBoxDebug(int id, int isDebug) public static bool UpdateBoxDebug(int id, int isDebug)
......
using log4net; using log4net;
using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
...@@ -12,7 +13,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -12,7 +13,7 @@ namespace OnlineStore.LoadCSVLibrary
public class CSVReaderBase public class CSVReaderBase
{ {
public static char Spilt_Char = ','; public static char Spilt_Char = ',';
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// 获取一个类所有的《字段,AttributeName列名》集合 /// 获取一个类所有的《字段,AttributeName列名》集合
/// </summary> /// </summary>
...@@ -104,7 +105,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -104,7 +105,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.Error("出错:", e); LogUtil.error("出错:", e);
} }
if (File.Exists(filePath)) if (File.Exists(filePath))
...@@ -117,7 +118,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -117,7 +118,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error(ex.ToString()); LogUtil.error(ex.ToString());
return false; return false;
} }
return true; return true;
...@@ -137,7 +138,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -137,7 +138,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
}catch(Exception ex) }catch(Exception ex)
{ {
LOGGER.Error("出错:", ex); LogUtil.error("出错:", ex);
} }
return titleIndex; return titleIndex;
} }
...@@ -160,7 +161,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -160,7 +161,7 @@ namespace OnlineStore.LoadCSVLibrary
{ {
if (!titleIndex.ContainsKey(str)) if (!titleIndex.ContainsKey(str))
{ {
LOGGER.Error("未找到必须列:" + str + ",加载数据失败!"); LogUtil.error("未找到必须列:" + str + ",加载数据失败!");
throw new CVSFieldNotMatchingExection("未找到必须列:" + str + ",加载数据失败!"); throw new CVSFieldNotMatchingExection("未找到必须列:" + str + ",加载数据失败!");
} }
} }
......
using System; using OnlineStore.Common;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
...@@ -45,7 +46,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -45,7 +46,7 @@ namespace OnlineStore.LoadCSVLibrary
//必须有列【类型】 //必须有列【类型】
if (allTitleIndex.Count < 0 || !allTitleIndex.ContainsKey("类型")) if (allTitleIndex.Count < 0 || !allTitleIndex.ContainsKey("类型"))
{ {
LOGGER.Error("未找到必须列:类型,加载数据失败!"); LogUtil.error("未找到必须列:类型,加载数据失败!");
throw new CVSFieldNotMatchingExection("未找到必须列:类型,加载数据失败!"); throw new CVSFieldNotMatchingExection("未找到必须列:类型,加载数据失败!");
} }
typeIndex = allTitleIndex["类型"]; typeIndex = allTitleIndex["类型"];
...@@ -117,14 +118,14 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -117,14 +118,14 @@ namespace OnlineStore.LoadCSVLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("filepath=" + filePath + ",index=" + index + ",key=" + key + "出错:" + ex.ToString()); LogUtil.error("filepath=" + filePath + ",index=" + index + ",key=" + key + "出错:" + ex.ToString());
} }
listIndex++; listIndex++;
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("filepath=" + filePath + ",index=" + index + ",key=" + key + "出错:" + ex.ToString()); LogUtil.error("filepath=" + filePath + ",index=" + index + ",key=" + key + "出错:" + ex.ToString());
} }
} }
bllIns.CheckField(); bllIns.CheckField();
...@@ -162,7 +163,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -162,7 +163,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
public static DeviceConfig LoadConfig(DeviceConfig config) public static DeviceConfig LoadConfig(DeviceConfig config)
{ {
LOGGER.Debug("开始读取文件:" + config.ConfigFilePath); LogUtil.info("开始读取文件:" + config.ConfigFilePath);
if (config == null || config.ConfigFilePath.Equals("")) if (config == null || config.ConfigFilePath.Equals(""))
{ {
return null; return null;
...@@ -225,7 +226,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -225,7 +226,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.Error("出错:" + e.ToString()); LogUtil.error("出错:" + e.ToString());
} }
string newLine = ""; string newLine = "";
......
using log4net; using log4net;
using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -12,7 +13,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -12,7 +13,7 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
public class ConfigBase public class ConfigBase
{ {
protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// DI=输入IO,DO=输出IO,PRO=属性,AXIS=轴 /// DI=输入IO,DO=输出IO,PRO=属性,AXIS=轴
/// </summary> /// </summary>
...@@ -254,7 +255,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -254,7 +255,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("出错:", ex); LogUtil.error("出错:", ex);
} }
return value; return value;
} }
......
using log4net; using log4net;
using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -11,7 +12,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -11,7 +12,7 @@ namespace OnlineStore.LoadCSVLibrary
{ {
public static Dictionary<int, Dictionary<string, ConfigIO>> SubDIList { get; set; } public static Dictionary<int, Dictionary<string, ConfigIO>> SubDIList { get; set; }
public static Dictionary<int, Dictionary<string, ConfigIO>> SubDOList { get; set; } public static Dictionary<int, Dictionary<string, ConfigIO>> SubDOList { get; set; }
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static Dictionary<string, string> ProIOIpMap = null; public static Dictionary<string, string> ProIOIpMap = null;
public static Dictionary<string, string> ProRFIpMap = null; public static Dictionary<string, string> ProRFIpMap = null;
public const string IOIP_Str = "PRO_AOI_IP"; public const string IOIP_Str = "PRO_AOI_IP";
...@@ -120,7 +121,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -120,7 +121,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
else else
{ {
LOGGER.Error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!"); LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
} }
} }
else if (!ProIOIpMap.ContainsKey(con.ProName) && con.ProName.ToUpper().Contains(IOIP_Str.ToUpper())) else if (!ProIOIpMap.ContainsKey(con.ProName) && con.ProName.ToUpper().Contains(IOIP_Str.ToUpper()))
...@@ -133,7 +134,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -133,7 +134,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
else else
{ {
LOGGER.Error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!"); LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
} }
} }
...@@ -151,7 +152,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -151,7 +152,7 @@ namespace OnlineStore.LoadCSVLibrary
string newType = io.ProName.Replace("SW1_", "SW_").Replace("SW2_", "SW_").Replace("SW3_", "SW_").Replace("SW4_", "SW_"); string newType = io.ProName.Replace("SW1_", "SW_").Replace("SW2_", "SW_").Replace("SW3_", "SW_").Replace("SW4_", "SW_");
if (DIList.ContainsKey(newType)) if (DIList.ContainsKey(newType))
{ {
LOGGER.Error("配置DI:[" + io.ToString() + "] ProName重复 "); LogUtil.error("配置DI:[" + io.ToString() + "] ProName重复 ");
} }
else else
{ {
...@@ -164,7 +165,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -164,7 +165,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
if (SubDIList[io.SubType].ContainsKey(io.ProName)) if (SubDIList[io.SubType].ContainsKey(io.ProName))
{ {
LOGGER.Error("配置DI:[" + io.ToString() + "] ProName重复 "); LogUtil.error("配置DI:[" + io.ToString() + "] ProName重复 ");
} }
else else
{ {
...@@ -175,7 +176,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -175,7 +176,7 @@ namespace OnlineStore.LoadCSVLibrary
{ {
if (DIList.ContainsKey(io.ProName)) if (DIList.ContainsKey(io.ProName))
{ {
LOGGER.Error("配置DI:[" + io.ToString() + "] ProName重复 "); LogUtil.error("配置DI:[" + io.ToString() + "] ProName重复 ");
} }
else else
{ {
...@@ -198,7 +199,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -198,7 +199,7 @@ namespace OnlineStore.LoadCSVLibrary
string newType = io.ProName.Replace("SW1_", "SW_").Replace("SW2_", "SW_").Replace("SW3_", "SW_").Replace("SW4_", "SW_"); string newType = io.ProName.Replace("SW1_", "SW_").Replace("SW2_", "SW_").Replace("SW3_", "SW_").Replace("SW4_", "SW_");
if (DOList.ContainsKey(newType)) if (DOList.ContainsKey(newType))
{ {
LOGGER.Error("配置DO:[" + io.ToString() + "] ProName重复 "); LogUtil.error("配置DO:[" + io.ToString() + "] ProName重复 ");
} }
else else
{ {
...@@ -211,7 +212,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -211,7 +212,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
if (SubDOList[io.SubType].ContainsKey(io.ProName)) if (SubDOList[io.SubType].ContainsKey(io.ProName))
{ {
LOGGER.Error("配置DO:[" + io.ToString() + "] ProName重复 "); LogUtil.error("配置DO:[" + io.ToString() + "] ProName重复 ");
} }
else else
{ {
...@@ -222,7 +223,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -222,7 +223,7 @@ namespace OnlineStore.LoadCSVLibrary
{ {
if (DOList.ContainsKey(io.ProName)) if (DOList.ContainsKey(io.ProName))
{ {
LOGGER.Error("配置DO:[" + io.ToString() + "] ProName重复 "); LogUtil.error("配置DO:[" + io.ToString() + "] ProName重复 ");
} }
else else
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!