Commit ad54abf3 LN

出入库逻辑

1 个父辈 59dbda57
......@@ -12,7 +12,7 @@ namespace OnlineStore.Common
public class AcSerialBean
{
#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 object lockObj = new object();
......@@ -177,7 +177,7 @@ namespace OnlineStore.Common
}
catch (Exception Ex)
{
LogUtil.error(LOGGER, Ex.ToString());
LogUtil.error( Ex.ToString());
//throw Ex;
}
return ok;
......@@ -268,7 +268,7 @@ namespace OnlineStore.Common
// catch (Exception ex)
// {
// _serialPort.DiscardOutBuffer();
// LogUtil.error(LOGGER, "SendData ERROR:" + ex.ToString(), 21);
// LogUtil.error( "SendData ERROR:" + ex.ToString(), 21);
// }
// }
......@@ -323,7 +323,7 @@ namespace OnlineStore.Common
catch (Exception ex)
{
isOk = false;
LogUtil.error(LOGGER, "SendCommand ERROR:" + ex.ToString(), 20);
LogUtil.error( "SendCommand ERROR:" + ex.ToString(), 20);
}
finally
{
......
......@@ -12,7 +12,7 @@ namespace OnlineStore.Common
{
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;
......@@ -20,7 +20,7 @@ namespace OnlineStore.Common
{
if (seq.Equals(Int32.MaxValue))
{
LOGGER.Info("seq当前值:" + seq + ",重置seq=0");
LogUtil.info("seq当前值:" + seq + ",重置seq=0");
seq = 0;
}
Interlocked.Increment(ref seq);
......@@ -78,7 +78,7 @@ namespace OnlineStore.Common
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LOGGER.Error("未找到配置:" + key + ",请检查配置是否完整!");
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return "";
}
else
......@@ -93,7 +93,7 @@ namespace OnlineStore.Common
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LOGGER.Error("未找到配置:" + key + ",请检查配置是否完整!");
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
......@@ -110,7 +110,7 @@ namespace OnlineStore.Common
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LOGGER.Error("未找到配置:" + key + ",请检查配置是否完整!");
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
......@@ -145,7 +145,7 @@ namespace OnlineStore.Common
}
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
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + "," + ex.StackTrace);
LogUtil.error( "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + "," + ex.StackTrace);
}
}
///<summary>
......@@ -199,7 +199,7 @@ namespace OnlineStore.Common
}
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
{
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)
{
return Post(url, paramData, Encoding.UTF8);
......@@ -45,7 +45,7 @@ namespace OnlineStore.Common
{//入库或出库
string json = JsonHelper.SerializeObject(operation);
LogUtil.error(LOGGER, "模拟HTTP服务器返回出库入库信息:" + json);
LogUtil.error( "模拟HTTP服务器返回出库入库信息:" + json);
return operation;
}
}
......@@ -58,7 +58,7 @@ namespace OnlineStore.Common
}
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);
if (!string.IsNullOrEmpty(result))
......@@ -69,14 +69,14 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LOGGER.Error("JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex);
LogUtil.error("JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex);
}
}
}
}
catch (Exception ex)
{
LOGGER.Error("Post 出错【operation.op=" + operation.op + "】:" + ex);
LogUtil.error("Post 出错【operation.op=" + operation.op + "】:" + ex);
}
return null;
}
......@@ -85,7 +85,7 @@ namespace OnlineStore.Common
{
if (isLog == 1)
{
LOGGER.Info("给服务器发送数据【" + paramData + "】 ");
LogUtil.info("给服务器发送数据【" + paramData + "】 ");
}
if (paramData != "null" && paramData != null)
{
......@@ -111,7 +111,7 @@ namespace OnlineStore.Common
}
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)
{
......@@ -119,7 +119,7 @@ namespace OnlineStore.Common
}
if (isLog == 1)
{
LOGGER.Info("收到服务器数据【" + result + "】");
LogUtil.info("收到服务器数据【" + result + "】");
}
return result;
}
......@@ -133,19 +133,19 @@ namespace OnlineStore.Common
{
try
{
LogUtil.info(LOGGER, "HTTP GET FROM: " + url);
LogUtil.info( "HTTP GET FROM: " + url);
var wc = new WebClient { Encoding = encoding };
var readStream = wc.OpenRead(url);
using (var sr = new StreamReader(readStream, encoding))
{
var result = sr.ReadToEnd();
LogUtil.info(LOGGER, "receive << " + result);
LogUtil.info( "receive << " + result);
return result;
}
}
catch (Exception e)
{
LogUtil.error(LOGGER, "HTTP GET ERROR:" + e.Message, 2);
LogUtil.error( "HTTP GET ERROR:" + e.Message, 2);
}
return "";
}
......
......@@ -5,118 +5,97 @@ using System.Text;
using log4net;
using System.Reflection;
using System.Drawing;
using System.Runtime.ExceptionServices;
using System.Collections.Concurrent;
namespace OnlineStore.Common
{
public class LogUtil
{
public static readonly ILog AIOLog = LogManager.GetLogger("AIOBOX");
private static LogUtil instance = new LogUtil();
public delegate void ShowLog(string msg, Color color);
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static Dictionary<int, DateTime> lastErrorLogTime = new Dictionary<int, DateTime>();
public static readonly ILog LOGGER = LogManager.GetLogger("RollingLogFileAppender");
public static ConcurrentDictionary<int, DateTime> lastErrorLogTime = new ConcurrentDictionary<int, DateTime>();
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 void info(ILog log,string msg )
public static void info(ILog log, string msg)
{
if (log == null)
{
return;
}
log.Info(log.Logger.Name + " - " + msg);
if (logBox == null)
{
return;
}
log.Info(msg);
AddToBox(msg, Color.Black);
//clear();
}
public static void info(ILog log,string msg, Color color)
{
log.Info(log.Logger.Name + " - " + msg);
if (logBox == null)
public static void info(ILog log, string msg, Color color)
{
return;
}
log.Info(msg);
AddToBox(msg, color);
}
public static void debug(ILog log, string msg, Color color)
{
log.Debug(log.Logger.Name + " - " + msg);
log.Debug(msg);
if (debug_opened)
{
if (logBox == null)
{
return;
}
AddToBox(msg, color);
}
}
public static void debug(ILog log, string msg)
{
log.Debug(log.Logger.Name + " - " + msg);
log.Debug(msg);
if (debug_opened)
{
if (logBox == null)
{
return;
}
AddToBox(msg, Color.Gray);
}
}
private static List<string> lasErrorLogList = new List<string>();
private static int errCount = 5;
public static void error(string errorMsg, int type)
public static void error(string errorMsg, int type, int seconds = 10)
{
error(LOGGER, errorMsg, type);
}
public static void error(ILog log, string errorMsg,int type)
try
{
if (lastErrorLogTime.ContainsKey(type))
{
TimeSpan span = DateTime.Now - lastErrorLogTime[type];
if (span.TotalSeconds < 10)
if (span.TotalSeconds > seconds)
{
return;
lastErrorLogTime[type] = DateTime.Now;
error(LOGGER, errorMsg);
}
}
else
{
lastErrorLogTime.Remove(type);
lastErrorLogTime.Add(type, DateTime.Now);
error(log, errorMsg);
lastErrorLogTime.TryAdd(type, DateTime.Now);
error(LOGGER, errorMsg);
}
}
else
catch (Exception ex)
{
lastErrorLogTime.Add(type, DateTime.Now);
error(log, errorMsg);
LogUtil.error(" 打印日志【" + type + "-" + errorMsg + "】出错:" + ex.ToString());
}
}
public static void error(ILog log, string errorMsg)
public static void error(ILog log, string errorMsg, Exception ex = null)
{
//if (!lasErrorLogList.Contains(errorMsg))
{
log.Error(log.Logger.Name + " - " + errorMsg);
if (logBox == null)
if (errorMsg.Trim().Equals("") && (ex == null))
{
return;
}
AddToBox(errorMsg, Color.Red);
if (ex == null)
{
log.Error(errorMsg);
}
//lasErrorLogList.Add(errorMsg);
//if (lasErrorLogList.Count > errCount)
//{
// lasErrorLogList.RemoveAt(0);
//}
else
{
log.Error(errorMsg, ex);
}
AddToBox(errorMsg, Color.Red);
}
private static void AddToBox(string msg, Color color)
{
......@@ -126,52 +105,98 @@ namespace OnlineStore.Common
}
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)
{
try
{
//clear();
if (count > showCount)
if (logList.Count > 0)
{
// logList.RemoveAt(0);
}
if (logList.Count >= showCount)
{
logList.RemoveAt(0);
}
string text = "";
foreach (string str in logList)
{
count = 0;
logBox.Clear();
text += str;
}
//logBox.SelectionColor = color;
System.DateTime now = System.DateTime.Now;
logBox.AppendText(now.ToLongTimeString() + " " + msg + Environment.NewLine);
count++;
logList.Add(now.ToLongTimeString() + " " + msg + Environment.NewLine);
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()
{
if (logBox != null)
{
LastText = "";
logList.Clear();
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)
{
info(LOGGER,msg );
info(LOGGER, msg);
}
}
......
......@@ -13,7 +13,7 @@ namespace OnlineStore.Common
/// </summary>
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>
......@@ -50,7 +50,7 @@ namespace OnlineStore.Common
// }
// catch (Exception ex)
// {
// LOGGER.Error(ex);
// LogUtil.error(ex);
// }
//}
return message;
......
......@@ -12,7 +12,7 @@ namespace OnlineStore.Common
{
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);
private Socket m_clientSocket;
......@@ -91,17 +91,17 @@ namespace OnlineStore.Common
{
m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null);
onReceived = HandleMessage;
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " success!");
LogUtil.info( "Connect to " + serverIP + ":" + serverPort + " success!");
return true;
}
else
{
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " fail!");
LogUtil.info( "Connect to " + serverIP + ":" + serverPort + " fail!");
}
}
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;
}
return false;
......@@ -115,11 +115,11 @@ namespace OnlineStore.Common
if (m_clientSocket != null)
{
m_clientSocket.Close();
LogUtil.info(LOGGER,"Socket closed!");
LogUtil.info("Socket closed!");
}
else
{
LogUtil.error(LOGGER,"No socket is running!");
LogUtil.error("No socket is running!");
}
}
......@@ -135,7 +135,7 @@ namespace OnlineStore.Common
{
m_clientSocket.Send(sendBuffer);
LogUtil.debug(LOGGER,"Send >> " + strSendData);
LogUtil.debug("Send >> " + strSendData);
}
}
......@@ -153,7 +153,7 @@ namespace OnlineStore.Common
}
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
{
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 Socket m_serverSocket;
......@@ -39,7 +39,7 @@ namespace OnlineStore.Common
}
}
}
LogUtil.info(LOGGER, iplist + "]");
LogUtil.info( iplist + "]");
}
/// <summary>
......@@ -59,7 +59,7 @@ namespace OnlineStore.Common
m_serverThread = new Thread(new ThreadStart(ReceiveAccept));
m_serverThread.Start();
LogUtil.info(LOGGER, " Server start listen : " + m_serverPort);
LogUtil.info( " Server start listen : " + m_serverPort);
logLocalIp();
//this.AddRunningInfo(">> " + DateTime.Now.ToString() + " Server started.");
......@@ -101,14 +101,14 @@ namespace OnlineStore.Common
client.ClientSocket = m_serverSocket.Accept();
IPEndPoint clientipe = (IPEndPoint)client.ClientSocket.RemoteEndPoint;
client.ipAdd = clientipe.Address;
LogUtil.info(LOGGER, "有新的客户端链接上:" + client.ipAdd.ToString());
LogUtil.info( "有新的客户端链接上:" + client.ipAdd.ToString());
receiveMessageDelegate = new ReceiveMessageDelegate(ReceiveMessages);
receiveMessageDelegate.BeginInvoke(client, ReceiveMessagesCallback, "");
}
catch (Exception ex)
{
LogUtil.error(LOGGER, ex.Message);
LogUtil.error( ex.Message);
//throw new Exception(ex.Message);
}
}
......@@ -158,11 +158,11 @@ namespace OnlineStore.Common
}
catch (SocketException e)
{
LogUtil.error(LOGGER, e.ToString(), 6);
LogUtil.error( e.ToString(), 6);
}
catch (Exception ex)
{
LogUtil.error(LOGGER, ex.ToString(), 5);
LogUtil.error( ex.ToString(), 5);
}
}
//private void ReceiveMessages(Client client)
......@@ -180,10 +180,10 @@ namespace OnlineStore.Common
// if (!string.IsNullOrEmpty(strReceiveData))
// {
// LogUtil.info(LOGGER, "收到数据:" + strReceiveData);
// LogUtil.info( "收到数据:" + strReceiveData);
// // this.AddRunningInfo(">> Receive data from [" + client.ClientSocket.RemoteEndPoint.ToString()+ "]:" + 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);
// byte[] sendBuffer = new byte[sendBufferSize];
// sendBuffer = Encoding.Unicode.GetBytes(strSendData);
......@@ -194,11 +194,11 @@ namespace OnlineStore.Common
// }
// catch (SocketException e)
// {
// LogUtil.error(LOGGER, e.ToString());
// LogUtil.error( e.ToString());
// }
// catch (Exception ex)
// {
// LOGGER.Error(ex.ToString());
// LogUtil.error(ex.ToString());
// }
//}
......@@ -210,7 +210,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LOGGER.Error(ex.ToString());
LogUtil.error(ex.ToString());
}
}
......
......@@ -12,7 +12,7 @@ namespace OnlineStore.Common
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 Socket udpServer;
......@@ -37,7 +37,7 @@ namespace OnlineStore.Common
}
}
}
LogUtil.info(LOGGER, iplist + "]");
LogUtil.info( iplist + "]");
}
......
貫零,욋貫잚謹,膽邱섬,죕분욱똑,죕분멕똑,죕꾑ID,좋됐乞多,죕떱旗瘻菉貫零P2
P_1_1,1,1,210,300,1,1,10000
P_1_2,1,2,210,300,1,2,10000
P_1_3,1,3,210,300,1,3,10000
P_1_4,1,4,210,300,1,4,10000
P_1_5,1,5,210,300,1,5,10000
P_1_6,1,6,210,300,1,6,10000
P_1_7,1,7,210,300,1,7,10000
P_1_8,1,8,210,300,1,8,10000
P_1_9,1,9,210,300,1,9,10000
P_1_10,1,10,210,300,1,10,10000
P_2_1,1,11,210,300,1,11,50000
P_2_2,1,12,210,300,1,12,50000
P_2_3,1,13,210,300,1,13,50000
P_2_4,1,14,210,300,1,14,50000
P_2_5,1,15,210,300,1,15,50000
P_2_6,1,16,210,300,1,16,50000
P_2_7,1,17,210,300,1,17,50000
P_2_8,1,18,210,300,1,18,50000
P_2_9,1,19,210,300,1,19,50000
P_2_10,1,20,210,300,1,20,50000
P_3_1,2,21,400,300,1,21;22,90000
P_3_2,2,22,400,300,1,23;24,90000
P_3_3,2,23,400,300,1,25;26,90000
P_3_4,2,24,400,300,1,21;23,90000
P_3_5,2,25,400,300,1,23;25,90000
P_4_1,2,26,400,300,1,25;27,130000
P_4_2,2,27,400,300,1,21;24,130000
P_4_3,2,28,400,300,1,23;26,130000
P_4_4,2,29,400,300,1,25;28,130000
P_4_5,2,30,400,300,1,21;25,130000
位置,库位类型,优先级,料盒宽度,料盒高度,料仓ID,灯区域索引,亮灯索引,料斗旋转轴位置P2
P_1_1,1,1,210,300,1,0,1,10000
P_1_2,1,2,210,300,1,0,2,10000
P_1_3,1,3,210,300,1,0,3,10000
P_1_4,1,4,210,300,1,0,4,10000
P_1_5,1,5,210,300,1,0,5,10000
P_1_6,1,6,210,300,1,0,6,10000
P_1_7,1,7,210,300,1,0,7,10000
P_1_8,1,8,210,300,1,0,8,10000
P_1_9,1,9,210,300,1,0,9,10000
P_1_10,1,10,210,300,1,0,10,10000
P_2_1,1,11,210,300,1,0,11,50000
P_2_2,1,12,210,300,1,0,12,50000
P_2_3,1,13,210,300,1,0,13,50000
P_2_4,1,14,210,300,1,0,14,50000
P_2_5,1,15,210,300,1,0,15,50000
P_2_6,1,16,210,300,1,0,16,50000
P_2_7,1,17,210,300,1,0,17,50000
P_2_8,1,18,210,300,1,0,18,50000
P_2_9,1,19,210,300,1,0,19,50000
P_2_10,1,20,210,300,1,0,20,50000
P_3_1,2,21,400,300,1,0,21;22,90000
P_3_2,2,22,400,300,1,0,23;24,90000
P_3_3,2,23,400,300,1,0,25;26,90000
P_3_4,2,24,400,300,1,0,21;23,90000
P_3_5,2,25,400,300,1,0,23;25,90000
P_4_1,2,26,400,300,1,0,25;27,130000
P_4_2,2,27,400,300,1,0,21;24,130000
P_4_3,2,28,400,300,1,0,23;26,130000
P_4_4,2,29,400,300,1,0,25;28,130000
P_4_5,2,30,400,300,1,0,21;25,130000
......@@ -139,6 +139,8 @@ namespace OnlineStore.DeviceLibrary
private void StartReset()
{
CanCloseDoor = false;
WaitCanCloseDoor = false;
WarnMsg = "";
isInSuddenDown = false;
CurrInOutCount = 0;
......@@ -417,9 +419,7 @@ namespace OnlineStore.DeviceLibrary
else if (runStatus.Equals(StoreRunStatus.Runing))
{
IOTimeOutProcess();
}
}
catch (Exception ex)
{
......@@ -427,7 +427,6 @@ namespace OnlineStore.DeviceLibrary
}
}
private DateTime preIoTimerOutTime = DateTime.Now;
private void IOTimeOutProcess()
{
......@@ -491,8 +490,6 @@ namespace OnlineStore.DeviceLibrary
}
checkAlarmTime = DateTime.Now;
bool isInAlarm = false;
//Task.Factory.StartNew(delegate
// {
foreach (ConfigMoveAxis axisInfo in moveAxisList)
{
short axis = axisInfo.GetAxisValue();
......@@ -518,8 +515,6 @@ namespace OnlineStore.DeviceLibrary
}
AxisAlarmCodeMap[deviceName] = info;
}
//});
//判断报警状态
return isInAlarm;
}
#endregion
......@@ -600,31 +595,7 @@ namespace OnlineStore.DeviceLibrary
#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;
public void server_connect_timer_Tick(object sender, EventArgs e)
{
......@@ -644,7 +615,6 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("定时给服务器发送消息出错:" + ex.ToString());
}
}
HumidityProcess();
LedProcess();
isInProcess = false;
}
......@@ -723,12 +693,12 @@ namespace OnlineStore.DeviceLibrary
DateTime time = DateTime.Now;
//构建发送给服务器的对象
Operation lineOperation = getLineBoxStatus();
//如果还没湿度范围,先获取
if (Max_Humidity <= 0 || (Max_Temperature <= 0))
{
lineOperation.op = 5;
LogUtil.info( Name + "没有湿度预警范围,需要从服务器获取,发送OP=" + lineOperation.op);
}
////如果还没湿度范围,先获取
//if (Max_Humidity <= 0 || (Max_Temperature <= 0))
//{
// lineOperation.op = 5;
// LogUtil.info( Name + "没有湿度预警范围,需要从服务器获取,发送OP=" + lineOperation.op);
//}
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), lineOperation, false);
......@@ -763,24 +733,24 @@ namespace OnlineStore.DeviceLibrary
private void ProcessHumidityCMD(Operation resultOperation)
{
Dictionary<string, string> data = resultOperation.data;
if (data != null && data.ContainsKey(ParamDefine.maxHumidity) && data.ContainsKey(ParamDefine.maxTemperature))
{
string maxHumidity = data[ParamDefine.maxHumidity];
string maxTemp = data[ParamDefine.maxTemperature];
LogUtil.info( "收到服务器温湿度预警值:maxHumidity=" + maxHumidity + ",maxTemperature=" + maxTemp);
//Dictionary<string, string> data = resultOperation.data;
//if (data != null && data.ContainsKey(ParamDefine.maxHumidity) && data.ContainsKey(ParamDefine.maxTemperature))
//{
// string maxHumidity = data[ParamDefine.maxHumidity];
// string maxTemp = data[ParamDefine.maxTemperature];
// LogUtil.info( "收到服务器温湿度预警值:maxHumidity=" + maxHumidity + ",maxTemperature=" + maxTemp);
try
{
this.Max_Humidity = (float)Convert.ToDouble(maxHumidity);
this.Max_Temperature = (float)Convert.ToDouble(maxTemp);
LogUtil.info( "保存温湿度预警值:Max_Humidity=" + Max_Humidity + ",Max_Temperature=" + Max_Temperature);
}
catch (Exception ex)
{
LogUtil.error("转换温湿度失败:" + ex.ToString());
}
}
// try
// {
// this.Max_Humidity = (float)Convert.ToDouble(maxHumidity);
// this.Max_Temperature = (float)Convert.ToDouble(maxTemp);
// LogUtil.info( "保存温湿度预警值:Max_Humidity=" + Max_Humidity + ",Max_Temperature=" + Max_Temperature);
// }
// catch (Exception ex)
// {
// LogUtil.error("转换温湿度失败:" + ex.ToString());
// }
//}
}
private void ReviceOutStoreProcess(Operation resultOperation)
......@@ -1037,7 +1007,6 @@ namespace OnlineStore.DeviceLibrary
string msg = "";
msg += "" + runStatus +" _ "+ storeStatus+ " _ "+ alarmType+"\n";
msg += MoveInfo.MoveType + " _ "+MoveInfo.MoveStep + "\n";
msg += currTempStr;
return msg;
}
}
......
......@@ -12,6 +12,8 @@ namespace OnlineStore.DeviceLibrary
{
partial class VerticalStoreBean
{
public bool WaitCanCloseDoor = false;
public bool CanCloseDoor = false;
private Stopwatch moveWatch = new Stopwatch();
#region 自动出入库参数
private int CurrInOutCount = 0;
......@@ -58,7 +60,7 @@ namespace OnlineStore.DeviceLibrary
string msg = "";
if (wait.IsHomeMove)
{
wait.IsEnd =AxisBean. HomeMoveIsEnd(MoveInfo, wait.AxisInfo, out msg);
wait.IsEnd = AxisBean.HomeMoveIsEnd(MoveInfo, wait.AxisInfo, out msg);
}
else
{
......@@ -76,10 +78,7 @@ namespace OnlineStore.DeviceLibrary
{
wait.IsEnd = IOManager.IOValue(wait.IoType).Equals(wait.IoValue);
int timeOutMs = Config.IOSingle_TimerOut;
if (MoveInfo.MoveStep == StoreMoveStep.SO_18_WaitTake)
{
timeOutMs = 650000;
}
if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
{
ConfigIO io = Config.getWaitIO(wait.IoType);
......@@ -94,6 +93,11 @@ namespace OnlineStore.DeviceLibrary
{
wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
}
else if (wait.WaitType.Equals(7))
{
wait.IsEnd =( CanCloseDoor);
}
if (wait.IsEnd)
{
if (MoveInfo.OneWaitCanEndStep)
......@@ -129,240 +133,113 @@ namespace OnlineStore.DeviceLibrary
#region 入库
public override bool StartInStore(InOutParam param, bool isNeedCheckIO = false)
public override bool StartInStore(InOutParam param)
{
WaitCanCloseDoor = false;
param.paramType = MoveType.InStore;
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 + "失败,找不到库位信息");
return false;
}
LogUtil.info(Name + " 启动 " + param.LogName );
LogUtil.info(Name + " 启动 " + param.LogName);
moveWatch.Restart();
runStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute;
MoveInfo.NewMove(MoveType.InStore, param);
if (isNeedCheckIO)
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_01_TrayCheck);
InStoreLog(" 检测料盘信号");
}
else
{
//SI_02_InOutToP1(MoveInfo.MoveParam.MoveP);
}
MoveInfo.NextMoveStep(StoreMoveStep.SI_01_Wait);
InStoreLog("开始入库:等待光栅未被遮挡");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SafetyLightCurtains, IO_VALUE.HIGH));
return true;
}
else
{
LogUtil.error(Name + " 启动 " + param.LogName + "出错,当前状态:[" + runStatus+"],["+MoveInfo.MoveType+"]");
LogUtil.error(Name + " 启动 " + param.LogName + "出错,当前状态:[" + runStatus + "],[" + MoveInfo.MoveType + "]");
return false;
}
}
protected override void InStoreProcess()
{
//StoreMoveP moveP = MoveInfo.MoveParam.MoveP;
//if (MoveInfo.IsInWait)
//{
// 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)
{
CheckWait();
}
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
......@@ -370,43 +247,37 @@ namespace OnlineStore.DeviceLibrary
public override bool StartOutStore(InOutParam param)
{
//param.paramType = MoveType.OutStore;
//if (runStatus.Equals(StoreRunStatus.Runing) && MoveInfo.MoveType.Equals(MoveType.None))
//{
// if (!param.LoadParam(Config))
// {
// LogUtil.error(Name + " 启动 " + param.LogName + "失败,找不到库位");
// return false;
// }
// if (IOManager.IOValue(IO_Type.TinCheck_Fixture).Equals(IO_VALUE.HIGH))
// {
// LogUtil.error(Name + " 启动 " + param.LogName + "失败,叉子料盘检测有料");
// return false;
// }
// moveWatch.Restart();
// LogUtil.info(Name + "启动 " + param.LogName + " ");
// runStatus = StoreRunStatus.Busy;
// storeStatus = StoreStatus.OutStoreExecute;
// MoveInfo.NewMove(MoveType.OutStore, param);
// MoveInfo.NextMoveStep(StoreMoveStep.SO_01_InoutToP1);
// ConfigMoveAxis axis = GetPosTAxis();
// OutStoreLog(" 叉子先运动到P1 ," + axis.ProName + "停止匀速运动");
// InOutBackToP1(MoveInfo.MoveParam.MoveP.InOut_P1);
// AxisSuddenStop(axis);
// return true;
//}
//else
//{
// LogUtil.error(Name + " 启动 " + param.LogName + "出错,当前状态:[" + runStatus + "],[" + MoveInfo.MoveType + "]");
WaitCanCloseDoor = false;
param.paramType = MoveType.OutStore;
if (runStatus.Equals(StoreRunStatus.Runing) && MoveInfo.MoveType.Equals(MoveType.None))
{
if (param.Position == null)
{
LogUtil.error(Name + " 启动 " + param.LogName + "失败,找不到库位信息");
return false;
}
moveWatch.Restart();
LogUtil.info(Name + "启动 " + param.LogName + " ");
runStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.OutStoreExecute;
MoveInfo.NewMove(MoveType.OutStore, param);
MoveInfo.NextMoveStep(StoreMoveStep.SO_01_Wait);
InStoreLog("开始出库:等待光栅未被遮挡");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SafetyLightCurtains, IO_VALUE.HIGH));
return true;
}
else
{
LogUtil.error(Name + " 启动 " + param.LogName + "出错,当前状态:[" + runStatus + "],[" + MoveInfo.MoveType + "]");
return false;
//}
}
}
protected override void OutStoreProcess()
{
//StoreMoveP moveP = MoveInfo.MoveParam.MoveP;
if (MoveInfo.IsInWait)
{
CheckWait();
......@@ -415,197 +286,85 @@ namespace OnlineStore.DeviceLibrary
{
return;
}
//if (MoveInfo.MoveStep .Equals( StoreMoveStep.SO_01_InoutToP1))
//{
// 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()
if (MoveInfo.IsStep(StoreMoveStep.SO_01_Wait))
{
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
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)
{
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosId : "";
......@@ -691,10 +450,6 @@ namespace OnlineStore.DeviceLibrary
}
}
private void AddWaitMoveParam(InOutParam newParam)
{
throw new NotImplementedException();
}
private void InStoreLog(string msg)
{
......@@ -708,16 +463,6 @@ namespace OnlineStore.DeviceLibrary
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)
{
LogUtil.info(Name+" "+MoveInfo.MoveType+ " ["+MoveInfo.MoveStep+"] " + msg);
......
......@@ -210,7 +210,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 开始入库移动移动
/// </summary>
public abstract bool StartInStore(InOutParam param, bool isNeedCheckIO = false);
public abstract bool StartInStore(InOutParam param );
protected abstract void InStoreProcess();
#endregion
......
......@@ -148,9 +148,9 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
SO_02_CloseDoor ,
/// <summary>
/// 出库: 旋转轴到P1
/// 出库:旋转轴到P2
/// </summary>
SO_03_MiddleToP1 ,
SO_03_MiddleToP2 ,
/// <summary>
/// 出库:打开升降门,打开库位灯
/// </summary>
......@@ -175,15 +175,15 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
///入库:等待光栅未被遮挡
/// </summary>
SI_01_Wait = 1001,
SI_01_Wait = 2001,
/// <summary>
///入库:关闭升降门
/// </summary>
SI_02_CloseDoor,
/// <summary>
/// 入库: 旋转轴到P1
/// 入库: 旋转轴到P2
/// </summary>
SI_03_MiddleToP1,
SI_03_MiddleToP2,
/// <summary>
/// 入库:打开升降门,打开库位灯
/// </summary>
......
......@@ -228,6 +228,15 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = false;
return wait;
}
internal static WaitResultInfo WaitCloseDoor()
{
WaitResultInfo wait = new WaitResultInfo();
wait.CanWhileMoveCount = 0;
wait.WaitType = 7;
wait.IsEnd = false;
return wait;
}
public string ToStr()
{
......@@ -262,11 +271,16 @@ namespace OnlineStore.DeviceLibrary
{
return "轴【" + AxisInfo.DisplayStr + "】ORG信号:【" + IoValue + "】 ";
}
else if (WaitType.Equals(7))
{
return "可以关闭升降门";
}
else
{
return "Wait位置类型:WaitType=【" + WaitType + "】";
}
}
/// <summary>
/// 当未结束时可以重复运动的次数
/// </summary>
......
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.IO;
......@@ -12,7 +13,7 @@ namespace OnlineStore.LoadCSVLibrary
public class CSVReaderBase
{
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>
/// 获取一个类所有的《字段,AttributeName列名》集合
/// </summary>
......@@ -109,12 +110,12 @@ namespace OnlineStore.LoadCSVLibrary
}
catch (Exception e)
{
LOGGER.Error("出错:", e);
LogUtil.error("出错:", e);
}
}
catch (Exception ex)
{
LOGGER.Error(ex.ToString());
LogUtil.error(ex.ToString());
return false;
}
return true;
......@@ -151,7 +152,7 @@ namespace OnlineStore.LoadCSVLibrary
{
if (!titleIndex.ContainsKey(str))
{
LOGGER.Error("未找到必须列:" + str + ",加载数据失败!");
LogUtil.error("未找到必须列:" + str + ",加载数据失败!");
throw new CVSFieldNotMatchingExection("未找到必须列:" + str + ",加载数据失败!");
}
}
......

