Commit ad54abf3 LN

出入库逻辑

1 个父辈 59dbda57
...@@ -12,7 +12,7 @@ namespace OnlineStore.Common ...@@ -12,7 +12,7 @@ namespace OnlineStore.Common
public class AcSerialBean public class AcSerialBean
{ {
#region 全部变量 #region 全部变量
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 SerialPort _serialPort = null; private SerialPort _serialPort = null;
private object lockObj = new object(); private object lockObj = new object();
...@@ -177,7 +177,7 @@ namespace OnlineStore.Common ...@@ -177,7 +177,7 @@ namespace OnlineStore.Common
} }
catch (Exception Ex) catch (Exception Ex)
{ {
LogUtil.error(LOGGER, Ex.ToString()); LogUtil.error( Ex.ToString());
//throw Ex; //throw Ex;
} }
return ok; return ok;
...@@ -268,7 +268,7 @@ namespace OnlineStore.Common ...@@ -268,7 +268,7 @@ namespace OnlineStore.Common
// catch (Exception ex) // catch (Exception ex)
// { // {
// _serialPort.DiscardOutBuffer(); // _serialPort.DiscardOutBuffer();
// LogUtil.error(LOGGER, "SendData ERROR:" + ex.ToString(), 21); // LogUtil.error( "SendData ERROR:" + ex.ToString(), 21);
// } // }
// } // }
...@@ -323,7 +323,7 @@ namespace OnlineStore.Common ...@@ -323,7 +323,7 @@ namespace OnlineStore.Common
catch (Exception ex) catch (Exception ex)
{ {
isOk = false; isOk = false;
LogUtil.error(LOGGER, "SendCommand ERROR:" + ex.ToString(), 20); LogUtil.error( "SendCommand ERROR:" + ex.ToString(), 20);
} }
finally finally
{ {
......
...@@ -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.StackTrace); LogUtil.error( "SaveValue保存配置出错:AppKey=" + key + ",AppValue=" + value + "," + ex.StackTrace);
} }
} }
...@@ -167,7 +167,7 @@ namespace OnlineStore.Common ...@@ -167,7 +167,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + "," + ex.StackTrace); LogUtil.error( "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + "," + ex.StackTrace);
} }
} }
///<summary> ///<summary>
...@@ -199,7 +199,7 @@ namespace OnlineStore.Common ...@@ -199,7 +199,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + "," + ex.StackTrace); LogUtil.error( "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + "," + ex.StackTrace);
} }
} }
} }
......
...@@ -17,7 +17,7 @@ namespace OnlineStore.Common ...@@ -17,7 +17,7 @@ namespace OnlineStore.Common
{ {
public class HttpHelper public class HttpHelper
{ {
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static string Post(string url, string paramData) public static string Post(string url, string paramData)
{ {
return Post(url, paramData, Encoding.UTF8); return Post(url, paramData, Encoding.UTF8);
...@@ -45,7 +45,7 @@ namespace OnlineStore.Common ...@@ -45,7 +45,7 @@ namespace OnlineStore.Common
{//入库或出库 {//入库或出库
string json = JsonHelper.SerializeObject(operation); string json = JsonHelper.SerializeObject(operation);
LogUtil.error(LOGGER, "模拟HTTP服务器返回出库入库信息:" + json); LogUtil.error( "模拟HTTP服务器返回出库入库信息:" + json);
return operation; return operation;
} }
} }
...@@ -58,7 +58,7 @@ namespace OnlineStore.Common ...@@ -58,7 +58,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("JsonHelper.SerializeObject(operation) 出错【operation.op=" + operation.op + "】" + ex); LogUtil.error("JsonHelper.SerializeObject(operation) 出错【operation.op=" + operation.op + "】" + ex);
} }
string result = Post(url, json); string result = Post(url, json);
if (!string.IsNullOrEmpty(result)) if (!string.IsNullOrEmpty(result))
...@@ -69,14 +69,14 @@ namespace OnlineStore.Common ...@@ -69,14 +69,14 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex); LogUtil.error("JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex);
} }
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("Post 出错【operation.op=" + operation.op + "】:" + ex); LogUtil.error("Post 出错【operation.op=" + operation.op + "】:" + ex);
} }
return null; return null;
} }
...@@ -85,7 +85,7 @@ namespace OnlineStore.Common ...@@ -85,7 +85,7 @@ namespace OnlineStore.Common
{ {
if (isLog == 1) if (isLog == 1)
{ {
LOGGER.Info("给服务器发送数据【" + paramData + "】 "); LogUtil.info("给服务器发送数据【" + paramData + "】 ");
} }
if (paramData != "null" && paramData != null) if (paramData != "null" && paramData != null)
{ {
...@@ -111,7 +111,7 @@ namespace OnlineStore.Common ...@@ -111,7 +111,7 @@ namespace OnlineStore.Common
} }
catch (Exception e) catch (Exception e)
{ {
LogUtil.error(LOGGER, "POST ERROR:" + e.StackTrace, 1); LogUtil.error( "POST ERROR:" + e.StackTrace, 1);
} }
if (!result.Contains("null") && result.Length != 0) if (!result.Contains("null") && result.Length != 0)
{ {
...@@ -119,7 +119,7 @@ namespace OnlineStore.Common ...@@ -119,7 +119,7 @@ namespace OnlineStore.Common
} }
if (isLog == 1) if (isLog == 1)
{ {
LOGGER.Info("收到服务器数据【" + result + "】"); LogUtil.info("收到服务器数据【" + result + "】");
} }
return result; return result;
} }
...@@ -133,19 +133,19 @@ namespace OnlineStore.Common ...@@ -133,19 +133,19 @@ namespace OnlineStore.Common
{ {
try try
{ {
LogUtil.info(LOGGER, "HTTP GET FROM: " + url); LogUtil.info( "HTTP GET FROM: " + url);
var wc = new WebClient { Encoding = encoding }; 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(LOGGER, "receive << " + result); LogUtil.info( "receive << " + result);
return result; return result;
} }
} }
catch (Exception e) catch (Exception e)
{ {
LogUtil.error(LOGGER, "HTTP GET ERROR:" + e.Message, 2); LogUtil.error( "HTTP GET ERROR:" + e.Message, 2);
} }
return ""; return "";
} }
......
...@@ -5,118 +5,97 @@ using System.Text; ...@@ -5,118 +5,97 @@ using System.Text;
using log4net; using log4net;
using System.Reflection; using System.Reflection;
using System.Drawing; using System.Drawing;
using System.Runtime.ExceptionServices;
using System.Collections.Concurrent;
namespace OnlineStore.Common namespace OnlineStore.Common
{ {
public class LogUtil public class LogUtil
{ {
public static readonly ILog AIOLog = LogManager.GetLogger("AIOBOX");
private static LogUtil instance = new LogUtil(); private static LogUtil instance = new LogUtil();
public delegate void ShowLog(string msg, Color color); public delegate void ShowLog(string msg, Color color);
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static readonly ILog LOGGER = LogManager.GetLogger("RollingLogFileAppender");
public static ConcurrentDictionary<int, DateTime> lastErrorLogTime = new ConcurrentDictionary<int, DateTime>();
public static Dictionary<int, DateTime> lastErrorLogTime = new Dictionary<int, DateTime>();
public static System.Windows.Forms.RichTextBox logBox = null; public static System.Windows.Forms.RichTextBox logBox = null;
public static int showCount = 20; public static int showCount = 15;
public static bool debug_opened = false; public static bool debug_opened = false;
public static void info(ILog log,string msg ) public static void info(ILog log, string msg)
{ {
if (log == null) if (log == null)
{ {
return; return;
} }
log.Info(msg);
log.Info(log.Logger.Name + " - " + msg);
if (logBox == null)
{
return;
}
AddToBox(msg, Color.Black); AddToBox(msg, Color.Black);
//clear(); //clear();
} }
public static void info(ILog log,string msg, Color color) public static void info(ILog log, string msg, Color color)
{
log.Info(log.Logger.Name + " - " + msg);
if (logBox == null)
{ {
return; log.Info(msg);
}
AddToBox(msg, color); AddToBox(msg, color);
} }
public static void debug(ILog log, string msg, Color color) public static void debug(ILog log, string msg, Color color)
{ {
log.Debug(log.Logger.Name + " - " + msg); log.Debug(msg);
if (debug_opened) if (debug_opened)
{ {
if (logBox == null)
{
return;
}
AddToBox(msg, color); AddToBox(msg, color);
} }
} }
public static void debug(ILog log, string msg) public static void debug(ILog log, string msg)
{ {
log.Debug(log.Logger.Name + " - " + msg); log.Debug(msg);
if (debug_opened) if (debug_opened)
{ {
if (logBox == null)
{
return;
}
AddToBox(msg, Color.Gray); AddToBox(msg, Color.Gray);
} }
} }
private static List<string> lasErrorLogList = new List<string>(); public static void error(string errorMsg, int type, int seconds = 10)
private static int errCount = 5;
public static void error(string errorMsg, int type)
{ {
error(LOGGER, errorMsg, type); try
}
public static void error(ILog log, string errorMsg,int type)
{ {
if (lastErrorLogTime.ContainsKey(type)) if (lastErrorLogTime.ContainsKey(type))
{ {
TimeSpan span = DateTime.Now - lastErrorLogTime[type]; TimeSpan span = DateTime.Now - lastErrorLogTime[type];
if (span.TotalSeconds < 10) if (span.TotalSeconds > seconds)
{ {
return; lastErrorLogTime[type] = DateTime.Now;
error(LOGGER, errorMsg);
}
} }
else else
{ {
lastErrorLogTime.Remove(type); lastErrorLogTime.TryAdd(type, DateTime.Now);
lastErrorLogTime.Add(type, DateTime.Now); error(LOGGER, errorMsg);
error(log, errorMsg);
} }
} }
else catch (Exception ex)
{ {
lastErrorLogTime.Add(type, DateTime.Now); LogUtil.error(" 打印日志【" + type + "-" + errorMsg + "】出错:" + ex.ToString());
error(log, errorMsg);
} }
} }
public static void error(ILog log, string errorMsg) public static void error(ILog log, string errorMsg, Exception ex = null)
{ {
//if (!lasErrorLogList.Contains(errorMsg)) if (errorMsg.Trim().Equals("") && (ex == null))
{
log.Error(log.Logger.Name + " - " + errorMsg);
if (logBox == null)
{ {
return; return;
} }
AddToBox(errorMsg, Color.Red); if (ex == null)
{
log.Error(errorMsg);
} }
//lasErrorLogList.Add(errorMsg); else
//if (lasErrorLogList.Count > errCount) {
//{ log.Error(errorMsg, ex);
// lasErrorLogList.RemoveAt(0); }
//} AddToBox(errorMsg, Color.Red);
} }
private static void AddToBox(string msg, Color color) private static void AddToBox(string msg, Color color)
{ {
...@@ -126,52 +105,98 @@ namespace OnlineStore.Common ...@@ -126,52 +105,98 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("出错:" + ex.StackTrace); LogUtil.error("出错:", ex);
} }
} }
private static int count = 0; private static List<string> logList = new List<string>();
public static string LastText = "";
[HandleProcessCorruptedStateExceptions]
private static void ShowLogPro(string msg, Color color) private static void ShowLogPro(string msg, Color color)
{ {
try try
{ {
//clear(); if (logList.Count > 0)
if (count > showCount) {
// logList.RemoveAt(0);
}
if (logList.Count >= showCount)
{
logList.RemoveAt(0);
}
string text = "";
foreach (string str in logList)
{ {
count = 0; text += str;
logBox.Clear();
} }
//logBox.SelectionColor = color;
System.DateTime now = System.DateTime.Now; System.DateTime now = System.DateTime.Now;
logBox.AppendText(now.ToLongTimeString() + " " + msg + Environment.NewLine); logList.Add(now.ToLongTimeString() + " " + msg + Environment.NewLine);
count++; if (logBox == null)
{
return;
} }
catch (Exception ex) LastText = text;
if (logBox.Visible)
{
logBox.Text = text;
// logBox.Focus(); //使文本框获取焦点
logBox.AppendText(now.ToLongTimeString() + " " + msg + Environment.NewLine); //增加文本
TimeSpan span = DateTime.Now - lastTime;
if (span.TotalSeconds > 3000000)
{ {
LOGGER.Error("出错:" + ex.ToString()); lastTime = DateTime.Now;
logBox.Select(logBox.Text.Length, 0); //设置光标的位置到文本尾
logBox.ScrollToCaret(); //滚动到控件光标处
} }
} }
public static void debug(string msg) }
catch (AccessViolationException e)
{ {
debug(LOGGER, msg); LogUtil.error(" ShowLogPro 出错:" + e.ToString());
} }
public static void error(string errorMsg) catch (Exception ex)
{ {
error( LOGGER,errorMsg); LogUtil.error("出错:" + ex.ToString());
}
} }
private static DateTime lastTime = DateTime.Now;
public static void UpdateLogbox()
{
if (logBox != null && logBox.Visible)
{
logBox.Text = LastText;
TimeSpan span = DateTime.Now - lastTime;
if (span.TotalSeconds > 3000000)
{
lastTime = DateTime.Now;
logBox.Select(logBox.Text.Length, 0); //设置光标的位置到文本尾
logBox.ScrollToCaret(); //滚动到控件光标处
}
}
}
public static void ClearLog() public static void ClearLog()
{ {
if (logBox != null) if (logBox != null)
{ {
LastText = "";
logList.Clear();
logBox.Text = ""; logBox.Text = "";
count = 0;
} }
} }
public static void debug(string msg)
{
debug(LOGGER, msg);
}
public static void error(string errorMsg, Exception ex = null)
{
error(LOGGER, errorMsg, ex);
}
public static void info(string msg) public static void info(string msg)
{ {
info(LOGGER,msg ); info(LOGGER, msg);
} }
} }
......
...@@ -13,7 +13,7 @@ namespace OnlineStore.Common ...@@ -13,7 +13,7 @@ namespace OnlineStore.Common
/// </summary> /// </summary>
public class ScanCodeManager public class ScanCodeManager
{ {
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// 处理接收后的二维码 /// 处理接收后的二维码
/// </summary> /// </summary>
...@@ -50,7 +50,7 @@ namespace OnlineStore.Common ...@@ -50,7 +50,7 @@ namespace OnlineStore.Common
// } // }
// catch (Exception ex) // catch (Exception ex)
// { // {
// LOGGER.Error(ex); // LogUtil.error(ex);
// } // }
//} //}
return message; return message;
......
...@@ -12,7 +12,7 @@ namespace OnlineStore.Common ...@@ -12,7 +12,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; private Socket m_clientSocket;
...@@ -91,17 +91,17 @@ namespace OnlineStore.Common ...@@ -91,17 +91,17 @@ 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)
{ {
LogUtil.error(LOGGER,"Connect to " + serverIP + ":" + serverPort + " fail!" + ex.ToString(),3); LogUtil.error("Connect to " + serverIP + ":" + serverPort + " fail!" + ex.ToString(),3);
m_clientSocket = null; m_clientSocket = null;
} }
return false; return false;
...@@ -115,11 +115,11 @@ namespace OnlineStore.Common ...@@ -115,11 +115,11 @@ namespace OnlineStore.Common
if (m_clientSocket != null) if (m_clientSocket != null)
{ {
m_clientSocket.Close(); m_clientSocket.Close();
LogUtil.info(LOGGER,"Socket closed!"); LogUtil.info("Socket closed!");
} }
else else
{ {
LogUtil.error(LOGGER,"No socket is running!"); LogUtil.error("No socket is running!");
} }
} }
...@@ -135,7 +135,7 @@ namespace OnlineStore.Common ...@@ -135,7 +135,7 @@ namespace OnlineStore.Common
{ {
m_clientSocket.Send(sendBuffer); m_clientSocket.Send(sendBuffer);
LogUtil.debug(LOGGER,"Send >> " + strSendData); LogUtil.debug("Send >> " + strSendData);
} }
} }
...@@ -153,7 +153,7 @@ namespace OnlineStore.Common ...@@ -153,7 +153,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER,"socket received error:" + ex.ToString(),4); LogUtil.error("socket received error:" + ex.ToString(),4);
} }
} }
} }
......
...@@ -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);
private Thread m_serverThread; private Thread m_serverThread;
private Socket m_serverSocket; private Socket m_serverSocket;
...@@ -39,7 +39,7 @@ namespace OnlineStore.Common ...@@ -39,7 +39,7 @@ namespace OnlineStore.Common
} }
} }
} }
LogUtil.info(LOGGER, iplist + "]"); LogUtil.info( iplist + "]");
} }
/// <summary> /// <summary>
...@@ -59,7 +59,7 @@ namespace OnlineStore.Common ...@@ -59,7 +59,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.");
...@@ -101,14 +101,14 @@ namespace OnlineStore.Common ...@@ -101,14 +101,14 @@ 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.ipAdd = clientipe.Address; client.ipAdd = clientipe.Address;
LogUtil.info(LOGGER, "有新的客户端链接上:" + client.ipAdd.ToString()); LogUtil.info( "有新的客户端链接上:" + client.ipAdd.ToString());
receiveMessageDelegate = new ReceiveMessageDelegate(ReceiveMessages); receiveMessageDelegate = new ReceiveMessageDelegate(ReceiveMessages);
receiveMessageDelegate.BeginInvoke(client, ReceiveMessagesCallback, ""); receiveMessageDelegate.BeginInvoke(client, ReceiveMessagesCallback, "");
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, ex.Message); LogUtil.error( ex.Message);
//throw new Exception(ex.Message); //throw new Exception(ex.Message);
} }
} }
...@@ -158,11 +158,11 @@ namespace OnlineStore.Common ...@@ -158,11 +158,11 @@ namespace OnlineStore.Common
} }
catch (SocketException e) catch (SocketException e)
{ {
LogUtil.error(LOGGER, e.ToString(), 6); LogUtil.error( e.ToString(), 6);
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, ex.ToString(), 5); LogUtil.error( ex.ToString(), 5);
} }
} }
//private void ReceiveMessages(Client client) //private void ReceiveMessages(Client client)
...@@ -180,10 +180,10 @@ namespace OnlineStore.Common ...@@ -180,10 +180,10 @@ namespace OnlineStore.Common
// if (!string.IsNullOrEmpty(strReceiveData)) // if (!string.IsNullOrEmpty(strReceiveData))
// { // {
// LogUtil.info(LOGGER, "收到数据:" + strReceiveData); // LogUtil.info( "收到数据:" + strReceiveData);
// // this.AddRunningInfo(">> Receive data from [" + client.ClientSocket.RemoteEndPoint.ToString()+ "]:" + strReceiveData); // // this.AddRunningInfo(">> Receive data from [" + client.ClientSocket.RemoteEndPoint.ToString()+ "]:" + strReceiveData);
// string strSendData = "OK. The content is:" + strReceiveData; // string strSendData = "OK. The content is:" + strReceiveData;
// //LogUtil.info(LOGGER, "OK. The content is:" + strReceiveData); // //LogUtil.info( "OK. The content is:" + strReceiveData);
// int sendBufferSize = Encoding.Unicode.GetByteCount(strSendData); // int sendBufferSize = Encoding.Unicode.GetByteCount(strSendData);
// byte[] sendBuffer = new byte[sendBufferSize]; // byte[] sendBuffer = new byte[sendBufferSize];
// sendBuffer = Encoding.Unicode.GetBytes(strSendData); // sendBuffer = Encoding.Unicode.GetBytes(strSendData);
...@@ -194,11 +194,11 @@ namespace OnlineStore.Common ...@@ -194,11 +194,11 @@ namespace OnlineStore.Common
// } // }
// catch (SocketException e) // catch (SocketException e)
// { // {
// LogUtil.error(LOGGER, e.ToString()); // LogUtil.error( e.ToString());
// } // }
// catch (Exception ex) // catch (Exception ex)
// { // {
// LOGGER.Error(ex.ToString()); // LogUtil.error(ex.ToString());
// } // }
//} //}
...@@ -210,7 +210,7 @@ namespace OnlineStore.Common ...@@ -210,7 +210,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 + "]");
} }
......
貫零,욋貫잚謹,膽邱섬,죕분욱똑,죕분멕똑,죕꾑ID,좋됐乞多,죕떱旗瘻菉貫零P2 位置,库位类型,优先级,料盒宽度,料盒高度,料仓ID,灯区域索引,亮灯索引,料斗旋转轴位置P2
P_1_1,1,1,210,300,1,1,10000 P_1_1,1,1,210,300,1,0,1,10000
P_1_2,1,2,210,300,1,2,10000 P_1_2,1,2,210,300,1,0,2,10000
P_1_3,1,3,210,300,1,3,10000 P_1_3,1,3,210,300,1,0,3,10000
P_1_4,1,4,210,300,1,4,10000 P_1_4,1,4,210,300,1,0,4,10000
P_1_5,1,5,210,300,1,5,10000 P_1_5,1,5,210,300,1,0,5,10000
P_1_6,1,6,210,300,1,6,10000 P_1_6,1,6,210,300,1,0,6,10000
P_1_7,1,7,210,300,1,7,10000 P_1_7,1,7,210,300,1,0,7,10000
P_1_8,1,8,210,300,1,8,10000 P_1_8,1,8,210,300,1,0,8,10000
P_1_9,1,9,210,300,1,9,10000 P_1_9,1,9,210,300,1,0,9,10000
P_1_10,1,10,210,300,1,10,10000 P_1_10,1,10,210,300,1,0,10,10000
P_2_1,1,11,210,300,1,11,50000 P_2_1,1,11,210,300,1,0,11,50000
P_2_2,1,12,210,300,1,12,50000 P_2_2,1,12,210,300,1,0,12,50000
P_2_3,1,13,210,300,1,13,50000 P_2_3,1,13,210,300,1,0,13,50000
P_2_4,1,14,210,300,1,14,50000 P_2_4,1,14,210,300,1,0,14,50000
P_2_5,1,15,210,300,1,15,50000 P_2_5,1,15,210,300,1,0,15,50000
P_2_6,1,16,210,300,1,16,50000 P_2_6,1,16,210,300,1,0,16,50000
P_2_7,1,17,210,300,1,17,50000 P_2_7,1,17,210,300,1,0,17,50000
P_2_8,1,18,210,300,1,18,50000 P_2_8,1,18,210,300,1,0,18,50000
P_2_9,1,19,210,300,1,19,50000 P_2_9,1,19,210,300,1,0,19,50000
P_2_10,1,20,210,300,1,20,50000 P_2_10,1,20,210,300,1,0,20,50000
P_3_1,2,21,400,300,1,21;22,90000 P_3_1,2,21,400,300,1,0,21;22,90000
P_3_2,2,22,400,300,1,23;24,90000 P_3_2,2,22,400,300,1,0,23;24,90000
P_3_3,2,23,400,300,1,25;26,90000 P_3_3,2,23,400,300,1,0,25;26,90000
P_3_4,2,24,400,300,1,21;23,90000 P_3_4,2,24,400,300,1,0,21;23,90000
P_3_5,2,25,400,300,1,23;25,90000 P_3_5,2,25,400,300,1,0,23;25,90000
P_4_1,2,26,400,300,1,25;27,130000 P_4_1,2,26,400,300,1,0,25;27,130000
P_4_2,2,27,400,300,1,21;24,130000 P_4_2,2,27,400,300,1,0,21;24,130000
P_4_3,2,28,400,300,1,23;26,130000 P_4_3,2,28,400,300,1,0,23;26,130000
P_4_4,2,29,400,300,1,25;28,130000 P_4_4,2,29,400,300,1,0,25;28,130000
P_4_5,2,30,400,300,1,21;25,130000 P_4_5,2,30,400,300,1,0,21;25,130000
...@@ -139,6 +139,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -139,6 +139,8 @@ namespace OnlineStore.DeviceLibrary
private void StartReset() private void StartReset()
{ {
CanCloseDoor = false;
WaitCanCloseDoor = false;
WarnMsg = ""; WarnMsg = "";
isInSuddenDown = false; isInSuddenDown = false;
CurrInOutCount = 0; CurrInOutCount = 0;
...@@ -417,9 +419,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -417,9 +419,7 @@ namespace OnlineStore.DeviceLibrary
else if (runStatus.Equals(StoreRunStatus.Runing)) else if (runStatus.Equals(StoreRunStatus.Runing))
{ {
IOTimeOutProcess(); IOTimeOutProcess();
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -427,7 +427,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -427,7 +427,6 @@ namespace OnlineStore.DeviceLibrary
} }
} }
private DateTime preIoTimerOutTime = DateTime.Now; private DateTime preIoTimerOutTime = DateTime.Now;
private void IOTimeOutProcess() private void IOTimeOutProcess()
{ {
...@@ -491,8 +490,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -491,8 +490,6 @@ namespace OnlineStore.DeviceLibrary
} }
checkAlarmTime = DateTime.Now; checkAlarmTime = DateTime.Now;
bool isInAlarm = false; bool isInAlarm = false;
//Task.Factory.StartNew(delegate
// {
foreach (ConfigMoveAxis axisInfo in moveAxisList) foreach (ConfigMoveAxis axisInfo in moveAxisList)
{ {
short axis = axisInfo.GetAxisValue(); short axis = axisInfo.GetAxisValue();
...@@ -518,8 +515,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -518,8 +515,6 @@ namespace OnlineStore.DeviceLibrary
} }
AxisAlarmCodeMap[deviceName] = info; AxisAlarmCodeMap[deviceName] = info;
} }
//});
//判断报警状态
return isInAlarm; return isInAlarm;
} }
#endregion #endregion
...@@ -600,31 +595,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -600,31 +595,7 @@ namespace OnlineStore.DeviceLibrary
#region 与服务器通信定时器 #region 与服务器通信定时器
private float Max_Humidity = 0;
private float Max_Temperature = 0;
public string currTempStr = "";
private void HumidityProcess()
{
try
{
ASTemperateParam param = HumitureController.ColdLastData;
currTempStr = "";
if (param != null)
{
currTempStr = ("冷藏区湿度:" + param.Humidity.ToString() + " 温度:" + param.Temperate.ToString() + " \n ");
}
param = HumitureController.WarmLastData;
if (param != null)
{
currTempStr += ("回温区湿度:" + param.Humidity.ToString() + " 温度:" + param.Temperate.ToString() + "\n ");
}
}
catch (Exception ex)
{
LogUtil.error(Name + "HumidityProcess出错:" + ex.ToString());
}
}
private bool isInProcess = false; private bool isInProcess = false;
public void server_connect_timer_Tick(object sender, EventArgs e) public void server_connect_timer_Tick(object sender, EventArgs e)
{ {
...@@ -644,7 +615,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -644,7 +615,6 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("定时给服务器发送消息出错:" + ex.ToString()); LogUtil.error("定时给服务器发送消息出错:" + ex.ToString());
} }
} }
HumidityProcess();
LedProcess(); LedProcess();
isInProcess = false; isInProcess = false;
} }
...@@ -723,12 +693,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -723,12 +693,12 @@ namespace OnlineStore.DeviceLibrary
DateTime time = DateTime.Now; DateTime time = DateTime.Now;
//构建发送给服务器的对象 //构建发送给服务器的对象
Operation lineOperation = getLineBoxStatus(); Operation lineOperation = getLineBoxStatus();
//如果还没湿度范围,先获取 ////如果还没湿度范围,先获取
if (Max_Humidity <= 0 || (Max_Temperature <= 0)) //if (Max_Humidity <= 0 || (Max_Temperature <= 0))
{ //{
lineOperation.op = 5; // lineOperation.op = 5;
LogUtil.info( Name + "没有湿度预警范围,需要从服务器获取,发送OP=" + lineOperation.op); // LogUtil.info( Name + "没有湿度预警范围,需要从服务器获取,发送OP=" + lineOperation.op);
} //}
string server = ConfigAppSettings.GetValue(Setting_Init.http_server); string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), lineOperation, false); Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), lineOperation, false);
...@@ -763,24 +733,24 @@ namespace OnlineStore.DeviceLibrary ...@@ -763,24 +733,24 @@ namespace OnlineStore.DeviceLibrary
private void ProcessHumidityCMD(Operation resultOperation) private void ProcessHumidityCMD(Operation resultOperation)
{ {
Dictionary<string, string> data = resultOperation.data; //Dictionary<string, string> data = resultOperation.data;
if (data != null && data.ContainsKey(ParamDefine.maxHumidity) && data.ContainsKey(ParamDefine.maxTemperature)) //if (data != null && data.ContainsKey(ParamDefine.maxHumidity) && data.ContainsKey(ParamDefine.maxTemperature))
{ //{
string maxHumidity = data[ParamDefine.maxHumidity]; // string maxHumidity = data[ParamDefine.maxHumidity];
string maxTemp = data[ParamDefine.maxTemperature]; // string maxTemp = data[ParamDefine.maxTemperature];
LogUtil.info( "收到服务器温湿度预警值:maxHumidity=" + maxHumidity + ",maxTemperature=" + maxTemp); // LogUtil.info( "收到服务器温湿度预警值:maxHumidity=" + maxHumidity + ",maxTemperature=" + maxTemp);
try // try
{ // {
this.Max_Humidity = (float)Convert.ToDouble(maxHumidity); // this.Max_Humidity = (float)Convert.ToDouble(maxHumidity);
this.Max_Temperature = (float)Convert.ToDouble(maxTemp); // this.Max_Temperature = (float)Convert.ToDouble(maxTemp);
LogUtil.info( "保存温湿度预警值:Max_Humidity=" + Max_Humidity + ",Max_Temperature=" + Max_Temperature); // LogUtil.info( "保存温湿度预警值:Max_Humidity=" + Max_Humidity + ",Max_Temperature=" + Max_Temperature);
} // }
catch (Exception ex) // catch (Exception ex)
{ // {
LogUtil.error("转换温湿度失败:" + ex.ToString()); // LogUtil.error("转换温湿度失败:" + ex.ToString());
} // }
} //}
} }
private void ReviceOutStoreProcess(Operation resultOperation) private void ReviceOutStoreProcess(Operation resultOperation)
...@@ -1037,7 +1007,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -1037,7 +1007,6 @@ namespace OnlineStore.DeviceLibrary
string msg = ""; string msg = "";
msg += "" + runStatus +" _ "+ storeStatus+ " _ "+ alarmType+"\n"; msg += "" + runStatus +" _ "+ storeStatus+ " _ "+ alarmType+"\n";
msg += MoveInfo.MoveType + " _ "+MoveInfo.MoveStep + "\n"; msg += MoveInfo.MoveType + " _ "+MoveInfo.MoveStep + "\n";
msg += currTempStr;
return msg; return msg;
} }
} }
......
...@@ -12,6 +12,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -12,6 +12,8 @@ namespace OnlineStore.DeviceLibrary
{ {
partial class VerticalStoreBean partial class VerticalStoreBean
{ {
public bool WaitCanCloseDoor = false;
public bool CanCloseDoor = false;
private Stopwatch moveWatch = new Stopwatch(); private Stopwatch moveWatch = new Stopwatch();
#region 自动出入库参数 #region 自动出入库参数
private int CurrInOutCount = 0; private int CurrInOutCount = 0;
...@@ -58,7 +60,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -58,7 +60,7 @@ namespace OnlineStore.DeviceLibrary
string msg = ""; string msg = "";
if (wait.IsHomeMove) if (wait.IsHomeMove)
{ {
wait.IsEnd =AxisBean. HomeMoveIsEnd(MoveInfo, wait.AxisInfo, out msg); wait.IsEnd = AxisBean.HomeMoveIsEnd(MoveInfo, wait.AxisInfo, out msg);
} }
else else
{ {
...@@ -76,10 +78,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -76,10 +78,7 @@ namespace OnlineStore.DeviceLibrary
{ {
wait.IsEnd = IOManager.IOValue(wait.IoType).Equals(wait.IoValue); wait.IsEnd = IOManager.IOValue(wait.IoType).Equals(wait.IoValue);
int timeOutMs = Config.IOSingle_TimerOut; int timeOutMs = Config.IOSingle_TimerOut;
if (MoveInfo.MoveStep == StoreMoveStep.SO_18_WaitTake)
{
timeOutMs = 650000;
}
if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs) if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
{ {
ConfigIO io = Config.getWaitIO(wait.IoType); ConfigIO io = Config.getWaitIO(wait.IoType);
...@@ -94,6 +93,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -94,6 +93,11 @@ namespace OnlineStore.DeviceLibrary
{ {
wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds); wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
} }
else if (wait.WaitType.Equals(7))
{
wait.IsEnd =( CanCloseDoor);
}
if (wait.IsEnd) if (wait.IsEnd)
{ {
if (MoveInfo.OneWaitCanEndStep) if (MoveInfo.OneWaitCanEndStep)
...@@ -129,240 +133,113 @@ namespace OnlineStore.DeviceLibrary ...@@ -129,240 +133,113 @@ namespace OnlineStore.DeviceLibrary
#region 入库 #region 入库
public override bool StartInStore(InOutParam param, bool isNeedCheckIO = false) public override bool StartInStore(InOutParam param)
{ {
WaitCanCloseDoor = false;
param.paramType = MoveType.InStore; param.paramType = MoveType.InStore;
string posId = param != null ? param.PosId : ""; string posId = param != null ? param.PosId : "";
if (runStatus .Equals( StoreRunStatus.Runing)&&MoveInfo.MoveType.Equals(MoveType.None)) if (runStatus.Equals(StoreRunStatus.Runing) && MoveInfo.MoveType.Equals(MoveType.None))
{ {
if (param.Position==null) if (param.Position == null)
{ {
LogUtil.error(Name + " 启动 " + param.LogName + "失败,找不到库位信息"); LogUtil.error(Name + " 启动 " + param.LogName + "失败,找不到库位信息");
return false; return false;
} }
LogUtil.info(Name + " 启动 " + param.LogName ); LogUtil.info(Name + " 启动 " + param.LogName);
moveWatch.Restart(); moveWatch.Restart();
runStatus = StoreRunStatus.Busy; runStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute; storeStatus = StoreStatus.InStoreExecute;
MoveInfo.NewMove(MoveType.InStore, param); MoveInfo.NewMove(MoveType.InStore, param);
if (isNeedCheckIO)
{ MoveInfo.NextMoveStep(StoreMoveStep.SI_01_Wait);
MoveInfo.NextMoveStep(StoreMoveStep.SI_01_TrayCheck); InStoreLog("开始入库:等待光栅未被遮挡");
InStoreLog(" 检测料盘信号"); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
} MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SafetyLightCurtains, IO_VALUE.HIGH));
else
{
//SI_02_InOutToP1(MoveInfo.MoveParam.MoveP);
}
return true; return true;
} }
else else
{ {
LogUtil.error(Name + " 启动 " + param.LogName + "出错,当前状态:[" + runStatus+"],["+MoveInfo.MoveType+"]"); LogUtil.error(Name + " 启动 " + param.LogName + "出错,当前状态:[" + runStatus + "],[" + MoveInfo.MoveType + "]");
return false; return false;
} }
} }
protected override void InStoreProcess() protected override void InStoreProcess()
{ {
//StoreMoveP moveP = MoveInfo.MoveParam.MoveP; if (MoveInfo.IsInWait)
//if (MoveInfo.IsInWait) {
//{ CheckWait();
// CheckWait();
//}
//if (MoveInfo.IsInWait)
//{
// return;
//}
//if (MoveInfo.IsStep(StoreMoveStep.SI_01_TrayCheck))
//{
// SI_02_InOutToP1(moveP);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_02_InOutToP1))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_03_Clamping_Relax);
// InStoreLog(" 夹爪放松");
// CylinderMove(MoveInfo, IO_Type.Clamping_Tighten, IO_Type.Clamping_Relax);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_03_Clamping_Relax))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_04_AxisToP1);
// InStoreLog(" 轴2、轴1 动作到P1 ");
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
// ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_04_AxisToP1))
//{
// SI_05_InoutToP2();
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_05_InoutToP2))
//{
// NeedCheckSafetyLight = 0;
// MoveInfo.NextMoveStep(StoreMoveStep.SI_06_Clamping_Work);
// InStoreLog("夹爪夹紧 ");
// CylinderMove(MoveInfo, IO_Type.Clamping_Relax, IO_Type.Clamping_Tighten);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_06_Clamping_Work))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_07_UpdownToP7);
// InStoreLog("升降轴到P7 ");
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P7, Config.UpDownAxis_P7_Speed);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_07_UpdownToP7))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_08_InOutToP1);
// InOutBackToP1(moveP.InOut_P1);
// ConfigMoveAxis axis = GetPosTAxis();
// InStoreLog("进出轴返回待机点P1, " + axis.ProName + "停止匀速运动 ");
// AxisSuddenStop(axis);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_08_InOutToP1))
//{
// ConfigMoveAxis axis = GetPosTAxis();
// MoveInfo.NextMoveStep(StoreMoveStep.SI_09_MoveToBag);
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
// InStoreLog("移动到库位点,旋转轴 至P2( 库位点)升降轴至P3(库位入库前点)关闭仓门 " + axis.ProName + "开始原点返回");
// ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P2_Speed);
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed);
// CylinderMove(null, IO_Type.Door_Up, IO_Type.Door_Down);
// ACAxisHomeMove(axis);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_09_MoveToBag))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_10_TargetAxisToP2);
// if (MoveInfo.MoveParam.Position.PosType.Equals(1))
// {
// InStoreLog("冷藏旋转轴到P2 ");
// ACAxisMove(Config.Colding_Axis, moveP.Cold_P2, Config.ColdingAxis_P2_Speed);
// }
// else
// {
// InStoreLog("回温旋转轴到P2 ");
// ACAxisMove(Config.Warming_Axis, moveP.Warm_P2, Config.WarmingAxis_P2_Speed);
// }
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_10_TargetAxisToP2))
//{
// if (MoveInfo.MoveParam.Position.PosType.Equals(1))
// {
// MoveInfo.NextMoveStep(StoreMoveStep.SI_11_OpenColddoor);
// InStoreLog("打开冷藏门,关闭仓门 ");
// CylinderMove(MoveInfo, IO_Type.Door_Up, IO_Type.Door_Down);
// CylinderMove(MoveInfo, IO_Type.ColdDoor_Close, IO_Type.ColdDoor_Open);
// }
// else
// {
// MoveInfo.NextMoveStep(StoreMoveStep.SI_12_InoutToP3);
// InStoreLog("进出轴到P3 ");
// ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
// }
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_11_OpenColddoor))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_12_InoutToP3);
// InStoreLog("进出轴到P3 ");
// ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_12_InoutToP3))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_13_UpdownToP4);
// InStoreLog("升降轴到入料缓冲点P4 ");
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_13_UpdownToP4))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_14_Clamping_Relax);
// InStoreLog(" 夹爪放松");
// CylinderMove(MoveInfo, IO_Type.Clamping_Tighten, IO_Type.Clamping_Relax);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_14_Clamping_Relax))
//{
// // 5= 入仓位完成(料仓Box把料盘放入对应的库位中,装置还未恢复原始状态)
// UpdateLastStatus(StoreStatus.InStoreEnd);
// MoveInfo.NextMoveStep(StoreMoveStep.SI_15_InOutToP1);
// InStoreLog(" 进出轴返回待机点P1");
// InOutBackToP1(moveP.InOut_P1);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_15_InOutToP1))
//{
// if (MoveInfo.MoveParam.Position.PosType.Equals(1))
// {
// MoveInfo.NextMoveStep(StoreMoveStep.SI_16_CloseColddoor);
// InStoreLog(" 关闭冷藏区门");
// CylinderMove(MoveInfo, IO_Type.ColdDoor_Open, IO_Type.ColdDoor_Close);
// }
// else
// {
// SI_17_GoBack();
// }
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_16_CloseColddoor))
//{
// SI_17_GoBack();
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SI_17_GoBack))
//{
// TimeSpan span = moveWatch.Elapsed;
// moveWatch.Stop();
// LogUtil.info(Name + " 【" + MoveInfo.MoveParam.LogName + "】 结束,开始旋转,耗时【" + FormUtil.GetSpanStr(span) + "】!");
// MoveInfo.EndMove();
// runStatus = StoreRunStatus.Runing;
// //设备连接,入库后,BOX恢复原始状态
// storeStatus = StoreStatus.StoreOnline;
// InOutEndProcess(MoveType.InStore);
//}
//else
//{
// LogUtil.info(Name + " 入库,moveStatus=" + MoveInfo.MoveStep + ",没有对应的处理!");
//}
}
private void SI_02_InOutToP1( )
{
//MoveInfo.NextMoveStep(StoreMoveStep.SI_02_InOutToP1);
//InStoreLog(" 进出轴到P1,打开舱门");
//CylinderMove(MoveInfo, IO_Type.Door_Down, IO_Type.Door_Up);
//InOutBackToP1(moveP.InOut_P1);
}
private void SI_05_InoutToP2()
{
//MoveInfo.NextMoveStep(StoreMoveStep.SI_05_InoutToP2);
//InStoreLog("进出轴到P2");
//ACAxisMove(Config.InOut_Axis, MoveInfo.MoveParam.MoveP.InOut_P2, Config.InOutAxis_P2_Speed);
//NeedCheckSafetyLight = 1;
}
private void SI_17_GoBack()
{
//MoveInfo.NextMoveStep(StoreMoveStep.SI_17_GoBack);
//ConfigMoveAxis axis = GetPosTAxis();
//InStoreLog(" 升降轴,旋转轴返回P1," + axis.ProName + "开始匀速运转");
//ACAxisMove(Config.Middle_Axis, MoveInfo.MoveParam.MoveP.Middle_P1, Config.MiddleAxis_P1_Speed);
//ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
//StartWork(MoveInfo.MoveParam.Position.PosType);
}
private void InOutBackToP1(int InOut_P1)
{
////判断是否在P1,如果是,不需要运行
//int outCount = ACServerManager.GetActualtPosition(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue());
//int errorCount = Math.Abs(outCount - InOut_P1);
//if (errorCount <= Config.InOut_Axis.CanErrorCountMin)
//{
// LogUtil.info("进出轴当前位置:" + outCount + ",已经在P1,不需要再回P1");
//}
//else
//{
// ACAxisMove(Config.InOut_Axis, InOut_P1, Config.InOutAxis_P1_Speed);
//}
//StoreMove.WaitList.Add(WaitResultInfo.WaitAxisOrg(Config.InOut_Axis,IO_VALUE.HIGH));
} }
if (MoveInfo.IsInWait)
{
return;
}
if (MoveInfo.IsStep(StoreMoveStep.SI_01_Wait))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_02_CloseDoor);
InStoreLog(" 关闭升降门,关闭所有灯");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
DoorBean.StartClose(MoveInfo);
LEDManager.GetLedModule(Config.LED_IP).AllLightOff();
}
else if (MoveInfo.IsStep(StoreMoveStep.SI_02_CloseDoor))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_03_MiddleToP2);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
InStoreLog(" 旋转轴到P2点");
MiddleAxis.AbsMove(MoveInfo, MoveInfo.MoveParam.Position.MiddleAxis_P2, Config.MiddleAxis_P2_Speed);
}
else if (MoveInfo.IsStep(StoreMoveStep.SI_03_MiddleToP2))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_04_OpenDoor);
InStoreLog(" 打开升降门,打开库位灯蓝色 ,更新状态为入仓完成 ");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
DoorBean.StartOpen(MoveInfo);
List<Light> lights = new List<Light>();
foreach(int index in MoveInfo.MoveParam.Position.GetLedList())
{
lights.Add(Light.BlueLight(MoveInfo.MoveParam.Position.LedDmx, index));
}
LEDManager.GetLedModule(Config.LED_IP).LightOff(lights.ToArray<Light>());
UpdateLastStatus(StoreStatus.InStoreEnd);
}
else if (MoveInfo.IsStep(StoreMoveStep.SI_04_OpenDoor))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_05_WaitCloseDoor);
InStoreLog(" 等待关门 ");
WaitCanCloseDoor = true;
CanCloseDoor = false;
MoveInfo.WaitList.Add(WaitResultInfo.WaitCloseDoor());
}
else if (MoveInfo.IsStep(StoreMoveStep.SI_05_WaitCloseDoor))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_06_CloseDoor);
InStoreLog(" 开始关门 ");
WaitCanCloseDoor = false;
CanCloseDoor = false;
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
DoorBean.StartClose(MoveInfo);
}
else if (MoveInfo.IsStep(StoreMoveStep.SI_06_CloseDoor))
{
TimeSpan span = moveWatch.Elapsed;
moveWatch.Stop();
LogUtil.info(Name + " 【" + MoveInfo.MoveParam.LogName + "】 结束,耗时【" + FormUtil.GetSpanStr(span) + "】!");
MoveInfo.EndMove();
runStatus = StoreRunStatus.Runing;
//设备连接,入库后,BOX恢复原始状态
storeStatus = StoreStatus.StoreOnline;
InOutEndProcess(MoveType.InStore);
}
else
{
LogUtil.info(Name + " 入库," + MoveInfo.MoveStep + ",没有对应的处理!");
}
}
#endregion #endregion
...@@ -370,43 +247,37 @@ namespace OnlineStore.DeviceLibrary ...@@ -370,43 +247,37 @@ namespace OnlineStore.DeviceLibrary
public override bool StartOutStore(InOutParam param) public override bool StartOutStore(InOutParam param)
{ {
//param.paramType = MoveType.OutStore; WaitCanCloseDoor = false;
//if (runStatus.Equals(StoreRunStatus.Runing) && MoveInfo.MoveType.Equals(MoveType.None)) param.paramType = MoveType.OutStore;
//{ if (runStatus.Equals(StoreRunStatus.Runing) && MoveInfo.MoveType.Equals(MoveType.None))
// if (!param.LoadParam(Config)) {
// { if (param.Position == null)
// LogUtil.error(Name + " 启动 " + param.LogName + "失败,找不到库位"); {
// return false; LogUtil.error(Name + " 启动 " + param.LogName + "失败,找不到库位信息");
// } return false;
// if (IOManager.IOValue(IO_Type.TinCheck_Fixture).Equals(IO_VALUE.HIGH)) }
// {
// LogUtil.error(Name + " 启动 " + param.LogName + "失败,叉子料盘检测有料"); moveWatch.Restart();
// return false; LogUtil.info(Name + "启动 " + param.LogName + " ");
// } runStatus = StoreRunStatus.Busy;
// moveWatch.Restart(); storeStatus = StoreStatus.OutStoreExecute;
// LogUtil.info(Name + "启动 " + param.LogName + " "); MoveInfo.NewMove(MoveType.OutStore, param);
// runStatus = StoreRunStatus.Busy;
// storeStatus = StoreStatus.OutStoreExecute; MoveInfo.NextMoveStep(StoreMoveStep.SO_01_Wait);
// MoveInfo.NewMove(MoveType.OutStore, param); InStoreLog("开始出库:等待光栅未被遮挡");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
// MoveInfo.NextMoveStep(StoreMoveStep.SO_01_InoutToP1); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SafetyLightCurtains, IO_VALUE.HIGH));
// ConfigMoveAxis axis = GetPosTAxis(); return true;
// OutStoreLog(" 叉子先运动到P1 ," + axis.ProName + "停止匀速运动"); }
// InOutBackToP1(MoveInfo.MoveParam.MoveP.InOut_P1); else
// AxisSuddenStop(axis); {
LogUtil.error(Name + " 启动 " + param.LogName + "出错,当前状态:[" + runStatus + "],[" + MoveInfo.MoveType + "]");
// return true;
//}
//else
//{
// LogUtil.error(Name + " 启动 " + param.LogName + "出错,当前状态:[" + runStatus + "],[" + MoveInfo.MoveType + "]");
return false; return false;
//} }
} }
protected override void OutStoreProcess() protected override void OutStoreProcess()
{ {
//StoreMoveP moveP = MoveInfo.MoveParam.MoveP;
if (MoveInfo.IsInWait) if (MoveInfo.IsInWait)
{ {
CheckWait(); CheckWait();
...@@ -415,197 +286,85 @@ namespace OnlineStore.DeviceLibrary ...@@ -415,197 +286,85 @@ namespace OnlineStore.DeviceLibrary
{ {
return; return;
} }
//if (MoveInfo.MoveStep .Equals( StoreMoveStep.SO_01_InoutToP1)) if (MoveInfo.IsStep(StoreMoveStep.SO_01_Wait))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_02_AxisHome);
// ConfigMoveAxis axis = GetPosTAxis();
// OutStoreLog(" " + axis.ProName + "开始原点返回");
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
// ACAxisHomeMove(axis);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_02_AxisHome))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_03_ToBag);
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
// ConfigMoveAxis axis = GetPosTAxis();
// OutStoreLog(" 旋转轴至P2(库位点),升降轴至P5(库位出库前点)," + axis.ProName + "到P2");
// ACAxisMove(Config.Middle_Axis, MoveInfo.MoveParam.MoveP.Middle_P2, Config.MiddleAxis_P2_Speed);
// ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_P5, Config.UpDownAxis_P5_Speed);
// if (MoveInfo.MoveParam.Position.PosType.Equals(1))
// {
// ACAxisMove(Config.Colding_Axis, moveP.Cold_P2, Config.ColdingAxis_P2_Speed);
// }
// else
// {
// ACAxisMove(Config.Warming_Axis, moveP.Warm_P2, Config.WarmingAxis_P2_Speed);
// }
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_03_ToBag))
//{
// if (MoveInfo.MoveParam.Position.PosType.Equals(1))
// {
// MoveInfo.NextMoveStep(StoreMoveStep.SO_04_OpenCold);
// OutStoreLog("打开冷藏区门 ");
// CylinderMove(MoveInfo, IO_Type.ColdDoor_Close, IO_Type.ColdDoor_Open);
// }
// else
// {
// MoveInfo.NextMoveStep(StoreMoveStep.SO_05_InoutToP3);
// OutStoreLog(" 进出轴至P3(库位取放料点) ");
// ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
// }
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_04_OpenCold))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_05_InoutToP3);
// OutStoreLog(" 进出轴至P3(库位取放料点) ");
// ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_05_InoutToP3))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_06_Clamping_Work);
// OutStoreLog("夹爪夹紧 ");
// CylinderMove(MoveInfo, IO_Type.Clamping_Relax, IO_Type.Clamping_Tighten);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_06_Clamping_Work))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_07_UpdownToP6);
// OutStoreLog(" 升降轴至P6(库位出料缓冲点) ");
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P6, Config.UpDownAxis_P6_Speed);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_07_UpdownToP6))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_08_InoutToP1);
// OutStoreLog(" 进出轴至P1(待机点) ");
// InOutBackToP1(moveP.InOut_P1);
// //把库位的物品放到取到叉子上之后是出仓完成
// UpdateLastStatus(StoreStatus.OutStoreBoxEnd);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_08_InoutToP1))
//{
// if (IOManager.IOValue(IO_Type.TinCheck_Fixture).Equals(IO_VALUE.LOW))
// {
// CodeMsg = MoveInfo.MoveParam.LogName + " 叉子从库位退出后,未检测到料盘有料";
// LogUtil.error(CodeMsg);
// }
// if (MoveInfo.MoveParam.Position.PosType.Equals(1))
// {
// MoveInfo.NextMoveStep(StoreMoveStep.SO_09_CloseCold);
// OutStoreLog("关闭冷藏区门 ");
// CylinderMove(MoveInfo, IO_Type.ColdDoor_Open, IO_Type.ColdDoor_Close);
// }
// else
// {
// MoveInfo.NextMoveStep(StoreMoveStep.SO_10_ToDoorPosition);
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
// OutStoreLog("旋转轴至P1(待机点)升降轴至P2(进料口出料前点),");
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P2, Config.UpDownAxis_P2_Speed);
// ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
// }
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_09_CloseCold))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_10_ToDoorPosition);
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
// OutStoreLog("旋转轴至P1(待机点)升降轴至P2(进料口出料前点),");
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P2, Config.UpDownAxis_P2_Speed);
// ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_10_ToDoorPosition))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_11_OpenDoor);
// ConfigMoveAxis axis = GetPosTAxis();
// OutStoreLog("打开仓门 ," + axis.ProName + "开始匀速运转");
// CylinderMove(MoveInfo, IO_Type.Door_Down, IO_Type.Door_Up);
// StartWork(MoveInfo.MoveParam.Position.PosType);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_11_OpenDoor))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_12_WaitNoTray);
// OutStoreLog("等待仓门口无料盘 ");
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(MoveInfo.MoveParam.GetDoorTinCheck(), IO_VALUE.LOW));
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_12_WaitNoTray))
//{
// SO_13_InoutToP2();
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_13_InoutToP2))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_14_UpdownToP8);
// OutStoreLog("进出轴到出料缓冲点P8 ");
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P8, Config.UpDownAxis_P8_Speed);
//}
////此处需要等待移栽没有工作,才能把盘放入出料口
//else if (MoveInfo.IsStep(StoreMoveStep.SO_14_UpdownToP8))
//{
// NeedCheckSafetyLight = 0;
// MoveInfo.NextMoveStep(StoreMoveStep.SO_15_Clamping_Relax);
// OutStoreLog("夹爪放松 ");
// CylinderMove(MoveInfo, IO_Type.Clamping_Tighten, IO_Type.Clamping_Relax);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_15_Clamping_Relax))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_16_InoutToP1);
// OutStoreLog("进出轴动作至P1(待机点) ");
// InOutBackToP1(moveP.InOut_P1);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_16_InoutToP1))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_17_CloseDoor);
// OutStoreLog("关闭仓门 ");
// CylinderMove(MoveInfo, IO_Type.Door_Up, IO_Type.Door_Down);
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_17_CloseDoor))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SO_18_WaitTake);
// int OutStoreWaitSeconds = ConfigAppSettings.GetIntValue(Setting_Init.OutStoreWaitSeconds);
// if (OutStoreWaitSeconds <= 0)
// {
// OutStoreWaitSeconds = 600;
// }
// int ms = OutStoreWaitSeconds * 1000;
// OutStoreLog(" 等待拿走物品,最多等待" + OutStoreWaitSeconds + "秒");
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(ms));
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(MoveInfo.MoveParam.GetDoorTinCheck(), IO_VALUE.LOW));
// MoveInfo.OneWaitCanEndStep = true;
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SO_18_WaitTake))
//{
// TimeSpan span = moveWatch.Elapsed;
// moveWatch.Stop();
// storeStatus = StoreStatus.StoreOnline;
// LogUtil.info(Name + " 【" + MoveInfo.MoveParam.LogName + "】 结束,耗时【" + FormUtil.GetSpanStr(span) + "】!");
// MoveInfo.EndMove();
// runStatus = StoreRunStatus.Runing;
// InOutEndProcess(MoveType.OutStore);
//}
//else
//{
// LogUtil.error(Name + " 出库处理,moveStatus=" + MoveInfo.MoveStep + ",没有对应的处理!");
//}
}
private void SO_13_InoutToP2()
{
//StoreMoveP moveP = MoveInfo.MoveParam.MoveP;
//MoveInfo.NextMoveStep(StoreMoveStep.SO_13_InoutToP2);
//OutStoreLog(" 进出轴至P2(进料口取料点) ");
//ACAxisMove(Config.InOut_Axis, moveP.InOut_P2, Config.InOutAxis_P2_Speed);
//NeedCheckSafetyLight = 1;
}
public bool InOutAxisCanMove()
{ {
return true; MoveInfo.NextMoveStep(StoreMoveStep.SO_02_CloseDoor);
InStoreLog(" 关闭升降门,关闭所有灯");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
DoorBean.StartClose(MoveInfo);
LEDManager.GetLedModule(Config.LED_IP).AllLightOff();
}
else if (MoveInfo.IsStep(StoreMoveStep.SO_02_CloseDoor))
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_03_MiddleToP2);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
InStoreLog(" 旋转轴到P2点");
MiddleAxis.AbsMove(MoveInfo, MoveInfo.MoveParam.Position.MiddleAxis_P2, Config.MiddleAxis_P2_Speed);
}
else if (MoveInfo.IsStep(StoreMoveStep.SO_03_MiddleToP2))
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_04_OpenDoor);
InStoreLog(" 打开升降门,打开库位灯绿色 ,更新状态为出仓完成 ");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
DoorBean.StartOpen(MoveInfo);
List<Light> lights = new List<Light>();
foreach (int index in MoveInfo.MoveParam.Position.GetLedList())
{
lights.Add(Light.GreenLight(MoveInfo.MoveParam.Position.LedDmx, index));
}
LEDManager.GetLedModule(Config.LED_IP).LightOff(lights.ToArray<Light>());
UpdateLastStatus(StoreStatus.OutStoreBoxEnd);
}
else if (MoveInfo.IsStep(StoreMoveStep.SO_04_OpenDoor))
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_05_WaitCloseDoor);
InStoreLog(" 等待关门 ");
WaitCanCloseDoor = true;
CanCloseDoor = false;
MoveInfo.WaitList.Add(WaitResultInfo.WaitCloseDoor());
}
else if (MoveInfo.IsStep(StoreMoveStep.SO_05_WaitCloseDoor))
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_06_CloseDoor);
InStoreLog(" 开始关门 ");
WaitCanCloseDoor = false;
CanCloseDoor = false;
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
DoorBean.StartClose(MoveInfo);
}
else if (MoveInfo.IsStep(StoreMoveStep.SO_06_CloseDoor))
{
TimeSpan span = moveWatch.Elapsed;
moveWatch.Stop();
LogUtil.info(Name + " 【" + MoveInfo.MoveParam.LogName + "】 结束,耗时【" + FormUtil.GetSpanStr(span) + "】!");
MoveInfo.EndMove();
runStatus = StoreRunStatus.Runing;
//设备连接,入库后,BOX恢复原始状态
storeStatus = StoreStatus.StoreOnline;
InOutEndProcess(MoveType.OutStore);
}
else
{
LogUtil.info(Name + " 出库," + MoveInfo.MoveStep + ",没有对应的处理!");
}
} }
#endregion #endregion
public void SureCloseDoor()
{
if (MoveInfo.MoveType.Equals(MoveType.InStore) && MoveInfo.MoveStep.Equals(StoreMoveStep.SI_05_WaitCloseDoor))
{
CanCloseDoor = true;
}
else if (MoveInfo.MoveType.Equals(MoveType.OutStore) && MoveInfo.MoveStep.Equals(StoreMoveStep.SO_05_WaitCloseDoor))
{
CanCloseDoor = true;
}
}
private void UpdateLastStatus(StoreStatus status) private void UpdateLastStatus(StoreStatus status)
{ {
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosId : ""; string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosId : "";
...@@ -691,10 +450,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -691,10 +450,6 @@ namespace OnlineStore.DeviceLibrary
} }
} }
private void AddWaitMoveParam(InOutParam newParam)
{
throw new NotImplementedException();
}
private void InStoreLog(string msg) private void InStoreLog(string msg)
{ {
...@@ -708,16 +463,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -708,16 +463,6 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info("" + LogName + " [" + MoveInfo.MoveStep + "]" + msg); LogUtil.info("" + LogName + " [" + MoveInfo.MoveStep + "]" + msg);
} }
private void MovePosLog(string msg)
{
string LogName = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.LogName : "";
LogUtil.info("" + LogName + " [" + MoveInfo.MoveStep + "]" + msg);
}
private void StiringLog(string msg)
{
string LogName = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.LogName : "";
LogUtil.info("" + LogName + " [" + MoveInfo.MoveStep + "]" + msg);
}
private void ResetLog(string msg) private void ResetLog(string msg)
{ {
LogUtil.info(Name+" "+MoveInfo.MoveType+ " ["+MoveInfo.MoveStep+"] " + msg); LogUtil.info(Name+" "+MoveInfo.MoveType+ " ["+MoveInfo.MoveStep+"] " + msg);
......
...@@ -210,7 +210,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -210,7 +210,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 开始入库移动移动 /// 开始入库移动移动
/// </summary> /// </summary>
public abstract bool StartInStore(InOutParam param, bool isNeedCheckIO = false); public abstract bool StartInStore(InOutParam param );
protected abstract void InStoreProcess(); protected abstract void InStoreProcess();
#endregion #endregion
......
...@@ -148,9 +148,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -148,9 +148,9 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
SO_02_CloseDoor , SO_02_CloseDoor ,
/// <summary> /// <summary>
/// 出库: 旋转轴到P1 /// 出库:旋转轴到P2
/// </summary> /// </summary>
SO_03_MiddleToP1 , SO_03_MiddleToP2 ,
/// <summary> /// <summary>
/// 出库:打开升降门,打开库位灯 /// 出库:打开升降门,打开库位灯
/// </summary> /// </summary>
...@@ -175,15 +175,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -175,15 +175,15 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
///入库:等待光栅未被遮挡 ///入库:等待光栅未被遮挡
/// </summary> /// </summary>
SI_01_Wait = 1001, SI_01_Wait = 2001,
/// <summary> /// <summary>
///入库:关闭升降门 ///入库:关闭升降门
/// </summary> /// </summary>
SI_02_CloseDoor, SI_02_CloseDoor,
/// <summary> /// <summary>
/// 入库: 旋转轴到P1 /// 入库: 旋转轴到P2
/// </summary> /// </summary>
SI_03_MiddleToP1, SI_03_MiddleToP2,
/// <summary> /// <summary>
/// 入库:打开升降门,打开库位灯 /// 入库:打开升降门,打开库位灯
/// </summary> /// </summary>
......
...@@ -228,6 +228,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -228,6 +228,15 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = false; wait.IsEnd = false;
return wait; return wait;
} }
internal static WaitResultInfo WaitCloseDoor()
{
WaitResultInfo wait = new WaitResultInfo();
wait.CanWhileMoveCount = 0;
wait.WaitType = 7;
wait.IsEnd = false;
return wait;
}
public string ToStr() public string ToStr()
{ {
...@@ -262,11 +271,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -262,11 +271,16 @@ namespace OnlineStore.DeviceLibrary
{ {
return "轴【" + AxisInfo.DisplayStr + "】ORG信号:【" + IoValue + "】 "; return "轴【" + AxisInfo.DisplayStr + "】ORG信号:【" + IoValue + "】 ";
} }
else if (WaitType.Equals(7))
{
return "可以关闭升降门";
}
else else
{ {
return "Wait位置类型:WaitType=【" + WaitType + "】"; return "Wait位置类型:WaitType=【" + WaitType + "】";
} }
} }
/// <summary> /// <summary>
/// 当未结束时可以重复运动的次数 /// 当未结束时可以重复运动的次数
/// </summary> /// </summary>
......
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>
...@@ -109,12 +110,12 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -109,12 +110,12 @@ namespace OnlineStore.LoadCSVLibrary
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.Error("出错:", e); LogUtil.error("出错:", e);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error(ex.ToString()); LogUtil.error(ex.ToString());
return false; return false;
} }
return true; return true;
...@@ -151,7 +152,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -151,7 +152,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 log4net; using log4net;
using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
...@@ -50,7 +51,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -50,7 +51,7 @@ namespace OnlineStore.LoadCSVLibrary
{ {
if (hasReadFileList.Contains(filePath)) if (hasReadFileList.Contains(filePath))
{ {
LOGGER.Error("文件" + filePath + "已经加载过,直接返回null"); LogUtil.error("文件" + filePath + "已经加载过,直接返回null");
return null; return null;
} }
Type type = typeof(T); Type type = typeof(T);
...@@ -58,7 +59,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -58,7 +59,7 @@ namespace OnlineStore.LoadCSVLibrary
Dictionary<string, string> proTitleMap = getProAttributeMap(typeof(T)); Dictionary<string, string> proTitleMap = getProAttributeMap(typeof(T));
if (proTitleMap.Count <= 4) if (proTitleMap.Count <= 4)
{ {
LOGGER.Error(typeof(T).ToString() + "只读取到" + proTitleMap.Count + "个属性"); LogUtil.error(typeof(T).ToString() + "只读取到" + proTitleMap.Count + "个属性");
} }
List<string> cvsTitleList = new List<string>(proTitleMap.Values); List<string> cvsTitleList = new List<string>(proTitleMap.Values);
List<string> propertyList = new List<string>(proTitleMap.Keys); List<string> propertyList = new List<string>(proTitleMap.Keys);
...@@ -116,12 +117,12 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -116,12 +117,12 @@ namespace OnlineStore.LoadCSVLibrary
} }
else else
{ {
LOGGER.Error("读取csv,index=" + index + ",数据格式不匹配!,line=" + line); LogUtil.error("读取csv,index=" + index + ",数据格式不匹配!,line=" + line);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Debug( "CSV 读取行【" + line + "】行转换失败"); LogUtil.debug( "CSV 读取行【" + line + "】行转换失败");
} }
} }
index++; index++;
...@@ -156,7 +157,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -156,7 +157,7 @@ namespace OnlineStore.LoadCSVLibrary
Dictionary<string, string> proTitleMap = getProAttributeMap(typeof(T)); Dictionary<string, string> proTitleMap = getProAttributeMap(typeof(T));
if (proTitleMap.Count <= 4) if (proTitleMap.Count <= 4)
{ {
LOGGER.Error(typeof(T).ToString() + "只读取到" + proTitleMap.Count + "个属性"); LogUtil.error(typeof(T).ToString() + "只读取到" + proTitleMap.Count + "个属性");
} }
List<string> cvsTitleList = new List<string>(proTitleMap.Values); List<string> cvsTitleList = new List<string>(proTitleMap.Values);
List<string> propertyList = new List<string>(proTitleMap.Keys); List<string> propertyList = new List<string>(proTitleMap.Keys);
......
...@@ -34,10 +34,15 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -34,10 +34,15 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
[CSVAttribute("亮灯索引")] [CSVAttribute("亮灯索引")]
public string LedIndex { get; set; } public string LedIndex { get; set; }
/// <summary>
/// 亮灯索引
/// </summary>
[CSVAttribute("灯区域索引")]
public int LedDmx { get; set; }
private List<int> LedList = null; private List<int> LedList = null;
public List<int> GetLedList(bool isReload) public List<int> GetLedList(bool isReload = false )
{ {
if (LedList == null || isReload) if (LedList == null || isReload)
{ {
......
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();
...@@ -143,14 +144,14 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -143,14 +144,14 @@ namespace OnlineStore.LoadCSVLibrary
} }
else else
{ {
LOGGER.Error("配置的料仓类型=" + storeType + "未找到处理方法!"); LogUtil.error("配置的料仓类型=" + storeType + "未找到处理方法!");
} }
return LoadConfig(config); return LoadConfig(config);
} }
public static StoreConfig LoadConfig(StoreConfig config) public static StoreConfig LoadConfig(StoreConfig config)
{ {
LOGGER.Info("开始读取文件:" + config.ConfigFilePath); LogUtil.info("开始读取文件:" + config.ConfigFilePath);
if (config == null || config.ConfigFilePath.Equals("")) if (config == null || config.ConfigFilePath.Equals(""))
{ {
return null; return null;
...@@ -205,7 +206,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -205,7 +206,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
} }
catch (Exception e) { catch (Exception e) {
LOGGER.Error("出错:" + e.ToString()); LogUtil.error("出错:" + e.ToString());
} }
string newLine = ""; string newLine = "";
foreach (string s in newArray) foreach (string s in newArray)
......
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;
...@@ -13,7 +14,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -13,7 +14,7 @@ namespace OnlineStore.LoadCSVLibrary
public class ConfigBase public class ConfigBase
{ {
public string DataStr = ""; public string DataStr = "";
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>
...@@ -44,7 +45,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -44,7 +45,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("出错:", ex); LogUtil.error("出错:", ex);
} }
return value; return value;
} }
...@@ -313,7 +314,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -313,7 +314,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("出错了:", ex); LogUtil.error ("出错了:", ex);
return -1; return -1;
} }
return IoValue; return IoValue;
......
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;
...@@ -9,7 +10,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -9,7 +10,7 @@ namespace OnlineStore.LoadCSVLibrary
{ {
public class StoreConfig public class StoreConfig
{ {
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>
/// ID /// ID
/// </summary> /// </summary>
...@@ -117,7 +118,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -117,7 +118,7 @@ namespace OnlineStore.LoadCSVLibrary
else else
{ {
AddProBuffer(con, proBuilder); AddProBuffer(con, proBuilder);
LOGGER.Error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!"); LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
} }
} }
else if (con.ProType == ConfigItemType.DI) else if (con.ProType == ConfigItemType.DI)
...@@ -133,9 +134,9 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -133,9 +134,9 @@ namespace OnlineStore.LoadCSVLibrary
} }
else else
{ {
LOGGER.Error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
}
AddBuffer(con, builder); AddBuffer(con, builder);
LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
}
} }
else if (con.ProType == ConfigItemType.DO) else if (con.ProType == ConfigItemType.DO)
{ {
...@@ -150,18 +151,18 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -150,18 +151,18 @@ namespace OnlineStore.LoadCSVLibrary
} }
else else
{ {
LOGGER.Error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
}
AddBuffer(con, builder); AddBuffer(con, builder);
LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
}
} }
} }
if (String.IsNullOrEmpty(proBuilder.ToString()).Equals(false) && proBuilder.ToString().Equals("\r\n").Equals(false)) if (String.IsNullOrEmpty(proBuilder.ToString()).Equals(false) && proBuilder.ToString().Equals("\r\n").Equals(false))
{ {
LOGGER.Error(proBuilder.ToString()); LogUtil.error(proBuilder.ToString());
} }
if (String.IsNullOrEmpty(builder.ToString()).Equals(false) && builder.ToString().Equals("\r\n").Equals(false)) if (String.IsNullOrEmpty(builder.ToString()).Equals(false) && builder.ToString().Equals("\r\n").Equals(false))
{ {
LOGGER.Error(builder.ToString()); LogUtil.error(builder.ToString());
} }
if (checkProList.Count >= 0) if (checkProList.Count >= 0)
{ {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<appSettings> <appSettings>
<!--是否开机自动启动料仓--> <!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1"/> <add key="App_AutoRun" value="1"/>
<add key="App_Title" value="锡膏料仓"/> <add key="App_Title" value="垂直货柜"/>
<add key ="ACBaudRate" value ="115200"/> <add key ="ACBaudRate" value ="115200"/>
<!--Server address--> <!--Server address-->
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<add key="Store_Position_Config" value="\StoreConfig\linePositions.csv"/> <add key="Store_Position_Config" value="\StoreConfig\linePositions.csv"/>
<add key="Store_ConfigPath" value="\StoreConfig\StoreConfig.csv"/> <add key="Store_ConfigPath" value="\StoreConfig\StoreConfig.csv"/>
<add key="Store_Type" value="RC_AC_SA_Vertical"/> <add key="Store_Type" value="RC_AC_SA_Vertical"/>
<add key="Store_CID" value="rc1258ac-1"/> <add key="Store_CID" value="RC1275"/>
<!--end one store config--> <!--end one store config-->
<!--摄像机名称列表配置,用#分割--> <!--摄像机名称列表配置,用#分割-->
...@@ -48,6 +48,28 @@ ...@@ -48,6 +48,28 @@
<conversionPattern value="[%date][%t]%-5p %m%n"/> <conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout> </layout>
</appender> </appender>
<appender name="AIOBOX" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="logs/aoi/AIOBOX.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<logger name="RollingLogFileAppender">
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
<logger name="AIOBOX">
<level value="Info" />
<appender-ref ref="AIOBOX" />
</logger>
<root>
<level value="INFO" />
<appender-ref ref="RollingLogFileAppender" />
</root>
<root> <root>
<level value="Info"/> <level value="Info"/>
<appender-ref ref="RollingLogFileAppender"/> <appender-ref ref="RollingLogFileAppender"/>
......
...@@ -24,7 +24,7 @@ namespace OnlineStore.TinPasteStore ...@@ -24,7 +24,7 @@ namespace OnlineStore.TinPasteStore
{ {
private int StoreId = 1; private int StoreId = 1;
private VerticalStoreBean boxBean; private VerticalStoreBean boxBean;
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public FrmIOStatus() public FrmIOStatus()
{ {
Control.CheckForIllegalCrossThreadCalls = false; Control.CheckForIllegalCrossThreadCalls = false;
...@@ -105,7 +105,7 @@ namespace OnlineStore.TinPasteStore ...@@ -105,7 +105,7 @@ namespace OnlineStore.TinPasteStore
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.StackTrace, "Exception(异常)", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.StackTrace, "Exception(异常)", MessageBoxButtons.OK, MessageBoxIcon.Error);
LogUtil.error(LOGGER, ex.StackTrace); LogUtil.error( ex.StackTrace);
} }
} }
......
...@@ -770,12 +770,14 @@ ...@@ -770,12 +770,14 @@
this.btnCloseDoor.BackColor = System.Drawing.Color.White; this.btnCloseDoor.BackColor = System.Drawing.Color.White;
this.btnCloseDoor.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnCloseDoor.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCloseDoor.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnCloseDoor.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCloseDoor.Location = new System.Drawing.Point(1019, 114); this.btnCloseDoor.Location = new System.Drawing.Point(957, 114);
this.btnCloseDoor.Name = "btnCloseDoor"; this.btnCloseDoor.Name = "btnCloseDoor";
this.btnCloseDoor.Size = new System.Drawing.Size(132, 39); this.btnCloseDoor.Size = new System.Drawing.Size(194, 39);
this.btnCloseDoor.TabIndex = 275; this.btnCloseDoor.TabIndex = 275;
this.btnCloseDoor.Text = "关闭升降门"; this.btnCloseDoor.Text = "料盒已放入/拿出,关闭升降门";
this.btnCloseDoor.UseVisualStyleBackColor = false; this.btnCloseDoor.UseVisualStyleBackColor = false;
this.btnCloseDoor.Visible = false;
this.btnCloseDoor.Click += new System.EventHandler(this.btnCloseDoor_Click);
// //
// panel1 // panel1
// //
...@@ -801,7 +803,7 @@ ...@@ -801,7 +803,7 @@
this.lblWarnMsg.ForeColor = System.Drawing.Color.Red; this.lblWarnMsg.ForeColor = System.Drawing.Color.Red;
this.lblWarnMsg.Location = new System.Drawing.Point(13, 114); this.lblWarnMsg.Location = new System.Drawing.Point(13, 114);
this.lblWarnMsg.Name = "lblWarnMsg"; this.lblWarnMsg.Name = "lblWarnMsg";
this.lblWarnMsg.Size = new System.Drawing.Size(983, 56); this.lblWarnMsg.Size = new System.Drawing.Size(938, 56);
this.lblWarnMsg.TabIndex = 224; this.lblWarnMsg.TabIndex = 224;
this.lblWarnMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblWarnMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
......
...@@ -25,7 +25,7 @@ namespace OnlineStore.TinPasteStore ...@@ -25,7 +25,7 @@ namespace OnlineStore.TinPasteStore
{ {
private VerticalStoreBean store; private VerticalStoreBean store;
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public FrmStoreBox() public FrmStoreBox()
{ {
Control.CheckForIllegalCrossThreadCalls = false; Control.CheckForIllegalCrossThreadCalls = false;
...@@ -41,7 +41,7 @@ namespace OnlineStore.TinPasteStore ...@@ -41,7 +41,7 @@ namespace OnlineStore.TinPasteStore
this.store = StoreManager.InitStore(); this.store = StoreManager.InitStore();
if (store == null) if (store == null)
{ {
LogUtil.error(LOGGER, "找不到对应的料仓"); LogUtil.error( "找不到对应的料仓");
return; return;
} }
VerticalPosition ktkPosition = null; VerticalPosition ktkPosition = null;
...@@ -86,7 +86,7 @@ namespace OnlineStore.TinPasteStore ...@@ -86,7 +86,7 @@ namespace OnlineStore.TinPasteStore
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "出错:" + ex.StackTrace); LogUtil.error( "出错:" + ex.StackTrace);
} }
} }
private bool preOpen = false; private bool preOpen = false;
...@@ -211,6 +211,8 @@ namespace OnlineStore.TinPasteStore ...@@ -211,6 +211,8 @@ namespace OnlineStore.TinPasteStore
btnStartAuTo.Text = "开始自动出入库"; btnStartAuTo.Text = "开始自动出入库";
} }
} }
btnCloseDoor.Visible = (store.WaitCanCloseDoor && (!store.CanCloseDoor));
} }
else else
{ {
...@@ -352,7 +354,7 @@ namespace OnlineStore.TinPasteStore ...@@ -352,7 +354,7 @@ namespace OnlineStore.TinPasteStore
store.AutoStartIndex = currIndex; store.AutoStartIndex = currIndex;
string poText = cmbPosition.Text; string poText = cmbPosition.Text;
store.autoMsg = "自动出库:" + poText; store.autoMsg = "自动出库:" + poText;
LogUtil.info(LOGGER, store.Name + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!"); LogUtil.info( store.Name + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
//store.StartOutStoreMove(new InOutStoreParam("", poText)); //store.StartOutStoreMove(new InOutStoreParam("", poText));
store.StartInStore(new InOutParam(MoveType.InStore, poText)); store.StartInStore(new InOutParam(MoveType.InStore, poText));
} }
...@@ -496,7 +498,7 @@ namespace OnlineStore.TinPasteStore ...@@ -496,7 +498,7 @@ namespace OnlineStore.TinPasteStore
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.StackTrace, "Exception(异常)", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.StackTrace, "Exception(异常)", MessageBoxButtons.OK, MessageBoxIcon.Error);
LogUtil.error(LOGGER, ex.StackTrace); LogUtil.error( ex.StackTrace);
} }
} }
...@@ -587,5 +589,12 @@ namespace OnlineStore.TinPasteStore ...@@ -587,5 +589,12 @@ namespace OnlineStore.TinPasteStore
string ip = txtLedIp.Text; string ip = txtLedIp.Text;
LEDManager.GetLedModule(ip).AllLightOn(Light.DefaultLight(0, 0)); LEDManager.GetLedModule(ip).AllLightOn(Light.DefaultLight(0, 0));
} }
private void btnCloseDoor_Click(object sender, EventArgs e)
{
LogUtil.info("用户点击:" + btnCloseDoor.Text);
store.SureCloseDoor();
}
} }
} }
...@@ -43,7 +43,7 @@ namespace OnlineStore.TinPasteStore ...@@ -43,7 +43,7 @@ namespace OnlineStore.TinPasteStore
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
...@@ -113,7 +113,7 @@ namespace OnlineStore.TinPasteStore ...@@ -113,7 +113,7 @@ namespace OnlineStore.TinPasteStore
static void LogUnhandledException(object exceptionobj) static void LogUnhandledException(object exceptionobj)
{ {
//这里可以进一步地写日志 //这里可以进一步地写日志
LOGGER.Error(exceptionobj.ToString()); LogUtil.error(exceptionobj.ToString());
} }
} }
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace OnlineStore.TinPasteStore.Properties { namespace OnlineStore.VerticalStore.Properties {
using System; using System;
...@@ -39,7 +39,7 @@ namespace OnlineStore.TinPasteStore.Properties { ...@@ -39,7 +39,7 @@ namespace OnlineStore.TinPasteStore.Properties {
internal static global::System.Resources.ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OnlineStore.TinPasteStore.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OnlineStore.VerticalStore.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace OnlineStore.TinPasteStore.Properties { namespace OnlineStore.VerticalStore.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
<ProjectGuid>{0D2542F5-DD62-4352-82D0-383D9A045E74}</ProjectGuid> <ProjectGuid>{0D2542F5-DD62-4352-82D0-383D9A045E74}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.TinPasteStore</RootNamespace> <RootNamespace>OnlineStore.VerticalStore</RootNamespace>
<AssemblyName>TinPasteStore</AssemblyName> <AssemblyName>VerticalStore</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!