Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 6596eb2a
由
LN
编写于
2021-06-28 16:04:52 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
日志修改,增加运行日志:RunLogUtil
1 个父辈
fdf38543
隐藏空白字符变更
内嵌
并排
正在显示
38 个修改的文件
包含
879 行增加
和
308 行删除
source/ACSingleStore/App.config
source/ACSingleStore/FrmAxisDebug.cs
source/ACSingleStore/FrmIOStatus.cs
source/ACSingleStore/FrmStoreBox.cs
source/ACSingleStore/Program.cs
source/ACSingleStore/记录.txt
source/Common/Common.csproj
source/Common/packages.config
source/Common/util/AcSerialBean.cs
source/Common/util/ConfigAppSettings.cs
source/Common/util/HttpHelper.cs
source/Common/util/HumitureController.cs
source/Common/util/HumitureServer.cs
source/Common/util/LogUtil.cs
source/Common/util/NetTCPServer.cs
source/Common/util/RunLogUtil.cs
source/Common/util/ScanCodeManager.cs
source/Common/util/TcpClient.cs
source/Common/util/TcpServer.cs
source/Common/util/UdpServer.cs
source/DeviceLibrary/IO/AIOBOX/AIOBOXManager.cs
source/DeviceLibrary/IO/KangNaiDe/KNDManager.cs
source/DeviceLibrary/IO/KangNaiDe/MasterTcpClient.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Inventory.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Partial.cs
source/DeviceLibrary/acSingleStore/StoreManager.cs
source/DeviceLibrary/store/InOutParam.cs
source/DeviceLibrary/store/KTK_Store.cs
source/DeviceLibrary/store/StoreStep.cs
source/DeviceLibrary/store/model/StoreMoveInfo.cs
source/LoadCVSLibrary/CSVReaderBase.cs
source/LoadCVSLibrary/LoadCSVLibrary.csproj
source/LoadCVSLibrary/position/CSVPositionReader.cs
source/LoadCVSLibrary/storeConfig/CSVConfigReader.cs
source/LoadCVSLibrary/storeConfig/ConfigItemBase.cs
source/LoadCVSLibrary/storeConfig/config/StoreConfig.cs
source/UserFromControl/UserFromControl.csproj
source/ACSingleStore/App.config
查看文件 @
6596eb2
...
...
@@ -49,10 +49,28 @@
<
conversionPattern
value
=
"[%date][%t]%-5p %m%n"
/>
</
layout
>
</
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"
/>
<
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
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.6.1"
/>
...
...
source/ACSingleStore/FrmAxisDebug.cs
查看文件 @
6596eb2
...
...
@@ -26,7 +26,7 @@ namespace OnlineStore.ACSingleStore
private
ConfigMoveAxis
comp
=
null
;
//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
)
{
middle
=
boxBean
.
Config
.
Middle_Axis
;
...
...
@@ -41,7 +41,7 @@ namespace OnlineStore.ACSingleStore
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
);
}
...
...
source/ACSingleStore/FrmIOStatus.cs
查看文件 @
6596eb2
...
...
@@ -24,7 +24,7 @@ namespace OnlineStore.ACSingleStore
{
private
int
StoreId
=
1
;
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
()
{
Control
.
CheckForIllegalCrossThreadCalls
=
false
;
...
...
@@ -96,7 +96,7 @@ namespace OnlineStore.ACSingleStore
catch
(
Exception
ex
)
{
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
)
...
...
source/ACSingleStore/FrmStoreBox.cs
查看文件 @
6596eb2
...
...
@@ -27,7 +27,7 @@ namespace OnlineStore.ACSingleStore
{
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
()
{
Control
.
CheckForIllegalCrossThreadCalls
=
false
;
...
...
@@ -75,7 +75,7 @@ namespace OnlineStore.ACSingleStore
this
.
store
=
StoreManager
.
InitStore
();
if
(
store
==
null
)
{
LogUtil
.
error
(
LOGGER
,
"找不到对应的料仓"
);
LogUtil
.
error
(
"找不到对应的料仓"
);
this
.
Close
();
return
;
}
...
...
@@ -154,7 +154,7 @@ namespace OnlineStore.ACSingleStore
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"出错:"
+
ex
.
StackTrace
);
LogUtil
.
error
(
"出错:"
+
ex
.
StackTrace
);
}
}
private
bool
preOpen
=
false
;
...
...
@@ -399,7 +399,7 @@ namespace OnlineStore.ACSingleStore
if
(
ReturnCode
!=
0
)
{
MessageBox
.
Show
(
"错误码:"
+
ReturnCode
.
ToString
(),
""
,
MessageBoxButtons
.
OK
);
LogUtil
.
error
(
LOGGER
,
"错误码:"
+
ReturnCode
.
ToString
());
LogUtil
.
error
(
"错误码:"
+
ReturnCode
.
ToString
());
}
}
private
void
FunctionFail
(
string
funName
,
System
.
Int32
ReturnCode
)
...
...
@@ -407,7 +407,7 @@ namespace OnlineStore.ACSingleStore
if
(
ReturnCode
!=
0
)
{
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
store
.
AutoStartIndex
=
currIndex
;
string
poText
=
cmbPosition
.
Text
;
store
.
autoMsg
=
"自动出库:"
+
poText
;
LogUtil
.
info
(
LOGGER
,
store
.
StoreName
+
"开启自动出入库模式,开始位置【"
+
poText
+
"】(索引="
+
currIndex
+
"),间隔="
+
jiange
+
",入库开始!"
);
LogUtil
.
info
(
store
.
StoreName
+
"开启自动出入库模式,开始位置【"
+
poText
+
"】(索引="
+
currIndex
+
"),间隔="
+
jiange
+
",入库开始!"
);
//store.StartOutStoreMove(new InOutStoreParam("", poText));
store
.
StartInStoreMove
(
new
InOutParam
(
new
InOutPosInfo
(
"AUTOINOUT"
,
poText
)));
}
...
...
@@ -1231,7 +1231,7 @@ namespace OnlineStore.ACSingleStore
catch
(
Exception
ex
)
{
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
)
...
...
@@ -1499,7 +1499,7 @@ namespace OnlineStore.ACSingleStore
store
.
AutoStartIndex
=
currIndex
;
string
poText
=
cmbPosition
.
Text
;
store
.
autoMsg
=
"自动盘点:"
+
poText
;
LogUtil
.
info
(
LOGGER
,
store
.
StoreName
+
"开启自动盘点模式,开始位置【"
+
poText
+
"】(索引="
+
currIndex
+
"),间隔="
+
jiange
+
",盘点开始!"
);
LogUtil
.
info
(
store
.
StoreName
+
"开启自动盘点模式,开始位置【"
+
poText
+
"】(索引="
+
currIndex
+
"),间隔="
+
jiange
+
",盘点开始!"
);
//store.StartOutStoreMove(new InOutStoreParam("", poText));
store
.
StartInventoryMove
(
new
InOutParam
(
new
InOutPosInfo
(
"AUTOINOUT"
,
poText
)));
}
...
...
source/ACSingleStore/Program.cs
查看文件 @
6596eb2
...
...
@@ -43,7 +43,7 @@ namespace OnlineStore.ACSingleStore
public
static
extern
int
ShowWindow
(
IntPtr
hwnd
,
int
nCmdShow
);
public
const
int
SW_RESTORE
=
9
;
public
static
IntPtr
formhwnd
;
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
System
.
Reflection
.
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
//
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#
endregion
...
...
@@ -53,6 +53,7 @@ namespace OnlineStore.ACSingleStore
[
STAThread
]
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
);
AppDomain
.
CurrentDomain
.
UnhandledException
+=
new
UnhandledExceptionEventHandler
(
CurrentDomain_UnhandledException
);
...
...
@@ -93,7 +94,8 @@ namespace OnlineStore.ACSingleStore
}
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
();
System
.
Net
.
ServicePointManager
.
DefaultConnectionLimit
=
512
;
// XmlConfigurator.Configure();
...
...
source/ACSingleStore/记录.txt
查看文件 @
6596eb2
...
...
@@ -67,4 +67,42 @@ PRO,,拍照相机名称,PhotoCamera_Name,,,,,,,,,,,,,
StoreConfig.csv需要增加一行配置:
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
source/Common/Common.csproj
查看文件 @
6596eb2
...
...
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.Common</RootNamespace>
<AssemblyName>Common</AssemblyName>
<TargetFrameworkVersion>v4.
0
</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.
6.1
</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
...
...
@@ -44,6 +44,10 @@
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<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.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
...
...
@@ -68,6 +72,7 @@
<Compile Include="util\NetTCPServer.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="util\RunLogUtil.cs" />
<Compile Include="util\ScanCodeManager.cs" />
<Compile Include="util\TcpClient.cs" />
<Compile Include="util\TcpServer.cs" />
...
...
@@ -76,6 +81,9 @@
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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.
...
...
source/Common/packages.config
0 → 100644
查看文件 @
6596eb2
<?
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
source/Common/util/AcSerialBean.cs
查看文件 @
6596eb2
...
...
@@ -12,7 +12,7 @@ namespace OnlineStore.Common
public
class
AcSerialBean
{
#
region
全部变量
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
System
.
Reflection
.
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
//
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private
SerialPort
_serialPort
=
null
;
private
object
lockObj
=
new
object
();
...
...
source/Common/util/ConfigAppSettings.cs
查看文件 @
6596eb2
...
...
@@ -12,7 +12,7 @@ namespace OnlineStore.Common
{
public
class
ConfigAppSettings
{
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
System
.
Reflection
.
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
//
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private
static
int
seq
=
1
;
...
...
@@ -20,7 +20,7 @@ namespace OnlineStore.Common
{
if
(
seq
.
Equals
(
Int32
.
MaxValue
))
{
L
OGGER
.
I
nfo
(
"seq当前值:"
+
seq
+
",重置seq=0"
);
L
ogUtil
.
i
nfo
(
"seq当前值:"
+
seq
+
",重置seq=0"
);
seq
=
0
;
}
Interlocked
.
Increment
(
ref
seq
);
...
...
@@ -78,7 +78,7 @@ namespace OnlineStore.Common
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
L
OGGER
.
E
rror
(
"未找到配置:"
+
key
+
",请检查配置是否完整!"
);
L
ogUtil
.
e
rror
(
"未找到配置:"
+
key
+
",请检查配置是否完整!"
);
return
""
;
}
else
...
...
@@ -93,7 +93,7 @@ namespace OnlineStore.Common
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
L
OGGER
.
E
rror
(
"未找到配置:"
+
key
+
",请检查配置是否完整!"
);
L
ogUtil
.
e
rror
(
"未找到配置:"
+
key
+
",请检查配置是否完整!"
);
return
a
;
}
else
...
...
@@ -110,7 +110,7 @@ namespace OnlineStore.Common
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
L
OGGER
.
E
rror
(
"未找到配置:"
+
key
+
",请检查配置是否完整!"
);
L
ogUtil
.
e
rror
(
"未找到配置:"
+
key
+
",请检查配置是否完整!"
);
return
a
;
}
else
...
...
@@ -145,7 +145,7 @@ namespace OnlineStore.Common
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"SaveValue保存配置出错:AppKey="
+
key
+
",AppValue="
+
value
+
","
+
ex
.
StackTrace
);
LogUtil
.
error
(
"SaveValue保存配置出错:AppKey="
+
key
+
",AppValue="
+
value
+
","
+
ex
.
StackTrace
);
}
}
...
...
@@ -167,7 +167,7 @@ namespace OnlineStore.Common
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"UpdateConfig保存配置出错:name="
+
name
+
",Xvalue="
+
Xvalue
+
","
+
ex
.
StackTrace
);
LogUtil
.
error
(
"UpdateConfig保存配置出错:name="
+
name
+
",Xvalue="
+
Xvalue
+
","
+
ex
.
StackTrace
);
}
}
///<summary>
...
...
@@ -199,7 +199,7 @@ namespace OnlineStore.Common
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"SetValue保存配置出错:AppKey="
+
AppKey
+
",AppValue="
+
AppValue
+
","
+
ex
.
StackTrace
);
LogUtil
.
error
(
"SetValue保存配置出错:AppKey="
+
AppKey
+
",AppValue="
+
AppValue
+
","
+
ex
.
StackTrace
);
}
}
}
...
...
source/Common/util/HttpHelper.cs
查看文件 @
6596eb2
...
...
@@ -18,7 +18,7 @@ namespace OnlineStore.Common
{
public
class
HttpHelper
{
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
//
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public
static
Operation
PostOP
(
string
url
,
Operation
operation
,
out
bool
isTimeOut
)
{
...
...
@@ -62,7 +62,7 @@ namespace OnlineStore.Common
IsTimeOut
=
false
;
if
(
isLog
==
1
)
{
L
OGGER
.
I
nfo
(
"给服务器发送数据【"
+
paramData
+
"】 "
);
L
ogUtil
.
i
nfo
(
"给服务器发送数据【"
+
paramData
+
"】 "
);
}
string
result
=
""
;
...
...
source/Common/util/HumitureController.cs
查看文件 @
6596eb2
...
...
@@ -14,7 +14,7 @@ namespace OnlineStore.Common
/// </summary>
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
string
serialPort
=
""
;
...
...
@@ -56,7 +56,7 @@ namespace OnlineStore.Common
}
else
{
LogUtil
.
error
(
LOGGER
,
LogName
+
"串口打开失败!"
);
LogUtil
.
error
(
LogName
+
"串口打开失败!"
);
IsRun
=
false
;
return
false
;
}
...
...
@@ -236,7 +236,7 @@ namespace OnlineStore.Common
}
catch
(
Exception
ex
)
{
L
OGGER
.
I
nfo
(
LogName
+
"转换出错:"
+
ex
.
ToString
());
L
ogUtil
.
i
nfo
(
LogName
+
"转换出错:"
+
ex
.
ToString
());
}
return
list
;
}
...
...
@@ -280,7 +280,7 @@ namespace OnlineStore.Common
}
catch
(
Exception
ex
)
{
L
OGGER
.
I
nfo
(
LogName
+
"转换出错:"
+
ex
.
ToString
());
L
ogUtil
.
i
nfo
(
LogName
+
"转换出错:"
+
ex
.
ToString
());
}
return
-
1
;
}
...
...
@@ -307,7 +307,7 @@ namespace OnlineStore.Common
}
catch
(
Exception
ex
)
{
L
OGGER
.
I
nfo
(
LogName
+
"转换出错:"
+
ex
.
ToString
());
L
ogUtil
.
i
nfo
(
LogName
+
"转换出错:"
+
ex
.
ToString
());
}
return
list
;
}
...
...
source/Common/util/HumitureServer.cs
查看文件 @
6596eb2
...
...
@@ -15,7 +15,7 @@ namespace OnlineStore.Common
/// </summary>
public
class
HumitureServer
{
private
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
//
private static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// 最后一次接受到的温度信息,key=温湿度传感器IP地址
...
...
@@ -92,7 +92,7 @@ namespace OnlineStore.Common
}
TemperateIsStart
=
true
;
temperateTcpServer
.
Start
(
port
);
LogUtil
.
info
(
LOGGER
,
"温湿度已开始在端口["
+
port
+
"]监听!"
);
LogUtil
.
info
(
"温湿度已开始在端口["
+
port
+
"]监听!"
);
temperateTcpServer
.
ReviceMsgEvent
+=
tcp_ReviceMsgEvent
;
}
}
...
...
@@ -111,7 +111,7 @@ namespace OnlineStore.Common
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"关闭温湿度监听出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"关闭温湿度监听出错:"
+
ex
.
ToString
());
}
}
...
...
@@ -132,11 +132,11 @@ namespace OnlineStore.Common
string
deviceId
=
strList
[
10
];
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
)
{
//湿度小于0不处理
LogUtil
.
info
(
LOGGER
,
"address="
+
add
+
",收到:温度="
+
wendu
+
",湿度="
+
shidu
+
",设备ID="
+
deviceId
+
",密码:"
+
pwd
+
",湿度小于0不处理"
);
LogUtil
.
info
(
"address="
+
add
+
",收到:温度="
+
wendu
+
",湿度="
+
shidu
+
",设备ID="
+
deviceId
+
",密码:"
+
pwd
+
",湿度小于0不处理"
);
}
else
{
...
...
@@ -152,7 +152,7 @@ namespace OnlineStore.Common
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
ex
.
ToString
());
LogUtil
.
error
(
ex
.
ToString
());
}
}
private
static
double
PreShiDu
=
7
;
...
...
@@ -171,7 +171,7 @@ namespace OnlineStore.Common
TemperateParamMap
.
Remove
(
IP
);
}
TemperateParamMap
.
Add
(
IP
,
ast
);
//LogUtil.info(
LOGGER,
"address=" + IP + ",收到:温度=" + newWenDu + ",湿度=" + newShiDu + " ");
//LogUtil.info(
"address=" + IP + ",收到:温度=" + newWenDu + ",湿度=" + newShiDu + " ");
}
}
catch
(
Exception
ex
)
{
...
...
source/Common/util/LogUtil.cs
查看文件 @
6596eb2
...
...
@@ -210,5 +210,9 @@ namespace OnlineStore.Common
info
(
LOGGER
,
msg
);
}
}
}
source/Common/util/NetTCPServer.cs
查看文件 @
6596eb2
...
...
@@ -11,7 +11,7 @@ namespace OnlineStore
{
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>
/// TCP服务端监听
...
...
@@ -118,13 +118,13 @@ namespace OnlineStore
NetworkStream
ns
=
client
.
tcpClient
.
GetStream
();
StreamReader
sr
=
new
StreamReader
(
ns
);
string
str
=
sr
.
ReadLine
();
LOGGER
.
I
nfo
(
"读取到数据:"
+
str
);
Common
.
LogUtil
.
i
nfo
(
"读取到数据:"
+
str
);
byte
[]
recdata
=
new
byte
[
ns
.
EndRead
(
ar
)];
if
(
recdata
.
Length
>
0
)
{
//Array.Copy(client.Buffer, recdata, recdata.Length);
LOGGER
.
I
nfo
(
"读取到数据1111:"
+
Encoding
.
ASCII
.
GetString
(
recdata
));
Common
.
LogUtil
.
i
nfo
(
"读取到数据1111:"
+
Encoding
.
ASCII
.
GetString
(
recdata
));
//ns.BeginRead(client.Buffer, 0, client.Buffer.Length, new AsyncCallback(TCPCallBack), client);
}
else
...
...
source/Common/util/RunLogUtil.cs
0 → 100644
查看文件 @
6596eb2
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
;
}
=
""
;
}
}
source/Common/util/ScanCodeManager.cs
查看文件 @
6596eb2
...
...
@@ -13,7 +13,7 @@ namespace OnlineStore.Common
/// </summary>
public
class
ScanCodeManager
{
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
//
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// 处理接收后的二维码
/// </summary>
...
...
source/Common/util/TcpClient.cs
查看文件 @
6596eb2
...
...
@@ -16,7 +16,7 @@ namespace OnlineStore.Common
private
static
int
ServerPort
=
0
;
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
);
private
Socket
m_clientSocket
;
...
...
@@ -112,13 +112,13 @@ namespace OnlineStore.Common
{
m_clientSocket
.
BeginReceive
(
m_receiveBuffer
,
0
,
m_receiveBuffer
.
Length
,
0
,
new
AsyncCallback
(
ReceiveCallBack
),
null
);
onReceived
=
HandleMessage
;
LogUtil
.
info
(
LOGGER
,
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" success!"
);
LogUtil
.
info
(
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" success!"
);
ReConnectTimer
.
Start
();
return
true
;
}
else
{
LogUtil
.
info
(
LOGGER
,
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" fail!"
);
LogUtil
.
info
(
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" fail!"
);
}
}
catch
(
Exception
ex
)
...
...
@@ -154,7 +154,7 @@ namespace OnlineStore.Common
if
(
m_clientSocket
!=
null
)
{
m_clientSocket
.
Close
();
LogUtil
.
debug
(
LOGGER
,
"Socket closed!"
);
LogUtil
.
debug
(
"Socket closed!"
);
}
}
catch
(
Exception
ex
)
{
...
...
@@ -168,7 +168,7 @@ namespace OnlineStore.Common
{
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
;
...
...
@@ -189,11 +189,11 @@ namespace OnlineStore.Common
if
(
m_clientSocket
!=
null
)
{
m_clientSocket
.
Close
();
LogUtil
.
info
(
LOGGER
,
"Socket closed!"
);
LogUtil
.
info
(
"Socket closed!"
);
}
else
{
LogUtil
.
error
(
LOGGER
,
"No socket is running!"
);
LogUtil
.
error
(
"No socket is running!"
);
}
}
...
...
@@ -209,7 +209,7 @@ namespace OnlineStore.Common
{
m_clientSocket
.
Send
(
sendBuffer
);
LogUtil
.
debug
(
LOGGER
,
"Send >> "
+
strSendData
);
LogUtil
.
debug
(
"Send >> "
+
strSendData
);
}
}
...
...
source/Common/util/TcpServer.cs
查看文件 @
6596eb2
...
...
@@ -12,7 +12,7 @@ namespace OnlineStore.Common
{
public
class
TcpServer
{
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
System
.
Reflection
.
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
//
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private
Thread
m_serverThread
;
private
Socket
m_serverSocket
;
...
...
@@ -210,7 +210,7 @@ namespace OnlineStore.Common
}
catch
(
Exception
ex
)
{
LOGGER
.
E
rror
(
ex
.
ToString
());
Common
.
LogUtil
.
e
rror
(
ex
.
ToString
());
}
}
...
...
source/Common/util/UdpServer.cs
查看文件 @
6596eb2
...
...
@@ -12,7 +12,7 @@ namespace OnlineStore.Common
public
class
UdpServer
{
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
System
.
Reflection
.
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
//
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private
Thread
m_serverThread
;
private
Socket
udpServer
;
...
...
@@ -37,7 +37,7 @@ namespace OnlineStore.Common
}
}
}
LogUtil
.
info
(
LOGGER
,
iplist
+
"]"
);
LogUtil
.
info
(
iplist
+
"]"
);
}
...
...
source/DeviceLibrary/IO/AIOBOX/AIOBOXManager.cs
查看文件 @
6596eb2
...
...
@@ -18,7 +18,7 @@ namespace OnlineStore.DeviceLibrary
//public static uint DefaultDICount = 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
,
List
<
Box_Sta
>>
DIValueMap
=
new
Dictionary
<
string
,
List
<
Box_Sta
>>();
...
...
@@ -124,7 +124,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
error
)
{
LogUtil
.
error
(
LOGGER
,
"连接IO模块 "
+
logName
+
" 出错:"
+
error
.
ToString
());
LogUtil
.
error
(
"连接IO模块 "
+
logName
+
" 出错:"
+
error
.
ToString
());
}
}
private
DateTime
lastLogTime
=
DateTime
.
Now
;
...
...
@@ -292,12 +292,12 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil
.
error
(
LOGGER
,
"WriteSingleDO出错 没有连接IO模块:"
+
ioIp
);
LogUtil
.
error
(
"WriteSingleDO出错 没有连接IO模块:"
+
ioIp
);
}
}
catch
(
Exception
ex
)
{
LOGGER
.
E
rror
(
"AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"] 出错啦:"
+
ex
.
ToString
());
Common
.
LogUtil
.
e
rror
(
"AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"] 出错啦:"
+
ex
.
ToString
());
}
}
public
override
void
WriteSingleDO
(
string
ioIp
,
byte
slaveId
,
ushort
StartAddress
,
IO_VALUE
onOff
,
int
mSeconds
)
...
...
@@ -317,11 +317,11 @@ namespace OnlineStore.DeviceLibrary
try
{
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
)
{
LogUtil
.
error
(
LOGGER
,
"**********定时回写入 出错:"
+
ex
.
StackTrace
);
LogUtil
.
error
(
"**********定时回写入 出错:"
+
ex
.
StackTrace
);
}
};
mytimer
.
AutoReset
=
false
;
//设置是否自动重启,即自动执行多次;
...
...
@@ -330,7 +330,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil
.
error
(
LOGGER
,
"AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"] 出错 没有连接IO模块:"
+
ioIp
);
LogUtil
.
error
(
"AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"] 出错 没有连接IO模块:"
+
ioIp
);
}
}
catch
(
Exception
ex
)
...
...
@@ -449,7 +449,7 @@ namespace OnlineStore.DeviceLibrary
}
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
;
}
...
...
source/DeviceLibrary/IO/KangNaiDe/KNDManager.cs
查看文件 @
6596eb2
...
...
@@ -22,7 +22,7 @@ namespace OnlineStore.DeviceLibrary
//public static ushort DefaultDILength = 16;
//public static ushort DefaultDOLength = 16;
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
,
List
<
KNDIO
>>
DIValueMap
=
new
Dictionary
<
string
,
List
<
KNDIO
>>();
public
static
Dictionary
<
string
,
List
<
KNDIO
>>
DOValueMap
=
new
Dictionary
<
string
,
List
<
KNDIO
>>();
...
...
@@ -87,7 +87,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
error
)
{
LogUtil
.
error
(
LOGGER
,
"连接IO模块["
+
ioIp
+
"]出错:"
+
error
.
ToString
());
LogUtil
.
error
(
"连接IO模块["
+
ioIp
+
"]出错:"
+
error
.
ToString
());
}
}
public
override
void
ReadAllDI
(
string
ioIp
,
byte
slaveId
)
...
...
@@ -122,7 +122,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"出错啦:"
+
ex
.
ToString
());
LogUtil
.
error
(
"出错啦:"
+
ex
.
ToString
());
}
return
false
;
}
...
...
@@ -144,14 +144,14 @@ namespace OnlineStore.DeviceLibrary
else
{
ConnectionIP
(
io
);
LogUtil
.
error
(
LOGGER
,
io
+
"当前没有连上,重连"
+
io
);
LogUtil
.
error
(
io
+
"当前没有连上,重连"
+
io
);
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"出错啦:"
+
ex
.
ToString
());
LogUtil
.
error
(
"出错啦:"
+
ex
.
ToString
());
}
Thread
.
Sleep
(
1
);
}
...
...
@@ -175,7 +175,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil
.
error
(
LOGGER
,
"ReadMultipleDI出错 没有连接IO模块:"
+
ioIp
);
LogUtil
.
error
(
"ReadMultipleDI出错 没有连接IO模块:"
+
ioIp
);
}
}
public
static
void
ReadMultipleDO
(
string
ioIp
,
byte
slaveId
,
ushort
StartAddress
,
ushort
length
)
...
...
@@ -189,7 +189,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil
.
error
(
LOGGER
,
"ReadMultipleDO出错 没有连接IO模块:"
+
ioIp
);
LogUtil
.
error
(
"ReadMultipleDO出错 没有连接IO模块:"
+
ioIp
);
}
}
//关闭所有的DO
...
...
@@ -235,7 +235,7 @@ namespace OnlineStore.DeviceLibrary
}
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
)
...
...
@@ -252,7 +252,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil
.
error
(
LOGGER
,
"WriteSingleDO 出错没有连接IO模块:"
+
ioIp
);
LogUtil
.
error
(
"WriteSingleDO 出错没有连接IO模块:"
+
ioIp
);
}
}
...
...
@@ -282,11 +282,11 @@ namespace OnlineStore.DeviceLibrary
MBmaster
.
WriteSingleCoils
(
ID
,
StartAddress
,
newValue
,
slaveId
);
KNDIO
newIo
=
new
KNDIO
(
ioIp
,
slaveId
,
StartAddress
,
newValue
);
SaveDOValue
(
newIo
,
ioIp
);
LogUtil
.
info
(
LOGGER
,
"**********定时回写入 IO【"
+
ioIp
+
","
+
StartAddress
+
",值"
+
onOff
+
"】:"
);
LogUtil
.
info
(
"**********定时回写入 IO【"
+
ioIp
+
","
+
StartAddress
+
",值"
+
onOff
+
"】:"
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"**********定时回写入 出错:"
+
ex
.
StackTrace
);
LogUtil
.
error
(
"**********定时回写入 出错:"
+
ex
.
StackTrace
);
}
};
mytimer
.
AutoReset
=
false
;
//设置是否自动重启,即自动执行多次;
...
...
@@ -294,7 +294,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil
.
error
(
LOGGER
,
"WriteSingleDO出错 没有连接IO模块:"
+
ioIp
);
LogUtil
.
error
(
"WriteSingleDO出错 没有连接IO模块:"
+
ioIp
);
}
}
...
...
@@ -327,7 +327,7 @@ namespace OnlineStore.DeviceLibrary
}
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
)
...
...
@@ -393,7 +393,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"获取数据出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"获取数据出错:"
+
ex
.
ToString
());
}
return
value
;
}
...
...
@@ -413,7 +413,7 @@ namespace OnlineStore.DeviceLibrary
{
finalData
=
Convert
.
ToString
(
values
[
0
],
2
).
PadLeft
(
DILength
,
'0'
);
}
L
OGGER
.
D
ebug
(
"IO模块【"
+
ioIp
+
"】收到DI上传:【"
+
finalData
+
"】"
);
L
ogUtil
.
d
ebug
(
"IO模块【"
+
ioIp
+
"】收到DI上传:【"
+
finalData
+
"】"
);
if
(
finalData
.
Length
>=
DILength
)
{
List
<
KNDIO
>
kndList
=
new
List
<
KNDIO
>();
...
...
@@ -444,7 +444,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"SaveDIData出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"SaveDIData出错:"
+
ex
.
ToString
());
//LOGGER.Error("处理接受数据出错:", ex);
}
}
...
...
@@ -532,7 +532,7 @@ namespace OnlineStore.DeviceLibrary
switch
(
Func
)
{
case
1
:
LOGGER
.
I
nfo
(
"Read coils end:【"
+
reviceMsg
+
"】 "
);
Common
.
LogUtil
.
i
nfo
(
"Read coils end:【"
+
reviceMsg
+
"】 "
);
SaveDOData
(
ioIp
,
SlaveId
,
values
);
break
;
case
2
:
...
...
@@ -553,7 +553,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"处理接受数据出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"处理接受数据出错:"
+
ex
.
ToString
());
//LOGGER.Error("处理接受数据出错:", ex);
}
}
...
...
@@ -580,7 +580,7 @@ namespace OnlineStore.DeviceLibrary
default
:
break
;
}
LOGGER
.
E
rror
(
"接收数据出错:"
+
exc
);
Common
.
LogUtil
.
e
rror
(
"接收数据出错:"
+
exc
);
//MessageBox.Show(exc, "Modbus slave exception");
}
}
...
...
source/DeviceLibrary/IO/KangNaiDe/MasterTcpClient.cs
查看文件 @
6596eb2
...
...
@@ -16,7 +16,7 @@ namespace OnlineStore.DeviceLibrary
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
private
const
byte
fctReadCoil
=
1
;
...
...
@@ -137,7 +137,7 @@ namespace OnlineStore.DeviceLibrary
connResult
.
AsyncWaitHandle
.
WaitOne
(
this
.
TimeOutTime
,
true
);
//等待2秒
if
(!
connResult
.
IsCompleted
)
{
LogUtil
.
info
(
LOGGER
,
"Connect to "
+
ip
+
":"
+
port
+
" fail!"
);
LogUtil
.
info
(
"Connect to "
+
ip
+
":"
+
port
+
" fail!"
);
return
;
}
else
...
...
@@ -155,7 +155,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
System
.
IO
.
IOException
error
)
{
LogUtil
.
info
(
LOGGER
,
"Connect to "
+
ip
+
":"
+
port
+
" fail!"
);
LogUtil
.
info
(
"Connect to "
+
ip
+
":"
+
port
+
" fail!"
);
_connected
=
false
;
throw
(
error
);
}
...
...
@@ -171,7 +171,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LOGGER
.
E
rror
(
"IO模块["
+
IP
+
"]出错:"
+
ex
.
ToString
());
Common
.
LogUtil
.
e
rror
(
"IO模块["
+
IP
+
"]出错:"
+
ex
.
ToString
());
}
}
...
...
@@ -238,7 +238,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil
.
debug
(
LOGGER
,
clientipe
.
ToString
()
+
"收到数据(无需分包):"
+
str
);
LogUtil
.
debug
(
clientipe
.
ToString
()
+
"收到数据(无需分包):"
+
str
);
ushort
id
=
BitConverter
.
ToUInt16
(
rdata
,
0
);
byte
function
=
rdata
[
7
];
DataProcess
(
clientipe
.
ToString
(),
id
,
function
,
rdata
);
...
...
@@ -295,7 +295,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
SocketException
e
)
{
LogUtil
.
error
(
LOGGER
,
"IO模块["
+
IP
+
"]接收数据出现错误:"
+
e
.
ToString
());
LogUtil
.
error
(
"IO模块["
+
IP
+
"]接收数据出现错误:"
+
e
.
ToString
());
if
(
socketClient
!=
null
)
{
socketClient
.
Close
();
...
...
@@ -335,7 +335,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"IO模块["
+
IP
+
"]dispose出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"IO模块["
+
IP
+
"]dispose出错:"
+
ex
.
ToString
());
}
socketClient
.
Close
();
}
...
...
@@ -515,7 +515,7 @@ namespace OnlineStore.DeviceLibrary
{
if
(
socketClient
==
null
)
{
LOGGER
.
E
rror
(
"发送数据时发现socketClient=null"
);
Common
.
LogUtil
.
e
rror
(
"发送数据时发现socketClient=null"
);
return
;
}
IPEndPoint
clientipe
=
(
IPEndPoint
)
socketClient
.
RemoteEndPoint
;
...
...
@@ -537,7 +537,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
SystemException
error
)
{
LogUtil
.
error
(
LOGGER
,
"IO模块 WriteAsyncData出错:"
+
error
.
ToString
());
LogUtil
.
error
(
"IO模块 WriteAsyncData出错:"
+
error
.
ToString
());
CallException
(
id
,
write_data
[
7
],
excExceptionConnectionLost
,
tcpSocketReviceBuffer
);
}
}
...
...
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
查看文件 @
6596eb2
...
...
@@ -52,6 +52,7 @@ namespace OnlineStore.DeviceLibrary
private
System
.
Timers
.
Timer
readDITimer
=
new
System
.
Timers
.
Timer
();
public
AC_SA_BoxBean
(
AC_SA_Config
config
)
{
StoreName
=
(
"料仓BOX_"
+
config
.
Id
+
" "
).
ToUpper
();
Init
();
serverConnectTimer
=
new
System
.
Timers
.
Timer
();
serverConnectTimer
.
Interval
=
1000
;
...
...
@@ -74,7 +75,6 @@ namespace OnlineStore.DeviceLibrary
IsDebug
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
IsInDebug
).
Equals
(
1
);
IsHasCompress_Axis
=
config
.
IsHasCompress_Axis
.
Equals
(
1
);
StoreName
=
(
"料仓BOX_"
+
config
.
Id
+
" "
).
ToUpper
();
this
.
StoreID
=
config
.
Id
;
this
.
Config
=
config
;
moveAxisList
=
new
List
<
ConfigMoveAxis
>();
...
...
@@ -263,8 +263,8 @@ namespace OnlineStore.DeviceLibrary
if
(
IOManager
.
IOValue
(
IO_Type
.
SuddenStop_BTN
).
Equals
(
IO_VALUE
.
LOW
))
{
isInSuddenDown
=
true
;
LogUtil
.
error
(
LOGGER
,
StoreName
+
"收到急停信号,报警急停"
);
WarnMsg
=
StoreName
+
"收到急停信号,报警急停"
;
LogUtil
.
error
(
StoreName
+
"收到急停信号,报警急停"
);
SetWarnMsg
(
StoreName
+
"收到急停信号,报警急停"
,
"报警急停"
)
;
//报警时会关闭所有轴
Alarm
(
StoreAlarmType
.
SuddenStop
,
"1"
,
WarnMsg
,
StoreMoveType
.
None
);
...
...
@@ -313,7 +313,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public
override
bool
StartRun
()
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"开始启动,启动时间:"
+
StartTime
.
ToString
());
LogUtil
.
info
(
StoreName
+
"开始启动,启动时间:"
+
StartTime
.
ToString
());
autoNext
=
false
;
mainTimer
.
Enabled
=
false
;
...
...
@@ -352,11 +352,11 @@ namespace OnlineStore.DeviceLibrary
{
if
(
suddenBtn
.
Equals
(
IO_VALUE
.
LOW
))
{
LogUtil
.
error
(
LOGGER
,
" ("
+
StoreName
+
")启动出现错误:急停没开 !启动失败!"
);
LogUtil
.
error
(
" ("
+
StoreName
+
")启动出现错误:急停没开 !启动失败!"
);
}
else
{
LogUtil
.
error
(
LOGGER
,
" ("
+
StoreName
+
")启动出现错误:没有气压信号 !启动失败!"
);
LogUtil
.
error
(
" ("
+
StoreName
+
")启动出现错误:没有气压信号 !启动失败!"
);
}
return
false
;
}
...
...
@@ -368,7 +368,7 @@ namespace OnlineStore.DeviceLibrary
{
isNoAirCheck
=
false
;
isInSuddenDown
=
false
;
WarnMsg
=
""
;
SetWarnMsg
()
;
CurrInOutACount
=
0
;
CurrInOutCount
=
0
;
IOManager
.
IOMove
(
IO_Type
.
Alarm_HddLed
,
IO_VALUE
.
LOW
);
...
...
@@ -379,7 +379,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_InOutBack
);
ACAxisHomeMove
(
Config
.
InOut_Axis
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"开始原点返回,先把进出轴回原点"
);
LogUtil
.
info
(
StoreName
+
"开始原点返回,先把进出轴回原点"
);
StoreMove
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
}
...
...
@@ -388,7 +388,7 @@ namespace OnlineStore.DeviceLibrary
//压紧轴回原点,叉子回到P1,关闭门旋转轴和升降轴回到P1
StoreMove
.
NewMove
(
StoreMoveType
.
StoreReset
);
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
);
//ComBeforeHomeMove();
//判断叉子没有料盘
...
...
@@ -419,13 +419,12 @@ namespace OnlineStore.DeviceLibrary
storeRunStatus
=
StoreRunStatus
.
Reset
;
storeStatus
=
StoreStatus
.
ResetMove
;
StoreMove
.
NewMove
(
StoreMoveType
.
StoreReset
);
WarnMsg
=
""
;
SetWarnMsg
();
if
(!
RunAxis
(
true
))
////打开四个轴
//if (!OpenAllAxis())
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"复位时打开轴失败,需要再次复位,直接报警停止复位"
);
LogUtil
.
info
(
StoreName
+
"复位时打开轴失败,需要再次复位,直接报警停止复位"
);
return
;
}
if
(
IsHasCompress_Axis
||
Config
.
IsHasLocationCylinder
.
Equals
(
0
))
...
...
@@ -435,7 +434,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"开始复位:先定位气缸下降"
);
LogUtil
.
info
(
StoreName
+
"开始复位:先定位气缸下降"
);
// 复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_LocationCylinderBack
);
LocationDownAndWait
();
...
...
@@ -448,7 +447,7 @@ namespace OnlineStore.DeviceLibrary
int
slvAddr
=
Config
.
InOut_Axis
.
GetAxisValue
();
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_InOutBack
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"复位中,进出轴开始原点返回"
);
LogUtil
.
info
(
StoreName
+
"复位中,进出轴开始原点返回"
);
ACAxisHomeMove
(
Config
.
InOut_Axis
);
StoreMove
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
}
...
...
@@ -473,13 +472,13 @@ namespace OnlineStore.DeviceLibrary
case
StoreMoveStep
.
BOX_H_InOutMove
:
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_InOutBack
);
ACAxisHomeMove
(
Config
.
InOut_Axis
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"复位中:进出轴开始原点返回"
);
LogUtil
.
info
(
StoreName
+
"复位中:进出轴开始原点返回"
);
StoreMove
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
break
;
case
StoreMoveStep
.
BOX_H_InOutBack
:
Thread
.
Sleep
(
200
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_InOutToP1
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"复位中:进出轴到待机点P1,关闭舱门"
);
LogUtil
.
info
(
StoreName
+
"复位中:进出轴到待机点P1,关闭舱门"
);
//进出轴原点返回完成,将进出轴的位置设置=0
AxisCountClear
(
Config
.
InOut_Axis
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
...
...
@@ -492,11 +491,11 @@ namespace OnlineStore.DeviceLibrary
//如果此时轴三还在报警,需要提示错误并等待
if
(
ACServerManager
.
GetAlarmStatus
(
Config
.
InOut_Axis
.
DeviceName
,
Config
.
InOut_Axis
.
GetAxisValue
())
>
0
)
{
LogUtil
.
error
(
LOGGER
,
"进出轴报警!复位失败,请检查!"
);
LogUtil
.
error
(
"进出轴报警!复位失败,请检查!"
);
}
//复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
LogUtil
.
info
(
LOGGER
,
StoreName
+
"复位中: 压紧轴,旋转轴,上下轴开始 原点返回"
);
LogUtil
.
info
(
StoreName
+
"复位中: 压紧轴,旋转轴,上下轴开始 原点返回"
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_OtherAxisBack
);
StoreMove
.
TimeOutSeconds
=
100
;
if
(
IsHasCompress_Axis
)
...
...
@@ -509,26 +508,26 @@ namespace OnlineStore.DeviceLibrary
case
StoreMoveStep
.
BOX_H_OtherAxisBack
:
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
.
UpDown_Axis
,
Config
.
UpDownAxis_DoorOPosition_P1
,
Config
.
UpDownAxis_P1_Speed
);
ComMoveToPosition
(
Config
.
CompressAxis_P1_Position
,
Config
.
CompAxis_P1_Speed
);
break
;
case
StoreMoveStep
.
BOX_H_MiddleAxisToP1
:
LogUtil
.
info
(
LOGGER
,
StoreName
+
"复位完成"
);
LogUtil
.
info
(
StoreName
+
"复位完成"
);
storeRunStatus
=
StoreRunStatus
.
Runing
;
StoreMove
.
EndMove
();
storeStatus
=
StoreStatus
.
StoreOnline
;
if
(
alarmType
.
Equals
(
StoreAlarmType
.
None
))
{
WarnMsg
=
""
;
SetWarnMsg
()
;
}
break
;
case
StoreMoveStep
.
BOX_M_H_TOP1_InOutToP1
:
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_M_H_TOP1_CompressHome
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"到待机状态,压紧轴回原点,关闭舱门"
);
LogUtil
.
info
(
StoreName
+
"到待机状态,压紧轴回原点,关闭舱门"
);
if
(
IsHasCompress_Axis
)
{
ACAxisHomeMove
(
Config
.
Comp_Axis
);
...
...
@@ -538,19 +537,19 @@ namespace OnlineStore.DeviceLibrary
break
;
case
StoreMoveStep
.
BOX_M_H_TOP1_CompressHome
:
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
.
UpDown_Axis
,
Config
.
UpDownAxis_DoorOPosition_P1
,
Config
.
UpDownAxis_P1_Speed
);
ComMoveToPosition
(
Config
.
CompressAxis_P1_Position
,
Config
.
CompAxis_P1_Speed
);
break
;
case
StoreMoveStep
.
BOX_M_H_TOP1_OtherAxisToP1
:
LogUtil
.
info
(
LOGGER
,
StoreName
+
"到待机状态完成"
);
LogUtil
.
info
(
StoreName
+
"到待机状态完成"
);
StoreMove
.
EndMove
();
storeStatus
=
StoreStatus
.
StoreOnline
;
storeRunStatus
=
StoreRunStatus
.
Runing
;
if
(
alarmType
.
Equals
(
StoreAlarmType
.
None
))
{
WarnMsg
=
""
;
SetWarnMsg
()
;
}
break
;
...
...
@@ -619,7 +618,7 @@ namespace OnlineStore.DeviceLibrary
{
case
StoreMoveStep
.
BOX_H_LocationCylinderBack
:
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_InOutBack
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"原点返回中,进出轴回原点"
);
LogUtil
.
info
(
StoreName
+
"原点返回中,进出轴回原点"
);
//复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
ACAxisHomeMove
(
Config
.
InOut_Axis
);
StoreMove
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
...
...
@@ -627,7 +626,7 @@ namespace OnlineStore.DeviceLibrary
case
StoreMoveStep
.
BOX_H_InOutBack
:
Thread
.
Sleep
(
200
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_InOutToP1
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"原点返回中,进出轴退回P1点,关闭仓门,检测叉子没有料盘"
);
LogUtil
.
info
(
StoreName
+
"原点返回中,进出轴退回P1点,关闭仓门,检测叉子没有料盘"
);
//进出轴原点返回完成,将进出轴的位置设置=0
AxisCountClear
(
Config
.
InOut_Axis
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
...
...
@@ -642,10 +641,10 @@ namespace OnlineStore.DeviceLibrary
if
(
ACServerManager
.
GetAlarmStatus
(
Config
.
InOut_Axis
.
DeviceName
,
Config
.
InOut_Axis
.
GetAxisValue
())
>
0
)
{
WarnMsg
=
"进出轴报警!复位失败,请检查!"
;
LogUtil
.
error
(
LOGGER
,
"进出轴报警!复位失败,请检查!"
);
LogUtil
.
error
(
"进出轴报警!复位失败,请检查!"
);
}
//复位和回原点要等轴3进出轴ORG亮了以后才能返回其他轴
LogUtil
.
info
(
LOGGER
,
StoreName
+
"原点返回中 :压紧轴,旋转轴,上下轴开始原点返回"
);
LogUtil
.
info
(
StoreName
+
"原点返回中 :压紧轴,旋转轴,上下轴开始原点返回"
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
BOX_H_OtherAxisBack
);
if
(
IsHasCompress_Axis
)
{
...
...
@@ -657,17 +656,17 @@ namespace OnlineStore.DeviceLibrary
case
StoreMoveStep
.
BOX_H_OtherAxisBack
:
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
.
UpDown_Axis
,
Config
.
UpDownAxis_DoorOPosition_P1
,
Config
.
UpDownAxis_P1_Speed
);
ComMoveToPosition
(
Config
.
CompressAxis_P1_Position
,
Config
.
CompAxis_P1_Speed
);
break
;
case
StoreMoveStep
.
BOX_H_MiddleAxisToP1
:
LogUtil
.
info
(
LOGGER
,
StoreName
+
"回原点完成"
);
LogUtil
.
info
(
StoreName
+
"回原点完成"
);
storeRunStatus
=
StoreRunStatus
.
Runing
;
StoreMove
.
EndMove
();
storeStatus
=
StoreStatus
.
StoreOnline
;
WarnMsg
=
""
;
SetWarnMsg
()
;
break
;
default
:
break
;
}
...
...
@@ -720,26 +719,27 @@ namespace OnlineStore.DeviceLibrary
{
if
(
ACServerManager
.
ServerOnStatus
(
axis
.
DeviceName
,
axis
.
GetAxisValue
()))
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"成功打开轴:"
+
axis
.
Explain
);
LogUtil
.
info
(
StoreName
+
"成功打开轴:"
+
axis
.
Explain
);
}
else
{
//清理报警,再重新打开一次
LogUtil
.
info
(
LOGGER
,
StoreName
+
"第一次打开轴"
+
axis
.
Explain
+
"失败,先清理一下报警,再重新打开一次"
);
LogUtil
.
info
(
StoreName
+
"第一次打开轴"
+
axis
.
Explain
+
"失败,先清理一下报警,再重新打开一次"
);
ACServerManager
.
AlarmClear
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
System
.
Threading
.
Thread
.
Sleep
(
1200
);
ACServerManager
.
ServoOn
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
System
.
Threading
.
Thread
.
Sleep
(
100
);
if
(
ACServerManager
.
ServerOnStatus
(
axis
.
DeviceName
,
axis
.
GetAxisValue
()))
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"清理报警后重新打卡轴成功:"
+
axis
.
Explain
);
LogUtil
.
info
(
StoreName
+
"清理报警后重新打卡轴成功:"
+
axis
.
Explain
);
}
else
{
ACServerManager
.
ServoOff
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
int
alarmCode
=
GetAlarmCodeByAxis
(
axis
);
WarnMsg
=
StoreName
+
"打开轴"
+
axis
.
Explain
+
"失败 "
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
WarnMsg
);
SetWarnMsg
(
StoreName
+
"打开轴"
+
axis
.
Explain
+
"失败 "
,
axis
.
Explain
+
"_打开识别"
);
LogUtil
.
info
(
StoreName
+
WarnMsg
);
Alarm
(
StoreAlarmType
.
AxisAlarm
,
GetAlarmCodeByAxis
(
axis
).
ToString
(),
WarnMsg
,
StoreMove
.
MoveType
);
return
false
;
}
...
...
@@ -790,7 +790,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public
override
void
StopRun
()
{
WarnMsg
=
""
;
SetWarnMsg
()
;
autoNext
=
false
;
IoCheckTimer
.
Enabled
=
false
;
serverConnectTimer
.
Enabled
=
false
;
...
...
@@ -808,7 +808,7 @@ namespace OnlineStore.DeviceLibrary
//ShuoKeControls.ClosePort();
}
LogUtil
.
info
(
LOGGER
,
StoreName
+
",停止运行,总运行时间:"
+
span
.
ToString
());
LogUtil
.
info
(
StoreName
+
",停止运行,总运行时间:"
+
span
.
ToString
());
}
private
DateTime
lastDisTime
=
DateTime
.
Now
;
private
string
LastPosId
=
""
;
...
...
@@ -821,7 +821,7 @@ namespace OnlineStore.DeviceLibrary
{
return
;
}
LogUtil
.
error
(
LOGGER
,
StoreName
+
" 报警,报警类型:"
+
nalarmType
);
LogUtil
.
error
(
StoreName
+
" 报警,报警类型:"
+
nalarmType
);
this
.
alarmType
=
nalarmType
;
if
(
nalarmType
.
Equals
(
StoreAlarmType
.
AxisAlarm
)
||
nalarmType
.
Equals
(
StoreAlarmType
.
AxisMoveError
))
...
...
@@ -847,7 +847,7 @@ namespace OnlineStore.DeviceLibrary
}
}
LogUtil
.
error
(
LOGGER
,
StoreName
+
"轴报警,关闭刹车,停止运动,关闭轴,打开报警灯"
);
LogUtil
.
error
(
StoreName
+
"轴报警,关闭刹车,停止运动,关闭轴,打开报警灯"
);
IOManager
.
IOMove
(
IO_Type
.
Axis_Brake
,
IO_VALUE
.
LOW
);
StoreMove
.
EndMove
();
StopMove
(
true
);
...
...
@@ -855,7 +855,7 @@ namespace OnlineStore.DeviceLibrary
else
if
(
nalarmType
==
StoreAlarmType
.
SuddenStop
)
{
isInSuddenDown
=
true
;
LogUtil
.
error
(
LOGGER
,
StoreName
+
"收到急停信号,关闭刹车,停止运动,关闭轴,打开报警灯 "
);
LogUtil
.
error
(
StoreName
+
"收到急停信号,关闭刹车,停止运动,关闭轴,打开报警灯 "
);
IOManager
.
IOMove
(
IO_Type
.
Axis_Brake
,
IO_VALUE
.
LOW
);
StoreMove
.
EndMove
();
StopMove
(
true
);
...
...
@@ -864,7 +864,7 @@ namespace OnlineStore.DeviceLibrary
else
if
(
nalarmType
.
Equals
(
StoreAlarmType
.
NoAirCheck
))
{
isNoAirCheck
=
true
;
LogUtil
.
error
(
LOGGER
,
StoreName
+
" 未检测到气压信号 ,打开刹车,停止运动,关闭轴,打开报警灯 "
);
LogUtil
.
error
(
StoreName
+
" 未检测到气压信号 ,打开刹车,停止运动,关闭轴,打开报警灯 "
);
IOManager
.
IOMove
(
IO_Type
.
Axis_Brake
,
IO_VALUE
.
LOW
);
StoreMove
.
EndMove
();
StopMove
(
true
);
...
...
@@ -917,7 +917,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LOGGER
.
E
rror
(
StoreName
+
"定时处理出错:"
+
ex
.
ToString
());
Common
.
LogUtil
.
e
rror
(
StoreName
+
"定时处理出错:"
+
ex
.
ToString
());
}
IsChongfu
=
false
;
InProcess
=
false
;
...
...
@@ -946,7 +946,7 @@ namespace OnlineStore.DeviceLibrary
TimeSpan
span
=
DateTime
.
Now
-
lastAirCloseTime
;
if
(
span
.
TotalSeconds
>
Config
.
AirCheckSeconds
)
{
WarnMsg
=
"未检测到气压信号"
;
SetWarnMsg
(
"未检测到气压信号"
,
"未检测到气压信号"
)
;
preAirValue
=
IO_VALUE
.
LOW
;
LogUtil
.
info
(
"已持续【"
+
FormUtil
.
GetSpanStr
(
span
)
+
"】未检测到气压信号,报警"
);
Alarm
(
StoreAlarmType
.
NoAirCheck
,
"2"
,
WarnMsg
,
StoreMoveType
.
None
);
...
...
@@ -1065,7 +1065,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LOGGER
.
E
rror
(
StoreName
+
"灯处理定时器出错:"
,
ex
);
Common
.
LogUtil
.
e
rror
(
StoreName
+
"灯处理定时器出错:"
,
ex
);
}
}
private
IO_VALUE
lastAutoRun
=
IO_VALUE
.
LOW
;
...
...
@@ -1082,7 +1082,7 @@ namespace OnlineStore.DeviceLibrary
if
(
autoSingle
.
Equals
(
IO_VALUE
.
HIGH
)
&&
lastAutoRun
.
Equals
(
IO_VALUE
.
LOW
))
{
//没有启动时收到复位按钮,相当于启动按钮
LogUtil
.
info
(
LOGGER
,
StoreName
+
"没有启动时收到复位按钮,相当于启动按钮,开始调用启动方法!"
);
LogUtil
.
info
(
StoreName
+
"没有启动时收到复位按钮,相当于启动按钮,开始调用启动方法!"
);
bool
result
=
StartRun
();
if
(
result
.
Equals
(
false
))
{
...
...
@@ -1114,18 +1114,18 @@ namespace OnlineStore.DeviceLibrary
{
if
(
StoreMove
.
MoveType
.
Equals
(
StoreMoveType
.
None
))
{
LogUtil
.
info
(
LOGGER
,
"收到复位信号,当前无报警,且空闲中,只回到待机点"
);
LogUtil
.
info
(
"收到复位信号,当前无报警,且空闲中,只回到待机点"
);
MoveToP1
();
}
else
{
LogUtil
.
info
(
LOGGER
,
"收到复位信号,当前无报警, 在"
+
StoreMove
.
MoveType
+
"处理中,不处理复位"
);
LogUtil
.
info
(
"收到复位信号,当前无报警, 在"
+
StoreMove
.
MoveType
+
"处理中,不处理复位"
);
}
}
else
{
//收到复位信号
LogUtil
.
info
(
LOGGER
,
"收到复位信号,自动复位"
);
LogUtil
.
info
(
"收到复位信号,自动复位"
);
WarnMsg
=
"收到复位信号,自动复位"
;
Reset
();
}
...
...
@@ -1156,7 +1156,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LOGGER
.
E
rror
(
StoreName
+
"定时处理出错"
,
ex
);
Common
.
LogUtil
.
e
rror
(
StoreName
+
"定时处理出错"
,
ex
);
}
}
...
...
@@ -1195,13 +1195,13 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil
.
info
(
StoreName
+
"之前有IO超时异常【"
+
alarmInfo
.
alarmDetail
+
"】,但是当前已经没有在等待中,清理信号超时异常!"
);
alarmType
=
StoreAlarmType
.
None
;
WarnMsg
=
""
;
SetWarnMsg
()
;
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"IOTimeOutProcess出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"IOTimeOutProcess出错:"
+
ex
.
ToString
());
}
}
...
...
@@ -1217,11 +1217,11 @@ namespace OnlineStore.DeviceLibrary
{
if
(
storeRunStatus
<
StoreRunStatus
.
Runing
||
StoreMove
.
MoveType
==
StoreMoveType
.
InStore
||
StoreMove
.
MoveType
==
StoreMoveType
.
OutStore
)
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"已经累计出入库"
+
CurrInOutACount
+
"次,当时当前正在忙碌中暂不复位"
);
LogUtil
.
info
(
StoreName
+
"已经累计出入库"
+
CurrInOutACount
+
"次,当时当前正在忙碌中暂不复位"
);
}
else
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"已经累计出入库"
+
CurrInOutACount
+
"次,需要复位一下"
);
LogUtil
.
info
(
StoreName
+
"已经累计出入库"
+
CurrInOutACount
+
"次,需要复位一下"
);
Reset
();
}
}
...
...
@@ -1229,11 +1229,11 @@ namespace OnlineStore.DeviceLibrary
{
if
(
storeRunStatus
<
StoreRunStatus
.
Runing
||
StoreMove
.
MoveType
==
StoreMoveType
.
InStore
||
StoreMove
.
MoveType
==
StoreMoveType
.
OutStore
)
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"已经累计出入库"
+
CurrInOutCount
+
"次,当时当前正在忙碌中暂不复位旋转轴"
);
LogUtil
.
info
(
StoreName
+
"已经累计出入库"
+
CurrInOutCount
+
"次,当时当前正在忙碌中暂不复位旋转轴"
);
}
else
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"已经累计出入库"
+
CurrInOutCount
+
"次,需要复位一下旋转轴"
);
LogUtil
.
info
(
StoreName
+
"已经累计出入库"
+
CurrInOutCount
+
"次,需要复位一下旋转轴"
);
}
}
else
if
(
LineConnect
.
CanStartOut
()
||
IsDebug
)
...
...
@@ -1250,12 +1250,12 @@ namespace OnlineStore.DeviceLibrary
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.PosId, currInOutFixture.plateH, currInOutFixture.plateW));
if
(!
result
)
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 执行排队中的出库【"
+
currInOutFixture
.
ToStr
()
+
"】失败,重新加入等待队列"
);
LogUtil
.
info
(
StoreName
+
" 执行排队中的出库【"
+
currInOutFixture
.
ToStr
()
+
"】失败,重新加入等待队列"
);
AddWaitOutInfo
(
currInOutFixture
);
}
}
...
...
@@ -1263,7 +1263,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"处理出入库排队列表出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"处理出入库排队列表出错:"
+
ex
.
ToString
());
}
}
...
...
@@ -1308,7 +1308,7 @@ namespace OnlineStore.DeviceLibrary
if
(
alarmIo
==
1
)
{
WarnMsg
=
StoreName
+
" 运动轴"
+
axisInfo
.
Explain
+
"报警"
;
SetWarnMsg
(
StoreName
+
" 运动轴"
+
axisInfo
.
Explain
+
"报警"
,
axisInfo
.
Explain
+
"_轴报警"
)
;
info
.
AlarmIoValue
=
alarmIo
;
Alarm
(
StoreAlarmType
.
AxisAlarm
,
GetAlarmCodeByAxis
(
axisInfo
).
ToString
(),
WarnMsg
,
StoreMoveType
.
None
);
isInAlarm
=
true
;
...
...
@@ -1317,7 +1317,7 @@ namespace OnlineStore.DeviceLibrary
{
if
(!
info
.
AlarmIoValue
.
Equals
(
alarmIo
))
{
LogUtil
.
error
(
LOGGER
,
StoreName
+
" 运动轴 "
+
axisInfo
.
Explain
+
",报警已解除!"
);
LogUtil
.
error
(
StoreName
+
" 运动轴 "
+
axisInfo
.
Explain
+
",报警已解除!"
);
info
.
AlarmIoValue
=
alarmIo
;
}
}
...
...
@@ -1357,7 +1357,7 @@ namespace OnlineStore.DeviceLibrary
{
CloseAllAxis
();
}
LogUtil
.
info
(
LOGGER
,
StoreName
+
"StopMove"
);
LogUtil
.
info
(
StoreName
+
"StopMove"
);
IOManager
.
IOMove
(
IO_Type
.
Door_Down
,
IO_VALUE
.
LOW
);
IOManager
.
IOMove
(
IO_Type
.
Door_Up
,
IO_VALUE
.
LOW
);
...
...
@@ -1411,8 +1411,8 @@ namespace OnlineStore.DeviceLibrary
if
(
position
==
null
)
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg
=
"入库未找到库位:【"
+
inoutInfo
.
ToStr
()
+
"】 "
;
LogUtil
.
error
(
LOGGER
,
"收到服务器入库命令:入库未找到库位:【"
+
inoutInfo
.
ToStr
()
+
"】"
);
LogUtil
.
info
(
LOGGER
,
"收到服务器入库命令:入库未找到库位:【"
+
inoutInfo
.
ToStr
()
+
"】"
);
LogUtil
.
error
(
"收到服务器入库命令:入库未找到库位:【"
+
inoutInfo
.
ToStr
()
+
"】"
);
LogUtil
.
info
(
"收到服务器入库命令:入库未找到库位:【"
+
inoutInfo
.
ToStr
()
+
"】"
);
return
;
}
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
...
...
@@ -1421,11 +1421,11 @@ namespace OnlineStore.DeviceLibrary
InOutParam
param
=
new
InOutParam
(
inoutInfo
);
StartInStoreMove
(
param
);
//如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 收到服务器入库命令:【"
+
inoutInfo
.
ToStr
()
+
"】开始入库!"
);
LogUtil
.
info
(
StoreName
+
" 收到服务器入库命令:【"
+
inoutInfo
.
ToStr
()
+
"】开始入库!"
);
}
else
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 收到服务器入库命令:【"
+
inoutInfo
.
ToStr
()
+
"】 正在忙碌中,无法入库!"
);
LogUtil
.
info
(
StoreName
+
" 收到服务器入库命令:【"
+
inoutInfo
.
ToStr
()
+
"】 正在忙碌中,无法入库!"
);
}
}
...
...
@@ -1440,7 +1440,7 @@ namespace OnlineStore.DeviceLibrary
if
(
storeRunStatus
.
Equals
(
StoreRunStatus
.
Wait
))
{
LogUtil
.
info
(
LOGGER
,
logName
+
" 设备未启动,验证失败"
);
LogUtil
.
info
(
logName
+
" 设备未启动,验证失败"
);
return
false
;
}
//发送扫码内容到服务器进行入库操作
...
...
@@ -1455,23 +1455,23 @@ namespace OnlineStore.DeviceLibrary
Operation
resultOperation
=
HttpHelper
.
PostOP
(
StoreManager
.
GetPostApi
(
server
),
operation
,
out
timeOut
);
if
(
timeOut
)
{
LogUtil
.
info
(
LOGGER
,
logName
+
" 第"
+
i
+
"次发送超时 "
);
LogUtil
.
info
(
logName
+
" 第"
+
i
+
"次发送超时 "
);
continue
;
}
if
(
resultOperation
==
null
)
{
// CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
LogUtil
.
info
(
LOGGER
,
logName
+
" 没有收到服务器反馈 "
);
LogUtil
.
info
(
logName
+
" 没有收到服务器反馈 "
);
}
else
if
(!
string
.
IsNullOrEmpty
(
resultOperation
.
msg
))
{
//如果有提示消息,直接显示提示
LogUtil
.
info
(
LOGGER
,
logName
+
"服务器反馈 :"
+
resultOperation
.
msg
);
LogUtil
.
info
(
logName
+
"服务器反馈 :"
+
resultOperation
.
msg
);
}
else
if
(
resultOperation
.
op
.
Equals
(
1
))
{
LogUtil
.
info
(
LOGGER
,
logName
+
" 成功"
);
LogUtil
.
info
(
logName
+
" 成功"
);
return
true
;
}
break
;
...
...
@@ -1479,7 +1479,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
info
(
LOGGER
,
logName
+
" 出错:"
+
ex
.
ToString
());
LogUtil
.
info
(
logName
+
" 出错:"
+
ex
.
ToString
());
}
return
false
;
...
...
@@ -1506,7 +1506,7 @@ namespace OnlineStore.DeviceLibrary
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg
=
"入库未找到库位:二维码【"
+
message
+
"】库位【"
+
posId
+
"】 "
;
LogUtil
.
error
(
logName
+
"未找到库位"
);
// LogUtil.info(
LOGGER,
"收到流水线入库:入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
// LogUtil.info(
"收到流水线入库:入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
return
;
}
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
...
...
@@ -1582,7 +1582,7 @@ namespace OnlineStore.DeviceLibrary
TimeSpan
span
=
DateTime
.
Now
-
LastEndBlowTime
;
if
(
span
.
TotalMinutes
>
this
.
Config
.
BlowAir_Interval
)
{
L
OGGER
.
I
nfo
(
"当前最大湿度:"
+
currMaxHumidity
.
ToString
()
+
",开始吹气湿度:"
+
startBlowHumidity
+
",当前不在吹气中,且间隔超过"
+
Config
.
BlowAir_Interval
+
"分钟,开始吹气!"
);
L
ogUtil
.
i
nfo
(
"当前最大湿度:"
+
currMaxHumidity
.
ToString
()
+
",开始吹气湿度:"
+
startBlowHumidity
+
",当前不在吹气中,且间隔超过"
+
Config
.
BlowAir_Interval
+
"分钟,开始吹气!"
);
IsInBlowing
=
true
;
//Thread.Sleep(100);
IOManager
.
IOMove
(
IO_Type
.
StartOrStopBlow
,
IO_VALUE
.
HIGH
);
...
...
@@ -1593,7 +1593,7 @@ namespace OnlineStore.DeviceLibrary
if
(
IsInBlowing
&&
stopBlowHumidity
>
currMaxHumidity
)
{
L
OGGER
.
I
nfo
(
"当前最大湿度:"
+
currMaxHumidity
.
ToString
()
+
",停止吹气湿度:"
+
stopBlowHumidity
+
",停止吹气!"
);
L
ogUtil
.
i
nfo
(
"当前最大湿度:"
+
currMaxHumidity
.
ToString
()
+
",停止吹气湿度:"
+
stopBlowHumidity
+
",停止吹气!"
);
IsInBlowing
=
false
;
IOManager
.
IOMove
(
IO_Type
.
StartOrStopBlow
,
IO_VALUE
.
LOW
);
LastEndBlowTime
=
DateTime
.
Now
;
...
...
@@ -1604,7 +1604,7 @@ namespace OnlineStore.DeviceLibrary
TimeSpan
span
=
DateTime
.
Now
-
LastBeginBlowTime
;
if
(
span
.
TotalMinutes
>
this
.
Config
.
BlowAir_Time
)
{
L
OGGER
.
I
nfo
(
"已经吹气"
+
span
.
TotalMinutes
+
"分钟,超过配置的吹气时间"
+
Config
.
BlowAir_Time
+
"分钟,停止吹气!"
);
L
ogUtil
.
i
nfo
(
"已经吹气"
+
span
.
TotalMinutes
+
"分钟,超过配置的吹气时间"
+
Config
.
BlowAir_Time
+
"分钟,停止吹气!"
);
IsInBlowing
=
false
;
//Thread.Sleep(100);
IOManager
.
IOMove
(
IO_Type
.
StartOrStopBlow
,
IO_VALUE
.
LOW
);
...
...
@@ -1619,7 +1619,7 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
temp
>
Max_Temperature
&&
Max_Temperature
>
0
)
{
L
OGGER
.
I
nfo
(
"当前温度【"
+
param
.
Temperate
+
"】超过最高温度【"
+
Max_Temperature
+
"】,开始报警!"
);
L
ogUtil
.
i
nfo
(
"当前温度【"
+
param
.
Temperate
+
"】超过最高温度【"
+
Max_Temperature
+
"】,开始报警!"
);
needAlarm
=
true
;
//Thread.Sleep(100);
IOManager
.
IOMove
(
IO_Type
.
StartOrStopBlow
,
IO_VALUE
.
LOW
);
...
...
@@ -1628,7 +1628,7 @@ namespace OnlineStore.DeviceLibrary
{
if
(
IsInBlowing
.
Equals
(
false
)
&&
TempOrHumidityIsAlarm
)
{
L
OGGER
.
I
nfo
(
"不在吹气中,且当前温度【"
+
param
.
Temperate
+
"】低于【"
+
Max_Temperature
+
"】,关闭报警!"
);
L
ogUtil
.
i
nfo
(
"不在吹气中,且当前温度【"
+
param
.
Temperate
+
"】低于【"
+
Max_Temperature
+
"】,关闭报警!"
);
TempOrHumidityIsAlarm
=
false
;
//Thread.Sleep(100);
IOManager
.
IOMove
(
IO_Type
.
StartOrStopBlow
,
IO_VALUE
.
LOW
);
...
...
@@ -1646,7 +1646,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LOGGER
.
E
rror
(
StoreName
+
"HumidityProcess出错:"
+
ex
.
ToString
());
Common
.
LogUtil
.
e
rror
(
StoreName
+
"HumidityProcess出错:"
+
ex
.
ToString
());
}
}
private
void
HTAlarm
()
...
...
@@ -1704,7 +1704,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LOGGER
.
E
rror
(
"定时给服务器发送消息出错:"
,
ex
);
Common
.
LogUtil
.
e
rror
(
"定时给服务器发送消息出错:"
,
ex
);
}
}
}
...
...
@@ -1793,7 +1793,7 @@ namespace OnlineStore.DeviceLibrary
boxStatus
.
status
=
(
int
)
lastPosIdStatus
;
if
(
lastPosId
!=
""
)
{
LogUtil
.
info
(
LOGGER
,
"给服务器发送出入库完成消息:"
+
StoreName
+
",status【"
+
lastPosIdStatus
+
"】posId【"
+
lastPosId
+
"】"
);
LogUtil
.
info
(
"给服务器发送出入库完成消息:"
+
StoreName
+
",status【"
+
lastPosIdStatus
+
"】posId【"
+
lastPosId
+
"】"
);
}
lastPosId
=
""
;
}
...
...
@@ -1835,7 +1835,7 @@ namespace OnlineStore.DeviceLibrary
if
(
Max_Humidity
<=
0
||
(
Max_Temperature
<=
0
))
{
lineOperation
.
op
=
5
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
"没有湿度预警范围,需要从服务器获取,发送OP="
+
lineOperation
.
op
);
LogUtil
.
info
(
StoreName
+
"没有湿度预警范围,需要从服务器获取,发送OP="
+
lineOperation
.
op
);
}
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
);
bool
isTimeout
=
false
;
...
...
@@ -1876,13 +1876,13 @@ namespace OnlineStore.DeviceLibrary
{
string
maxHumidity
=
data
[
ParamDefine
.
maxHumidity
];
string
maxTemp
=
data
[
ParamDefine
.
maxTemperature
];
LogUtil
.
info
(
LOGGER
,
"收到服务器温湿度预警值:maxHumidity="
+
maxHumidity
+
",maxTemperature="
+
maxTemp
);
LogUtil
.
info
(
"收到服务器温湿度预警值:maxHumidity="
+
maxHumidity
+
",maxTemperature="
+
maxTemp
);
try
{
this
.
Max_Humidity
=
(
float
)
Convert
.
ToDouble
(
maxHumidity
);
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
)
{
...
...
@@ -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号皮带线
string
dataStr
=
JsonHelper
.
SerializeObject
(
data
);
LogUtil
.
info
(
LOGGER
,
"收到服务器出库消息:【"
+
dataStr
+
"】"
);
LogUtil
.
info
(
"收到服务器出库消息:【"
+
dataStr
+
"】"
);
int
index
=
-
1
;
foreach
(
string
posId
in
posIdArray
)
...
...
@@ -1937,7 +1937,7 @@ namespace OnlineStore.DeviceLibrary
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg
=
StoreName
+
"未找到库位:【"
+
intouInfo
.
ToStr
()
+
"】"
;
LogUtil
.
error
(
LOGGER
,
WarnMsg
);
LogUtil
.
error
(
WarnMsg
);
continue
;
}
...
...
@@ -1946,7 +1946,7 @@ namespace OnlineStore.DeviceLibrary
//判断是否接收过此库位的出库信息
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
;
}
else
...
...
@@ -1956,7 +1956,7 @@ namespace OnlineStore.DeviceLibrary
reviceList
=
(
from
m
in
reviceList
where
m
.
PosId
.
Equals
(
posId
)
select
m
).
ToList
<
InOutPosInfo
>();
if
(
reviceList
.
Count
>
0
)
{
LogUtil
.
debug
(
LOGGER
,
StoreName
+
" 出库命令【"
+
intouInfo
.
ToStr
()
+
"】重复,排队列表中已存在【"
+
reviceList
[
0
].
ToStr
()
+
"】"
);
LogUtil
.
debug
(
StoreName
+
" 出库命令【"
+
intouInfo
.
ToStr
()
+
"】重复,排队列表中已存在【"
+
reviceList
[
0
].
ToStr
()
+
"】"
);
continue
;
}
}
...
...
@@ -1971,13 +1971,13 @@ namespace OnlineStore.DeviceLibrary
bool
result
=
StartOutStoreMove
(
new
InOutParam
(
intouInfo
));
if
(!
result
)
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 执行出库【"
+
intouInfo
.
ToStr
()
+
"】失败,加入等待队列"
);
LogUtil
.
info
(
StoreName
+
" 执行出库【"
+
intouInfo
.
ToStr
()
+
"】失败,加入等待队列"
);
AddWaitOutInfo
(
intouInfo
);
}
}
else
{
LogUtil
.
error
(
LOGGER
,
"执行出库【"
+
intouInfo
.
ToStr
()
+
"】失败,当前在忙碌中,加入等待队列"
);
LogUtil
.
error
(
"执行出库【"
+
intouInfo
.
ToStr
()
+
"】失败,当前在忙碌中,加入等待队列"
);
AddWaitOutInfo
(
intouInfo
);
}
...
...
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Inventory.cs
查看文件 @
6596eb2
...
...
@@ -106,14 +106,14 @@ namespace OnlineStore.DeviceLibrary
if
(
AutoStartIndex
>=
0
&&
AutoStartIndex
<
PositionNumList
.
Count
)
{
newIndex
=
AutoStartIndex
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
"下一个索引不存在,重新开始自动盘点,索引【"
+
AutoStartIndex
+
"】"
);
LogUtil
.
info
(
StoreName
+
"下一个索引不存在,重新开始自动盘点,索引【"
+
AutoStartIndex
+
"】"
);
}
else
{
autoNext
=
false
;
readDITimer
.
Enabled
=
false
;
autoMsg
=
"自动盘点结束!"
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
"下一个索引不存在,自动盘点结束!"
);
LogUtil
.
info
(
StoreName
+
"下一个索引不存在,自动盘点结束!"
);
//回待机位
MoveToP1
();
}
...
...
@@ -123,7 +123,7 @@ namespace OnlineStore.DeviceLibrary
autoPositionIndex
=
newIndex
;
string
posid
=
PositionNumList
[
autoPositionIndex
];
InOutPosInfo
inoutinfo
=
new
InOutPosInfo
(
autoInoutCode
,
posid
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动进入下一个仓位:posid="
+
posid
);
LogUtil
.
info
(
StoreName
+
"自动进入下一个仓位:posid="
+
posid
);
autoMsg
=
"自动盘点:"
+
posid
;
StartInventoryMove
(
new
InOutParam
(
inoutinfo
));
...
...
@@ -132,7 +132,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
ex
.
ToString
());
LogUtil
.
error
(
ex
.
ToString
());
}
}
...
...
@@ -149,10 +149,10 @@ namespace OnlineStore.DeviceLibrary
{
if
(!
LoadParamPosition
(
param
))
{
LogUtil
.
error
(
LOGGER
,
StoreName
+
" 启动盘点库位【"
+
posId
+
"】出错,找不到库位信息"
);
LogUtil
.
error
(
StoreName
+
" 启动盘点库位【"
+
posId
+
"】出错,找不到库位信息"
);
return
;
}
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 启动盘点库位【"
+
posId
+
"】"
,
storeMoveColor
);
LogUtil
.
info
(
StoreName
+
" 启动盘点库位【"
+
posId
+
"】"
);
storeRunStatus
=
StoreRunStatus
.
Busy
;
storeStatus
=
StoreStatus
.
CheckPosMove
;
StoreMove
.
NewMove
(
StoreMoveType
.
CheckPosition
,
param
);
...
...
@@ -161,7 +161,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil
.
error
(
LOGGER
,
StoreName
+
" 启动盘点库位【"
+
posId
+
"】出错,当前状态,storeStatus="
+
storeRunStatus
);
LogUtil
.
error
(
StoreName
+
" 启动盘点库位【"
+
posId
+
"】出错,当前状态,storeStatus="
+
storeRunStatus
);
}
}
...
...
@@ -174,7 +174,7 @@ namespace OnlineStore.DeviceLibrary
private
void
CheckPositionLog
(
string
msg
)
{
string
posId
=
StoreMove
.
MoveParam
!=
null
?
"【"
+
StoreMove
.
MoveParam
.
PosInfo
.
PosId
+
"】"
:
" "
;
LogUtil
.
info
(
LOGGER
,
posId
+
StoreMove
.
MoveStep
+
" "
+
msg
,
storeMoveColor
);
LogUtil
.
info
(
posId
+
StoreMove
.
MoveStep
+
" "
+
msg
);
}
}
}
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Partial.cs
查看文件 @
6596eb2
...
...
@@ -155,15 +155,24 @@ namespace OnlineStore.DeviceLibrary
if
(
wait
.
IsHomeMove
)
{
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
{
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
(
""
))
{
isOk
=
false
;
WarnMsg
=
msg
;
//WarnMsg = msg;
SetWarnMsg
(
msg
,
StoreMove
.
GetStepDes
()+
"_轴运动报警"
,
StoreMove
);
Alarm
(
StoreAlarmType
.
AxisMoveError
,
GetAlarmCodeByAxis
(
wait
.
AxisInfo
).
ToString
(),
WarnMsg
,
StoreMove
.
MoveType
);
break
;
}
...
...
@@ -189,10 +198,12 @@ namespace OnlineStore.DeviceLibrary
if
((!
wait
.
IsEnd
)
&&
span
.
TotalMilliseconds
>
timeOutMs
)
{
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_点检"
))
{
WarnMsg
=
""
;
SetWarnMsg
()
;
break
;
}
...
...
@@ -262,14 +273,17 @@ namespace OnlineStore.DeviceLibrary
if
(
isOk
)
{
StoreMove
.
EndStepWait
();
ClearStepAlarm
(
StoreMove
.
GetStepDes
());
}
else
if
(
span
.
TotalSeconds
>
StoreMove
.
TimeOutSeconds
)
{
WarnM
sg
=
StoreName
+
"["
+
StoreMove
.
MoveType
+
"]["
+
StoreMove
.
MoveStep
+
"] 等待超时 ["
+
NotOkMsg
string
m
sg
=
StoreName
+
"["
+
StoreMove
.
MoveType
+
"]["
+
StoreMove
.
MoveStep
+
"] 等待超时 ["
+
NotOkMsg
+
"]已等待["
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"]秒"
;
SetWarnMsg
(
msg
,
StoreMove
.
GetStepDes
()
+
"_超时报警"
,
StoreMove
);
if
(
WarnMsg
.
Contains
(
"CheckPos"
)
||
WarnMsg
.
Contains
(
"X03_点检"
))
{
WarnMsg
=
""
;
SetWarnMsg
()
;
return
;
}
...
...
@@ -305,7 +319,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
StoreName
+
" 启动入库【"
+
posId
+
"】出错,叉子料盘检测有料"
);
return
;
}
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 启动入库【"
+
posId
+
"】"
,
storeMoveColor
);
LogUtil
.
info
(
StoreName
+
" 启动入库【"
+
posId
+
"】"
);
storeRunStatus
=
StoreRunStatus
.
Busy
;
storeStatus
=
StoreStatus
.
InStoreExecute
;
StoreMove
.
NewMove
(
StoreMoveType
.
InStore
,
param
);
...
...
@@ -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
);
Alarm
(
StoreAlarmType
.
IoSingleTimeOut
,
""
,
WarnMsg
,
StoreMove
.
MoveType
);
}
...
...
@@ -573,8 +589,9 @@ namespace OnlineStore.DeviceLibrary
else
if
(
StoreMove
.
MoveStep
==
StoreMoveStep
.
SI_16_GoBack
)
{
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
:
""
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 【"
+
posId
+
"】 整个入库流程结束,耗时【"
+
FormUtil
.
GetSpanStr
(
span
)
+
"】!"
,
storeMoveColor
);
LogUtil
.
info
(
StoreName
+
" 【"
+
posId
+
"】 整个入库流程结束,耗时【"
+
FormUtil
.
GetSpanStr
(
span
)
+
"】!"
);
StoreMove
.
EndMove
();
storeRunStatus
=
StoreRunStatus
.
Runing
;
//设备连接,入库后,BOX恢复原始状态
...
...
@@ -583,7 +600,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 入库,moveStatus="
+
StoreMove
.
MoveStep
+
",没有对应的处理!"
);
LogUtil
.
info
(
StoreName
+
" 入库,moveStatus="
+
StoreMove
.
MoveStep
+
",没有对应的处理!"
);
}
}
...
...
@@ -632,7 +649,7 @@ namespace OnlineStore.DeviceLibrary
return
false
;
}
storeStatus
=
StoreStatus
.
OutStoreExecute
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
"启动出库【"
+
posId
+
"】 "
,
storeMoveColor
);
LogUtil
.
info
(
StoreName
+
"启动出库【"
+
posId
+
"】 "
);
storeRunStatus
=
StoreRunStatus
.
Busy
;
StoreMove
.
NewMove
(
StoreMoveType
.
OutStore
,
param
);
EmptyOut
=
false
;
...
...
@@ -931,10 +948,11 @@ namespace OnlineStore.DeviceLibrary
else
if
(
StoreMove
.
MoveStep
==
StoreMoveStep
.
SO_31_WaitTake
)
{
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
:
""
;
storeStatus
=
StoreStatus
.
StoreOnline
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 【"
+
posId
+
"】 整个出库流程结束,耗时【"
+
FormUtil
.
GetSpanStr
(
span
)
+
"】!"
,
storeMoveColor
);
LogUtil
.
info
(
StoreName
+
" 【"
+
posId
+
"】 整个出库流程结束,耗时【"
+
FormUtil
.
GetSpanStr
(
span
)
+
"】!"
);
StoreMove
.
EndMove
();
storeRunStatus
=
StoreRunStatus
.
Runing
;
InOutEndProcess
(
StoreMoveType
.
OutStore
);
...
...
@@ -960,6 +978,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil
.
info
(
StoreName
+
"执行用户操作:忽略检测信号,继续出库"
);
StoreMove
.
EndStepWait
();
ClearStepAlarm
(
StoreMove
.
GetStepDes
());
}
}
private
void
SO_28_GoBack
()
...
...
@@ -1104,13 +1123,13 @@ namespace OnlineStore.DeviceLibrary
if
(
AutoStartIndex
>=
0
&&
AutoStartIndex
<
PositionNumList
.
Count
)
{
newIndex
=
AutoStartIndex
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
"下一个索引不存在,重新开始自动出入库,索引【"
+
AutoStartIndex
+
"】"
);
LogUtil
.
info
(
StoreName
+
"下一个索引不存在,重新开始自动出入库,索引【"
+
AutoStartIndex
+
"】"
);
}
else
{
autoNext
=
false
;
autoMsg
=
"自动出入库结束!"
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
"下一个索引不存在,自动 出入库结束!"
);
LogUtil
.
info
(
StoreName
+
"下一个索引不存在,自动 出入库结束!"
);
}
}
else
...
...
@@ -1121,21 +1140,21 @@ namespace OnlineStore.DeviceLibrary
//判断是否需要重置
if
(
CurrInOutACount
>=
Config
.
Box_ResetACount
)
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动进入下一个出库:posid="
+
posid
+
",当时已经出入库"
+
CurrInOutACount
+
"次,需要重置BOX,先把出库信息存入排队列表中"
);
LogUtil
.
info
(
StoreName
+
"自动进入下一个出库:posid="
+
posid
+
",当时已经出入库"
+
CurrInOutACount
+
"次,需要重置BOX,先把出库信息存入排队列表中"
);
Reset
(
false
);
autoMsg
=
"自动出库:"
+
posid
;
AddWaitOutInfo
(
inoutinfo
);
}
else
if
(
CurrInOutCount
>=
Config
.
Box_ResetMCount
)
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动进入下一个出库:posid="
+
posid
+
",当时已经出入库"
+
CurrInOutCount
+
"次,需要重置BOX旋转轴,先把出库信息存入排队列表中"
);
LogUtil
.
info
(
StoreName
+
"自动进入下一个出库:posid="
+
posid
+
",当时已经出入库"
+
CurrInOutCount
+
"次,需要重置BOX旋转轴,先把出库信息存入排队列表中"
);
//ResetMiddleAxis(false);
autoMsg
=
"自动出库:"
+
posid
;
AddWaitOutInfo
(
inoutinfo
);
}
else
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动进入下一个出库:posid="
+
posid
);
LogUtil
.
info
(
StoreName
+
"自动进入下一个出库:posid="
+
posid
);
autoMsg
=
"自动出库:"
+
posid
;
StartOutStoreMove
(
new
InOutParam
(
inoutinfo
));
}
...
...
@@ -1149,13 +1168,13 @@ namespace OnlineStore.DeviceLibrary
if
(
AutoStartIndex
>=
0
&&
AutoStartIndex
<
PositionNumList
.
Count
)
{
newIndex
=
AutoStartIndex
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
"下一个索引不存在,重新开始自动出入库,索引【"
+
AutoStartIndex
+
"】"
);
LogUtil
.
info
(
StoreName
+
"下一个索引不存在,重新开始自动出入库,索引【"
+
AutoStartIndex
+
"】"
);
}
else
{
autoNext
=
false
;
autoMsg
=
"自动出入库结束!"
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
"下一个索引不存在,自动 出入库结束!"
);
LogUtil
.
info
(
StoreName
+
"下一个索引不存在,自动 出入库结束!"
);
}
}
else
...
...
@@ -1165,21 +1184,21 @@ namespace OnlineStore.DeviceLibrary
//判断是否需要重置
//if (CurrInOutACount >= Config.Box_ResetACount)
//{
// LogUtil.info(
LOGGER,
StoreName + "自动进入下一个入库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把入库信息存入排队列表中");
// LogUtil.info( StoreName + "自动进入下一个入库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把入库信息存入排队列表中");
// Reset(false);
// autoMsg = "自动入库:" + posid;
// AddWaitOutInfo(inoutinfo);
//}
//else if (CurrInOutCount >= Config.Box_ResetMCount)
//{
// LogUtil.info(
LOGGER,
StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中");
// LogUtil.info( StoreName + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中");
// //ResetMiddleAxis(false);
// autoMsg = "自动入库:" + posid;
// AddWaitOutInfo(inoutinfo);
//}
//else
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动进入下一个入库:posid="
+
posid
);
LogUtil
.
info
(
StoreName
+
"自动进入下一个入库:posid="
+
posid
);
autoMsg
=
"自动入库:"
+
posid
;
StartInStoreMove
(
new
InOutParam
(
inoutinfo
));
}
...
...
@@ -1194,13 +1213,13 @@ namespace OnlineStore.DeviceLibrary
private
void
InStoreLog
(
string
msg
)
{
string
posId
=
StoreMove
.
MoveParam
!=
null
?
"【"
+
StoreMove
.
MoveParam
.
PosInfo
.
PosId
+
"】"
:
" "
;
LogUtil
.
info
(
LOGGER
,
posId
+
StoreMove
.
MoveStep
.
ToString
().
Substring
(
0
,
6
)+
msg
,
storeMoveColor
);
string
posId
=
StoreMove
.
MoveParam
!=
null
?
"【"
+
StoreMove
.
MoveParam
.
PosInfo
?
.
PosId
+
"】"
:
" "
;
LogUtil
.
info
(
posId
+
StoreMove
.
MoveStep
.
ToString
().
Substring
(
0
,
6
)+
msg
);
}
private
void
OutStoreLog
(
string
msg
)
{
string
posId
=
StoreMove
.
MoveParam
!=
null
?
"【"
+
StoreMove
.
MoveParam
.
PosInfo
.
PosId
+
"】"
:
" "
;
LogUtil
.
info
(
LOGGER
,
posId
+
StoreMove
.
MoveStep
.
ToString
().
Substring
(
0
,
6
)
+
" "
+
msg
,
storeMoveColor
);
string
posId
=
StoreMove
.
MoveParam
!=
null
?
"【"
+
StoreMove
.
MoveParam
.
PosInfo
?
.
PosId
+
"】"
:
" "
;
LogUtil
.
info
(
posId
+
StoreMove
.
MoveStep
.
ToString
().
Substring
(
0
,
6
)
+
" "
+
msg
);
}
}
}
source/DeviceLibrary/acSingleStore/StoreManager.cs
查看文件 @
6596eb2
...
...
@@ -19,7 +19,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
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_Config
Config
=
null
;
private
static
bool
isInit
=
false
;
...
...
@@ -27,8 +27,9 @@ namespace OnlineStore.DeviceLibrary
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
)
{
...
...
@@ -37,11 +38,18 @@ namespace OnlineStore.DeviceLibrary
{
if
(
valueList
.
Contains
(
item
))
{
LogUtil
.
error
(
LOGGER
,
type
.
Name
+
"枚举值:"
+
item
+
"重复存在,请检查代码!"
);
LogUtil
.
error
(
type
.
Name
+
"枚举值:"
+
item
+
"重复存在,请检查代码!"
);
Application
.
Exit
();
break
;
}
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
{
//IsConnectServer = true;
}
CheckEnum
(
typeof
(
StoreMoveStep
));
CheckEnum
(
typeof
(
StoreStatus
));
CheckEnum
(
typeof
(
StoreRunStatus
));
CheckEnum
(
typeof
(
StoreMoveStep
)
,
true
);
CheckEnum
(
typeof
(
StoreStatus
)
,
false
);
CheckEnum
(
typeof
(
StoreRunStatus
)
,
false
);
isInit
=
true
;
string
storeType
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
Store_Type
);
LogUtil
.
info
(
LOGGER
,
"配置的料仓 类型="
+
storeType
+
",开始加载料仓配置"
);
LogUtil
.
info
(
"配置的料仓 类型="
+
storeType
+
",开始加载料仓配置"
);
if
(
storeType
==
StoreType
.
RC_AC_SA
)
{
string
appPath
=
Application
.
StartupPath
;
...
...
@@ -79,20 +87,20 @@ namespace OnlineStore.DeviceLibrary
if
(
File
.
Exists
(
positionConfigFile
))
{
LogUtil
.
info
(
LOGGER
,
"加载位置文件:"
+
positionConfigFile
);
LogUtil
.
info
(
"加载位置文件:"
+
positionConfigFile
);
CSVPositionReader
<
ACStorePosition
>.
ReloadCSVFile
(
positionConfigFile
);
}
Config
=
(
AC_SA_Config
)
storeConfig
;
Store
=
new
AC_SA_BoxBean
(
Config
);
Store
.
CID
=
CID
;
LogUtil
.
info
(
LOGGER
,
"加载料仓完成!"
);
LogUtil
.
info
(
"加载料仓完成!"
);
return
Store
;
}
}
}
catch
(
Exception
ex
)
{
LOGGER
.
E
rror
(
"出错:"
,
ex
);
Common
.
LogUtil
.
e
rror
(
"出错:"
,
ex
);
MessageBox
.
Show
(
ex
.
ToString
(),
"加载配置错误(请检查配置)"
);
Application
.
Exit
();
}
...
...
@@ -122,14 +130,14 @@ namespace OnlineStore.DeviceLibrary
bool
result
=
CSVConfigReader
.
SaveBoxPosition
(
configFile
,
storeConfig
);
if
(!
result
)
{
LOGGER
.
E
rror
(
"保存配置文件失败:"
+
configFile
);
Common
.
LogUtil
.
e
rror
(
"保存配置文件失败:"
+
configFile
);
}
Store
.
Config
=
storeConfig
;
Store
.
MoveAxisConfig
();
}
catch
(
Exception
ex
)
{
LOGGER
.
E
rror
(
"出错:"
,
ex
);
Common
.
LogUtil
.
e
rror
(
"出错:"
,
ex
);
}
}
private
static
string
api_communication
=
"service/store/communication"
;
//流水线状态通信接口
...
...
source/DeviceLibrary/store/InOutParam.cs
查看文件 @
6596eb2
...
...
@@ -15,7 +15,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
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
()
{
ACStoreP
=
null
;
...
...
@@ -43,7 +43,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
log
,
"出入库获取库位信息GetKTKPosition出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"出入库获取库位信息GetKTKPosition出错:"
+
ex
.
ToString
());
}
return
ACStoreP
;
}
...
...
source/DeviceLibrary/store/KTK_Store.cs
查看文件 @
6596eb2
...
...
@@ -27,11 +27,12 @@ namespace OnlineStore.DeviceLibrary
/// 提示消息,一般发给服务器后清空(LineBean表示报警提示消息,BoxBean表示出入库失败的原因记录)
/// </summary>
public
string
WarnMsg
=
""
;
private
WarnParam
warnParam
=
new
WarnParam
();
/// <summary>
/// 日志颜色
/// </summary>
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
int
StoreID
{
get
;
set
;
}
/// <summary>
...
...
@@ -98,7 +99,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LOGGER
.
E
rror
(
ex
.
ToString
());
Common
.
LogUtil
.
e
rror
(
ex
.
ToString
());
}
}
...
...
@@ -257,7 +258,7 @@ namespace OnlineStore.DeviceLibrary
protected
void
ACAxisHomeMove
(
ConfigMoveAxis
moveAxis
)
{
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
));
AddAxisMoveTime
(
moveAxis
);
ACServerManager
.
HomeMove
(
moveAxis
.
DeviceName
,
(
short
)
moveAxis
.
GetAxisValue
(),
moveAxis
.
HomeHighSpeed
);
...
...
@@ -305,7 +306,7 @@ namespace OnlineStore.DeviceLibrary
//判断是否需要重新运动
if
(
StoreMove
.
CanWhileCount
>
0
)
{
LogUtil
.
error
(
LOGGER
,
moveAxis
.
DisplayStr
+
"目标位置["
+
targetPosition
+
"]当前位置["
+
outCount
+
LogUtil
.
error
(
moveAxis
.
DisplayStr
+
"目标位置["
+
targetPosition
+
"]当前位置["
+
outCount
+
"],误差过大,重新开始运动,剩余["
+
StoreMove
.
CanWhileCount
+
"]次"
);
ACServerManager
.
AbsMove
(
moveAxis
.
DeviceName
,
moveAxis
.
GetAxisValue
(),
targetPosition
,
targetSpeed
);
StoreMove
.
CanWhileCount
--;
...
...
@@ -314,7 +315,7 @@ namespace OnlineStore.DeviceLibrary
{
msg
=
StoreName
+
" storeMoveStep="
+
StoreMove
.
MoveStep
+
moveAxis
.
DisplayStr
+
"目标位置["
+
targetPosition
+
"]当前位置["
+
outCount
+
"],误差过大,需要报警"
;
LogUtil
.
error
(
LOGGER
,
msg
);
LogUtil
.
error
(
msg
);
}
}
return
false
;
...
...
@@ -334,15 +335,15 @@ namespace OnlineStore.DeviceLibrary
//判断是否需要重新运动
if
(
StoreMove
.
CanWhileCount
>
0
)
{
LogUtil
.
error
(
LOGGER
,
moveAxis
.
DisplayStr
+
"收到原点完成信号,当前位置["
+
outCount
+
"],重新回原点,剩余["
+
StoreMove
.
CanWhileCount
+
"]次"
);
//LogUtil.error(
LOGGER,
StoreName + moveAxis.DisplayStr + "重新回原点");
LogUtil
.
error
(
moveAxis
.
DisplayStr
+
"收到原点完成信号,当前位置["
+
outCount
+
"],重新回原点,剩余["
+
StoreMove
.
CanWhileCount
+
"]次"
);
//LogUtil.error( StoreName + moveAxis.DisplayStr + "重新回原点");
ACServerManager
.
HomeMove
(
moveAxis
.
DeviceName
,
moveAxis
.
GetAxisValue
(),
moveAxis
.
HomeHighSpeed
);
StoreMove
.
CanWhileCount
--;
}
else
{
msg
=
StoreName
+
" storeMoveStep="
+
StoreMove
.
MoveStep
+
moveAxis
.
DisplayStr
+
"收到原点完成信号,当前位置["
+
outCount
+
"],误差过大,需要报警"
;
LogUtil
.
error
(
LOGGER
,
msg
);
LogUtil
.
error
(
msg
);
}
}
return
false
;
...
...
@@ -360,7 +361,7 @@ namespace OnlineStore.DeviceLibrary
{
if
(!
isInit
)
{
StoreMove
=
new
StoreMoveInfo
(
StoreID
);
StoreMove
=
new
StoreMoveInfo
(
StoreID
,
StoreName
);
mainTimer
=
new
System
.
Timers
.
Timer
();
mainTimer
.
Enabled
=
false
;
...
...
@@ -498,7 +499,125 @@ namespace OnlineStore.DeviceLibrary
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
=
""
;
}
}
source/DeviceLibrary/store/StoreStep.cs
查看文件 @
6596eb2
...
...
@@ -4,6 +4,7 @@ using OnlineStore.DeviceLibrary;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Drawing
;
using
System.IO
;
using
System.IO.Ports
;
...
...
@@ -120,63 +121,73 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 无操作,等待状态
/// </summary>
[
Description
(
""
)]
Wait
=
0
,
#
region
料仓原点返回和重置步骤
/// <summary>
/// 料仓原点返回和重置步骤,,定位气缸下降
/// </summary>
[
Description
(
"复位_定位气缸下降"
)]
BOX_H_LocationCylinderBack
=
010
,
/// <summary>
/// 料仓原点返回和重置步骤,
轴三先相对走3000
/// 料仓原点返回和重置步骤,
进出轴原点返回
/// </summary>
[
Description
(
"复位_进出轴原点返回"
)]
BOX_H_InOutMove
=
011
,
/// <summary>
/// 料仓原点返回和重置步骤,,
轴三进出轴先返回原点
/// 料仓原点返回和重置步骤,,
压紧轴,旋转轴,上下轴原点返回
/// </summary>
[
Description
(
"复位_压紧轴,旋转轴,上下轴原点返回"
)]
BOX_H_InOutBack
=
012
,
/// <summary>
/// 料仓原点返回和重置步骤,,
轴三返回P1点
/// 料仓原点返回和重置步骤,,
进出轴到待机点P1,关闭舱门
/// </summary>
[
Description
(
"复位_进出轴到待机点P1,关闭舱门"
)]
BOX_H_InOutToP1
=
013
,
/// <summary>
/// 料仓原点返回和重置步骤,,升降轴,旋转轴,压紧轴原点返回
/// </summary>
[
Description
(
"复位_升降轴,旋转轴,压紧轴原点返回"
)]
BOX_H_OtherAxisBack
=
014
,
///// <summary>
///// 清理轴位置
///// </summary>
//BOX_H_WaitAxisCountClear = 015,
/// <summary>
/// 旋转轴
返回
P1
/// 旋转轴
运动到P1,上下轴走到P1,压紧轴到
P1
/// </summary>
[
Description
(
"复位_旋转轴运动到P1,上下轴走到P1,压紧轴到P1"
)]
BOX_H_MiddleAxisToP1
=
016
,
/// <summary>
/// 叉子先退回P1
/// </summary>
BOX_M_H_InOutToP1
=
018
,
/// <summary>
/// 旋转轴回原点
/// </summary>
BOX_M_H_MiddleAxisHome
=
019
,
/// <summary>
/// 旋转轴等待清理位置
/// </summary>
BOX_M_H_MiddleWait
=
020
,
///
////
<summary>
///
////
叉子先退回P1
///
////
</summary>
////
BOX_M_H_InOutToP1 = 018,
///
//
<summary>
///
//
旋转轴回原点
///
//
</summary>
//
BOX_M_H_MiddleAxisHome = 019,
///
//
<summary>
///
//
旋转轴等待清理位置
///
//
</summary>
//
BOX_M_H_MiddleWait = 020,
/// <summary>
///
叉子走到P1
///
进出轴到P1,判断叉子没有料盘
/// </summary>
[
Description
(
"复位_进出轴到P1,判断叉子没有料盘"
)]
BOX_M_H_TOP1_InOutToP1
=
030
,
/// <summary>
/// 压紧轴回原点
/// 压紧轴回原点
,关闭舱门
/// </summary>
[
Description
(
"复位_压紧轴回原点,关闭舱门"
)]
BOX_M_H_TOP1_CompressHome
=
031
,
/// <summary>
///
关闭门,旋转轴到P1,升降
轴到P1
///
旋转轴运动到P1,上下轴走到P1,压紧
轴到P1
/// </summary>
[
Description
(
"复位_旋转轴运动到P1,上下轴走到P1,压紧轴到P1"
)]
BOX_M_H_TOP1_OtherAxisToP1
=
032
,
#
endregion
...
...
@@ -184,27 +195,32 @@ namespace OnlineStore.DeviceLibrary
#
region
料仓
出库步骤
101
-
200
/// <summary>
///料仓出库:
叉子先运动
到P1
///料仓出库:
进出轴
到P1
/// </summary>
[
Description
(
"出库_取料前_进出轴到P1"
)]
SO_02_InoutBack
=
102
,
/// <summary>
/// 料仓出库,,
所有轴运行到库位, 压紧轴到P3(压紧前点) ,旋转轴到P2( 库位点),升降轴到P5(库位出库前点)
/// 料仓出库,,
压紧轴至P3(压紧前点) ,旋转轴至P2(库位点),升降轴至P5(库位出库前点)
/// </summary>
[
Description
(
"出库_取料_压紧轴至P3(压紧前点) ,旋转轴至P2(库位点),升降轴至P5(库位出库前点) "
)]
SO_03_ToBagP
,
/// <summary>
/// 料仓出库,,
叉子进入库位中, 进出轴到P3(库位取放料点)
/// 料仓出库,,
进出轴至P3(库位取放料点)
/// </summary>
[
Description
(
"出库_取料_进出轴至P3(库位取放料点)"
)]
SO_04_InoutToP3
,
/// <summary>
///料仓出库,, 库位的物品放入叉子上,升降轴
到P6( 库位出料缓冲点),压紧轴到
P2(压紧点)
///料仓出库,, 库位的物品放入叉子上,升降轴
至P6(库位出料缓冲点),压紧轴至
P2(压紧点)
/// </summary>
[
Description
(
"出库_取料_升降轴至P6(库位出料缓冲点),压紧轴至P2(压紧点)"
)]
SO_05_GetWare
,
/// <summary>
///料仓出库,,
叉子从 库位返回,进出轴到P1( 待机点)
///料仓出库,,
进出轴至P1(待机点)
/// </summary>
[
Description
(
"出库_取料完成_进出轴至P1(待机点)"
)]
SO_06_InoutToP1
,
...
...
@@ -214,44 +230,54 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 出库定位:旋转轴 至P2( 库位点)升降轴到P3(库位入库前点)
/// </summary>
[
Description
(
"出库_取料完成_旋转轴 至P2( 库位点)升降轴到P3(库位入库前点)"
)]
SOL_11_MoveToBag
=
110
,
/// <summary>
/// 出库定位:进出轴到P3(库位取放料点)
/// </summary>
[
Description
(
"出库_出库定位_进出轴到P3(库位取放料点)"
)]
SOL_12_InoutToP3
,
/// <summary>
/// 出库定位: 压紧轴到P3( 压紧前点)
/// </summary>
[
Description
(
"出库_出库定位_压紧轴到P3( 压紧前点)"
)]
SOL_13_ComToP3
,
/// <summary>
/// 出库定位:放下物品,升降轴到P4( 库位入料缓冲点)
/// </summary>
[
Description
(
"出库_出库定位_升降轴到P4( 库位入料缓冲点)"
)]
SOL_14_UpdownToP4
,
/// <summary>
/// 出库定位:放下物品后等待200
/// </summary>
[
Description
(
"出库_出库定位_放下物品后等待200"
)]
SOL_15_WaitTime
,
/// <summary>
/// 出库定位:拿物品,升降轴到P6( 库位出料缓冲点),压紧轴到P2(压紧点)
/// </summary>
[
Description
(
"出库_出库定位_升降轴到P6( 库位出料缓冲点),压紧轴到P2(压紧点)"
)]
SOL_16_GetWare
,
/// <summary>
/// 出库定位2:放下物品,升降轴到P4( 库位入料缓冲点)
/// </summary>
[
Description
(
"出库_出库定位2_升降轴到P4( 库位入料缓冲点)"
)]
SOL_17_UpdownToP42
,
/// <summary>
/// 出库定位2:放下物品后等待200
/// </summary>
[
Description
(
"出库_出库定位2_放下物品后等待200"
)]
SOL_18_WaitTime2
,
/// <summary>
/// 出库定位2:拿物品,升降轴到P6( 库位出料缓冲点),压紧轴到P2(压紧点)
/// </summary>
SOL_19_GetWare2
,
[
Description
(
"出库_出库定位2_升降轴到P6( 库位出料缓冲点),压紧轴到P2(压紧点)"
)]
SOL_19_GetWare2
,
/// <summary>
/// 出库定位:叉子从 库位返回,进出轴到P1( 待机点)
/// </summary>
[
Description
(
"出库_出库定位完成_进出轴到P1( 待机点)"
)]
SOL_20_InoutToP1
,
#
endregion
...
...
@@ -259,124 +285,151 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 料仓出库,,所有设备运行到门,,旋转轴
到P1( 待机点)升降轴到P2( 进料口出料前点)
/// 料仓出库,,所有设备运行到门,,旋转轴
至P1(待机点)升降轴至P2(进料口出料前点),打开舱门
/// </summary>
[
Description
(
"出库_放料前_旋转轴至P1(待机点)升降轴至P2(进料口出料前点),打开舱门"
)]
SO_21_ToDoorP
=
121
,
/// <summary>
/// 料仓出库:
等待夹爪
有料
/// 料仓出库:
打开仓门,等待料叉
有料
/// </summary>
[
Description
(
"出库_放料前_打开仓门,等待料叉有料"
)]
SO_22_WaitTray
,
/// <summary>
///
等待门口无料盘
///
打开仓门,等待门口无料盘信号
/// </summary>
[
Description
(
"出库_放料前_等待门口无料盘信号"
)]
SO_23_WaitNoTray
,
/// <summary>
/// 料仓出库,,叉子进出料口,,进出轴到P2( 进料口取料点)
/// /// </summary>
[
Description
(
"出库_放料_进出轴到P2( 进料口取料点)"
)]
SO_24_InoutToP2
,
/// <summary>
/// 料仓出库,,把物品放下,,升降轴到P8( 进料口出料缓冲点)压紧轴到P1( 待机点)
/// </summary>
[
Description
(
"出库_放料_升降轴到P8( 进料口出料缓冲点)压紧轴到P1( 待机点)"
)]
SO_25_PutWare
,
/// <summary>
/// 料仓出库,,叉子从出料口返回,,
轴3( 叉子) 动作至P1( 待机点)
/// 料仓出库,,叉子从出料口返回,,
进出轴动作至P1(待机点)
/// </summary>
[
Description
(
"出库_放料_进出轴动作至P1(待机点)"
)]
SO_26_InoutToP1
,
/// <summary>
/// 料仓出库:等待仓门口有料
/// </summary>
[
Description
(
"出库_放料完成_等待仓门口有料"
)]
SO_27_WaitDoorTray
,
/// <summary>
/// 料仓出库,,升降轴返回,,
轴2
至P1( 待机点),关闭仓门
/// 料仓出库,,升降轴返回,,
升降轴
至P1( 待机点),关闭仓门
/// </summary>
[
Description
(
"出库_放料完成_升降轴至P1( 待机点),关闭仓门"
)]
SO_28_CloseDoor
,
/// <summary>
/// 料仓出库,检测料仓门口信号
/// </summary>
[
Description
(
"出库_放料完成_检测料仓门口信号"
)]
SO_29_CheckTray
,
/// <summary>
/// 料仓出库,,
升降轴返回,, 轴2至P1( 待机点)
/// 料仓出库,,
发送出库完成消息给流水线
/// </summary>
[
Description
(
"出库_放料完成_发送出库完成消息给流水线"
)]
SO_30_GoBack
,
/// <summary>
/// 等待拿走物品
/// </summary>
[
Description
(
"出库_放料完成_等待拿走物品"
)]
SO_31_WaitTake
,
#
endregion
#
region
料仓
入库
/// <summary>
///
入库检测
///
等待仓门口有料
/// </summary>
[
Description
(
"入库_取料前_"
)]
SI_00_TrayCheck
=
200
,
///// <summary>
///// 入库,。定位气缸下降
///// </summary>
//SI_01_TrayCheckAgain = 201,
/// <summary>
/// 入库。。进出轴
(叉子)先返回P1
/// 入库。。进出轴
(叉子)动作至P1,打开舱门
/// </summary>
SI_02_InOutAxisHome
,
[
Description
(
"入库_取料_进出轴(叉子)动作至P1,打开舱门"
)]
SI_02_InOutAxisHome
,
/// <summary>
/// 入库。。
所有轴先回到待机点,轴2、轴1 动作到P1,,轴4动作至P3
/// 入库。。
升降轴到P1,旋转轴到P1 ,压紧轴到P3,打开仓门
/// </summary>
SI_03_ReturnHome
,
[
Description
(
"入库_取料_升降轴到P1,旋转轴到P1 ,压紧轴到P3,打开仓门"
)]
SI_03_ReturnHome
,
/// <summary>
/// 入库。。
压紧物品(有压紧轴的才需要此步骤),压紧轴到P3(压紧前点)
/// 入库。。
叉子即将取料,发现门未上升到位,重新打开门
/// </summary>
[
Description
(
"入库_取料_叉子即将取料,发现门未上升到位,重新打开门"
)]
SI_04_CompressWare
,
/// <summary>
/// 入库。。叉子进入入料口,进出轴
到P2( 进料口取料点)
/// 入库。。叉子进入入料口,进出轴
至P2(进料口取料点)
/// </summary>
[
Description
(
"入库_取料_进出轴至P2(进料口取料点) "
)]
SI_05_DeviceToDoor
,
/// <summary>
/// 入库。。把物品放入叉子上,
升降轴到P7( 进料口取料缓冲点),压紧物品(有压紧轴的才需要此步骤),压紧轴到P2(压紧
点)
/// 入库。。把物品放入叉子上,
压紧轴至P2(压紧点)),升降轴至P7(进料口取料缓冲
点)
/// </summary>
[
Description
(
"入库_取料_压紧轴至P2(压紧点)),升降轴至P7(进料口取料缓冲点)"
)]
SI_06_GetWare
,
/// <summary>
/// 入库。。叉子 从入料口抽出,进出轴到P1( 待机点)
/// </summary>
[
Description
(
"入库_取料_进出轴到P1( 待机点)"
)]
SI_07_InoutToP1
,
/// <summary>
/// 入库:等待叉子有料
/// </summary>
[
Description
(
"入库_取料_等待叉子有料"
)]
SI_08_WaitTray
,
/// <summary>
/// 入库。。,定位气缸伸出 (有压紧轴的不需要此步骤)
/// </summary>
[
Description
(
"入库_取料完成_定位气缸伸出"
)]
SI_09_LocationUp
,
/// <summary>
/// 入库。。移动到库位点,旋转轴
到P2( 库位点)升降轴到P3(库位入库前点)
/// 入库。。移动到库位点,旋转轴
至P2(库位点),升降轴至P3(库位入库前点)),关闭舱门
/// </summary>
[
Description
(
"入库_放料_旋转轴至P2(库位点),升降轴至P3(库位入库前点)),关闭舱门"
)]
SI_11_MoveToBag
,
/// <summary>
/// 入库。。定位气缸退回 (有压紧轴的不需要此步骤)
/// </summary>
[
Description
(
"入库_放料_定位气缸退回"
)]
SI_12_LocationDown
,
/// <summary>
/// 入库。。叉子进入库位中,进出轴到P3(库位取放料点)
/// </summary>
[
Description
(
"入库_放料_进出轴到P3(库位取放料点)"
)]
SI_13_InoutToP3
,
/// <summary>
/// 入库。。放下物品,升降轴到P4( 库位入料缓冲点)压紧轴到P3( 压紧前点)
/// </summary>
[
Description
(
"入库_放料_升降轴到P4( 库位入料缓冲点)压紧轴到P3( 压紧前点)"
)]
SI_14_PutWareToBag
,
/// <summary>
/// 入库。。叉子从库位中返回,
轴3( 叉子) 动作至P1(
待机点)
/// 入库。。叉子从库位中返回,
进出轴动作至P1(
待机点)
/// </summary>
[
Description
(
"入库_放料_进出轴动作至P1(待机点)"
)]
SI_15_InoutBack
,
/// <summary>
/// 入库。。返回待机点,轴2/轴1/轴4动作至P1
( 待机点))开始
/// 入库。。返回待机点,轴2/轴1/轴4动作至P1
(待机点)),检测门关闭
/// </summary>
[
Description
(
"入库_放料完成_轴2/轴1/轴4动作至P1(待机点)),检测门关闭"
)]
SI_16_GoBack
,
/// <summary>
/// 入库。等待
叉子
无信号
/// 入库。等待
料叉
无信号
/// </summary>
[
Description
(
"入库_放料完成_等待料叉无信号"
)]
SI_17_WaitNoReel
,
#
endregion
...
...
source/DeviceLibrary/store/model/StoreMoveInfo.cs
查看文件 @
6596eb2
...
...
@@ -3,6 +3,7 @@ using OnlineStore.DeviceLibrary;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Linq
;
using
System.Text
;
...
...
@@ -14,11 +15,12 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public
class
StoreMoveInfo
{
private
string
Name
;
/// <summary>
/// 超时时间
/// </summary>
public
int
TimeOutSeconds
=
60
;
public
StoreMoveInfo
(
int
storeId
)
public
StoreMoveInfo
(
int
storeId
,
string
name
)
{
moveType
=
StoreMoveType
.
None
;
...
...
@@ -27,6 +29,7 @@ namespace OnlineStore.DeviceLibrary
this
.
moveStep
=
StoreMoveStep
.
Wait
;
IsInWait
=
false
;
MoveNum
=
0
;
this
.
Name
=
name
;
}
public
int
MoveNum
{
get
;
set
;
}
...
...
@@ -96,6 +99,7 @@ namespace OnlineStore.DeviceLibrary
public
void
NextMoveStep
(
StoreMoveStep
step
)
{
stepMoveLog
();
PreMoveStep
=
moveStep
;
moveStep
=
step
;
LastSetpTime
=
DateTime
.
Now
;
...
...
@@ -105,6 +109,17 @@ namespace OnlineStore.DeviceLibrary
CanWhileCount
=
5
;
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>
...
...
@@ -131,6 +146,7 @@ namespace OnlineStore.DeviceLibrary
}
public
void
EndMove
()
{
stepMoveLog
();
this
.
moveType
=
StoreMoveType
.
None
;
this
.
MoveParam
=
null
;
moveStep
=
StoreMoveStep
.
Wait
;
...
...
@@ -139,10 +155,45 @@ namespace OnlineStore.DeviceLibrary
WaitList
=
new
List
<
WaitResultInfo
>();
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
()
{
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
>();
/// <summary>
...
...
@@ -154,7 +205,25 @@ namespace OnlineStore.DeviceLibrary
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
{
private
WaitResultInfo
()
...
...
source/LoadCVSLibrary/CSVReaderBase.cs
查看文件 @
6596eb2
...
...
@@ -13,7 +13,7 @@ namespace OnlineStore.LoadCSVLibrary
public
class
CSVReaderBase
{
public
static
char
Spilt_Char
=
','
;
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
//
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// 获取一个类所有的《字段,AttributeName列名》集合
/// </summary>
...
...
@@ -110,12 +110,12 @@ namespace OnlineStore.LoadCSVLibrary
}
catch
(
Exception
e
)
{
LOGGER
.
E
rror
(
"出错:"
,
e
);
Common
.
LogUtil
.
e
rror
(
"出错:"
,
e
);
}
}
catch
(
Exception
ex
)
{
LOGGER
.
E
rror
(
ex
.
ToString
());
Common
.
LogUtil
.
e
rror
(
ex
.
ToString
());
return
false
;
}
return
true
;
...
...
@@ -152,7 +152,7 @@ namespace OnlineStore.LoadCSVLibrary
{
if
(!
titleIndex
.
ContainsKey
(
str
))
{
LOGGER
.
E
rror
(
"未找到必须列:"
+
str
+
",加载数据失败!"
);
Common
.
LogUtil
.
e
rror
(
"未找到必须列:"
+
str
+
",加载数据失败!"
);
throw
new
CVSFieldNotMatchingExection
(
"未找到必须列:"
+
str
+
",加载数据失败!"
);
}
}
...
...
source/LoadCVSLibrary/LoadCSVLibrary.csproj
查看文件 @
6596eb2
...
...
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.LoadCSVLibrary</RootNamespace>
<AssemblyName>LoadCSVLibrary</AssemblyName>
<TargetFrameworkVersion>v4.
0
</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.
6.1
</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
...
...
source/LoadCVSLibrary/position/CSVPositionReader.cs
查看文件 @
6596eb2
...
...
@@ -51,7 +51,7 @@ namespace OnlineStore.LoadCSVLibrary
{
if
(
hasReadFileList
.
Contains
(
filePath
))
{
LOGGER
.
E
rror
(
"文件"
+
filePath
+
"已经加载过,直接返回null"
);
Common
.
LogUtil
.
e
rror
(
"文件"
+
filePath
+
"已经加载过,直接返回null"
);
return
null
;
}
Type
type
=
typeof
(
T
);
...
...
@@ -59,7 +59,7 @@ namespace OnlineStore.LoadCSVLibrary
Dictionary
<
string
,
string
>
proTitleMap
=
getProAttributeMap
(
typeof
(
T
));
if
(
proTitleMap
.
Count
<=
4
)
{
LOGGER
.
E
rror
(
typeof
(
T
).
ToString
()
+
"只读取到"
+
proTitleMap
.
Count
+
"个属性"
);
Common
.
LogUtil
.
e
rror
(
typeof
(
T
).
ToString
()
+
"只读取到"
+
proTitleMap
.
Count
+
"个属性"
);
}
List
<
string
>
cvsTitleList
=
new
List
<
string
>(
proTitleMap
.
Values
);
List
<
string
>
propertyList
=
new
List
<
string
>(
proTitleMap
.
Keys
);
...
...
@@ -117,12 +117,12 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
LOGGER
.
E
rror
(
"读取csv,index="
+
index
+
",数据格式不匹配!,line="
+
line
);
Common
.
LogUtil
.
e
rror
(
"读取csv,index="
+
index
+
",数据格式不匹配!,line="
+
line
);
}
}
catch
(
Exception
ex
)
{
LOGGER
.
Debug
(
"CSV 读取行【"
+
line
+
"】行转换失败"
);
Common
.
LogUtil
.
info
(
"CSV 读取行【"
+
line
+
"】行转换失败"
);
}
}
index
++;
...
...
@@ -157,7 +157,7 @@ namespace OnlineStore.LoadCSVLibrary
Dictionary
<
string
,
string
>
proTitleMap
=
getProAttributeMap
(
typeof
(
T
));
if
(
proTitleMap
.
Count
<=
4
)
{
LOGGER
.
E
rror
(
typeof
(
T
).
ToString
()
+
"只读取到"
+
proTitleMap
.
Count
+
"个属性"
);
Common
.
LogUtil
.
e
rror
(
typeof
(
T
).
ToString
()
+
"只读取到"
+
proTitleMap
.
Count
+
"个属性"
);
}
List
<
string
>
cvsTitleList
=
new
List
<
string
>(
proTitleMap
.
Values
);
List
<
string
>
propertyList
=
new
List
<
string
>(
proTitleMap
.
Keys
);
...
...
@@ -207,7 +207,7 @@ namespace OnlineStore.LoadCSVLibrary
Dictionary
<
string
,
string
>
proTitleMap
=
getProAttributeMap
(
typeof
(
T
));
if
(
proTitleMap
.
Count
<=
4
)
{
LOGGER
.
E
rror
(
typeof
(
T
).
ToString
()
+
"只读取到"
+
proTitleMap
.
Count
+
"个属性"
);
Common
.
LogUtil
.
e
rror
(
typeof
(
T
).
ToString
()
+
"只读取到"
+
proTitleMap
.
Count
+
"个属性"
);
}
List
<
string
>
cvsTitleList
=
new
List
<
string
>(
proTitleMap
.
Values
);
List
<
string
>
propertyList
=
new
List
<
string
>(
proTitleMap
.
Keys
);
...
...
source/LoadCVSLibrary/storeConfig/CSVConfigReader.cs
查看文件 @
6596eb2
...
...
@@ -45,7 +45,7 @@ namespace OnlineStore.LoadCSVLibrary
//必须有列【类型】
if
(
allTitleIndex
.
Count
<
0
||
!
allTitleIndex
.
ContainsKey
(
"类型"
))
{
LOGGER
.
E
rror
(
"未找到必须列:类型,加载数据失败!"
);
Common
.
LogUtil
.
e
rror
(
"未找到必须列:类型,加载数据失败!"
);
throw
new
CVSFieldNotMatchingExection
(
"未找到必须列:类型,加载数据失败!"
);
}
typeIndex
=
allTitleIndex
[
"类型"
];
...
...
@@ -116,14 +116,14 @@ namespace OnlineStore.LoadCSVLibrary
}
catch
(
Exception
ex
)
{
LOGGER
.
E
rror
(
"filepath="
+
filePath
+
",index="
+
index
+
",key="
+
key
+
"出错:"
+
ex
.
ToString
());
Common
.
LogUtil
.
e
rror
(
"filepath="
+
filePath
+
",index="
+
index
+
",key="
+
key
+
"出错:"
+
ex
.
ToString
());
}
listIndex
++;
}
}
catch
(
Exception
ex
)
{
LOGGER
.
E
rror
(
"filepath="
+
filePath
+
",index="
+
index
+
",key="
+
key
+
"出错:"
+
ex
.
ToString
());
Common
.
LogUtil
.
e
rror
(
"filepath="
+
filePath
+
",index="
+
index
+
",key="
+
key
+
"出错:"
+
ex
.
ToString
());
}
}
bllIns
.
CheckField
();
...
...
@@ -142,14 +142,14 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
LOGGER
.
E
rror
(
"配置的料仓类型="
+
storeType
+
"未找到处理方法!"
);
Common
.
LogUtil
.
e
rror
(
"配置的料仓类型="
+
storeType
+
"未找到处理方法!"
);
}
return
LoadConfig
(
config
);
}
public
static
StoreConfig
LoadConfig
(
StoreConfig
config
)
{
LOGGER
.
I
nfo
(
"开始读取文件:"
+
config
.
ConfigFilePath
);
Common
.
LogUtil
.
i
nfo
(
"开始读取文件:"
+
config
.
ConfigFilePath
);
if
(
config
==
null
||
config
.
ConfigFilePath
.
Equals
(
""
))
{
return
null
;
...
...
@@ -205,7 +205,7 @@ namespace OnlineStore.LoadCSVLibrary
}
}
catch
(
Exception
e
)
{
LOGGER
.
E
rror
(
"出错:"
+
e
.
ToString
());
Common
.
LogUtil
.
e
rror
(
"出错:"
+
e
.
ToString
());
}
string
newLine
=
""
;
foreach
(
string
s
in
newArray
)
...
...
source/LoadCVSLibrary/storeConfig/ConfigItemBase.cs
查看文件 @
6596eb2
...
...
@@ -12,7 +12,7 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
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>
/// DI=输入IO,DO=输出IO,PRO=属性,AXIS=轴
/// </summary>
...
...
@@ -268,7 +268,7 @@ namespace OnlineStore.LoadCSVLibrary
}
catch
(
Exception
ex
)
{
LOGGER
.
E
rror
(
"出错:"
,
ex
);
Common
.
LogUtil
.
e
rror
(
"出错:"
,
ex
);
}
return
value
;
}
...
...
source/LoadCVSLibrary/storeConfig/config/StoreConfig.cs
查看文件 @
6596eb2
...
...
@@ -12,7 +12,7 @@ namespace OnlineStore.LoadCSVLibrary
public
static
Dictionary
<
string
,
string
>
ProIOIpMap
=
null
;
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>
/// ID
/// </summary>
...
...
@@ -117,7 +117,7 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
LOGGER
.
E
rror
(
"配置文件:"
+
this
.
ConfigFilePath
+
",属性名="
+
con
.
ProName
+
"的属性未找到匹配字段!"
);
Common
.
LogUtil
.
e
rror
(
"配置文件:"
+
this
.
ConfigFilePath
+
",属性名="
+
con
.
ProName
+
"的属性未找到匹配字段!"
);
}
}
else
if
(!
ProIOIpMap
.
ContainsKey
(
con
.
ProName
)
&&
con
.
ProName
.
ToUpper
().
Contains
(
IOIP_Str
))
...
...
@@ -130,7 +130,7 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
LOGGER
.
E
rror
(
"配置文件:"
+
this
.
ConfigFilePath
+
",属性名="
+
con
.
ProName
+
"的属性未找到匹配字段!"
);
Common
.
LogUtil
.
e
rror
(
"配置文件:"
+
this
.
ConfigFilePath
+
",属性名="
+
con
.
ProName
+
"的属性未找到匹配字段!"
);
}
}
else
if
(
con
.
ProType
==
ConfigItemType
.
DI
)
...
...
@@ -146,7 +146,7 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
LOGGER
.
E
rror
(
"配置文件:"
+
this
.
ConfigFilePath
+
",属性名="
+
con
.
ProName
+
"的属性未找到匹配字段!"
);
Common
.
LogUtil
.
e
rror
(
"配置文件:"
+
this
.
ConfigFilePath
+
",属性名="
+
con
.
ProName
+
"的属性未找到匹配字段!"
);
}
}
else
if
(
con
.
ProType
==
ConfigItemType
.
DO
)
...
...
@@ -162,7 +162,7 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
LOGGER
.
E
rror
(
"配置文件:"
+
this
.
ConfigFilePath
+
",属性名="
+
con
.
ProName
+
"的属性未找到匹配字段!"
);
Common
.
LogUtil
.
e
rror
(
"配置文件:"
+
this
.
ConfigFilePath
+
",属性名="
+
con
.
ProName
+
"的属性未找到匹配字段!"
);
}
}
}
...
...
source/UserFromControl/UserFromControl.csproj
查看文件 @
6596eb2
...
...
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UserFromControl</RootNamespace>
<AssemblyName>UserFromControl</AssemblyName>
<TargetFrameworkVersion>v4.
0
</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.
6.1
</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论