using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Data;
......@@ -50,7 +51,7 @@ namespace OnlineStore.LoadCSVLibrary
{
if (hasReadFileList.Contains(filePath))
{
LOGGER.Error("文件" + filePath + "已经加载过,直接返回null");
LogUtil.error("文件" + filePath + "已经加载过,直接返回null");
return null;
}
Type type = typeof(T);
......@@ -58,7 +59,7 @@ namespace OnlineStore.LoadCSVLibrary
Dictionary<string, string> proTitleMap = getProAttributeMap(typeof(T));
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> propertyList = new List<string>(proTitleMap.Keys);
......@@ -116,12 +117,12 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
LOGGER.Error("读取csv,index=" + index + ",数据格式不匹配!,line=" + line);
LogUtil.error("读取csv,index=" + index + ",数据格式不匹配!,line=" + line);
}
}
catch (Exception ex)
{
LOGGER.Debug( "CSV 读取行【" + line + "】行转换失败");
LogUtil.debug( "CSV 读取行【" + line + "】行转换失败");
}
}
index++;
......@@ -156,7 +157,7 @@ namespace OnlineStore.LoadCSVLibrary
Dictionary<string, string> proTitleMap = getProAttributeMap(typeof(T));
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> propertyList = new List<string>(proTitleMap.Keys);
......
......@@ -34,10 +34,15 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
[CSVAttribute("亮灯索引")]
public string LedIndex { get; set; }
/// <summary>
/// 亮灯索引
/// </summary>
[CSVAttribute("灯区域索引")]
public int LedDmx { get; set; }
private List<int> LedList = null;
public List<int> GetLedList(bool isReload)
public List<int> GetLedList(bool isReload = false )
{
if (LedList == null || isReload)
{
......
using System;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
......@@ -45,7 +46,7 @@ namespace OnlineStore.LoadCSVLibrary
//必须有列【类型】
if (allTitleIndex.Count < 0 || !allTitleIndex.ContainsKey("类型"))
{
LOGGER.Error("未找到必须列:类型,加载数据失败!");
LogUtil.error("未找到必须列:类型,加载数据失败!");
throw new CVSFieldNotMatchingExection("未找到必须列:类型,加载数据失败!");
}
typeIndex = allTitleIndex["类型"];
......@@ -117,14 +118,14 @@ namespace OnlineStore.LoadCSVLibrary
}
catch (Exception ex)
{
LOGGER.Error("filepath=" + filePath + ",index=" + index + ",key=" + key + "出错:" + ex.ToString());
LogUtil.error("filepath=" + filePath + ",index=" + index + ",key=" + key + "出错:" + ex.ToString());
}
listIndex++;
}
}
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();
......@@ -143,14 +144,14 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
LOGGER.Error("配置的料仓类型=" + storeType + "未找到处理方法!");
LogUtil.error("配置的料仓类型=" + storeType + "未找到处理方法!");
}
return LoadConfig(config);
}
public static StoreConfig LoadConfig(StoreConfig config)
{
LOGGER.Info("开始读取文件:" + config.ConfigFilePath);
LogUtil.info("开始读取文件:" + config.ConfigFilePath);
if (config == null || config.ConfigFilePath.Equals(""))
{
return null;
......@@ -205,7 +206,7 @@ namespace OnlineStore.LoadCSVLibrary
}
}
catch (Exception e) {
LOGGER.Error("出错:" + e.ToString());
LogUtil.error("出错:" + e.ToString());
}
string newLine = "";
foreach (string s in newArray)
......
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -13,7 +14,7 @@ namespace OnlineStore.LoadCSVLibrary
public class ConfigBase
{
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>
/// DI=输入IO,DO=输出IO,PRO=属性,AXIS=轴
/// </summary>
......@@ -44,7 +45,7 @@ namespace OnlineStore.LoadCSVLibrary
}
catch (Exception ex)
{
LOGGER.Error("出错:", ex);
LogUtil.error("出错:", ex);
}
return value;
}
......@@ -313,7 +314,7 @@ namespace OnlineStore.LoadCSVLibrary
}
catch (Exception ex)
{
LOGGER.Error("出错了:", ex);
LogUtil.error ("出错了:", ex);
return -1;
}
return IoValue;
......
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -9,7 +10,7 @@ namespace OnlineStore.LoadCSVLibrary
{
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>
/// ID
/// </summary>
......@@ -117,7 +118,7 @@ namespace OnlineStore.LoadCSVLibrary
else
{
AddProBuffer(con, proBuilder);
LOGGER.Error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
}
}
else if (con.ProType == ConfigItemType.DI)
......@@ -133,9 +134,9 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
LOGGER.Error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
}
AddBuffer(con, builder);
LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
}
}
else if (con.ProType == ConfigItemType.DO)
{
......@@ -150,18 +151,18 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
LOGGER.Error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
}
AddBuffer(con, builder);
LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
}
}
}
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))
{
LOGGER.Error(builder.ToString());
LogUtil.error(builder.ToString());
}
if (checkProList.Count >= 0)
{
......
......@@ -6,7 +6,7 @@
<appSettings>
<!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1"/>
<add key="App_Title" value="锡膏料仓"/>
<add key="App_Title" value="垂直货柜"/>
<add key ="ACBaudRate" value ="115200"/>
<!--Server address-->
......@@ -17,7 +17,7 @@
<add key="Store_Position_Config" value="\StoreConfig\linePositions.csv"/>
<add key="Store_ConfigPath" value="\StoreConfig\StoreConfig.csv"/>
<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-->
<!--摄像机名称列表配置,用#分割-->
......@@ -48,6 +48,28 @@
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</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>
<level value="Info"/>
<appender-ref ref="RollingLogFileAppender"/>
......
......@@ -24,7 +24,7 @@ namespace OnlineStore.TinPasteStore
{
private int StoreId = 1;
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()
{
Control.CheckForIllegalCrossThreadCalls = false;
......@@ -105,7 +105,7 @@ namespace OnlineStore.TinPasteStore
catch (Exception ex)
{
MessageBox.Show(ex.StackTrace, "Exception(异常)", MessageBoxButtons.OK, MessageBoxIcon.Error);
LogUtil.error(LOGGER, ex.StackTrace);
LogUtil.error( ex.StackTrace);
}
}
......
......@@ -770,12 +770,14 @@
this.btnCloseDoor.BackColor = System.Drawing.Color.White;
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.Location = new System.Drawing.Point(1019, 114);
this.btnCloseDoor.Location = new System.Drawing.Point(957, 114);
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.Text = "关闭升降门";
this.btnCloseDoor.Text = "料盒已放入/拿出,关闭升降门";
this.btnCloseDoor.UseVisualStyleBackColor = false;
this.btnCloseDoor.Visible = false;
this.btnCloseDoor.Click += new System.EventHandler(this.btnCloseDoor_Click);
//
// panel1
//
......@@ -801,7 +803,7 @@
this.lblWarnMsg.ForeColor = System.Drawing.Color.Red;
this.lblWarnMsg.Location = new System.Drawing.Point(13, 114);
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.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
......
......@@ -25,7 +25,7 @@ namespace OnlineStore.TinPasteStore
{
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()
{
Control.CheckForIllegalCrossThreadCalls = false;
......@@ -41,7 +41,7 @@ namespace OnlineStore.TinPasteStore
this.store = StoreManager.InitStore();
if (store == null)
{
LogUtil.error(LOGGER, "找不到对应的料仓");
LogUtil.error( "找不到对应的料仓");
return;
}
VerticalPosition ktkPosition = null;
......@@ -86,7 +86,7 @@ namespace OnlineStore.TinPasteStore
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "出错:" + ex.StackTrace);
LogUtil.error( "出错:" + ex.StackTrace);
}
}
private bool preOpen = false;
......@@ -211,6 +211,8 @@ namespace OnlineStore.TinPasteStore
btnStartAuTo.Text = "开始自动出入库";
}
}
btnCloseDoor.Visible = (store.WaitCanCloseDoor && (!store.CanCloseDoor));
}
else
{
......@@ -352,7 +354,7 @@ namespace OnlineStore.TinPasteStore
store.AutoStartIndex = currIndex;
string poText = cmbPosition.Text;
store.autoMsg = "自动出库:" + poText;
LogUtil.info(LOGGER, store.Name + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
LogUtil.info( store.Name + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
//store.StartOutStoreMove(new InOutStoreParam("", poText));
store.StartInStore(new InOutParam(MoveType.InStore, poText));
}
......@@ -496,7 +498,7 @@ namespace OnlineStore.TinPasteStore
catch (Exception ex)
{
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
string ip = txtLedIp.Text;
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
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
public const int SW_RESTORE = 9;
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
......@@ -113,7 +113,7 @@ namespace OnlineStore.TinPasteStore
static void LogUnhandledException(object exceptionobj)
{
//这里可以进一步地写日志
LOGGER.Error(exceptionobj.ToString());
LogUtil.error(exceptionobj.ToString());
}
}
}
......@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace OnlineStore.TinPasteStore.Properties {
namespace OnlineStore.VerticalStore.Properties {
using System;
......@@ -39,7 +39,7 @@ namespace OnlineStore.TinPasteStore.Properties {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
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;
}
return resourceMan;
......
......@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace OnlineStore.TinPasteStore.Properties {
namespace OnlineStore.VerticalStore.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
......
......@@ -7,8 +7,8 @@
<ProjectGuid>{0D2542F5-DD62-4352-82D0-383D9A045E74}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.TinPasteStore</RootNamespace>
<AssemblyName>TinPasteStore</AssemblyName>
<RootNamespace>OnlineStore.VerticalStore</RootNamespace>
<AssemblyName>VerticalStore</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!