Commit 6596eb2a LN

日志修改,增加运行日志:RunLogUtil

1 个父辈 fdf38543
正在显示 38 个修改的文件 包含 879 行增加308 行删除
...@@ -49,10 +49,28 @@ ...@@ -49,10 +49,28 @@
<conversionPattern value="[%date][%t]%-5p %m%n" /> <conversionPattern value="[%date][%t]%-5p %m%n" />
</layout> </layout>
</appender> </appender>
<root> <appender name="RunLog" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="logs/log/RunLog-%property{fname}.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=" %m%n" />
</layout>
</appender>
<!--<root>
<level value="Info" /> <level value="Info" />
<appender-ref ref="RollingLogFileAppender" /> <appender-ref ref="RollingLogFileAppender" />
</root> </root>-->
<logger name="RollingLogFileAppender">
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
<logger name="RunLog">
<level value="Info" />
<appender-ref ref="RunLog" />
</logger>
</log4net> </log4net>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
......
...@@ -26,7 +26,7 @@ namespace OnlineStore.ACSingleStore ...@@ -26,7 +26,7 @@ namespace OnlineStore.ACSingleStore
private ConfigMoveAxis comp = null; private ConfigMoveAxis comp = null;
//private int compress_Slv = 0; //private int compress_Slv = 0;
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public FrmAxisDebug(AC_SA_BoxBean boxBean) public FrmAxisDebug(AC_SA_BoxBean boxBean)
{ {
middle = boxBean.Config.Middle_Axis; middle = boxBean.Config.Middle_Axis;
...@@ -41,7 +41,7 @@ namespace OnlineStore.ACSingleStore ...@@ -41,7 +41,7 @@ namespace OnlineStore.ACSingleStore
private void AxisMove(ConfigMoveAxis axis, int speed) private void AxisMove(ConfigMoveAxis axis, int speed)
{ {
LogUtil.debug(LOGGER, "点动:deviceName=" + axis.DeviceName + ",axis=" + axis.GetAxisValue() + ",speed=" + speed); LogUtil.debug( "点动:deviceName=" + axis.DeviceName + ",axis=" + axis.GetAxisValue() + ",speed=" + speed);
ACServerManager.SpeedMove(axis.DeviceName, axis.GetAxisValue(), speed); ACServerManager.SpeedMove(axis.DeviceName, axis.GetAxisValue(), speed);
} }
......
...@@ -24,7 +24,7 @@ namespace OnlineStore.ACSingleStore ...@@ -24,7 +24,7 @@ namespace OnlineStore.ACSingleStore
{ {
private int StoreId = 1; private int StoreId = 1;
private AC_SA_BoxBean boxBean; private AC_SA_BoxBean 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;
...@@ -96,7 +96,7 @@ namespace OnlineStore.ACSingleStore ...@@ -96,7 +96,7 @@ namespace OnlineStore.ACSingleStore
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);
} }
} }
private void btnWriteSingleDO_Click(object sender, EventArgs e) private void btnWriteSingleDO_Click(object sender, EventArgs e)
......
...@@ -27,7 +27,7 @@ namespace OnlineStore.ACSingleStore ...@@ -27,7 +27,7 @@ namespace OnlineStore.ACSingleStore
{ {
private AC_SA_BoxBean store; private AC_SA_BoxBean 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;
...@@ -75,7 +75,7 @@ namespace OnlineStore.ACSingleStore ...@@ -75,7 +75,7 @@ namespace OnlineStore.ACSingleStore
this.store = StoreManager.InitStore(); this.store = StoreManager.InitStore();
if (store == null) if (store == null)
{ {
LogUtil.error(LOGGER, "找不到对应的料仓"); LogUtil.error( "找不到对应的料仓");
this.Close(); this.Close();
return; return;
} }
...@@ -154,7 +154,7 @@ namespace OnlineStore.ACSingleStore ...@@ -154,7 +154,7 @@ namespace OnlineStore.ACSingleStore
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "出错:" + ex.StackTrace); LogUtil.error( "出错:" + ex.StackTrace);
} }
} }
private bool preOpen = false; private bool preOpen = false;
...@@ -399,7 +399,7 @@ namespace OnlineStore.ACSingleStore ...@@ -399,7 +399,7 @@ namespace OnlineStore.ACSingleStore
if (ReturnCode != 0) if (ReturnCode != 0)
{ {
MessageBox.Show("错误码:" + ReturnCode.ToString(), "", MessageBoxButtons.OK); MessageBox.Show("错误码:" + ReturnCode.ToString(), "", MessageBoxButtons.OK);
LogUtil.error(LOGGER, "错误码:" + ReturnCode.ToString()); LogUtil.error( "错误码:" + ReturnCode.ToString());
} }
} }
private void FunctionFail(string funName, System.Int32 ReturnCode) private void FunctionFail(string funName, System.Int32 ReturnCode)
...@@ -407,7 +407,7 @@ namespace OnlineStore.ACSingleStore ...@@ -407,7 +407,7 @@ namespace OnlineStore.ACSingleStore
if (ReturnCode != 0) if (ReturnCode != 0)
{ {
MessageBox.Show("方法:" + funName + ",错误码:" + ReturnCode.ToString(), "", MessageBoxButtons.OK); MessageBox.Show("方法:" + funName + ",错误码:" + ReturnCode.ToString(), "", MessageBoxButtons.OK);
LogUtil.error(LOGGER, "方法:" + funName + ",错误码:" + ReturnCode.ToString()); LogUtil.error( "方法:" + funName + ",错误码:" + ReturnCode.ToString());
} }
} }
...@@ -977,7 +977,7 @@ namespace OnlineStore.ACSingleStore ...@@ -977,7 +977,7 @@ namespace OnlineStore.ACSingleStore
store.AutoStartIndex = currIndex; store.AutoStartIndex = currIndex;
string poText = cmbPosition.Text; string poText = cmbPosition.Text;
store.autoMsg = "自动出库:" + poText; store.autoMsg = "自动出库:" + poText;
LogUtil.info(LOGGER, store.StoreName + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!"); LogUtil.info( store.StoreName + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
//store.StartOutStoreMove(new InOutStoreParam("", poText)); //store.StartOutStoreMove(new InOutStoreParam("", poText));
store.StartInStoreMove(new InOutParam(new InOutPosInfo("AUTOINOUT", poText))); store.StartInStoreMove(new InOutParam(new InOutPosInfo("AUTOINOUT", poText)));
} }
...@@ -1231,7 +1231,7 @@ namespace OnlineStore.ACSingleStore ...@@ -1231,7 +1231,7 @@ namespace OnlineStore.ACSingleStore
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);
} }
} }
private void toolStripMenuItem1_Click(object sender, EventArgs e) private void toolStripMenuItem1_Click(object sender, EventArgs e)
...@@ -1499,7 +1499,7 @@ namespace OnlineStore.ACSingleStore ...@@ -1499,7 +1499,7 @@ namespace OnlineStore.ACSingleStore
store.AutoStartIndex = currIndex; store.AutoStartIndex = currIndex;
string poText = cmbPosition.Text; string poText = cmbPosition.Text;
store.autoMsg = "自动盘点:" + poText; store.autoMsg = "自动盘点:" + poText;
LogUtil.info(LOGGER, store.StoreName + "开启自动盘点模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",盘点开始!"); LogUtil.info( store.StoreName + "开启自动盘点模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",盘点开始!");
//store.StartOutStoreMove(new InOutStoreParam("", poText)); //store.StartOutStoreMove(new InOutStoreParam("", poText));
store.StartInventoryMove(new InOutParam(new InOutPosInfo("AUTOINOUT", poText))); store.StartInventoryMove(new InOutParam(new InOutPosInfo("AUTOINOUT", poText)));
} }
......
...@@ -43,7 +43,7 @@ namespace OnlineStore.ACSingleStore ...@@ -43,7 +43,7 @@ namespace OnlineStore.ACSingleStore
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
...@@ -53,6 +53,7 @@ namespace OnlineStore.ACSingleStore ...@@ -53,6 +53,7 @@ namespace OnlineStore.ACSingleStore
[STAThread] [STAThread]
static void Main(string[] Args) static void Main(string[] Args)
{ {
RunLogUtil.InoutEndLog(new InoutEndLog("name", "type", DateTime.Now.AddMinutes(-1), DateTime.Now));
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
...@@ -93,7 +94,8 @@ namespace OnlineStore.ACSingleStore ...@@ -93,7 +94,8 @@ namespace OnlineStore.ACSingleStore
} }
if (!isShow) if (!isShow)
{ {
log4net.GlobalContext.Properties["fname"] = ConfigAppSettings.GetValue(Setting_Init.Store_CID); log4net.GlobalContext.Properties["fname"] = ConfigAppSettings.GetValue(Setting_Init.Store_CID);
log4net.GlobalContext.Properties["fname"] = ConfigAppSettings.GetValue(Setting_Init.Store_CID);
log4net.Config.XmlConfigurator.Configure(); log4net.Config.XmlConfigurator.Configure();
System.Net.ServicePointManager.DefaultConnectionLimit = 512; System.Net.ServicePointManager.DefaultConnectionLimit = 512;
// XmlConfigurator.Configure(); // XmlConfigurator.Configure();
......
...@@ -67,4 +67,42 @@ PRO,,拍照相机名称,PhotoCamera_Name,,,,,,,,,,,,, ...@@ -67,4 +67,42 @@ PRO,,拍照相机名称,PhotoCamera_Name,,,,,,,,,,,,,
StoreConfig.csv需要增加一行配置: StoreConfig.csv需要增加一行配置:
PRO,是否启用仓门口料盘检测信号,IsUse_Door_Check,1,,,,,,,,,,, PRO,是否启用仓门口料盘检测信号,IsUse_Door_Check,1,,,,,,,,,,,
20200628 增加json日志 打印,需要修改日志配置:
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="logs/Store-%property{fname}.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>
<appender name="RunLog" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="logs/log/RunLog-%property{fname}.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=" %m%n" />
</layout>
</appender>
<!--<root>
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
</root>-->
<logger name="RollingLogFileAppender">
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
<logger name="RunLog">
<level value="Info" />
<appender-ref ref="RunLog" />
</logger>
</log4net>
\ No newline at end of file \ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.Common</RootNamespace> <RootNamespace>OnlineStore.Common</RootNamespace>
<AssemblyName>Common</AssemblyName> <AssemblyName>Common</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
...@@ -44,6 +44,10 @@ ...@@ -44,6 +44,10 @@
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Runtime.Serialization.Primitives, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Runtime.Serialization.Primitives.4.3.0\lib\net46\System.Runtime.Serialization.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
...@@ -68,6 +72,7 @@ ...@@ -68,6 +72,7 @@
<Compile Include="util\NetTCPServer.cs"> <Compile Include="util\NetTCPServer.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="util\RunLogUtil.cs" />
<Compile Include="util\ScanCodeManager.cs" /> <Compile Include="util\ScanCodeManager.cs" />
<Compile Include="util\TcpClient.cs" /> <Compile Include="util\TcpClient.cs" />
<Compile Include="util\TcpServer.cs" /> <Compile Include="util\TcpServer.cs" />
...@@ -76,6 +81,9 @@ ...@@ -76,6 +81,9 @@
<ItemGroup> <ItemGroup>
<WCFMetadata Include="Service References\" /> <WCFMetadata Include="Service References\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="net461" />
</packages>
\ No newline at end of file \ No newline at end of file
...@@ -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();
......
...@@ -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);
} }
} }
} }
......
...@@ -18,7 +18,7 @@ namespace OnlineStore.Common ...@@ -18,7 +18,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 Operation PostOP(string url, Operation operation,out bool isTimeOut) public static Operation PostOP(string url, Operation operation,out bool isTimeOut)
{ {
...@@ -62,7 +62,7 @@ namespace OnlineStore.Common ...@@ -62,7 +62,7 @@ namespace OnlineStore.Common
IsTimeOut = false; IsTimeOut = false;
if (isLog == 1) if (isLog == 1)
{ {
LOGGER.Info("给服务器发送数据【" + paramData + "】 "); LogUtil.info("给服务器发送数据【" + paramData + "】 ");
} }
string result = ""; string result = "";
......
...@@ -14,7 +14,7 @@ namespace OnlineStore.Common ...@@ -14,7 +14,7 @@ namespace OnlineStore.Common
/// </summary> /// </summary>
public class HumitureController public class HumitureController
{ {
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static bool IsRun = false; public static bool IsRun = false;
public static string serialPort = ""; public static string serialPort = "";
...@@ -56,7 +56,7 @@ namespace OnlineStore.Common ...@@ -56,7 +56,7 @@ namespace OnlineStore.Common
} }
else else
{ {
LogUtil.error(LOGGER, LogName + "串口打开失败!"); LogUtil.error( LogName + "串口打开失败!");
IsRun = false; IsRun = false;
return false; return false;
} }
...@@ -236,7 +236,7 @@ namespace OnlineStore.Common ...@@ -236,7 +236,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Info(LogName + "转换出错:" + ex.ToString()); LogUtil.info(LogName + "转换出错:" + ex.ToString());
} }
return list; return list;
} }
...@@ -280,7 +280,7 @@ namespace OnlineStore.Common ...@@ -280,7 +280,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Info(LogName + "转换出错:" + ex.ToString()); LogUtil.info(LogName + "转换出错:" + ex.ToString());
} }
return -1; return -1;
} }
...@@ -307,7 +307,7 @@ namespace OnlineStore.Common ...@@ -307,7 +307,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Info(LogName + "转换出错:" + ex.ToString()); LogUtil.info(LogName + "转换出错:" + ex.ToString());
} }
return list; return list;
} }
......
...@@ -15,7 +15,7 @@ namespace OnlineStore.Common ...@@ -15,7 +15,7 @@ namespace OnlineStore.Common
/// </summary> /// </summary>
public class HumitureServer public class HumitureServer
{ {
private static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //private static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// 最后一次接受到的温度信息,key=温湿度传感器IP地址 /// 最后一次接受到的温度信息,key=温湿度传感器IP地址
...@@ -92,7 +92,7 @@ namespace OnlineStore.Common ...@@ -92,7 +92,7 @@ namespace OnlineStore.Common
} }
TemperateIsStart = true; TemperateIsStart = true;
temperateTcpServer.Start(port); temperateTcpServer.Start(port);
LogUtil.info(LOGGER, "温湿度已开始在端口[" + port + "]监听!"); LogUtil.info( "温湿度已开始在端口[" + port + "]监听!");
temperateTcpServer.ReviceMsgEvent += tcp_ReviceMsgEvent; temperateTcpServer.ReviceMsgEvent += tcp_ReviceMsgEvent;
} }
} }
...@@ -111,7 +111,7 @@ namespace OnlineStore.Common ...@@ -111,7 +111,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "关闭温湿度监听出错:" + ex.ToString()); LogUtil.error( "关闭温湿度监听出错:" + ex.ToString());
} }
} }
...@@ -132,11 +132,11 @@ namespace OnlineStore.Common ...@@ -132,11 +132,11 @@ namespace OnlineStore.Common
string deviceId = strList[10]; string deviceId = strList[10];
string pwd = strList[11]; string pwd = strList[11];
LogUtil.debug(LOGGER, "address=" + add + ",收到:温度=" + wendu + ",湿度=" + shidu + ",设备ID=" + deviceId + ",密码:" + pwd); LogUtil.debug( "address=" + add + ",收到:温度=" + wendu + ",湿度=" + shidu + ",设备ID=" + deviceId + ",密码:" + pwd);
if (shidu <= 0) if (shidu <= 0)
{ {
//湿度小于0不处理 //湿度小于0不处理
LogUtil.info(LOGGER, "address=" + add + ",收到:温度=" + wendu + ",湿度=" + shidu + ",设备ID=" + deviceId + ",密码:" + pwd + ",湿度小于0不处理"); LogUtil.info( "address=" + add + ",收到:温度=" + wendu + ",湿度=" + shidu + ",设备ID=" + deviceId + ",密码:" + pwd + ",湿度小于0不处理");
} }
else else
{ {
...@@ -152,7 +152,7 @@ namespace OnlineStore.Common ...@@ -152,7 +152,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, ex.ToString()); LogUtil.error( ex.ToString());
} }
} }
private static double PreShiDu = 7; private static double PreShiDu = 7;
...@@ -171,7 +171,7 @@ namespace OnlineStore.Common ...@@ -171,7 +171,7 @@ namespace OnlineStore.Common
TemperateParamMap.Remove(IP); TemperateParamMap.Remove(IP);
} }
TemperateParamMap.Add(IP, ast); TemperateParamMap.Add(IP, ast);
//LogUtil.info(LOGGER, "address=" + IP + ",收到:温度=" + newWenDu + ",湿度=" + newShiDu + " "); //LogUtil.info( "address=" + IP + ",收到:温度=" + newWenDu + ",湿度=" + newShiDu + " ");
} }
}catch(Exception ex) }catch(Exception ex)
{ {
......
...@@ -210,5 +210,9 @@ namespace OnlineStore.Common ...@@ -210,5 +210,9 @@ namespace OnlineStore.Common
info(LOGGER, msg); info(LOGGER, msg);
} }
} }
} }
...@@ -11,7 +11,7 @@ namespace OnlineStore ...@@ -11,7 +11,7 @@ namespace OnlineStore
{ {
public class NetTCPServer public class NetTCPServer
{ {
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// TCP服务端监听 /// TCP服务端监听
...@@ -118,13 +118,13 @@ namespace OnlineStore ...@@ -118,13 +118,13 @@ namespace OnlineStore
NetworkStream ns = client.tcpClient.GetStream(); NetworkStream ns = client.tcpClient.GetStream();
StreamReader sr = new StreamReader(ns); StreamReader sr = new StreamReader(ns);
string str = sr.ReadLine(); string str = sr.ReadLine();
LOGGER.Info("读取到数据:"+str); Common.LogUtil.info("读取到数据:"+str);
byte[] recdata = new byte[ns.EndRead(ar)]; byte[] recdata = new byte[ns.EndRead(ar)];
if (recdata.Length > 0) if (recdata.Length > 0)
{ {
//Array.Copy(client.Buffer, recdata, recdata.Length); //Array.Copy(client.Buffer, recdata, recdata.Length);
LOGGER.Info("读取到数据1111:" + Encoding.ASCII.GetString(recdata)); Common.LogUtil.info("读取到数据1111:" + Encoding.ASCII.GetString(recdata));
//ns.BeginRead(client.Buffer, 0, client.Buffer.Length, new AsyncCallback(TCPCallBack), client); //ns.BeginRead(client.Buffer, 0, client.Buffer.Length, new AsyncCallback(TCPCallBack), client);
} }
else else
......
using log4net;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace OnlineStore.Common
{
public class RunLogUtil
{
public static readonly ILog RunLog = LogManager.GetLogger("RunLog");
public static void ErrorLog(ErrorLog log)
{
string jsonStr = JsonHelper.SerializeObject(log);
RunLog.Error(jsonStr);
}
public static void MoveLog(MoveLog log)
{
if (log == null || (!log.IsValid()))
{
return;
}
string jsonStr = JsonHelper.SerializeObject(log);
RunLog.Info(jsonStr);
}
public static void InoutEndLog(InoutEndLog log)
{
if (log == null || (!log.IsValid()))
{
return;
}
string jsonStr = JsonHelper.SerializeObject(log);
RunLog.Info(jsonStr);
}
public static void AxisLog(AxisMoveLog log)
{
string jsonStr = JsonHelper.SerializeObject(log);
RunLog.Error(jsonStr);
}
}
public class BaseLog
{
[JsonProperty(Order = 0)]
public string Name { get; set; } = "四楼料仓";
[JsonProperty(Order = 1)]
public string DeviceName { get; set; } = "";
[JsonProperty(Order = 2)]
public string LogType { get; set; } = "";
[JsonProperty(Order = 3)]
public string StartTime { get; set; } = "";
[JsonProperty(Order = 4)]
public string EndTime { get; set; } = "";
[JsonProperty(Order = 5)]
public string timeSpan { get; set; } = "";
}
public class ErrorLog:BaseLog
{
public ErrorLog()
{
this.LogType = "Error";
}
public ErrorLog(string deviceName, string errType, string errMsg, DateTime startTime, DateTime endTime, string operType = "", string posid = "", string barcode = "")
{
this.LogType = "Error";
this.DeviceName = deviceName.Trim();
this.ErrorType = errType.Trim();
this.ErrorMsg = errMsg.Trim();
this.StartTime = startTime.ToString("yyyy-MM-dd HH:mm:ss");
this.EndTime = endTime.ToString("yyyy-MM-dd HH:mm:ss");
this.OperateType = operType.Trim();
this.PosId = posid.Trim();
this.Barcode = barcode.Trim();
TimeSpan span = endTime - startTime;
this.timeSpan = (Math.Round(span.TotalMinutes, 2)).ToString();//两位小数的分钟
}
public bool IsValid()
{
if (string.IsNullOrEmpty(DeviceName)||String.IsNullOrEmpty(LogType) || string.IsNullOrEmpty(ErrorType) || string.IsNullOrEmpty(ErrorMsg))
{
return false;
}
return true;
}
[JsonProperty(Order = 11)]
public string ErrorType { get; set; } = "";
[JsonProperty(Order = 12)]
public string ErrorMsg { get; set; } = "";
[JsonProperty(Order = 13)]
public string OperateType { get; set; } = "";
[JsonProperty(Order = 14)]
public string PosId { get; set; } = "";
[JsonProperty(Order = 15)]
public string Barcode { get; set; } = "";
}
public class MoveLog:BaseLog
{
public MoveLog()
{
this.LogType = "Running";
}
public MoveLog(string deviceName, string moveType, string moveMsg, DateTime startTime, DateTime endTime, string posid = "", string barcode = "")
{
this.LogType = "Running";
this.DeviceName = deviceName.Replace("-Move", "").Replace("-SMove", "").Trim();
this.MoveType = moveType.Trim();
this.MoveMsg = moveMsg.Trim();
this.StartTime = startTime.ToString("yyyy-MM-dd HH:mm:ss");
this.EndTime = endTime.ToString("yyyy-MM-dd HH:mm:ss");
this.PosId = posid.Trim();
this.Barcode = barcode.Trim();
TimeSpan span = endTime - startTime;
this.timeSpan = (Math.Round(span.TotalMinutes, 2)).ToString();//两位小数的分钟
}
public bool IsValid()
{
if (string.IsNullOrEmpty(DeviceName) || String.IsNullOrEmpty(LogType) || string.IsNullOrEmpty(MoveType) || string.IsNullOrEmpty(MoveMsg))
{
return false;
}
return true;
}
[JsonProperty(Order = 11)]
public string MoveType { get; set; } = "";
[JsonProperty(Order = 12)]
public string MoveMsg { get; set; } = "";
[JsonProperty(Order = 13)]
public string PosId { get; set; } = "";
[JsonProperty(Order = 14)]
public string Barcode { get; set; } = "";
}
public class InoutEndLog:BaseLog
{
public InoutEndLog()
{
this.LogType = "InoutEnd";
}
public InoutEndLog(string deviceName, string moveType, DateTime startTime, DateTime endTime, string posid = "", string barcode = "")
{
this.LogType = "InoutEnd";
this.DeviceName = deviceName.Replace("-Move", "").Replace("-SMove", "").Trim();
this.MoveType = moveType.Trim();
this.StartTime = startTime.ToString("yyyy-MM-dd HH:mm:ss");
this.EndTime = endTime.ToString("yyyy-MM-dd HH:mm:ss");
this.PosId = posid.Trim();
this.Barcode = barcode.Trim();
TimeSpan span = endTime - startTime;
this.timeSpan = (Math.Round(span.TotalMinutes, 2)).ToString();//两位小数的分钟
}
public bool IsValid()
{
if (string.IsNullOrEmpty(DeviceName) || string.IsNullOrEmpty(MoveType))
{
return false;
}
return true;
}
[JsonProperty(Order = 11)]
public string MoveType { get; set; } = "";
[JsonProperty(Order = 12)]
public string PosId { get; set; } = "";
[JsonProperty(Order = 13)]
public string Barcode { get; set; } = "";
}
public class AxisMoveLog:BaseLog
{
public AxisMoveLog()
{
this.LogType = "Axis";
}
public AxisMoveLog(string deviceName, string axisName, string moveType, int targetP, int speed, DateTime startTime, DateTime endTime, string posid = "", string barcode = "")
{
this.LogType = "Axis";
this.DeviceName = deviceName.Replace("-Move", "").Replace("-SMove", "").Trim();
this.MoveType = moveType.Trim();
this.AxisName = axisName;
this.TargetPos = targetP;
this.StartTime = startTime.ToString("yyyy-MM-dd HH:mm:ss");
this.EndTime = endTime.ToString("yyyy-MM-dd HH:mm:ss");
this.PosId = posid.Trim();
this.Barcode = barcode.Trim();
TimeSpan span = endTime - startTime;
this.timeSpan = (Math.Round(span.TotalMinutes, 2)).ToString();//两位小数的分钟
this.Speed = speed;
}
public bool IsValid()
{
if (string.IsNullOrEmpty(DeviceName) || string.IsNullOrEmpty(MoveType))
{
return false;
}
return true;
}
[JsonProperty(Order = 11)]
public string AxisName { get; set; } = "";
[JsonProperty(Order = 12)]
public string MoveType { get; set; } = "";
[JsonProperty(Order = 13)]
public int TargetPos { get; set; } = 0;
[JsonProperty(Order = 14)]
public int Speed { get; set; }
[JsonProperty(Order = 15)]
public string PosId { get; set; } = "";
[JsonProperty(Order = 16)]
public string Barcode { get; set; } = "";
}
}
...@@ -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>
......
...@@ -16,7 +16,7 @@ namespace OnlineStore.Common ...@@ -16,7 +16,7 @@ namespace OnlineStore.Common
private static int ServerPort = 0; private static int ServerPort = 0;
private System.Timers.Timer ReConnectTimer = null; private System.Timers.Timer ReConnectTimer = null;
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;
...@@ -112,13 +112,13 @@ namespace OnlineStore.Common ...@@ -112,13 +112,13 @@ 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!");
ReConnectTimer.Start(); ReConnectTimer.Start();
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)
...@@ -154,7 +154,7 @@ namespace OnlineStore.Common ...@@ -154,7 +154,7 @@ namespace OnlineStore.Common
if (m_clientSocket != null) if (m_clientSocket != null)
{ {
m_clientSocket.Close(); m_clientSocket.Close();
LogUtil.debug(LOGGER, "Socket closed!"); LogUtil.debug( "Socket closed!");
} }
}catch(Exception ex) }catch(Exception ex)
{ {
...@@ -168,7 +168,7 @@ namespace OnlineStore.Common ...@@ -168,7 +168,7 @@ namespace OnlineStore.Common
{ {
m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null); m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null);
LogUtil.info(LOGGER, "Connect to " + ServerIp + ":" + ServerPort + " success!"); LogUtil.info( "Connect to " + ServerIp + ":" + ServerPort + " success!");
} }
isInProcess = false; isInProcess = false;
...@@ -189,11 +189,11 @@ namespace OnlineStore.Common ...@@ -189,11 +189,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!");
} }
} }
...@@ -209,7 +209,7 @@ namespace OnlineStore.Common ...@@ -209,7 +209,7 @@ namespace OnlineStore.Common
{ {
m_clientSocket.Send(sendBuffer); m_clientSocket.Send(sendBuffer);
LogUtil.debug(LOGGER,"Send >> " + strSendData); LogUtil.debug( "Send >> " + strSendData);
} }
} }
......
...@@ -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;
...@@ -210,7 +210,7 @@ namespace OnlineStore.Common ...@@ -210,7 +210,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error(ex.ToString()); Common.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 + "]");
} }
......
...@@ -18,7 +18,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -18,7 +18,7 @@ namespace OnlineStore.DeviceLibrary
//public static uint DefaultDICount = 16; //public static uint DefaultDICount = 16;
//public static uint DefaultDOCount = 16; //public static uint DefaultDOCount = 16;
public readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //public readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public Dictionary<string, AIOBOX> AIOMap = new Dictionary<string, AIOBOX>(); public Dictionary<string, AIOBOX> AIOMap = new Dictionary<string, AIOBOX>();
public Dictionary<string, List<Box_Sta>> DIValueMap = new Dictionary<string, List<Box_Sta>>(); public Dictionary<string, List<Box_Sta>> DIValueMap = new Dictionary<string, List<Box_Sta>>();
...@@ -124,7 +124,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -124,7 +124,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception error) catch (Exception error)
{ {
LogUtil.error(LOGGER, "连接IO模块 " + logName + " 出错:" + error.ToString()); LogUtil.error( "连接IO模块 " + logName + " 出错:" + error.ToString());
} }
} }
private DateTime lastLogTime = DateTime.Now; private DateTime lastLogTime = DateTime.Now;
...@@ -292,12 +292,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -292,12 +292,12 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(LOGGER, "WriteSingleDO出错 没有连接IO模块:" + ioIp); LogUtil.error( "WriteSingleDO出错 没有连接IO模块:" + ioIp);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错啦:" + ex.ToString()); Common.LogUtil.error("AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错啦:" + ex.ToString());
} }
} }
public override void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff, int mSeconds) public override void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff, int mSeconds)
...@@ -317,11 +317,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -317,11 +317,11 @@ namespace OnlineStore.DeviceLibrary
try try
{ {
aioBox.WriteDO(StartAddress, aioBox.ReverseStatus(currBox_Sta)); aioBox.WriteDO(StartAddress, aioBox.ReverseStatus(currBox_Sta));
LogUtil.debug(LOGGER, "**********定时回写入 IO [" + ioIp + "] [" + StartAddress + "]值" + aioBox.ReverseStatus(currBox_Sta) + "】:"); LogUtil.debug( "**********定时回写入 IO [" + ioIp + "] [" + StartAddress + "]值" + aioBox.ReverseStatus(currBox_Sta) + "】:");
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "**********定时回写入 出错:" + ex.StackTrace); LogUtil.error( "**********定时回写入 出错:" + ex.StackTrace);
} }
}; };
mytimer.AutoReset = false;//设置是否自动重启,即自动执行多次; mytimer.AutoReset = false;//设置是否自动重启,即自动执行多次;
...@@ -330,7 +330,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -330,7 +330,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(LOGGER, "AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错 没有连接IO模块:" + ioIp); LogUtil.error( "AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错 没有连接IO模块:" + ioIp);
} }
} }
catch (Exception ex) catch (Exception ex)
...@@ -449,7 +449,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -449,7 +449,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, " GetIOValue [" + configIO.IO_IP + "] [" + configIO.GetIOAddr() + "] 获取数据出错:" + ex.ToString()); LogUtil.error( " GetIOValue [" + configIO.IO_IP + "] [" + configIO.GetIOAddr() + "] 获取数据出错:" + ex.ToString());
} }
return value; return value;
} }
......
...@@ -22,7 +22,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -22,7 +22,7 @@ namespace OnlineStore.DeviceLibrary
//public static ushort DefaultDILength = 16; //public static ushort DefaultDILength = 16;
//public static ushort DefaultDOLength = 16; //public static ushort DefaultDOLength = 16;
private static byte DefualtSlaveID = 255; private static byte DefualtSlaveID = 255;
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static Dictionary<string, MasterTcpClient> mastMap = new Dictionary<string, MasterTcpClient>(); public static Dictionary<string, MasterTcpClient> mastMap = new Dictionary<string, MasterTcpClient>();
public static Dictionary<string, List<KNDIO>> DIValueMap = new Dictionary<string, List<KNDIO>>(); public static Dictionary<string, List<KNDIO>> DIValueMap = new Dictionary<string, List<KNDIO>>();
public static Dictionary<string, List<KNDIO>> DOValueMap = new Dictionary<string, List<KNDIO>>(); public static Dictionary<string, List<KNDIO>> DOValueMap = new Dictionary<string, List<KNDIO>>();
...@@ -87,7 +87,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -87,7 +87,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception error) catch (Exception error)
{ {
LogUtil.error(LOGGER, "连接IO模块[" + ioIp + "]出错:" + error.ToString()); LogUtil.error( "连接IO模块[" + ioIp + "]出错:" + error.ToString());
} }
} }
public override void ReadAllDI(string ioIp, byte slaveId) public override void ReadAllDI(string ioIp, byte slaveId)
...@@ -122,7 +122,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -122,7 +122,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "出错啦:" + ex.ToString()); LogUtil.error( "出错啦:" + ex.ToString());
} }
return false; return false;
} }
...@@ -144,14 +144,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -144,14 +144,14 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
ConnectionIP(io); ConnectionIP(io);
LogUtil.error(LOGGER, io + "当前没有连上,重连" + io); LogUtil.error( io + "当前没有连上,重连" + io);
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "出错啦:" + ex.ToString()); LogUtil.error( "出错啦:" + ex.ToString());
} }
Thread.Sleep(1); Thread.Sleep(1);
} }
...@@ -175,7 +175,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -175,7 +175,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(LOGGER, "ReadMultipleDI出错 没有连接IO模块:" + ioIp); LogUtil.error( "ReadMultipleDI出错 没有连接IO模块:" + ioIp);
} }
} }
public static void ReadMultipleDO(string ioIp, byte slaveId, ushort StartAddress, ushort length) public static void ReadMultipleDO(string ioIp, byte slaveId, ushort StartAddress, ushort length)
...@@ -189,7 +189,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -189,7 +189,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(LOGGER, "ReadMultipleDO出错 没有连接IO模块:" + ioIp); LogUtil.error( "ReadMultipleDO出错 没有连接IO模块:" + ioIp);
} }
} }
//关闭所有的DO //关闭所有的DO
...@@ -235,7 +235,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -235,7 +235,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(LOGGER, "WriteMultipleDO 出错 没有连接IO模块:" + ioIp); LogUtil.error( "WriteMultipleDO 出错 没有连接IO模块:" + ioIp);
} }
} }
public override void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff) public override void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff)
...@@ -252,7 +252,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -252,7 +252,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(LOGGER, "WriteSingleDO 出错没有连接IO模块:" + ioIp); LogUtil.error( "WriteSingleDO 出错没有连接IO模块:" + ioIp);
} }
} }
...@@ -282,11 +282,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -282,11 +282,11 @@ namespace OnlineStore.DeviceLibrary
MBmaster.WriteSingleCoils(ID, StartAddress, newValue, slaveId); MBmaster.WriteSingleCoils(ID, StartAddress, newValue, slaveId);
KNDIO newIo = new KNDIO(ioIp, slaveId, StartAddress, newValue); KNDIO newIo = new KNDIO(ioIp, slaveId, StartAddress, newValue);
SaveDOValue(newIo, ioIp); SaveDOValue(newIo, ioIp);
LogUtil.info(LOGGER, "**********定时回写入 IO【" + ioIp + "," + StartAddress + ",值" + onOff + "】:"); LogUtil.info( "**********定时回写入 IO【" + ioIp + "," + StartAddress + ",值" + onOff + "】:");
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "**********定时回写入 出错:" + ex.StackTrace); LogUtil.error( "**********定时回写入 出错:" + ex.StackTrace);
} }
}; };
mytimer.AutoReset = false;//设置是否自动重启,即自动执行多次; mytimer.AutoReset = false;//设置是否自动重启,即自动执行多次;
...@@ -294,7 +294,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -294,7 +294,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(LOGGER, "WriteSingleDO出错 没有连接IO模块:" + ioIp); LogUtil.error( "WriteSingleDO出错 没有连接IO模块:" + ioIp);
} }
} }
...@@ -327,7 +327,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -327,7 +327,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "SaveDOValue出错:" + ex.ToString()); LogUtil.error( "SaveDOValue出错:" + ex.ToString());
} }
} }
public override IO_VALUE GetDOValue(string ioIP, byte slaveId, ushort StartAddress) public override IO_VALUE GetDOValue(string ioIP, byte slaveId, ushort StartAddress)
...@@ -393,7 +393,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -393,7 +393,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "获取数据出错:" + ex.ToString()); LogUtil.error( "获取数据出错:" + ex.ToString());
} }
return value; return value;
} }
...@@ -413,7 +413,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -413,7 +413,7 @@ namespace OnlineStore.DeviceLibrary
{ {
finalData = Convert.ToString(values[0], 2).PadLeft(DILength, '0'); finalData = Convert.ToString(values[0], 2).PadLeft(DILength, '0');
} }
LOGGER.Debug("IO模块【" + ioIp + "】收到DI上传:【" + finalData + "】"); LogUtil.debug("IO模块【" + ioIp + "】收到DI上传:【" + finalData + "】");
if (finalData.Length >= DILength) if (finalData.Length >= DILength)
{ {
List<KNDIO> kndList = new List<KNDIO>(); List<KNDIO> kndList = new List<KNDIO>();
...@@ -444,7 +444,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -444,7 +444,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "SaveDIData出错:" + ex.ToString()); LogUtil.error( "SaveDIData出错:" + ex.ToString());
//LOGGER.Error("处理接受数据出错:", ex); //LOGGER.Error("处理接受数据出错:", ex);
} }
} }
...@@ -532,7 +532,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -532,7 +532,7 @@ namespace OnlineStore.DeviceLibrary
switch (Func) switch (Func)
{ {
case 1: case 1:
LOGGER.Info("Read coils end:【" + reviceMsg + "】 "); Common.LogUtil.info("Read coils end:【" + reviceMsg + "】 ");
SaveDOData(ioIp, SlaveId, values); SaveDOData(ioIp, SlaveId, values);
break; break;
case 2: case 2:
...@@ -553,7 +553,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -553,7 +553,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "处理接受数据出错:" + ex.ToString()); LogUtil.error( "处理接受数据出错:" + ex.ToString());
//LOGGER.Error("处理接受数据出错:", ex); //LOGGER.Error("处理接受数据出错:", ex);
} }
} }
...@@ -580,7 +580,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -580,7 +580,7 @@ namespace OnlineStore.DeviceLibrary
default: default:
break; break;
} }
LOGGER.Error("接收数据出错:" + exc); Common.LogUtil.error("接收数据出错:" + exc);
//MessageBox.Show(exc, "Modbus slave exception"); //MessageBox.Show(exc, "Modbus slave exception");
} }
} }
......
...@@ -16,7 +16,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -16,7 +16,7 @@ namespace OnlineStore.DeviceLibrary
public class MasterTcpClient public class MasterTcpClient
{ {
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Constants for access // Constants for access
private const byte fctReadCoil = 1; private const byte fctReadCoil = 1;
...@@ -137,7 +137,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -137,7 +137,7 @@ namespace OnlineStore.DeviceLibrary
connResult.AsyncWaitHandle.WaitOne(this.TimeOutTime, true); //等待2秒 connResult.AsyncWaitHandle.WaitOne(this.TimeOutTime, true); //等待2秒
if (!connResult.IsCompleted) if (!connResult.IsCompleted)
{ {
LogUtil.info(LOGGER, "Connect to " + ip + ":" + port + " fail!"); LogUtil.info( "Connect to " + ip + ":" + port + " fail!");
return; return;
} }
else else
...@@ -155,7 +155,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -155,7 +155,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (System.IO.IOException error) catch (System.IO.IOException error)
{ {
LogUtil.info(LOGGER, "Connect to " + ip + ":" + port + " fail!"); LogUtil.info( "Connect to " + ip + ":" + port + " fail!");
_connected = false; _connected = false;
throw (error); throw (error);
} }
...@@ -171,7 +171,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -171,7 +171,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("IO模块[" + IP + "]出错:" + ex.ToString()); Common.LogUtil.error("IO模块[" + IP + "]出错:" + ex.ToString());
} }
} }
...@@ -238,7 +238,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -238,7 +238,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.debug(LOGGER, clientipe.ToString() + "收到数据(无需分包):" + str); LogUtil.debug( clientipe.ToString() + "收到数据(无需分包):" + str);
ushort id = BitConverter.ToUInt16(rdata, 0); ushort id = BitConverter.ToUInt16(rdata, 0);
byte function = rdata[7]; byte function = rdata[7];
DataProcess(clientipe.ToString(), id, function, rdata); DataProcess(clientipe.ToString(), id, function, rdata);
...@@ -295,7 +295,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -295,7 +295,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (SocketException e) catch (SocketException e)
{ {
LogUtil.error(LOGGER, "IO模块[" + IP + "]接收数据出现错误:" + e.ToString()); LogUtil.error( "IO模块[" + IP + "]接收数据出现错误:" + e.ToString());
if (socketClient != null) if (socketClient != null)
{ {
socketClient.Close(); socketClient.Close();
...@@ -335,7 +335,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -335,7 +335,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "IO模块[" + IP + "]dispose出错:" + ex.ToString()); LogUtil.error( "IO模块[" + IP + "]dispose出错:" + ex.ToString());
} }
socketClient.Close(); socketClient.Close();
} }
...@@ -515,7 +515,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -515,7 +515,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (socketClient == null) if (socketClient == null)
{ {
LOGGER.Error("发送数据时发现socketClient=null"); Common.LogUtil.error("发送数据时发现socketClient=null");
return; return;
} }
IPEndPoint clientipe = (IPEndPoint)socketClient.RemoteEndPoint; IPEndPoint clientipe = (IPEndPoint)socketClient.RemoteEndPoint;
...@@ -537,7 +537,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -537,7 +537,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (SystemException error) catch (SystemException error)
{ {
LogUtil.error(LOGGER, "IO模块 WriteAsyncData出错:" + error.ToString()); LogUtil.error( "IO模块 WriteAsyncData出错:" + error.ToString());
CallException(id, write_data[7], excExceptionConnectionLost, tcpSocketReviceBuffer); CallException(id, write_data[7], excExceptionConnectionLost, tcpSocketReviceBuffer);
} }
} }
......
...@@ -52,6 +52,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -52,6 +52,7 @@ namespace OnlineStore.DeviceLibrary
private System.Timers.Timer readDITimer = new System.Timers.Timer(); private System.Timers.Timer readDITimer = new System.Timers.Timer();
public AC_SA_BoxBean(AC_SA_Config config) public AC_SA_BoxBean(AC_SA_Config config)
{ {
StoreName = ("料仓BOX_" + config.Id + " ").ToUpper();
Init(); Init();
serverConnectTimer = new System.Timers.Timer(); serverConnectTimer = new System.Timers.Timer();
serverConnectTimer.Interval = 1000; serverConnectTimer.Interval = 1000;
...@@ -74,7 +75,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -74,7 +75,6 @@ namespace OnlineStore.DeviceLibrary
IsDebug = ConfigAppSettings.GetIntValue(Setting_Init.IsInDebug).Equals(1); IsDebug = ConfigAppSettings.GetIntValue(Setting_Init.IsInDebug).Equals(1);
IsHasCompress_Axis = config.IsHasCompress_Axis.Equals(1); IsHasCompress_Axis = config.IsHasCompress_Axis.Equals(1);
StoreName = ("料仓BOX_" + config.Id + " ").ToUpper();
this.StoreID = config.Id; this.StoreID = config.Id;
this.Config = config; this.Config = config;
moveAxisList = new List<ConfigMoveAxis>(); moveAxisList = new List<ConfigMoveAxis>();
...@@ -263,8 +263,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -263,8 +263,8 @@ namespace OnlineStore.DeviceLibrary
if (IOManager.IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW)) if (IOManager.IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{ {
isInSuddenDown = true; isInSuddenDown = true;
LogUtil.error(LOGGER, StoreName + "收到急停信号,报警急停"); LogUtil.error( StoreName + "收到急停信号,报警急停");
WarnMsg = StoreName + "收到急停信号,报警急停"; SetWarnMsg(StoreName + "收到急停信号,报警急停","报警急停");
//报警时会关闭所有轴 //报警时会关闭所有轴
Alarm(StoreAlarmType.SuddenStop, "1", WarnMsg, StoreMoveType.None); Alarm(StoreAlarmType.SuddenStop, "1", WarnMsg, StoreMoveType.None);
...@@ -313,7 +313,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -313,7 +313,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public override bool StartRun() public override bool StartRun()
{ {
LogUtil.info(LOGGER, StoreName + "开始启动,启动时间:" + StartTime.ToString()); LogUtil.info( StoreName + "开始启动,启动时间:" + StartTime.ToString());
autoNext = false; autoNext = false;
mainTimer.Enabled = false; mainTimer.Enabled = false;
...@@ -352,11 +352,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -352,11 +352,11 @@ namespace OnlineStore.DeviceLibrary
{ {
if (suddenBtn.Equals(IO_VALUE.LOW)) if (suddenBtn.Equals(IO_VALUE.LOW))
{ {
LogUtil.error(LOGGER, " (" + StoreName + ")启动出现错误:急停没开 !启动失败!"); LogUtil.error( " (" + StoreName + ")启动出现错误:急停没开 !启动失败!");
} }
else else
{ {
LogUtil.error(LOGGER, " (" + StoreName + ")启动出现错误:没有气压信号 !启动失败!"); LogUtil.error( " (" + StoreName + ")启动出现错误:没有气压信号 !启动失败!");
} }
return false; return false;
} }
...@@ -368,7 +368,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -368,7 +368,7 @@ namespace OnlineStore.DeviceLibrary
{ {
isNoAirCheck = false; isNoAirCheck = false;
isInSuddenDown = false; isInSuddenDown = false;
WarnMsg = ""; SetWarnMsg();
CurrInOutACount = 0; CurrInOutACount = 0;
CurrInOutCount = 0; CurrInOutCount = 0;
IOManager.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW); IOManager.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
...@@ -379,7 +379,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -379,7 +379,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack);
ACAxisHomeMove(Config.InOut_Axis); ACAxisHomeMove(Config.InOut_Axis);
LogUtil.info(LOGGER, StoreName + "开始原点返回,先把进出轴回原点"); LogUtil.info( StoreName + "开始原点返回,先把进出轴回原点");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000)); StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
} }
...@@ -388,7 +388,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -388,7 +388,7 @@ namespace OnlineStore.DeviceLibrary
//压紧轴回原点,叉子回到P1,关闭门旋转轴和升降轴回到P1 //压紧轴回原点,叉子回到P1,关闭门旋转轴和升降轴回到P1
StoreMove.NewMove(StoreMoveType.StoreReset); StoreMove.NewMove(StoreMoveType.StoreReset);
StoreMove.NextMoveStep(StoreMoveStep.BOX_M_H_TOP1_InOutToP1); StoreMove.NextMoveStep(StoreMoveStep.BOX_M_H_TOP1_InOutToP1);
LogUtil.info(LOGGER, StoreName + "到待机状态,进出轴到P1,判断叉子没有料盘"); LogUtil.info( StoreName + "到待机状态,进出轴到P1,判断叉子没有料盘");
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed); ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
//ComBeforeHomeMove(); //ComBeforeHomeMove();
//判断叉子没有料盘 //判断叉子没有料盘
...@@ -419,13 +419,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -419,13 +419,12 @@ namespace OnlineStore.DeviceLibrary
storeRunStatus = StoreRunStatus.Reset; storeRunStatus = StoreRunStatus.Reset;
storeStatus = StoreStatus.ResetMove; storeStatus = StoreStatus.ResetMove;
StoreMove.NewMove(StoreMoveType.StoreReset); StoreMove.NewMove(StoreMoveType.StoreReset);
WarnMsg = ""; SetWarnMsg();
if (!RunAxis(true)) if (!RunAxis(true))
////打开四个轴 ////打开四个轴
//if (!OpenAllAxis()) //if (!OpenAllAxis())
{ {
LogUtil.info(LOGGER, StoreName + "复位时打开轴失败,需要再次复位,直接报警停止复位"); LogUtil.info( StoreName + "复位时打开轴失败,需要再次复位,直接报警停止复位");
return; return;
} }
if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0)) if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0))
...@@ -435,7 +434,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -435,7 +434,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.info(LOGGER, StoreName + "开始复位:先定位气缸下降"); LogUtil.info( StoreName + "开始复位:先定位气缸下降");
// 复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴 // 复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_LocationCylinderBack); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_LocationCylinderBack);
LocationDownAndWait(); LocationDownAndWait();
...@@ -448,7 +447,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -448,7 +447,7 @@ namespace OnlineStore.DeviceLibrary
int slvAddr = Config.InOut_Axis.GetAxisValue(); int slvAddr = Config.InOut_Axis.GetAxisValue();
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack);
LogUtil.info(LOGGER, StoreName + "复位中,进出轴开始原点返回"); LogUtil.info( StoreName + "复位中,进出轴开始原点返回");
ACAxisHomeMove(Config.InOut_Axis); ACAxisHomeMove(Config.InOut_Axis);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000)); StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
} }
...@@ -473,13 +472,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -473,13 +472,13 @@ namespace OnlineStore.DeviceLibrary
case StoreMoveStep.BOX_H_InOutMove: case StoreMoveStep.BOX_H_InOutMove:
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack);
ACAxisHomeMove(Config.InOut_Axis); ACAxisHomeMove(Config.InOut_Axis);
LogUtil.info(LOGGER, StoreName + "复位中:进出轴开始原点返回"); LogUtil.info( StoreName + "复位中:进出轴开始原点返回");
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000)); StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
break; break;
case StoreMoveStep.BOX_H_InOutBack: case StoreMoveStep.BOX_H_InOutBack:
Thread.Sleep(200); Thread.Sleep(200);
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutToP1); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutToP1);
LogUtil.info(LOGGER, StoreName + "复位中:进出轴到待机点P1,关闭舱门"); LogUtil.info( StoreName + "复位中:进出轴到待机点P1,关闭舱门");
//进出轴原点返回完成,将进出轴的位置设置=0 //进出轴原点返回完成,将进出轴的位置设置=0
AxisCountClear(Config.InOut_Axis); AxisCountClear(Config.InOut_Axis);
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed); ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
...@@ -492,11 +491,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -492,11 +491,11 @@ namespace OnlineStore.DeviceLibrary
//如果此时轴三还在报警,需要提示错误并等待 //如果此时轴三还在报警,需要提示错误并等待
if (ACServerManager.GetAlarmStatus(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue()) > 0) if (ACServerManager.GetAlarmStatus(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue()) > 0)
{ {
LogUtil.error(LOGGER, "进出轴报警!复位失败,请检查!"); LogUtil.error( "进出轴报警!复位失败,请检查!");
} }
//复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴 //复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
LogUtil.info(LOGGER, StoreName + "复位中: 压紧轴,旋转轴,上下轴开始 原点返回"); LogUtil.info( StoreName + "复位中: 压紧轴,旋转轴,上下轴开始 原点返回");
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_OtherAxisBack); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_OtherAxisBack);
StoreMove.TimeOutSeconds = 100; StoreMove.TimeOutSeconds = 100;
if (IsHasCompress_Axis) if (IsHasCompress_Axis)
...@@ -509,26 +508,26 @@ namespace OnlineStore.DeviceLibrary ...@@ -509,26 +508,26 @@ namespace OnlineStore.DeviceLibrary
case StoreMoveStep.BOX_H_OtherAxisBack: case StoreMoveStep.BOX_H_OtherAxisBack:
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1);
LogUtil.info(LOGGER, StoreName + "复位中:旋转轴运动到P1,上下轴走到P1,压紧轴到P1!"); LogUtil.info( StoreName + "复位中:旋转轴运动到P1,上下轴走到P1,压紧轴到P1!");
ACAxisMove(Config.Middle_Axis, Config.MiddleAxis_P1_Position, Config.MiddleAxis_P1_Speed); ACAxisMove(Config.Middle_Axis, Config.MiddleAxis_P1_Position, Config.MiddleAxis_P1_Speed);
ACAxisMove(Config.UpDown_Axis, Config.UpDownAxis_DoorOPosition_P1, Config.UpDownAxis_P1_Speed); ACAxisMove(Config.UpDown_Axis, Config.UpDownAxis_DoorOPosition_P1, Config.UpDownAxis_P1_Speed);
ComMoveToPosition(Config.CompressAxis_P1_Position, Config.CompAxis_P1_Speed); ComMoveToPosition(Config.CompressAxis_P1_Position, Config.CompAxis_P1_Speed);
break; break;
case StoreMoveStep.BOX_H_MiddleAxisToP1: case StoreMoveStep.BOX_H_MiddleAxisToP1:
LogUtil.info(LOGGER, StoreName + "复位完成"); LogUtil.info( StoreName + "复位完成");
storeRunStatus = StoreRunStatus.Runing; storeRunStatus = StoreRunStatus.Runing;
StoreMove.EndMove(); StoreMove.EndMove();
storeStatus = StoreStatus.StoreOnline; storeStatus = StoreStatus.StoreOnline;
if (alarmType.Equals(StoreAlarmType.None)) if (alarmType.Equals(StoreAlarmType.None))
{ {
WarnMsg = ""; SetWarnMsg();
} }
break; break;
case StoreMoveStep.BOX_M_H_TOP1_InOutToP1: case StoreMoveStep.BOX_M_H_TOP1_InOutToP1:
StoreMove.NextMoveStep(StoreMoveStep.BOX_M_H_TOP1_CompressHome); StoreMove.NextMoveStep(StoreMoveStep.BOX_M_H_TOP1_CompressHome);
LogUtil.info(LOGGER, StoreName + "到待机状态,压紧轴回原点,关闭舱门"); LogUtil.info( StoreName + "到待机状态,压紧轴回原点,关闭舱门");
if (IsHasCompress_Axis) if (IsHasCompress_Axis)
{ {
ACAxisHomeMove(Config.Comp_Axis); ACAxisHomeMove(Config.Comp_Axis);
...@@ -538,19 +537,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -538,19 +537,19 @@ namespace OnlineStore.DeviceLibrary
break; break;
case StoreMoveStep.BOX_M_H_TOP1_CompressHome: case StoreMoveStep.BOX_M_H_TOP1_CompressHome:
StoreMove.NextMoveStep(StoreMoveStep.BOX_M_H_TOP1_OtherAxisToP1); StoreMove.NextMoveStep(StoreMoveStep.BOX_M_H_TOP1_OtherAxisToP1);
LogUtil.info(LOGGER, StoreName + "复位中:旋转轴运动到P1,上下轴走到P1,压紧轴到P1!"); LogUtil.info( StoreName + "复位中:旋转轴运动到P1,上下轴走到P1,压紧轴到P1!");
ACAxisMove(Config.Middle_Axis, Config.MiddleAxis_P1_Position, Config.MiddleAxis_P1_Speed); ACAxisMove(Config.Middle_Axis, Config.MiddleAxis_P1_Position, Config.MiddleAxis_P1_Speed);
ACAxisMove(Config.UpDown_Axis, Config.UpDownAxis_DoorOPosition_P1, Config.UpDownAxis_P1_Speed); ACAxisMove(Config.UpDown_Axis, Config.UpDownAxis_DoorOPosition_P1, Config.UpDownAxis_P1_Speed);
ComMoveToPosition(Config.CompressAxis_P1_Position, Config.CompAxis_P1_Speed); ComMoveToPosition(Config.CompressAxis_P1_Position, Config.CompAxis_P1_Speed);
break; break;
case StoreMoveStep.BOX_M_H_TOP1_OtherAxisToP1: case StoreMoveStep.BOX_M_H_TOP1_OtherAxisToP1:
LogUtil.info(LOGGER, StoreName + "到待机状态完成"); LogUtil.info( StoreName + "到待机状态完成");
StoreMove.EndMove(); StoreMove.EndMove();
storeStatus = StoreStatus.StoreOnline; storeStatus = StoreStatus.StoreOnline;
storeRunStatus = StoreRunStatus.Runing; storeRunStatus = StoreRunStatus.Runing;
if (alarmType.Equals(StoreAlarmType.None)) if (alarmType.Equals(StoreAlarmType.None))
{ {
WarnMsg = ""; SetWarnMsg();
} }
break; break;
...@@ -619,7 +618,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -619,7 +618,7 @@ namespace OnlineStore.DeviceLibrary
{ {
case StoreMoveStep.BOX_H_LocationCylinderBack: case StoreMoveStep.BOX_H_LocationCylinderBack:
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack);
LogUtil.info(LOGGER, StoreName + "原点返回中,进出轴回原点"); LogUtil.info( StoreName + "原点返回中,进出轴回原点");
//复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴 //复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
ACAxisHomeMove(Config.InOut_Axis); ACAxisHomeMove(Config.InOut_Axis);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000)); StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
...@@ -627,7 +626,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -627,7 +626,7 @@ namespace OnlineStore.DeviceLibrary
case StoreMoveStep.BOX_H_InOutBack: case StoreMoveStep.BOX_H_InOutBack:
Thread.Sleep(200); Thread.Sleep(200);
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutToP1); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutToP1);
LogUtil.info(LOGGER, StoreName + "原点返回中,进出轴退回P1点,关闭仓门,检测叉子没有料盘"); LogUtil.info( StoreName + "原点返回中,进出轴退回P1点,关闭仓门,检测叉子没有料盘");
//进出轴原点返回完成,将进出轴的位置设置=0 //进出轴原点返回完成,将进出轴的位置设置=0
AxisCountClear(Config.InOut_Axis); AxisCountClear(Config.InOut_Axis);
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed); ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
...@@ -642,10 +641,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -642,10 +641,10 @@ namespace OnlineStore.DeviceLibrary
if (ACServerManager.GetAlarmStatus(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue()) > 0) if (ACServerManager.GetAlarmStatus(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue()) > 0)
{ {
WarnMsg = "进出轴报警!复位失败,请检查!"; WarnMsg = "进出轴报警!复位失败,请检查!";
LogUtil.error(LOGGER, "进出轴报警!复位失败,请检查!"); LogUtil.error( "进出轴报警!复位失败,请检查!");
} }
//复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴 //复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
LogUtil.info(LOGGER, StoreName + "原点返回中 :压紧轴,旋转轴,上下轴开始原点返回"); LogUtil.info( StoreName + "原点返回中 :压紧轴,旋转轴,上下轴开始原点返回");
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_OtherAxisBack); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_OtherAxisBack);
if (IsHasCompress_Axis) if (IsHasCompress_Axis)
{ {
...@@ -657,17 +656,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -657,17 +656,17 @@ namespace OnlineStore.DeviceLibrary
case StoreMoveStep.BOX_H_OtherAxisBack: case StoreMoveStep.BOX_H_OtherAxisBack:
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_MiddleAxisToP1);
LogUtil.info(LOGGER, StoreName + "回原点:旋转轴运动到P1,上下轴到P1,压紧轴到P1!"); LogUtil.info( StoreName + "回原点:旋转轴运动到P1,上下轴到P1,压紧轴到P1!");
ACAxisMove(Config.Middle_Axis, Config.MiddleAxis_P1_Position, Config.MiddleAxis_P1_Speed); ACAxisMove(Config.Middle_Axis, Config.MiddleAxis_P1_Position, Config.MiddleAxis_P1_Speed);
ACAxisMove(Config.UpDown_Axis, Config.UpDownAxis_DoorOPosition_P1, Config.UpDownAxis_P1_Speed); ACAxisMove(Config.UpDown_Axis, Config.UpDownAxis_DoorOPosition_P1, Config.UpDownAxis_P1_Speed);
ComMoveToPosition(Config.CompressAxis_P1_Position, Config.CompAxis_P1_Speed); ComMoveToPosition(Config.CompressAxis_P1_Position, Config.CompAxis_P1_Speed);
break; break;
case StoreMoveStep.BOX_H_MiddleAxisToP1: case StoreMoveStep.BOX_H_MiddleAxisToP1:
LogUtil.info(LOGGER, StoreName + "回原点完成"); LogUtil.info( StoreName + "回原点完成");
storeRunStatus = StoreRunStatus.Runing; storeRunStatus = StoreRunStatus.Runing;
StoreMove.EndMove(); StoreMove.EndMove();
storeStatus = StoreStatus.StoreOnline; storeStatus = StoreStatus.StoreOnline;
WarnMsg = ""; SetWarnMsg();
break; break;
default: break; default: break;
} }
...@@ -720,26 +719,27 @@ namespace OnlineStore.DeviceLibrary ...@@ -720,26 +719,27 @@ namespace OnlineStore.DeviceLibrary
{ {
if (ACServerManager.ServerOnStatus(axis.DeviceName, axis.GetAxisValue())) if (ACServerManager.ServerOnStatus(axis.DeviceName, axis.GetAxisValue()))
{ {
LogUtil.info(LOGGER, StoreName + "成功打开轴:" + axis.Explain); LogUtil.info( StoreName + "成功打开轴:" + axis.Explain);
} }
else else
{ {
//清理报警,再重新打开一次 //清理报警,再重新打开一次
LogUtil.info(LOGGER, StoreName + "第一次打开轴" + axis.Explain + "失败,先清理一下报警,再重新打开一次"); LogUtil.info( StoreName + "第一次打开轴" + axis.Explain + "失败,先清理一下报警,再重新打开一次");
ACServerManager.AlarmClear(axis.DeviceName, axis.GetAxisValue()); ACServerManager.AlarmClear(axis.DeviceName, axis.GetAxisValue());
System.Threading.Thread.Sleep(1200); System.Threading.Thread.Sleep(1200);
ACServerManager.ServoOn(axis.DeviceName, axis.GetAxisValue()); ACServerManager.ServoOn(axis.DeviceName, axis.GetAxisValue());
System.Threading.Thread.Sleep(100); System.Threading.Thread.Sleep(100);
if (ACServerManager.ServerOnStatus(axis.DeviceName, axis.GetAxisValue())) if (ACServerManager.ServerOnStatus(axis.DeviceName, axis.GetAxisValue()))
{ {
LogUtil.info(LOGGER, StoreName + "清理报警后重新打卡轴成功:" + axis.Explain); LogUtil.info( StoreName + "清理报警后重新打卡轴成功:" + axis.Explain);
} }
else else
{ {
ACServerManager.ServoOff(axis.DeviceName, axis.GetAxisValue()); ACServerManager.ServoOff(axis.DeviceName, axis.GetAxisValue());
int alarmCode = GetAlarmCodeByAxis(axis); int alarmCode = GetAlarmCodeByAxis(axis);
WarnMsg = StoreName + "打开轴" + axis.Explain + "失败 "; SetWarnMsg( StoreName + "打开轴" + axis.Explain + "失败 ",axis.Explain+"_打开识别");
LogUtil.info(LOGGER, StoreName + WarnMsg);
LogUtil.info( StoreName + WarnMsg);
Alarm(StoreAlarmType.AxisAlarm, GetAlarmCodeByAxis(axis).ToString(), WarnMsg, StoreMove.MoveType); Alarm(StoreAlarmType.AxisAlarm, GetAlarmCodeByAxis(axis).ToString(), WarnMsg, StoreMove.MoveType);
return false; return false;
} }
...@@ -790,7 +790,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -790,7 +790,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public override void StopRun() public override void StopRun()
{ {
WarnMsg = ""; SetWarnMsg();
autoNext = false; autoNext = false;
IoCheckTimer.Enabled = false; IoCheckTimer.Enabled = false;
serverConnectTimer.Enabled = false; serverConnectTimer.Enabled = false;
...@@ -808,7 +808,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -808,7 +808,7 @@ namespace OnlineStore.DeviceLibrary
//ShuoKeControls.ClosePort(); //ShuoKeControls.ClosePort();
} }
LogUtil.info(LOGGER, StoreName + ",停止运行,总运行时间:" + span.ToString()); LogUtil.info( StoreName + ",停止运行,总运行时间:" + span.ToString());
} }
private DateTime lastDisTime = DateTime.Now; private DateTime lastDisTime = DateTime.Now;
private string LastPosId = ""; private string LastPosId = "";
...@@ -821,7 +821,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -821,7 +821,7 @@ namespace OnlineStore.DeviceLibrary
{ {
return; return;
} }
LogUtil.error(LOGGER, StoreName + " 报警,报警类型:" + nalarmType); LogUtil.error( StoreName + " 报警,报警类型:" + nalarmType);
this.alarmType = nalarmType; this.alarmType = nalarmType;
if (nalarmType.Equals(StoreAlarmType.AxisAlarm) || nalarmType.Equals(StoreAlarmType.AxisMoveError)) if (nalarmType.Equals(StoreAlarmType.AxisAlarm) || nalarmType.Equals(StoreAlarmType.AxisMoveError))
...@@ -847,7 +847,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -847,7 +847,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
LogUtil.error(LOGGER, StoreName + "轴报警,关闭刹车,停止运动,关闭轴,打开报警灯"); LogUtil.error( StoreName + "轴报警,关闭刹车,停止运动,关闭轴,打开报警灯");
IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW); IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
StoreMove.EndMove(); StoreMove.EndMove();
StopMove(true); StopMove(true);
...@@ -855,7 +855,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -855,7 +855,7 @@ namespace OnlineStore.DeviceLibrary
else if (nalarmType == StoreAlarmType.SuddenStop) else if (nalarmType == StoreAlarmType.SuddenStop)
{ {
isInSuddenDown = true; isInSuddenDown = true;
LogUtil.error(LOGGER, StoreName + "收到急停信号,关闭刹车,停止运动,关闭轴,打开报警灯 "); LogUtil.error( StoreName + "收到急停信号,关闭刹车,停止运动,关闭轴,打开报警灯 ");
IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW); IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
StoreMove.EndMove(); StoreMove.EndMove();
StopMove(true); StopMove(true);
...@@ -864,7 +864,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -864,7 +864,7 @@ namespace OnlineStore.DeviceLibrary
else if (nalarmType.Equals(StoreAlarmType.NoAirCheck)) else if (nalarmType.Equals(StoreAlarmType.NoAirCheck))
{ {
isNoAirCheck = true; isNoAirCheck = true;
LogUtil.error(LOGGER, StoreName + " 未检测到气压信号 ,打开刹车,停止运动,关闭轴,打开报警灯 "); LogUtil.error( StoreName + " 未检测到气压信号 ,打开刹车,停止运动,关闭轴,打开报警灯 ");
IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW); IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
StoreMove.EndMove(); StoreMove.EndMove();
StopMove(true); StopMove(true);
...@@ -917,7 +917,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -917,7 +917,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error(StoreName + "定时处理出错:" + ex.ToString()); Common.LogUtil.error(StoreName + "定时处理出错:" + ex.ToString());
} }
IsChongfu = false; IsChongfu = false;
InProcess = false; InProcess = false;
...@@ -946,7 +946,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -946,7 +946,7 @@ namespace OnlineStore.DeviceLibrary
TimeSpan span = DateTime.Now - lastAirCloseTime; TimeSpan span = DateTime.Now - lastAirCloseTime;
if (span.TotalSeconds > Config.AirCheckSeconds) if (span.TotalSeconds > Config.AirCheckSeconds)
{ {
WarnMsg = "未检测到气压信号"; SetWarnMsg( "未检测到气压信号", "未检测到气压信号");
preAirValue = IO_VALUE.LOW; preAirValue = IO_VALUE.LOW;
LogUtil.info("已持续【" + FormUtil.GetSpanStr(span) + "】未检测到气压信号,报警"); LogUtil.info("已持续【" + FormUtil.GetSpanStr(span) + "】未检测到气压信号,报警");
Alarm(StoreAlarmType.NoAirCheck, "2", WarnMsg, StoreMoveType.None); Alarm(StoreAlarmType.NoAirCheck, "2", WarnMsg, StoreMoveType.None);
...@@ -1065,7 +1065,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1065,7 +1065,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error(StoreName + "灯处理定时器出错:", ex); Common.LogUtil.error(StoreName + "灯处理定时器出错:", ex);
} }
} }
private IO_VALUE lastAutoRun = IO_VALUE.LOW; private IO_VALUE lastAutoRun = IO_VALUE.LOW;
...@@ -1082,7 +1082,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1082,7 +1082,7 @@ namespace OnlineStore.DeviceLibrary
if (autoSingle.Equals(IO_VALUE.HIGH) && lastAutoRun.Equals(IO_VALUE.LOW)) if (autoSingle.Equals(IO_VALUE.HIGH) && lastAutoRun.Equals(IO_VALUE.LOW))
{ {
//没有启动时收到复位按钮,相当于启动按钮 //没有启动时收到复位按钮,相当于启动按钮
LogUtil.info(LOGGER, StoreName + "没有启动时收到复位按钮,相当于启动按钮,开始调用启动方法!"); LogUtil.info( StoreName + "没有启动时收到复位按钮,相当于启动按钮,开始调用启动方法!");
bool result = StartRun(); bool result = StartRun();
if (result.Equals(false)) if (result.Equals(false))
{ {
...@@ -1114,18 +1114,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -1114,18 +1114,18 @@ namespace OnlineStore.DeviceLibrary
{ {
if (StoreMove.MoveType.Equals(StoreMoveType.None)) if (StoreMove.MoveType.Equals(StoreMoveType.None))
{ {
LogUtil.info(LOGGER, "收到复位信号,当前无报警,且空闲中,只回到待机点"); LogUtil.info( "收到复位信号,当前无报警,且空闲中,只回到待机点");
MoveToP1(); MoveToP1();
} }
else else
{ {
LogUtil.info(LOGGER, "收到复位信号,当前无报警, 在" + StoreMove.MoveType + "处理中,不处理复位"); LogUtil.info( "收到复位信号,当前无报警, 在" + StoreMove.MoveType + "处理中,不处理复位");
} }
} }
else else
{ {
//收到复位信号 //收到复位信号
LogUtil.info(LOGGER, "收到复位信号,自动复位"); LogUtil.info( "收到复位信号,自动复位");
WarnMsg = "收到复位信号,自动复位"; WarnMsg = "收到复位信号,自动复位";
Reset(); Reset();
} }
...@@ -1156,7 +1156,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1156,7 +1156,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error(StoreName + "定时处理出错", ex); Common.LogUtil.error(StoreName + "定时处理出错", ex);
} }
} }
...@@ -1195,13 +1195,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -1195,13 +1195,13 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.info(StoreName + "之前有IO超时异常【" + alarmInfo.alarmDetail + "】,但是当前已经没有在等待中,清理信号超时异常!"); LogUtil.info(StoreName + "之前有IO超时异常【" + alarmInfo.alarmDetail + "】,但是当前已经没有在等待中,清理信号超时异常!");
alarmType = StoreAlarmType.None; alarmType = StoreAlarmType.None;
WarnMsg = ""; SetWarnMsg();
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "IOTimeOutProcess出错:" + ex.ToString()); LogUtil.error( "IOTimeOutProcess出错:" + ex.ToString());
} }
} }
...@@ -1217,11 +1217,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -1217,11 +1217,11 @@ namespace OnlineStore.DeviceLibrary
{ {
if (storeRunStatus < StoreRunStatus.Runing || StoreMove.MoveType == StoreMoveType.InStore || StoreMove.MoveType == StoreMoveType.OutStore) if (storeRunStatus < StoreRunStatus.Runing || StoreMove.MoveType == StoreMoveType.InStore || StoreMove.MoveType == StoreMoveType.OutStore)
{ {
LogUtil.info(LOGGER, StoreName + "已经累计出入库" + CurrInOutACount + "次,当时当前正在忙碌中暂不复位"); LogUtil.info( StoreName + "已经累计出入库" + CurrInOutACount + "次,当时当前正在忙碌中暂不复位");
} }
else else
{ {
LogUtil.info(LOGGER, StoreName + "已经累计出入库" + CurrInOutACount + "次,需要复位一下"); LogUtil.info( StoreName + "已经累计出入库" + CurrInOutACount + "次,需要复位一下");
Reset(); Reset();
} }
} }
...@@ -1229,11 +1229,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -1229,11 +1229,11 @@ namespace OnlineStore.DeviceLibrary
{ {
if (storeRunStatus < StoreRunStatus.Runing || StoreMove.MoveType == StoreMoveType.InStore || StoreMove.MoveType == StoreMoveType.OutStore) if (storeRunStatus < StoreRunStatus.Runing || StoreMove.MoveType == StoreMoveType.InStore || StoreMove.MoveType == StoreMoveType.OutStore)
{ {
LogUtil.info(LOGGER, StoreName + "已经累计出入库" + CurrInOutCount + "次,当时当前正在忙碌中暂不复位旋转轴"); LogUtil.info( StoreName + "已经累计出入库" + CurrInOutCount + "次,当时当前正在忙碌中暂不复位旋转轴");
} }
else else
{ {
LogUtil.info(LOGGER, StoreName + "已经累计出入库" + CurrInOutCount + "次,需要复位一下旋转轴"); LogUtil.info( StoreName + "已经累计出入库" + CurrInOutCount + "次,需要复位一下旋转轴");
} }
} }
else if (LineConnect.CanStartOut() || IsDebug) else if (LineConnect.CanStartOut() || IsDebug)
...@@ -1250,12 +1250,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -1250,12 +1250,12 @@ namespace OnlineStore.DeviceLibrary
if (currInOutFixture != null) if (currInOutFixture != null)
{ //出库 { //出库
LogUtil.info(LOGGER, StoreName + "开始执行排队中的出库【" + currInOutFixture.ToStr() + "】"); LogUtil.info( StoreName + "开始执行排队中的出库【" + currInOutFixture.ToStr() + "】");
bool result = StartOutStoreMove(new InOutParam(currInOutFixture)); bool result = StartOutStoreMove(new InOutParam(currInOutFixture));
//bool result = StartOutStoreMove(new InOutParam("", currInOutFixture.PosId, currInOutFixture.plateH, currInOutFixture.plateW)); //bool result = StartOutStoreMove(new InOutParam("", currInOutFixture.PosId, currInOutFixture.plateH, currInOutFixture.plateW));
if (!result) if (!result)
{ {
LogUtil.info(LOGGER, StoreName + " 执行排队中的出库【" + currInOutFixture.ToStr() + "】失败,重新加入等待队列"); LogUtil.info( StoreName + " 执行排队中的出库【" + currInOutFixture.ToStr() + "】失败,重新加入等待队列");
AddWaitOutInfo(currInOutFixture); AddWaitOutInfo(currInOutFixture);
} }
} }
...@@ -1263,7 +1263,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1263,7 +1263,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "处理出入库排队列表出错:" + ex.ToString()); LogUtil.error( "处理出入库排队列表出错:" + ex.ToString());
} }
} }
...@@ -1308,7 +1308,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1308,7 +1308,7 @@ namespace OnlineStore.DeviceLibrary
if (alarmIo == 1) if (alarmIo == 1)
{ {
WarnMsg = StoreName + " 运动轴" + axisInfo.Explain + "报警"; SetWarnMsg( StoreName + " 运动轴" + axisInfo.Explain + "报警",axisInfo.Explain+"_轴报警");
info.AlarmIoValue = alarmIo; info.AlarmIoValue = alarmIo;
Alarm(StoreAlarmType.AxisAlarm, GetAlarmCodeByAxis(axisInfo).ToString(), WarnMsg, StoreMoveType.None); Alarm(StoreAlarmType.AxisAlarm, GetAlarmCodeByAxis(axisInfo).ToString(), WarnMsg, StoreMoveType.None);
isInAlarm = true; isInAlarm = true;
...@@ -1317,7 +1317,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1317,7 +1317,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (!info.AlarmIoValue.Equals(alarmIo)) if (!info.AlarmIoValue.Equals(alarmIo))
{ {
LogUtil.error(LOGGER, StoreName + " 运动轴 " + axisInfo.Explain + ",报警已解除!"); LogUtil.error( StoreName + " 运动轴 " + axisInfo.Explain + ",报警已解除!");
info.AlarmIoValue = alarmIo; info.AlarmIoValue = alarmIo;
} }
} }
...@@ -1357,7 +1357,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1357,7 +1357,7 @@ namespace OnlineStore.DeviceLibrary
{ {
CloseAllAxis(); CloseAllAxis();
} }
LogUtil.info(LOGGER, StoreName + "StopMove"); LogUtil.info( StoreName + "StopMove");
IOManager.IOMove(IO_Type.Door_Down, IO_VALUE.LOW); IOManager.IOMove(IO_Type.Door_Down, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.Door_Up, IO_VALUE.LOW); IOManager.IOMove(IO_Type.Door_Up, IO_VALUE.LOW);
...@@ -1411,8 +1411,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -1411,8 +1411,8 @@ namespace OnlineStore.DeviceLibrary
if (position == null) if (position == null)
{ //出入库没有找到服务器发送的库位,需要打印日志方便查询原因 { //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = "入库未找到库位:【" + inoutInfo.ToStr() + "】 "; WarnMsg = "入库未找到库位:【" + inoutInfo.ToStr() + "】 ";
LogUtil.error(LOGGER, "收到服务器入库命令:入库未找到库位:【" + inoutInfo.ToStr() + "】"); LogUtil.error( "收到服务器入库命令:入库未找到库位:【" + inoutInfo.ToStr() + "】");
LogUtil.info(LOGGER, "收到服务器入库命令:入库未找到库位:【" + inoutInfo.ToStr() + "】"); LogUtil.info( "收到服务器入库命令:入库未找到库位:【" + inoutInfo.ToStr() + "】");
return; return;
} }
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器; //TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
...@@ -1421,11 +1421,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -1421,11 +1421,11 @@ namespace OnlineStore.DeviceLibrary
InOutParam param = new InOutParam(inoutInfo); InOutParam param = new InOutParam(inoutInfo);
StartInStoreMove(param); StartInStoreMove(param);
//如果当前正在出入库中,需要记录下来,等待空闲时执行 //如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil.info(LOGGER, StoreName + " 收到服务器入库命令:【" + inoutInfo.ToStr() + "】开始入库!"); LogUtil.info( StoreName + " 收到服务器入库命令:【" + inoutInfo.ToStr() + "】开始入库!");
} }
else else
{ {
LogUtil.info(LOGGER, StoreName + " 收到服务器入库命令:【" + inoutInfo.ToStr() + "】 正在忙碌中,无法入库!"); LogUtil.info( StoreName + " 收到服务器入库命令:【" + inoutInfo.ToStr() + "】 正在忙碌中,无法入库!");
} }
} }
...@@ -1440,7 +1440,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1440,7 +1440,7 @@ namespace OnlineStore.DeviceLibrary
if (storeRunStatus.Equals(StoreRunStatus.Wait)) if (storeRunStatus.Equals(StoreRunStatus.Wait))
{ {
LogUtil.info(LOGGER, logName + " 设备未启动,验证失败"); LogUtil.info( logName + " 设备未启动,验证失败");
return false; return false;
} }
//发送扫码内容到服务器进行入库操作 //发送扫码内容到服务器进行入库操作
...@@ -1455,23 +1455,23 @@ namespace OnlineStore.DeviceLibrary ...@@ -1455,23 +1455,23 @@ namespace OnlineStore.DeviceLibrary
Operation resultOperation = HttpHelper.PostOP(StoreManager.GetPostApi(server), operation, out timeOut); Operation resultOperation = HttpHelper.PostOP(StoreManager.GetPostApi(server), operation, out timeOut);
if (timeOut) if (timeOut)
{ {
LogUtil.info(LOGGER, logName + " 第" + i + "次发送超时 "); LogUtil.info( logName + " 第" + i + "次发送超时 ");
continue; continue;
} }
if (resultOperation == null) if (resultOperation == null)
{ {
// CodeMsg = "二维码【" + message + "】没有收到服务器反馈"; // CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
LogUtil.info(LOGGER, logName + " 没有收到服务器反馈 "); LogUtil.info( logName + " 没有收到服务器反馈 ");
} }
else if (!string.IsNullOrEmpty(resultOperation.msg)) else if (!string.IsNullOrEmpty(resultOperation.msg))
{ {
//如果有提示消息,直接显示提示 //如果有提示消息,直接显示提示
LogUtil.info(LOGGER, logName + "服务器反馈 :" + resultOperation.msg); LogUtil.info( logName + "服务器反馈 :" + resultOperation.msg);
} }
else if (resultOperation.op.Equals(1)) else if (resultOperation.op.Equals(1))
{ {
LogUtil.info(LOGGER, logName + " 成功"); LogUtil.info( logName + " 成功");
return true; return true;
} }
break; break;
...@@ -1479,7 +1479,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1479,7 +1479,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.info(LOGGER, logName + " 出错:" + ex.ToString()); LogUtil.info( logName + " 出错:" + ex.ToString());
} }
return false; return false;
...@@ -1506,7 +1506,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1506,7 +1506,7 @@ namespace OnlineStore.DeviceLibrary
{ //出入库没有找到服务器发送的库位,需要打印日志方便查询原因 { //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = "入库未找到库位:二维码【" + message + "】库位【" + posId + "】 "; WarnMsg = "入库未找到库位:二维码【" + message + "】库位【" + posId + "】 ";
LogUtil.error(logName + "未找到库位"); LogUtil.error(logName + "未找到库位");
// LogUtil.info(LOGGER, "收到流水线入库:入库未找到库位:二维码【" + message + "】库位【" + posId + "】"); // LogUtil.info( "收到流水线入库:入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
return; return;
} }
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器; //TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
...@@ -1582,7 +1582,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1582,7 +1582,7 @@ namespace OnlineStore.DeviceLibrary
TimeSpan span = DateTime.Now - LastEndBlowTime; TimeSpan span = DateTime.Now - LastEndBlowTime;
if (span.TotalMinutes > this.Config.BlowAir_Interval) if (span.TotalMinutes > this.Config.BlowAir_Interval)
{ {
LOGGER.Info("当前最大湿度:" + currMaxHumidity.ToString() + ",开始吹气湿度:" + startBlowHumidity + ",当前不在吹气中,且间隔超过" + Config.BlowAir_Interval + "分钟,开始吹气!"); LogUtil.info("当前最大湿度:" + currMaxHumidity.ToString() + ",开始吹气湿度:" + startBlowHumidity + ",当前不在吹气中,且间隔超过" + Config.BlowAir_Interval + "分钟,开始吹气!");
IsInBlowing = true; IsInBlowing = true;
//Thread.Sleep(100); //Thread.Sleep(100);
IOManager.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.HIGH);
...@@ -1593,7 +1593,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1593,7 +1593,7 @@ namespace OnlineStore.DeviceLibrary
if (IsInBlowing && stopBlowHumidity > currMaxHumidity) if (IsInBlowing && stopBlowHumidity > currMaxHumidity)
{ {
LOGGER.Info("当前最大湿度:" + currMaxHumidity.ToString() + ",停止吹气湿度:" + stopBlowHumidity + ",停止吹气!"); LogUtil.info("当前最大湿度:" + currMaxHumidity.ToString() + ",停止吹气湿度:" + stopBlowHumidity + ",停止吹气!");
IsInBlowing = false; IsInBlowing = false;
IOManager.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW); IOManager.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
LastEndBlowTime = DateTime.Now; LastEndBlowTime = DateTime.Now;
...@@ -1604,7 +1604,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1604,7 +1604,7 @@ namespace OnlineStore.DeviceLibrary
TimeSpan span = DateTime.Now - LastBeginBlowTime; TimeSpan span = DateTime.Now - LastBeginBlowTime;
if (span.TotalMinutes > this.Config.BlowAir_Time) if (span.TotalMinutes > this.Config.BlowAir_Time)
{ {
LOGGER.Info("已经吹气" + span.TotalMinutes + "分钟,超过配置的吹气时间" + Config.BlowAir_Time + "分钟,停止吹气!"); LogUtil.info("已经吹气" + span.TotalMinutes + "分钟,超过配置的吹气时间" + Config.BlowAir_Time + "分钟,停止吹气!");
IsInBlowing = false; IsInBlowing = false;
//Thread.Sleep(100); //Thread.Sleep(100);
IOManager.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW); IOManager.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
...@@ -1619,7 +1619,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1619,7 +1619,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (temp > Max_Temperature && Max_Temperature > 0) else if (temp > Max_Temperature && Max_Temperature > 0)
{ {
LOGGER.Info("当前温度【" + param.Temperate + "】超过最高温度【" + Max_Temperature + "】,开始报警!"); LogUtil.info("当前温度【" + param.Temperate + "】超过最高温度【" + Max_Temperature + "】,开始报警!");
needAlarm = true; needAlarm = true;
//Thread.Sleep(100); //Thread.Sleep(100);
IOManager.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW); IOManager.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
...@@ -1628,7 +1628,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1628,7 +1628,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (IsInBlowing.Equals(false) && TempOrHumidityIsAlarm) if (IsInBlowing.Equals(false) && TempOrHumidityIsAlarm)
{ {
LOGGER.Info("不在吹气中,且当前温度【" + param.Temperate + "】低于【" + Max_Temperature + "】,关闭报警!"); LogUtil.info("不在吹气中,且当前温度【" + param.Temperate + "】低于【" + Max_Temperature + "】,关闭报警!");
TempOrHumidityIsAlarm = false; TempOrHumidityIsAlarm = false;
//Thread.Sleep(100); //Thread.Sleep(100);
IOManager.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW); IOManager.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
...@@ -1646,7 +1646,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1646,7 +1646,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error(StoreName + "HumidityProcess出错:" + ex.ToString()); Common.LogUtil.error(StoreName + "HumidityProcess出错:" + ex.ToString());
} }
} }
private void HTAlarm() private void HTAlarm()
...@@ -1704,7 +1704,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1704,7 +1704,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("定时给服务器发送消息出错:", ex); Common.LogUtil.error("定时给服务器发送消息出错:", ex);
} }
} }
} }
...@@ -1793,7 +1793,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1793,7 +1793,7 @@ namespace OnlineStore.DeviceLibrary
boxStatus.status = (int)lastPosIdStatus; boxStatus.status = (int)lastPosIdStatus;
if (lastPosId != "") if (lastPosId != "")
{ {
LogUtil.info(LOGGER, "给服务器发送出入库完成消息:" + StoreName + ",status【" + lastPosIdStatus + "】posId【" + lastPosId + "】"); LogUtil.info( "给服务器发送出入库完成消息:" + StoreName + ",status【" + lastPosIdStatus + "】posId【" + lastPosId + "】");
} }
lastPosId = ""; lastPosId = "";
} }
...@@ -1835,7 +1835,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1835,7 +1835,7 @@ namespace OnlineStore.DeviceLibrary
if (Max_Humidity <= 0 || (Max_Temperature <= 0)) if (Max_Humidity <= 0 || (Max_Temperature <= 0))
{ {
lineOperation.op = 5; lineOperation.op = 5;
LogUtil.info(LOGGER, StoreName + "没有湿度预警范围,需要从服务器获取,发送OP=" + lineOperation.op); LogUtil.info( StoreName + "没有湿度预警范围,需要从服务器获取,发送OP=" + lineOperation.op);
} }
string server = ConfigAppSettings.GetValue(Setting_Init.http_server); string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
bool isTimeout = false; bool isTimeout = false;
...@@ -1876,13 +1876,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -1876,13 +1876,13 @@ namespace OnlineStore.DeviceLibrary
{ {
string maxHumidity = data[ParamDefine.maxHumidity]; string maxHumidity = data[ParamDefine.maxHumidity];
string maxTemp = data[ParamDefine.maxTemperature]; string maxTemp = data[ParamDefine.maxTemperature];
LogUtil.info(LOGGER, "收到服务器温湿度预警值: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(LOGGER, "保存温湿度预警值:Max_Humidity=" + Max_Humidity + ",Max_Temperature=" + Max_Temperature); LogUtil.info( "保存温湿度预警值:Max_Humidity=" + Max_Humidity + ",Max_Temperature=" + Max_Temperature);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -1918,7 +1918,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1918,7 +1918,7 @@ namespace OnlineStore.DeviceLibrary
//rfidLoc: 料架的架位,值为 - 1时,可以自由分配皮带线, 小料时,架位为1 - 46优先走1 / 2号皮带线,47 - 92优先走3 / 4号皮带线, 70,71,72时只能分配到3 / 4号皮带线; 大料时,架位1 - 6优先走1 / 2号皮带线, 7 - 12优先走3 / 4号皮带线 //rfidLoc: 料架的架位,值为 - 1时,可以自由分配皮带线, 小料时,架位为1 - 46优先走1 / 2号皮带线,47 - 92优先走3 / 4号皮带线, 70,71,72时只能分配到3 / 4号皮带线; 大料时,架位1 - 6优先走1 / 2号皮带线, 7 - 12优先走3 / 4号皮带线
string dataStr = JsonHelper.SerializeObject(data); string dataStr = JsonHelper.SerializeObject(data);
LogUtil.info(LOGGER, "收到服务器出库消息:【" + dataStr+"】"); LogUtil.info( "收到服务器出库消息:【" + dataStr+"】");
int index = -1; int index = -1;
foreach (string posId in posIdArray) foreach (string posId in posIdArray)
...@@ -1937,7 +1937,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1937,7 +1937,7 @@ namespace OnlineStore.DeviceLibrary
{ {
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因 //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg = StoreName + "未找到库位:【" + intouInfo.ToStr() + "】"; WarnMsg = StoreName + "未找到库位:【" + intouInfo.ToStr() + "】";
LogUtil.error(LOGGER, WarnMsg); LogUtil.error( WarnMsg);
continue; continue;
} }
...@@ -1946,7 +1946,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1946,7 +1946,7 @@ namespace OnlineStore.DeviceLibrary
//判断是否接收过此库位的出库信息 //判断是否接收过此库位的出库信息
if (StoreMove.MoveType.Equals(StoreMoveType.OutStore) && StoreMove.MoveParam.PosInfo.PosId.Equals(posId)) if (StoreMove.MoveType.Equals(StoreMoveType.OutStore) && StoreMove.MoveParam.PosInfo.PosId.Equals(posId))
{ {
LogUtil.info(LOGGER, StoreName + " 出库命令【" + intouInfo.ToStr() + "】重复,正在【" + posId + "】出库中"); LogUtil.info( StoreName + " 出库命令【" + intouInfo.ToStr() + "】重复,正在【" + posId + "】出库中");
continue; continue;
} }
else else
...@@ -1956,7 +1956,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1956,7 +1956,7 @@ namespace OnlineStore.DeviceLibrary
reviceList = (from m in reviceList where m.PosId.Equals(posId) select m).ToList<InOutPosInfo>(); reviceList = (from m in reviceList where m.PosId.Equals(posId) select m).ToList<InOutPosInfo>();
if (reviceList.Count > 0) if (reviceList.Count > 0)
{ {
LogUtil.debug(LOGGER, StoreName + " 出库命令【" + intouInfo.ToStr() + "】重复,排队列表中已存在【" + reviceList[0].ToStr() + "】"); LogUtil.debug( StoreName + " 出库命令【" + intouInfo.ToStr() + "】重复,排队列表中已存在【" + reviceList[0].ToStr() + "】");
continue; continue;
} }
} }
...@@ -1971,13 +1971,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -1971,13 +1971,13 @@ namespace OnlineStore.DeviceLibrary
bool result = StartOutStoreMove(new InOutParam(intouInfo)); bool result = StartOutStoreMove(new InOutParam(intouInfo));
if (!result) if (!result)
{ {
LogUtil.info(LOGGER, StoreName + " 执行出库【" + intouInfo.ToStr() + "】失败,加入等待队列"); LogUtil.info( StoreName + " 执行出库【" + intouInfo.ToStr() + "】失败,加入等待队列");
AddWaitOutInfo(intouInfo); AddWaitOutInfo(intouInfo);
} }
} }
else else
{ {
LogUtil.error(LOGGER, "执行出库【" + intouInfo.ToStr() + "】失败,当前在忙碌中,加入等待队列"); LogUtil.error( "执行出库【" + intouInfo.ToStr() + "】失败,当前在忙碌中,加入等待队列");
AddWaitOutInfo(intouInfo); AddWaitOutInfo(intouInfo);
} }
......
...@@ -106,14 +106,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -106,14 +106,14 @@ namespace OnlineStore.DeviceLibrary
if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count) if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count)
{ {
newIndex = AutoStartIndex; newIndex = AutoStartIndex;
LogUtil.info(LOGGER, StoreName + "下一个索引不存在,重新开始自动盘点,索引【" + AutoStartIndex + "】"); LogUtil.info( StoreName + "下一个索引不存在,重新开始自动盘点,索引【" + AutoStartIndex + "】");
} }
else else
{ {
autoNext = false; autoNext = false;
readDITimer.Enabled = false; readDITimer.Enabled = false;
autoMsg = "自动盘点结束!"; autoMsg = "自动盘点结束!";
LogUtil.info(LOGGER, StoreName + "下一个索引不存在,自动盘点结束!"); LogUtil.info( StoreName + "下一个索引不存在,自动盘点结束!");
//回待机位 //回待机位
MoveToP1(); MoveToP1();
} }
...@@ -123,7 +123,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -123,7 +123,7 @@ namespace OnlineStore.DeviceLibrary
autoPositionIndex = newIndex; autoPositionIndex = newIndex;
string posid = PositionNumList[autoPositionIndex]; string posid = PositionNumList[autoPositionIndex];
InOutPosInfo inoutinfo = new InOutPosInfo(autoInoutCode, posid); InOutPosInfo inoutinfo = new InOutPosInfo(autoInoutCode, posid);
LogUtil.info(LOGGER, StoreName + "自动进入下一个仓位:posid=" + posid); LogUtil.info( StoreName + "自动进入下一个仓位:posid=" + posid);
autoMsg = "自动盘点:" + posid; autoMsg = "自动盘点:" + posid;
StartInventoryMove(new InOutParam(inoutinfo)); StartInventoryMove(new InOutParam(inoutinfo));
...@@ -132,7 +132,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -132,7 +132,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, ex.ToString()); LogUtil.error( ex.ToString());
} }
} }
...@@ -149,10 +149,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -149,10 +149,10 @@ namespace OnlineStore.DeviceLibrary
{ {
if (!LoadParamPosition(param)) if (!LoadParamPosition(param))
{ {
LogUtil.error(LOGGER, StoreName + " 启动盘点库位【" + posId + "】出错,找不到库位信息"); LogUtil.error( StoreName + " 启动盘点库位【" + posId + "】出错,找不到库位信息");
return; return;
} }
LogUtil.info(LOGGER, StoreName + " 启动盘点库位【" + posId + "】", storeMoveColor); LogUtil.info( StoreName + " 启动盘点库位【" + posId + "】");
storeRunStatus = StoreRunStatus.Busy; storeRunStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.CheckPosMove; storeStatus = StoreStatus.CheckPosMove;
StoreMove.NewMove(StoreMoveType.CheckPosition, param); StoreMove.NewMove(StoreMoveType.CheckPosition, param);
...@@ -161,7 +161,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -161,7 +161,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(LOGGER, StoreName + " 启动盘点库位【" + posId + "】出错,当前状态,storeStatus=" + storeRunStatus); LogUtil.error( StoreName + " 启动盘点库位【" + posId + "】出错,当前状态,storeStatus=" + storeRunStatus);
} }
} }
...@@ -174,7 +174,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -174,7 +174,7 @@ namespace OnlineStore.DeviceLibrary
private void CheckPositionLog(string msg) private void CheckPositionLog(string msg)
{ {
string posId = StoreMove.MoveParam != null ? "【" + StoreMove.MoveParam.PosInfo.PosId + "】" : " "; string posId = StoreMove.MoveParam != null ? "【" + StoreMove.MoveParam.PosInfo.PosId + "】" : " ";
LogUtil.info(LOGGER, posId + StoreMove.MoveStep + " " + msg, storeMoveColor); LogUtil.info( posId + StoreMove.MoveStep + " " + msg);
} }
} }
} }
...@@ -155,15 +155,24 @@ namespace OnlineStore.DeviceLibrary ...@@ -155,15 +155,24 @@ namespace OnlineStore.DeviceLibrary
if (wait.IsHomeMove) if (wait.IsHomeMove)
{ {
wait.IsEnd = ACHomeMoveIsEnd(wait.AxisInfo, out msg); wait.IsEnd = ACHomeMoveIsEnd(wait.AxisInfo, out msg);
if (wait.IsEnd)
{
RunLogUtil.AxisLog(new AxisMoveLog(StoreName, wait.AxisInfo.Explain, "回原点", 0,wait.AxisInfo.HomeHighSpeed, StoreMove.LastSetpTime, DateTime.Now, StoreMove.MoveParam.PosInfo.PosId, StoreMove.MoveParam.PosInfo.barcode));
}
} }
else else
{ {
wait.IsEnd = ACAxisMoveIsEnd(wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg); wait.IsEnd = ACAxisMoveIsEnd(wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
if (wait.IsEnd)
{
RunLogUtil.AxisLog(new AxisMoveLog(StoreName, wait.AxisInfo.Explain, "绝对运动", wait.TargetPosition,wait.TargetSpeed, StoreMove.LastSetpTime, DateTime.Now, StoreMove.MoveParam.PosInfo.PosId, StoreMove.MoveParam.PosInfo.barcode));
}
} }
if (!msg.Equals("")) if (!msg.Equals(""))
{ {
isOk = false; isOk = false;
WarnMsg = msg; //WarnMsg = msg;
SetWarnMsg(msg, StoreMove.GetStepDes()+"_轴运动报警", StoreMove);
Alarm(StoreAlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType); Alarm(StoreAlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, StoreMove.MoveType);
break; break;
} }
...@@ -189,10 +198,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -189,10 +198,12 @@ namespace OnlineStore.DeviceLibrary
if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs) if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
{ {
ConfigIO io = Config.getWaitIO(wait.IoType); ConfigIO io = Config.getWaitIO(wait.IoType);
WarnMsg = StoreName + "[" + StoreMove.MoveType + "][" + StoreMove.MoveStep + "] 等待" + io.DisplayStr + "=" + wait.IoValue + "超时 "; string msg = StoreName + "[" + StoreMove.MoveType + "][" + StoreMove.MoveStep + "] 等待" + io.DisplayStr + "=" + wait.IoValue + "超时 ";
SetWarnMsg(msg, StoreMove.GetStepDes() + "_超时报警", StoreMove);
if (WarnMsg.Contains("CheckPos") || WarnMsg.Contains("X03_点检")) if (WarnMsg.Contains("CheckPos") || WarnMsg.Contains("X03_点检"))
{ {
WarnMsg = ""; SetWarnMsg();
break; break;
} }
...@@ -262,14 +273,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -262,14 +273,17 @@ namespace OnlineStore.DeviceLibrary
if (isOk) if (isOk)
{ {
StoreMove.EndStepWait(); StoreMove.EndStepWait();
ClearStepAlarm(StoreMove.GetStepDes());
} }
else if (span.TotalSeconds > StoreMove.TimeOutSeconds) else if (span.TotalSeconds > StoreMove.TimeOutSeconds)
{ {
WarnMsg = StoreName + "[" + StoreMove.MoveType + "][" + StoreMove.MoveStep + "] 等待超时 [" + NotOkMsg string msg = StoreName + "[" + StoreMove.MoveType + "][" + StoreMove.MoveStep + "] 等待超时 [" + NotOkMsg
+ "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒"; + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
SetWarnMsg(msg, StoreMove.GetStepDes() + "_超时报警", StoreMove);
if (WarnMsg.Contains("CheckPos") || WarnMsg.Contains("X03_点检")) if (WarnMsg.Contains("CheckPos") || WarnMsg.Contains("X03_点检"))
{ {
WarnMsg = ""; SetWarnMsg();
return; return;
} }
...@@ -305,7 +319,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -305,7 +319,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(StoreName + " 启动入库【" + posId + "】出错,叉子料盘检测有料"); LogUtil.error(StoreName + " 启动入库【" + posId + "】出错,叉子料盘检测有料");
return; return;
} }
LogUtil.info(LOGGER, StoreName + " 启动入库【" + posId + "】", storeMoveColor); LogUtil.info( StoreName + " 启动入库【" + posId + "】");
storeRunStatus = StoreRunStatus.Busy; storeRunStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute; storeStatus = StoreStatus.InStoreExecute;
StoreMove.NewMove(StoreMoveType.InStore, param); StoreMove.NewMove(StoreMoveType.InStore, param);
...@@ -418,7 +432,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -418,7 +432,9 @@ namespace OnlineStore.DeviceLibrary
} }
} }
WarnMsg = StoreName + "入库 等待料仓门口检测到料盘 [" + StoreMove.MoveParam.PosInfo.barcode + "] [" + StoreMove.MoveParam.PosInfo.PosId + "] 超时 [" + Math.Round(StoreMove.StepSpan().TotalSeconds, 1) + "]秒 "; string msg = StoreName + "入库 等待料仓门口检测到料盘 [" + StoreMove.MoveParam.PosInfo.barcode + "] [" + StoreMove.MoveParam.PosInfo.PosId + "] 超时 [" + Math.Round(StoreMove.StepSpan().TotalSeconds, 1) + "]秒 ";
SetWarnMsg(msg, StoreMove.GetStepDes() + "_超时报警", StoreMove);
LogUtil.error(WarnMsg, 100); LogUtil.error(WarnMsg, 100);
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType); Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType);
} }
...@@ -573,8 +589,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -573,8 +589,9 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep == StoreMoveStep.SI_16_GoBack) else if (StoreMove.MoveStep == StoreMoveStep.SI_16_GoBack)
{ {
TimeSpan span = DateTime.Now - startInStoreTime; TimeSpan span = DateTime.Now - startInStoreTime;
RunLogUtil.InoutEndLog(new InoutEndLog(StoreName, "入库", startOutStoreTime, DateTime.Now, StoreMove.MoveParam.PosInfo.PosId, StoreMove.MoveParam.PosInfo.barcode));
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : ""; string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : "";
LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 整个入库流程结束,耗时【" + FormUtil.GetSpanStr(span) + "】!", storeMoveColor); LogUtil.info( StoreName + " 【" + posId + "】 整个入库流程结束,耗时【" + FormUtil.GetSpanStr(span) + "】!");
StoreMove.EndMove(); StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing; storeRunStatus = StoreRunStatus.Runing;
//设备连接,入库后,BOX恢复原始状态 //设备连接,入库后,BOX恢复原始状态
...@@ -583,7 +600,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -583,7 +600,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.info(LOGGER, StoreName + " 入库,moveStatus=" + StoreMove.MoveStep + ",没有对应的处理!"); LogUtil.info( StoreName + " 入库,moveStatus=" + StoreMove.MoveStep + ",没有对应的处理!");
} }
} }
...@@ -632,7 +649,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -632,7 +649,7 @@ namespace OnlineStore.DeviceLibrary
return false; return false;
} }
storeStatus = StoreStatus.OutStoreExecute; storeStatus = StoreStatus.OutStoreExecute;
LogUtil.info(LOGGER, StoreName + "启动出库【" + posId + "】 ", storeMoveColor); LogUtil.info( StoreName + "启动出库【" + posId + "】 ");
storeRunStatus = StoreRunStatus.Busy; storeRunStatus = StoreRunStatus.Busy;
StoreMove.NewMove(StoreMoveType.OutStore, param); StoreMove.NewMove(StoreMoveType.OutStore, param);
EmptyOut = false; EmptyOut = false;
...@@ -931,10 +948,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -931,10 +948,11 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep == StoreMoveStep.SO_31_WaitTake) else if (StoreMove.MoveStep == StoreMoveStep.SO_31_WaitTake)
{ {
TimeSpan span = DateTime.Now - startOutStoreTime; TimeSpan span = DateTime.Now - startOutStoreTime;
RunLogUtil.InoutEndLog(new InoutEndLog(StoreName, "出库", startOutStoreTime, DateTime.Now, StoreMove.MoveParam.PosInfo.PosId, StoreMove.MoveParam.PosInfo.barcode));
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : ""; string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PosInfo.PosId : "";
storeStatus = StoreStatus.StoreOnline; storeStatus = StoreStatus.StoreOnline;
LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 整个出库流程结束,耗时【" + FormUtil.GetSpanStr(span) + "】!", storeMoveColor); LogUtil.info( StoreName + " 【" + posId + "】 整个出库流程结束,耗时【" + FormUtil.GetSpanStr(span) + "】!");
StoreMove.EndMove(); StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing; storeRunStatus = StoreRunStatus.Runing;
InOutEndProcess(StoreMoveType.OutStore); InOutEndProcess(StoreMoveType.OutStore);
...@@ -960,6 +978,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -960,6 +978,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.info(StoreName + "执行用户操作:忽略检测信号,继续出库"); LogUtil.info(StoreName + "执行用户操作:忽略检测信号,继续出库");
StoreMove.EndStepWait(); StoreMove.EndStepWait();
ClearStepAlarm(StoreMove.GetStepDes());
} }
} }
private void SO_28_GoBack() private void SO_28_GoBack()
...@@ -1104,13 +1123,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -1104,13 +1123,13 @@ namespace OnlineStore.DeviceLibrary
if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count) if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count)
{ {
newIndex = AutoStartIndex; newIndex = AutoStartIndex;
LogUtil.info(LOGGER, StoreName + "下一个索引不存在,重新开始自动出入库,索引【" + AutoStartIndex + "】"); LogUtil.info( StoreName + "下一个索引不存在,重新开始自动出入库,索引【" + AutoStartIndex + "】");
} }
else else
{ {
autoNext = false; autoNext = false;
autoMsg = "自动出入库结束!"; autoMsg = "自动出入库结束!";
LogUtil.info(LOGGER, StoreName + "下一个索引不存在,自动 出入库结束!"); LogUtil.info( StoreName + "下一个索引不存在,自动 出入库结束!");
} }
} }
else else
...@@ -1121,21 +1140,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -1121,21 +1140,21 @@ namespace OnlineStore.DeviceLibrary
//判断是否需要重置 //判断是否需要重置
if (CurrInOutACount >= Config.Box_ResetACount) if (CurrInOutACount >= Config.Box_ResetACount)
{ {
LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把出库信息存入排队列表中"); LogUtil.info( StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把出库信息存入排队列表中");
Reset(false); Reset(false);
autoMsg = "自动出库:" + posid; autoMsg = "自动出库:" + posid;
AddWaitOutInfo(inoutinfo); AddWaitOutInfo(inoutinfo);
} }
else if (CurrInOutCount >= Config.Box_ResetMCount) else if (CurrInOutCount >= Config.Box_ResetMCount)
{ {
LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中"); LogUtil.info( StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中");
//ResetMiddleAxis(false); //ResetMiddleAxis(false);
autoMsg = "自动出库:" + posid; autoMsg = "自动出库:" + posid;
AddWaitOutInfo(inoutinfo); AddWaitOutInfo(inoutinfo);
} }
else else
{ {
LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid); LogUtil.info( StoreName + "自动进入下一个出库:posid=" + posid);
autoMsg = "自动出库:" + posid; autoMsg = "自动出库:" + posid;
StartOutStoreMove(new InOutParam(inoutinfo)); StartOutStoreMove(new InOutParam(inoutinfo));
} }
...@@ -1149,13 +1168,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -1149,13 +1168,13 @@ namespace OnlineStore.DeviceLibrary
if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count) if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count)
{ {
newIndex = AutoStartIndex; newIndex = AutoStartIndex;
LogUtil.info(LOGGER, StoreName + "下一个索引不存在,重新开始自动出入库,索引【" + AutoStartIndex + "】"); LogUtil.info( StoreName + "下一个索引不存在,重新开始自动出入库,索引【" + AutoStartIndex + "】");
} }
else else
{ {
autoNext = false; autoNext = false;
autoMsg = "自动出入库结束!"; autoMsg = "自动出入库结束!";
LogUtil.info(LOGGER, StoreName + "下一个索引不存在,自动 出入库结束!"); LogUtil.info( StoreName + "下一个索引不存在,自动 出入库结束!");
} }
} }
else else
...@@ -1165,21 +1184,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -1165,21 +1184,21 @@ namespace OnlineStore.DeviceLibrary
//判断是否需要重置 //判断是否需要重置
//if (CurrInOutACount >= Config.Box_ResetACount) //if (CurrInOutACount >= Config.Box_ResetACount)
//{ //{
// LogUtil.info(LOGGER, StoreName + "自动进入下一个入库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把入库信息存入排队列表中"); // LogUtil.info( StoreName + "自动进入下一个入库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把入库信息存入排队列表中");
// Reset(false); // Reset(false);
// autoMsg = "自动入库:" + posid; // autoMsg = "自动入库:" + posid;
// AddWaitOutInfo(inoutinfo); // AddWaitOutInfo(inoutinfo);
//} //}
//else if (CurrInOutCount >= Config.Box_ResetMCount) //else if (CurrInOutCount >= Config.Box_ResetMCount)
//{ //{
// LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中"); // LogUtil.info( StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中");
// //ResetMiddleAxis(false); // //ResetMiddleAxis(false);
// autoMsg = "自动入库:" + posid; // autoMsg = "自动入库:" + posid;
// AddWaitOutInfo(inoutinfo); // AddWaitOutInfo(inoutinfo);
//} //}
//else //else
{ {
LogUtil.info(LOGGER, StoreName + "自动进入下一个入库:posid=" + posid); LogUtil.info( StoreName + "自动进入下一个入库:posid=" + posid);
autoMsg = "自动入库:" + posid; autoMsg = "自动入库:" + posid;
StartInStoreMove(new InOutParam(inoutinfo)); StartInStoreMove(new InOutParam(inoutinfo));
} }
...@@ -1194,13 +1213,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -1194,13 +1213,13 @@ namespace OnlineStore.DeviceLibrary
private void InStoreLog(string msg) private void InStoreLog(string msg)
{ {
string posId = StoreMove.MoveParam != null ? "【" + StoreMove.MoveParam.PosInfo.PosId + "】" : " "; string posId = StoreMove.MoveParam != null ? "【" + StoreMove.MoveParam.PosInfo?.PosId + "】" : " ";
LogUtil.info(LOGGER, posId + StoreMove.MoveStep .ToString().Substring(0,6)+ msg, storeMoveColor); LogUtil.info( posId + StoreMove.MoveStep .ToString().Substring(0,6)+ msg);
} }
private void OutStoreLog(string msg) private void OutStoreLog(string msg)
{ {
string posId = StoreMove.MoveParam != null ? "【" + StoreMove.MoveParam.PosInfo.PosId + "】" : " "; string posId = StoreMove.MoveParam != null ? "【" + StoreMove.MoveParam.PosInfo?.PosId + "】" : " ";
LogUtil.info(LOGGER, posId + StoreMove.MoveStep.ToString().Substring(0,6) + " " + msg, storeMoveColor); LogUtil.info( posId + StoreMove.MoveStep.ToString().Substring(0,6) + " " + msg);
} }
} }
} }
...@@ -19,7 +19,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -19,7 +19,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public static int CurrInOutType = 0; public static int CurrInOutType = 0;
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static AC_SA_BoxBean Store = null; public static AC_SA_BoxBean Store = null;
public static AC_SA_Config Config = null; public static AC_SA_Config Config = null;
private static bool isInit = false; private static bool isInit = false;
...@@ -27,8 +27,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -27,8 +27,9 @@ namespace OnlineStore.DeviceLibrary
public StoreManager() public StoreManager()
{ {
} }
public static Dictionary<string, string> StepDesMap = new Dictionary<string, string>();
public static void CheckEnum(Type type) public static void CheckEnum(Type type,bool isStep)
{ {
if (type.IsEnum) if (type.IsEnum)
{ {
...@@ -37,11 +38,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -37,11 +38,18 @@ namespace OnlineStore.DeviceLibrary
{ {
if (valueList.Contains(item)) if (valueList.Contains(item))
{ {
LogUtil.error(LOGGER, type.Name + "枚举值:" + item + "重复存在,请检查代码!"); LogUtil.error( type.Name + "枚举值:" + item + "重复存在,请检查代码!");
Application.Exit(); Application.Exit();
break; break;
} }
valueList.Add(item); valueList.Add(item);
if (isStep)
{
StoreMoveStep en = (StoreMoveStep)item;
string des = EnumDesHelper.GetStepDes(en);
StepDesMap.Add(en.ToString(), des);
}
} }
} }
} }
...@@ -61,13 +69,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -61,13 +69,13 @@ namespace OnlineStore.DeviceLibrary
{ {
//IsConnectServer = true; //IsConnectServer = true;
} }
CheckEnum(typeof(StoreMoveStep)); CheckEnum(typeof(StoreMoveStep),true );
CheckEnum(typeof(StoreStatus)); CheckEnum(typeof(StoreStatus),false);
CheckEnum(typeof(StoreRunStatus)); CheckEnum(typeof(StoreRunStatus),false );
isInit = true; isInit = true;
string storeType = ConfigAppSettings.GetValue(Setting_Init.Store_Type); string storeType = ConfigAppSettings.GetValue(Setting_Init.Store_Type);
LogUtil.info(LOGGER, "配置的料仓 类型=" + storeType + ",开始加载料仓配置"); LogUtil.info( "配置的料仓 类型=" + storeType + ",开始加载料仓配置");
if (storeType == StoreType.RC_AC_SA) if (storeType == StoreType.RC_AC_SA)
{ {
string appPath = Application.StartupPath; string appPath = Application.StartupPath;
...@@ -79,20 +87,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -79,20 +87,20 @@ namespace OnlineStore.DeviceLibrary
if (File.Exists(positionConfigFile)) if (File.Exists(positionConfigFile))
{ {
LogUtil.info(LOGGER, "加载位置文件:" + positionConfigFile); LogUtil.info( "加载位置文件:" + positionConfigFile);
CSVPositionReader<ACStorePosition>.ReloadCSVFile(positionConfigFile); CSVPositionReader<ACStorePosition>.ReloadCSVFile(positionConfigFile);
} }
Config = (AC_SA_Config)storeConfig; Config = (AC_SA_Config)storeConfig;
Store = new AC_SA_BoxBean(Config); Store = new AC_SA_BoxBean(Config);
Store.CID = CID; Store.CID = CID;
LogUtil.info(LOGGER, "加载料仓完成!"); LogUtil.info( "加载料仓完成!");
return Store; return Store;
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("出错:", ex); Common.LogUtil.error("出错:", ex);
MessageBox.Show(ex.ToString(), "加载配置错误(请检查配置)"); MessageBox.Show(ex.ToString(), "加载配置错误(请检查配置)");
Application.Exit(); Application.Exit();
} }
...@@ -122,14 +130,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -122,14 +130,14 @@ namespace OnlineStore.DeviceLibrary
bool result = CSVConfigReader.SaveBoxPosition(configFile, storeConfig); bool result = CSVConfigReader.SaveBoxPosition(configFile, storeConfig);
if (!result) if (!result)
{ {
LOGGER.Error("保存配置文件失败:" + configFile); Common.LogUtil.error("保存配置文件失败:" + configFile);
} }
Store.Config = storeConfig; Store.Config = storeConfig;
Store.MoveAxisConfig(); Store.MoveAxisConfig();
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("出错:", ex); Common.LogUtil.error("出错:", ex);
} }
} }
private static string api_communication = "service/store/communication"; //流水线状态通信接口 private static string api_communication = "service/store/communication"; //流水线状态通信接口
......
...@@ -15,7 +15,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -15,7 +15,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public class InOutParam public class InOutParam
{ {
public static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // public static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public InOutParam() public InOutParam()
{ {
ACStoreP = null; ACStoreP = null;
...@@ -43,7 +43,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -43,7 +43,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(log, "出入库获取库位信息GetKTKPosition出错:" + ex.ToString()); LogUtil.error( "出入库获取库位信息GetKTKPosition出错:" + ex.ToString());
} }
return ACStoreP; return ACStoreP;
} }
......
...@@ -27,11 +27,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -27,11 +27,12 @@ namespace OnlineStore.DeviceLibrary
/// 提示消息,一般发给服务器后清空(LineBean表示报警提示消息,BoxBean表示出入库失败的原因记录) /// 提示消息,一般发给服务器后清空(LineBean表示报警提示消息,BoxBean表示出入库失败的原因记录)
/// </summary> /// </summary>
public string WarnMsg = ""; public string WarnMsg = "";
private WarnParam warnParam = new WarnParam();
/// <summary> /// <summary>
/// 日志颜色 /// 日志颜色
/// </summary> /// </summary>
protected static Color storeMoveColor = Color.Blue; protected static Color storeMoveColor = Color.Blue;
protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public string StoreName { get; set; } public string StoreName { get; set; }
public int StoreID { get; set; } public int StoreID { get; set; }
/// <summary> /// <summary>
...@@ -98,7 +99,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -98,7 +99,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error(ex.ToString()); Common.LogUtil.error(ex.ToString());
} }
} }
...@@ -257,7 +258,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -257,7 +258,7 @@ namespace OnlineStore.DeviceLibrary
protected void ACAxisHomeMove(ConfigMoveAxis moveAxis) protected void ACAxisHomeMove(ConfigMoveAxis moveAxis)
{ {
moveAxis.TargetPosition = 0; moveAxis.TargetPosition = 0;
LogUtil.info(LOGGER, moveAxis.DisplayStr + "speed[" + moveAxis.TargetSpeed + "]开始原点返回"); LogUtil.info( moveAxis.DisplayStr + "speed[" + moveAxis.TargetSpeed + "]开始原点返回");
StoreMove.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true)); StoreMove.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true));
AddAxisMoveTime(moveAxis); AddAxisMoveTime(moveAxis);
ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed); ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed);
...@@ -305,7 +306,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -305,7 +306,7 @@ namespace OnlineStore.DeviceLibrary
//判断是否需要重新运动 //判断是否需要重新运动
if (StoreMove.CanWhileCount > 0) if (StoreMove.CanWhileCount > 0)
{ {
LogUtil.error(LOGGER, moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount + LogUtil.error( moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount +
"],误差过大,重新开始运动,剩余[" + StoreMove.CanWhileCount + "]次"); "],误差过大,重新开始运动,剩余[" + StoreMove.CanWhileCount + "]次");
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed); ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
StoreMove.CanWhileCount--; StoreMove.CanWhileCount--;
...@@ -314,7 +315,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -314,7 +315,7 @@ namespace OnlineStore.DeviceLibrary
{ {
msg = StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount msg = StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount
+ "],误差过大,需要报警"; + "],误差过大,需要报警";
LogUtil.error(LOGGER, msg); LogUtil.error( msg);
} }
} }
return false; return false;
...@@ -334,15 +335,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -334,15 +335,15 @@ namespace OnlineStore.DeviceLibrary
//判断是否需要重新运动 //判断是否需要重新运动
if (StoreMove.CanWhileCount > 0) if (StoreMove.CanWhileCount > 0)
{ {
LogUtil.error(LOGGER, moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],重新回原点,剩余[" + StoreMove.CanWhileCount + "]次"); LogUtil.error( moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],重新回原点,剩余[" + StoreMove.CanWhileCount + "]次");
//LogUtil.error(LOGGER, StoreName + moveAxis.DisplayStr + "重新回原点"); //LogUtil.error( StoreName + moveAxis.DisplayStr + "重新回原点");
ACServerManager.HomeMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed); ACServerManager.HomeMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed);
StoreMove.CanWhileCount--; StoreMove.CanWhileCount--;
} }
else else
{ {
msg = StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警"; msg = StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警";
LogUtil.error(LOGGER, msg); LogUtil.error( msg);
} }
} }
return false; return false;
...@@ -360,7 +361,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -360,7 +361,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (!isInit) if (!isInit)
{ {
StoreMove = new StoreMoveInfo(StoreID); StoreMove = new StoreMoveInfo(StoreID,StoreName);
mainTimer = new System.Timers.Timer(); mainTimer = new System.Timers.Timer();
mainTimer.Enabled = false; mainTimer.Enabled = false;
...@@ -498,7 +499,125 @@ namespace OnlineStore.DeviceLibrary ...@@ -498,7 +499,125 @@ namespace OnlineStore.DeviceLibrary
return sta; return sta;
} }
} }
/// <summary>
/// 设置报警消息,报警类型,清除报警时记录日志
/// </summary>
/// <param name="msg"></param>
/// <param name="logtype"></param>
/// <param name="logseconds"></param>
public void SetWarnMsg(string msg = "", string alarmType = "", StoreMoveInfo moveInfo = null, int logseconds = 10)
{
int logtype = 801;
if (moveInfo != null)
{
logtype = StoreID * 10000 + (int)moveInfo.MoveStep;
}
if (String.IsNullOrEmpty(msg).Equals(false))
{
if (WarnMsg.Equals(msg))
{
if (msg.StartsWith(StoreName))
{
LogUtil.error(msg, logtype, logseconds);
}
else
{
LogUtil.error(StoreName + msg, logtype, logseconds);
}
}
else
{
if (msg.StartsWith(StoreName))
{
LogUtil.error(msg);
}
else
{
LogUtil.error(StoreName + msg);
}
}
}
if (!warnParam.AlarmType.Equals(alarmType))
{
//报警类型不一致,若之前不是空,记录日志
if (!String.IsNullOrEmpty(warnParam.AlarmType))
{
RunLogUtil.ErrorLog(new ErrorLog(StoreName, warnParam.AlarmType, WarnMsg, warnParam.StartTime, DateTime.Now, warnParam.OperteType, warnParam.PosId, warnParam.Barcode));
}
//更新开始时间
warnParam.StartTime = DateTime.Now;
if (moveInfo != null)
{
warnParam.PosId = moveInfo.MoveParam?.PosInfo?.PosId;
warnParam.Barcode = moveInfo.MoveParam?.PosInfo?.barcode;
warnParam.OperteType = moveInfo.MoveType.ToString();
}
else
{
warnParam.PosId = "";
warnParam.Barcode = "";
warnParam.OperteType = "";
}
}
WarnMsg = msg;
warnParam.AlarmType = alarmType;
}
protected void ClearStepAlarm(string stepDes)
{
if (isInSuddenDown || isNoAirCheck)
{
return;
}
if (String.IsNullOrEmpty(WarnMsg).Equals(false) && String.IsNullOrEmpty(warnParam.AlarmType).Equals(false))
{
if (alarmType.Equals(StoreAlarmType.IoSingleTimeOut))
{
string alarmTypeStr = stepDes + "_超时报警";
if (warnParam.AlarmType.Equals(alarmTypeStr))
{
LogUtil.info(StoreName + $"步骤{stepDes}结束,清理【{ WarnMsg }】 ");
alarmType = StoreAlarmType.None;
SetWarnMsg("");
}
}
else if (alarmType.Equals(StoreAlarmType.AxisMoveError))
{
string alarmTypeStr = stepDes + "_轴运动报警";
if (warnParam.AlarmType.Equals(alarmTypeStr))
{
LogUtil.info(StoreName + $"步骤{stepDes}结束,清理【{ WarnMsg }】 ");
alarmType = StoreAlarmType.None;
SetWarnMsg("");
}
}
}
}
}
public class WarnParam
{
public WarnParam()
{
}
public WarnParam(string alarmType, DateTime startTime, string operType, string posId, string barcode)
{
this.AlarmType = alarmType;
this.StartTime = startTime;
this.OperteType = operType;
this.PosId = posId;
this.Barcode = barcode;
}
public string AlarmType = "";
public DateTime StartTime = DateTime.Now;
public string OperteType = "";
public string PosId = "";
public string Barcode = "";
} }
} }
...@@ -4,6 +4,7 @@ using OnlineStore.DeviceLibrary; ...@@ -4,6 +4,7 @@ using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.IO.Ports; using System.IO.Ports;
...@@ -120,63 +121,73 @@ namespace OnlineStore.DeviceLibrary ...@@ -120,63 +121,73 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 无操作,等待状态 /// 无操作,等待状态
/// </summary> /// </summary>
[Description("")]
Wait = 0, Wait = 0,
#region 料仓原点返回和重置步骤 #region 料仓原点返回和重置步骤
/// <summary> /// <summary>
/// 料仓原点返回和重置步骤,,定位气缸下降 /// 料仓原点返回和重置步骤,,定位气缸下降
/// </summary> /// </summary>
[Description("复位_定位气缸下降")]
BOX_H_LocationCylinderBack = 010, BOX_H_LocationCylinderBack = 010,
/// <summary> /// <summary>
/// 料仓原点返回和重置步骤,轴三先相对走3000 /// 料仓原点返回和重置步骤,进出轴原点返回
/// </summary> /// </summary>
[Description("复位_进出轴原点返回")]
BOX_H_InOutMove = 011, BOX_H_InOutMove = 011,
/// <summary> /// <summary>
/// 料仓原点返回和重置步骤,,轴三进出轴先返回原点 /// 料仓原点返回和重置步骤,,压紧轴,旋转轴,上下轴原点返回
/// </summary> /// </summary>
[Description("复位_压紧轴,旋转轴,上下轴原点返回")]
BOX_H_InOutBack = 012, BOX_H_InOutBack = 012,
/// <summary> /// <summary>
/// 料仓原点返回和重置步骤,,轴三返回P1点 /// 料仓原点返回和重置步骤,,进出轴到待机点P1,关闭舱门
/// </summary> /// </summary>
[Description("复位_进出轴到待机点P1,关闭舱门")]
BOX_H_InOutToP1 = 013, BOX_H_InOutToP1 = 013,
/// <summary> /// <summary>
/// 料仓原点返回和重置步骤,,升降轴,旋转轴,压紧轴原点返回 /// 料仓原点返回和重置步骤,,升降轴,旋转轴,压紧轴原点返回
/// </summary> /// </summary>
[Description("复位_升降轴,旋转轴,压紧轴原点返回")]
BOX_H_OtherAxisBack = 014, BOX_H_OtherAxisBack = 014,
///// <summary> ///// <summary>
///// 清理轴位置 ///// 清理轴位置
///// </summary> ///// </summary>
//BOX_H_WaitAxisCountClear = 015, //BOX_H_WaitAxisCountClear = 015,
/// <summary> /// <summary>
/// 旋转轴返回P1 /// 旋转轴运动到P1,上下轴走到P1,压紧轴到P1
/// </summary> /// </summary>
[Description("复位_旋转轴运动到P1,上下轴走到P1,压紧轴到P1")]
BOX_H_MiddleAxisToP1 = 016, BOX_H_MiddleAxisToP1 = 016,
/// <summary> /////// <summary>
/// 叉子先退回P1 /////// 叉子先退回P1
/// </summary> /////// </summary>
BOX_M_H_InOutToP1 = 018, ////BOX_M_H_InOutToP1 = 018,
/// <summary> ///// <summary>
/// 旋转轴回原点 ///// 旋转轴回原点
/// </summary> ///// </summary>
BOX_M_H_MiddleAxisHome = 019, //BOX_M_H_MiddleAxisHome = 019,
/// <summary> ///// <summary>
/// 旋转轴等待清理位置 ///// 旋转轴等待清理位置
/// </summary> ///// </summary>
BOX_M_H_MiddleWait = 020, //BOX_M_H_MiddleWait = 020,
/// <summary> /// <summary>
/// 叉子走到P1 /// 进出轴到P1,判断叉子没有料盘
/// </summary> /// </summary>
[Description("复位_进出轴到P1,判断叉子没有料盘")]
BOX_M_H_TOP1_InOutToP1 = 030, BOX_M_H_TOP1_InOutToP1 = 030,
/// <summary> /// <summary>
/// 压紧轴回原点 /// 压紧轴回原点,关闭舱门
/// </summary> /// </summary>
[Description("复位_压紧轴回原点,关闭舱门")]
BOX_M_H_TOP1_CompressHome = 031, BOX_M_H_TOP1_CompressHome = 031,
/// <summary> /// <summary>
/// 关闭门,旋转轴到P1,升降轴到P1 /// 旋转轴运动到P1,上下轴走到P1,压紧轴到P1
/// </summary> /// </summary>
[Description("复位_旋转轴运动到P1,上下轴走到P1,压紧轴到P1")]
BOX_M_H_TOP1_OtherAxisToP1 = 032, BOX_M_H_TOP1_OtherAxisToP1 = 032,
#endregion #endregion
...@@ -184,27 +195,32 @@ namespace OnlineStore.DeviceLibrary ...@@ -184,27 +195,32 @@ namespace OnlineStore.DeviceLibrary
#region 料仓 出库步骤 101-200 #region 料仓 出库步骤 101-200
/// <summary> /// <summary>
///料仓出库:叉子先运动到P1 ///料仓出库:进出轴到P1
/// </summary> /// </summary>
[Description("出库_取料前_进出轴到P1")]
SO_02_InoutBack = 102, SO_02_InoutBack = 102,
/// <summary> /// <summary>
/// 料仓出库,,所有轴运行到库位, 压紧轴到P3(压紧前点) ,旋转轴到P2( 库位点),升降轴到P5(库位出库前点) /// 料仓出库,,压紧轴至P3(压紧前点) ,旋转轴至P2(库位点),升降轴至P5(库位出库前点)
/// </summary> /// </summary>
[Description("出库_取料_压紧轴至P3(压紧前点) ,旋转轴至P2(库位点),升降轴至P5(库位出库前点) ")]
SO_03_ToBagP, SO_03_ToBagP,
/// <summary> /// <summary>
/// 料仓出库,,叉子进入库位中, 进出轴到P3(库位取放料点) /// 料仓出库,,进出轴至P3(库位取放料点)
/// </summary> /// </summary>
[Description("出库_取料_进出轴至P3(库位取放料点)")]
SO_04_InoutToP3, SO_04_InoutToP3,
/// <summary> /// <summary>
///料仓出库,, 库位的物品放入叉子上,升降轴到P6( 库位出料缓冲点),压紧轴到P2(压紧点) ///料仓出库,, 库位的物品放入叉子上,升降轴至P6(库位出料缓冲点),压紧轴至P2(压紧点)
/// </summary> /// </summary>
[Description("出库_取料_升降轴至P6(库位出料缓冲点),压紧轴至P2(压紧点)")]
SO_05_GetWare, SO_05_GetWare,
/// <summary> /// <summary>
///料仓出库,,叉子从 库位返回,进出轴到P1( 待机点) ///料仓出库,,进出轴至P1(待机点)
/// </summary> /// </summary>
[Description("出库_取料完成_进出轴至P1(待机点)")]
SO_06_InoutToP1, SO_06_InoutToP1,
...@@ -214,44 +230,54 @@ namespace OnlineStore.DeviceLibrary ...@@ -214,44 +230,54 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 出库定位:旋转轴 至P2( 库位点)升降轴到P3(库位入库前点) /// 出库定位:旋转轴 至P2( 库位点)升降轴到P3(库位入库前点)
/// </summary> /// </summary>
[Description("出库_取料完成_旋转轴 至P2( 库位点)升降轴到P3(库位入库前点)")]
SOL_11_MoveToBag = 110, SOL_11_MoveToBag = 110,
/// <summary> /// <summary>
/// 出库定位:进出轴到P3(库位取放料点) /// 出库定位:进出轴到P3(库位取放料点)
/// </summary> /// </summary>
[Description("出库_出库定位_进出轴到P3(库位取放料点)")]
SOL_12_InoutToP3, SOL_12_InoutToP3,
/// <summary> /// <summary>
/// 出库定位: 压紧轴到P3( 压紧前点) /// 出库定位: 压紧轴到P3( 压紧前点)
/// </summary> /// </summary>
[Description("出库_出库定位_压紧轴到P3( 压紧前点)")]
SOL_13_ComToP3, SOL_13_ComToP3,
/// <summary> /// <summary>
/// 出库定位:放下物品,升降轴到P4( 库位入料缓冲点) /// 出库定位:放下物品,升降轴到P4( 库位入料缓冲点)
/// </summary> /// </summary>
[Description("出库_出库定位_升降轴到P4( 库位入料缓冲点)")]
SOL_14_UpdownToP4, SOL_14_UpdownToP4,
/// <summary> /// <summary>
/// 出库定位:放下物品后等待200 /// 出库定位:放下物品后等待200
/// </summary> /// </summary>
[Description("出库_出库定位_放下物品后等待200")]
SOL_15_WaitTime, SOL_15_WaitTime,
/// <summary> /// <summary>
/// 出库定位:拿物品,升降轴到P6( 库位出料缓冲点),压紧轴到P2(压紧点) /// 出库定位:拿物品,升降轴到P6( 库位出料缓冲点),压紧轴到P2(压紧点)
/// </summary> /// </summary>
[Description("出库_出库定位_升降轴到P6( 库位出料缓冲点),压紧轴到P2(压紧点)")]
SOL_16_GetWare, SOL_16_GetWare,
/// <summary> /// <summary>
/// 出库定位2:放下物品,升降轴到P4( 库位入料缓冲点) /// 出库定位2:放下物品,升降轴到P4( 库位入料缓冲点)
/// </summary> /// </summary>
[Description("出库_出库定位2_升降轴到P4( 库位入料缓冲点)")]
SOL_17_UpdownToP42, SOL_17_UpdownToP42,
/// <summary> /// <summary>
/// 出库定位2:放下物品后等待200 /// 出库定位2:放下物品后等待200
/// </summary> /// </summary>
[Description("出库_出库定位2_放下物品后等待200")]
SOL_18_WaitTime2, SOL_18_WaitTime2,
/// <summary> /// <summary>
/// 出库定位2:拿物品,升降轴到P6( 库位出料缓冲点),压紧轴到P2(压紧点) /// 出库定位2:拿物品,升降轴到P6( 库位出料缓冲点),压紧轴到P2(压紧点)
/// </summary> /// </summary>
SOL_19_GetWare2, [Description("出库_出库定位2_升降轴到P6( 库位出料缓冲点),压紧轴到P2(压紧点)")]
SOL_19_GetWare2,
/// <summary> /// <summary>
/// 出库定位:叉子从 库位返回,进出轴到P1( 待机点) /// 出库定位:叉子从 库位返回,进出轴到P1( 待机点)
/// </summary> /// </summary>
[Description("出库_出库定位完成_进出轴到P1( 待机点)")]
SOL_20_InoutToP1, SOL_20_InoutToP1,
#endregion #endregion
...@@ -259,124 +285,151 @@ namespace OnlineStore.DeviceLibrary ...@@ -259,124 +285,151 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 料仓出库,,所有设备运行到门,,旋转轴到P1( 待机点)升降轴到P2( 进料口出料前点) /// 料仓出库,,所有设备运行到门,,旋转轴至P1(待机点)升降轴至P2(进料口出料前点),打开舱门
/// </summary> /// </summary>
[Description("出库_放料前_旋转轴至P1(待机点)升降轴至P2(进料口出料前点),打开舱门")]
SO_21_ToDoorP = 121, SO_21_ToDoorP = 121,
/// <summary> /// <summary>
/// 料仓出库:等待夹爪有料 /// 料仓出库:打开仓门,等待料叉有料
/// </summary> /// </summary>
[Description("出库_放料前_打开仓门,等待料叉有料")]
SO_22_WaitTray, SO_22_WaitTray,
/// <summary> /// <summary>
/// 等待门口无料盘 /// 打开仓门,等待门口无料盘信号
/// </summary> /// </summary>
[Description("出库_放料前_等待门口无料盘信号")]
SO_23_WaitNoTray, SO_23_WaitNoTray,
/// <summary> /// <summary>
/// 料仓出库,,叉子进出料口,,进出轴到P2( 进料口取料点) /// 料仓出库,,叉子进出料口,,进出轴到P2( 进料口取料点)
/// /// </summary> /// /// </summary>
[Description("出库_放料_进出轴到P2( 进料口取料点)")]
SO_24_InoutToP2, SO_24_InoutToP2,
/// <summary> /// <summary>
/// 料仓出库,,把物品放下,,升降轴到P8( 进料口出料缓冲点)压紧轴到P1( 待机点) /// 料仓出库,,把物品放下,,升降轴到P8( 进料口出料缓冲点)压紧轴到P1( 待机点)
/// </summary> /// </summary>
[Description("出库_放料_升降轴到P8( 进料口出料缓冲点)压紧轴到P1( 待机点)")]
SO_25_PutWare, SO_25_PutWare,
/// <summary> /// <summary>
/// 料仓出库,,叉子从出料口返回,,轴3( 叉子) 动作至P1( 待机点) /// 料仓出库,,叉子从出料口返回,,进出轴动作至P1(待机点)
/// </summary> /// </summary>
[Description("出库_放料_进出轴动作至P1(待机点)")]
SO_26_InoutToP1, SO_26_InoutToP1,
/// <summary> /// <summary>
/// 料仓出库:等待仓门口有料 /// 料仓出库:等待仓门口有料
/// </summary> /// </summary>
[Description("出库_放料完成_等待仓门口有料")]
SO_27_WaitDoorTray, SO_27_WaitDoorTray,
/// <summary> /// <summary>
/// 料仓出库,,升降轴返回,, 轴2至P1( 待机点),关闭仓门 /// 料仓出库,,升降轴返回,, 升降轴至P1( 待机点),关闭仓门
/// </summary> /// </summary>
[Description("出库_放料完成_升降轴至P1( 待机点),关闭仓门")]
SO_28_CloseDoor, SO_28_CloseDoor,
/// <summary> /// <summary>
/// 料仓出库,检测料仓门口信号 /// 料仓出库,检测料仓门口信号
/// </summary> /// </summary>
[Description("出库_放料完成_检测料仓门口信号")]
SO_29_CheckTray, SO_29_CheckTray,
/// <summary> /// <summary>
/// 料仓出库,,升降轴返回,, 轴2至P1( 待机点) /// 料仓出库,,发送出库完成消息给流水线
/// </summary> /// </summary>
[Description("出库_放料完成_发送出库完成消息给流水线")]
SO_30_GoBack, SO_30_GoBack,
/// <summary> /// <summary>
/// 等待拿走物品 /// 等待拿走物品
/// </summary> /// </summary>
[Description("出库_放料完成_等待拿走物品")]
SO_31_WaitTake, SO_31_WaitTake,
#endregion #endregion
#region 料仓 入库 #region 料仓 入库
/// <summary> /// <summary>
/// 入库检测 /// 等待仓门口有料
/// </summary> /// </summary>
[Description("入库_取料前_")]
SI_00_TrayCheck = 200, SI_00_TrayCheck = 200,
///// <summary> ///// <summary>
///// 入库,。定位气缸下降 ///// 入库,。定位气缸下降
///// </summary> ///// </summary>
//SI_01_TrayCheckAgain = 201, //SI_01_TrayCheckAgain = 201,
/// <summary> /// <summary>
/// 入库。。进出轴(叉子)先返回P1 /// 入库。。进出轴(叉子)动作至P1,打开舱门
/// </summary> /// </summary>
SI_02_InOutAxisHome , [Description("入库_取料_进出轴(叉子)动作至P1,打开舱门")]
SI_02_InOutAxisHome,
/// <summary> /// <summary>
/// 入库。。所有轴先回到待机点,轴2、轴1 动作到P1,,轴4动作至P3 /// 入库。。升降轴到P1,旋转轴到P1 ,压紧轴到P3,打开仓门
/// </summary> /// </summary>
SI_03_ReturnHome , [Description("入库_取料_升降轴到P1,旋转轴到P1 ,压紧轴到P3,打开仓门")]
SI_03_ReturnHome,
/// <summary> /// <summary>
/// 入库。。压紧物品(有压紧轴的才需要此步骤),压紧轴到P3(压紧前点) /// 入库。。叉子即将取料,发现门未上升到位,重新打开门
/// </summary> /// </summary>
[Description("入库_取料_叉子即将取料,发现门未上升到位,重新打开门")]
SI_04_CompressWare, SI_04_CompressWare,
/// <summary> /// <summary>
/// 入库。。叉子进入入料口,进出轴到P2( 进料口取料点) /// 入库。。叉子进入入料口,进出轴至P2(进料口取料点)
/// </summary> /// </summary>
[Description("入库_取料_进出轴至P2(进料口取料点) ")]
SI_05_DeviceToDoor, SI_05_DeviceToDoor,
/// <summary> /// <summary>
/// 入库。。把物品放入叉子上,升降轴到P7( 进料口取料缓冲点),压紧物品(有压紧轴的才需要此步骤),压紧轴到P2(压紧点) /// 入库。。把物品放入叉子上,压紧轴至P2(压紧点)),升降轴至P7(进料口取料缓冲点)
/// </summary> /// </summary>
[Description("入库_取料_压紧轴至P2(压紧点)),升降轴至P7(进料口取料缓冲点)")]
SI_06_GetWare, SI_06_GetWare,
/// <summary> /// <summary>
/// 入库。。叉子 从入料口抽出,进出轴到P1( 待机点) /// 入库。。叉子 从入料口抽出,进出轴到P1( 待机点)
/// </summary> /// </summary>
[Description("入库_取料_进出轴到P1( 待机点)")]
SI_07_InoutToP1, SI_07_InoutToP1,
/// <summary> /// <summary>
/// 入库:等待叉子有料 /// 入库:等待叉子有料
/// </summary> /// </summary>
[Description("入库_取料_等待叉子有料")]
SI_08_WaitTray, SI_08_WaitTray,
/// <summary> /// <summary>
/// 入库。。,定位气缸伸出 (有压紧轴的不需要此步骤) /// 入库。。,定位气缸伸出 (有压紧轴的不需要此步骤)
/// </summary> /// </summary>
[Description("入库_取料完成_定位气缸伸出")]
SI_09_LocationUp, SI_09_LocationUp,
/// <summary> /// <summary>
/// 入库。。移动到库位点,旋转轴到P2( 库位点)升降轴到P3(库位入库前点) /// 入库。。移动到库位点,旋转轴至P2(库位点),升降轴至P3(库位入库前点)),关闭舱门
/// </summary> /// </summary>
[Description("入库_放料_旋转轴至P2(库位点),升降轴至P3(库位入库前点)),关闭舱门")]
SI_11_MoveToBag, SI_11_MoveToBag,
/// <summary> /// <summary>
/// 入库。。定位气缸退回 (有压紧轴的不需要此步骤) /// 入库。。定位气缸退回 (有压紧轴的不需要此步骤)
/// </summary> /// </summary>
[Description("入库_放料_定位气缸退回")]
SI_12_LocationDown, SI_12_LocationDown,
/// <summary> /// <summary>
/// 入库。。叉子进入库位中,进出轴到P3(库位取放料点) /// 入库。。叉子进入库位中,进出轴到P3(库位取放料点)
/// </summary> /// </summary>
[Description("入库_放料_进出轴到P3(库位取放料点)")]
SI_13_InoutToP3, SI_13_InoutToP3,
/// <summary> /// <summary>
/// 入库。。放下物品,升降轴到P4( 库位入料缓冲点)压紧轴到P3( 压紧前点) /// 入库。。放下物品,升降轴到P4( 库位入料缓冲点)压紧轴到P3( 压紧前点)
/// </summary> /// </summary>
[Description("入库_放料_升降轴到P4( 库位入料缓冲点)压紧轴到P3( 压紧前点)")]
SI_14_PutWareToBag, SI_14_PutWareToBag,
/// <summary> /// <summary>
/// 入库。。叉子从库位中返回,轴3( 叉子) 动作至P1( 待机点) /// 入库。。叉子从库位中返回,进出轴动作至P1(待机点)
/// </summary> /// </summary>
[Description("入库_放料_进出轴动作至P1(待机点)")]
SI_15_InoutBack, SI_15_InoutBack,
/// <summary> /// <summary>
/// 入库。。返回待机点,轴2/轴1/轴4动作至P1( 待机点))开始 /// 入库。。返回待机点,轴2/轴1/轴4动作至P1(待机点)),检测门关闭
/// </summary> /// </summary>
[Description("入库_放料完成_轴2/轴1/轴4动作至P1(待机点)),检测门关闭")]
SI_16_GoBack, SI_16_GoBack,
/// <summary> /// <summary>
/// 入库。等待叉子无信号 /// 入库。等待料叉无信号
/// </summary> /// </summary>
[Description("入库_放料完成_等待料叉无信号")]
SI_17_WaitNoReel, SI_17_WaitNoReel,
#endregion #endregion
......
...@@ -3,6 +3,7 @@ using OnlineStore.DeviceLibrary; ...@@ -3,6 +3,7 @@ using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -14,11 +15,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -14,11 +15,12 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public class StoreMoveInfo public class StoreMoveInfo
{ {
private string Name;
/// <summary> /// <summary>
/// 超时时间 /// 超时时间
/// </summary> /// </summary>
public int TimeOutSeconds = 60; public int TimeOutSeconds = 60;
public StoreMoveInfo(int storeId) public StoreMoveInfo(int storeId,string name)
{ {
moveType = StoreMoveType.None; moveType = StoreMoveType.None;
...@@ -27,6 +29,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -27,6 +29,7 @@ namespace OnlineStore.DeviceLibrary
this.moveStep = StoreMoveStep.Wait; this.moveStep = StoreMoveStep.Wait;
IsInWait = false; IsInWait = false;
MoveNum = 0; MoveNum = 0;
this.Name = name;
} }
public int MoveNum { get; set; } public int MoveNum { get; set; }
...@@ -96,6 +99,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -96,6 +99,7 @@ namespace OnlineStore.DeviceLibrary
public void NextMoveStep(StoreMoveStep step) public void NextMoveStep(StoreMoveStep step)
{ {
stepMoveLog();
PreMoveStep = moveStep; PreMoveStep = moveStep;
moveStep = step; moveStep = step;
LastSetpTime = DateTime.Now; LastSetpTime = DateTime.Now;
...@@ -105,6 +109,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -105,6 +109,17 @@ namespace OnlineStore.DeviceLibrary
CanWhileCount = 5; CanWhileCount = 5;
TimeOutSeconds = 60; TimeOutSeconds = 60;
} }
private void stepMoveLog()
{
try
{
RunLogUtil.MoveLog(new MoveLog(Name, GetMoveType(), GetStepDes(), LastSetpTime, DateTime.Now, MoveParam.PosInfo?.PosId, MoveParam.PosInfo?.barcode));
}
catch (Exception ex)
{
}
}
/// <summary> /// <summary>
/// 当前步骤执行完成 /// 当前步骤执行完成
/// </summary> /// </summary>
...@@ -131,6 +146,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -131,6 +146,7 @@ namespace OnlineStore.DeviceLibrary
} }
public void EndMove() public void EndMove()
{ {
stepMoveLog();
this.moveType = StoreMoveType.None; this.moveType = StoreMoveType.None;
this.MoveParam = null; this.MoveParam = null;
moveStep = StoreMoveStep.Wait; moveStep = StoreMoveStep.Wait;
...@@ -139,10 +155,45 @@ namespace OnlineStore.DeviceLibrary ...@@ -139,10 +155,45 @@ namespace OnlineStore.DeviceLibrary
WaitList = new List<WaitResultInfo>(); WaitList = new List<WaitResultInfo>();
CanWhileCount = 0; CanWhileCount = 0;
} }
public string GetStepDes()
{
string currName = moveStep.ToString();
try
{
if (StoreManager.StepDesMap.ContainsKey(currName))
{
return StoreManager.StepDesMap[currName];
}
}
catch (Exception ex)
{
LogUtil.error("GetStepDes 出错:" + ex.ToString());
}
return currName;
}
public StoreMoveInfo clone() public StoreMoveInfo clone()
{ {
return (StoreMoveInfo)this.MemberwiseClone(); return (StoreMoveInfo)this.MemberwiseClone();
} }
public string GetMoveType()
{
switch (moveType)
{
case StoreMoveType.InStore:
return "入料";
break;
case StoreMoveType.OutStore:
return "出料";
break;
case StoreMoveType.StoreReset:
return "复位";
break;
case StoreMoveType.ReturnHome:
return "回原";
break;
}
return "";
}
public List<WaitResultInfo> WaitList = new List<WaitResultInfo>(); public List<WaitResultInfo> WaitList = new List<WaitResultInfo>();
/// <summary> /// <summary>
...@@ -154,7 +205,25 @@ namespace OnlineStore.DeviceLibrary ...@@ -154,7 +205,25 @@ namespace OnlineStore.DeviceLibrary
IsInWait = false; IsInWait = false;
} }
} }
public static class EnumDesHelper
{
public static string GetStepDes(this Enum val)
{
var type = val.GetType();
var memberInfo = type.GetMember(val.ToString());
var attributes = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
if (attributes == null || attributes.Length != 1)
{
//如果没有定义描述,就把当前枚举值的对应名称返回
return val.ToString();
}
return (attributes.Single() as DescriptionAttribute).Description;
}
}
public class WaitResultInfo public class WaitResultInfo
{ {
private WaitResultInfo() private WaitResultInfo()
......
...@@ -13,7 +13,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -13,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>
...@@ -110,12 +110,12 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -110,12 +110,12 @@ namespace OnlineStore.LoadCSVLibrary
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.Error("出错:", e); Common.LogUtil.error("出错:", e);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error(ex.ToString()); Common.LogUtil.error(ex.ToString());
return false; return false;
} }
return true; return true;
...@@ -152,7 +152,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -152,7 +152,7 @@ namespace OnlineStore.LoadCSVLibrary
{ {
if (!titleIndex.ContainsKey(str)) if (!titleIndex.ContainsKey(str))
{ {
LOGGER.Error("未找到必须列:" + str + ",加载数据失败!"); Common.LogUtil.error("未找到必须列:" + str + ",加载数据失败!");
throw new CVSFieldNotMatchingExection("未找到必须列:" + str + ",加载数据失败!"); throw new CVSFieldNotMatchingExection("未找到必须列:" + str + ",加载数据失败!");
} }
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.LoadCSVLibrary</RootNamespace> <RootNamespace>OnlineStore.LoadCSVLibrary</RootNamespace>
<AssemblyName>LoadCSVLibrary</AssemblyName> <AssemblyName>LoadCSVLibrary</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
......
...@@ -51,7 +51,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -51,7 +51,7 @@ namespace OnlineStore.LoadCSVLibrary
{ {
if (hasReadFileList.Contains(filePath)) if (hasReadFileList.Contains(filePath))
{ {
LOGGER.Error("文件" + filePath + "已经加载过,直接返回null"); Common.LogUtil.error("文件" + filePath + "已经加载过,直接返回null");
return null; return null;
} }
Type type = typeof(T); Type type = typeof(T);
...@@ -59,7 +59,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -59,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 + "个属性"); Common.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);
...@@ -117,12 +117,12 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -117,12 +117,12 @@ namespace OnlineStore.LoadCSVLibrary
} }
else else
{ {
LOGGER.Error("读取csv,index=" + index + ",数据格式不匹配!,line=" + line); Common.LogUtil.error("读取csv,index=" + index + ",数据格式不匹配!,line=" + line);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Debug( "CSV 读取行【" + line + "】行转换失败"); Common.LogUtil.info( "CSV 读取行【" + line + "】行转换失败");
} }
} }
index++; index++;
...@@ -157,7 +157,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -157,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 + "个属性"); Common.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);
...@@ -207,7 +207,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -207,7 +207,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 + "个属性"); Common.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);
......
...@@ -45,7 +45,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -45,7 +45,7 @@ namespace OnlineStore.LoadCSVLibrary
//必须有列【类型】 //必须有列【类型】
if (allTitleIndex.Count < 0 || !allTitleIndex.ContainsKey("类型")) if (allTitleIndex.Count < 0 || !allTitleIndex.ContainsKey("类型"))
{ {
LOGGER.Error("未找到必须列:类型,加载数据失败!"); Common.LogUtil.error("未找到必须列:类型,加载数据失败!");
throw new CVSFieldNotMatchingExection("未找到必须列:类型,加载数据失败!"); throw new CVSFieldNotMatchingExection("未找到必须列:类型,加载数据失败!");
} }
typeIndex = allTitleIndex["类型"]; typeIndex = allTitleIndex["类型"];
...@@ -116,14 +116,14 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -116,14 +116,14 @@ namespace OnlineStore.LoadCSVLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("filepath=" + filePath + ",index=" + index + ",key=" + key + "出错:" + ex.ToString()); Common.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()); Common.LogUtil.error("filepath=" + filePath + ",index=" + index + ",key=" + key + "出错:" + ex.ToString());
} }
} }
bllIns.CheckField(); bllIns.CheckField();
...@@ -142,14 +142,14 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -142,14 +142,14 @@ namespace OnlineStore.LoadCSVLibrary
} }
else else
{ {
LOGGER.Error("配置的料仓类型=" + storeType + "未找到处理方法!"); Common.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); Common.LogUtil.info("开始读取文件:" + config.ConfigFilePath);
if (config == null || config.ConfigFilePath.Equals("")) if (config == null || config.ConfigFilePath.Equals(""))
{ {
return null; return null;
...@@ -205,7 +205,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -205,7 +205,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
} }
catch (Exception e) { catch (Exception e) {
LOGGER.Error("出错:" + e.ToString()); Common.LogUtil.error("出错:" + e.ToString());
} }
string newLine = ""; string newLine = "";
foreach (string s in newArray) foreach (string s in newArray)
......
...@@ -12,7 +12,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -12,7 +12,7 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
public class ConfigBase public class ConfigBase
{ {
protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// DI=输入IO,DO=输出IO,PRO=属性,AXIS=轴 /// DI=输入IO,DO=输出IO,PRO=属性,AXIS=轴
/// </summary> /// </summary>
...@@ -268,7 +268,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -268,7 +268,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Error("出错:", ex); Common.LogUtil.error("出错:", ex);
} }
return value; return value;
} }
......
...@@ -12,7 +12,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -12,7 +12,7 @@ namespace OnlineStore.LoadCSVLibrary
public static Dictionary<string, string> ProIOIpMap = null; public static Dictionary<string, string> ProIOIpMap = null;
public const string IOIP_Str = "PRO_AOI_IP"; public const string IOIP_Str = "PRO_AOI_IP";
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 +117,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -117,7 +117,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
else else
{ {
LOGGER.Error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!"); Common.LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
} }
} }
else if (!ProIOIpMap.ContainsKey(con.ProName) && con.ProName.ToUpper().Contains(IOIP_Str)) else if (!ProIOIpMap.ContainsKey(con.ProName) && con.ProName.ToUpper().Contains(IOIP_Str))
...@@ -130,7 +130,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -130,7 +130,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
else else
{ {
LOGGER.Error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!"); Common.LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
} }
} }
else if (con.ProType == ConfigItemType.DI) else if (con.ProType == ConfigItemType.DI)
...@@ -146,7 +146,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -146,7 +146,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
else else
{ {
LOGGER.Error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!"); Common.LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
} }
} }
else if (con.ProType == ConfigItemType.DO) else if (con.ProType == ConfigItemType.DO)
...@@ -162,7 +162,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -162,7 +162,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
else else
{ {
LOGGER.Error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!"); Common.LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
} }
} }
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UserFromControl</RootNamespace> <RootNamespace>UserFromControl</RootNamespace>
<AssemblyName>UserFromControl</AssemblyName> <AssemblyName>UserFromControl</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!