Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 1f248698
由
LN
编写于
2019-12-18 19:23:18 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
b1cebe83
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
15 行增加
和
217 行删除
source/DeviceLibrary/assemblyLine/LineBean.cs
source/DeviceLibrary/baan/AxisBean.cs
source/LoadCVSLibrary/storeConfig/ConfigItemBase.cs
source/DeviceLibrary/assemblyLine/LineBean.cs
查看文件 @
1f24869
...
@@ -171,15 +171,12 @@ namespace OnlineStore.DeviceLibrary
...
@@ -171,15 +171,12 @@ namespace OnlineStore.DeviceLibrary
{
{
IOManager
.
instance
.
ConnectionIOList
(
cioList
);
IOManager
.
instance
.
ConnectionIOList
(
cioList
);
Thread
.
Sleep
(
5
);
Thread
.
Sleep
(
5
);
// if (!IsDebug)
//{
Task
.
Factory
.
StartNew
(
delegate
Task
.
Factory
.
StartNew
(
delegate
{
{
string
[]
rfidArray
=
rfidList
.
ToArray
();
string
[]
rfidArray
=
rfidList
.
ToArray
();
//连接rfip
//连接rfip
RFIDManager
.
RfidReader
.
Open
(
rfidArray
);
RFIDManager
.
RfidReader
.
Open
(
rfidArray
);
});
});
//}
addLastDI
(
IO_Type
.
Airpressure_Check
,
IOValue
(
IO_Type
.
Airpressure_Check
));
addLastDI
(
IO_Type
.
Airpressure_Check
,
IOValue
(
IO_Type
.
Airpressure_Check
));
addLastDI
(
IO_Type
.
SuddenStop_BTN
,
IOValue
(
IO_Type
.
SuddenStop_BTN
));
addLastDI
(
IO_Type
.
SuddenStop_BTN
,
IOValue
(
IO_Type
.
SuddenStop_BTN
));
addLastDI
(
IO_Type
.
Reset_BTN
,
IOValue
(
IO_Type
.
Reset_BTN
));
addLastDI
(
IO_Type
.
Reset_BTN
,
IOValue
(
IO_Type
.
Reset_BTN
));
...
...
source/DeviceLibrary/baan/AxisBean.cs
查看文件 @
1f24869
...
@@ -11,10 +11,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -11,10 +11,7 @@ namespace OnlineStore.DeviceLibrary
{
{
public
class
AxisBean
public
class
AxisBean
{
{
public
ConfigMoveAxis
Config
=
null
;
public
ConfigMoveAxis
Config
=
null
;
public
static
int
TimeoutInterval
=
500
;
public
static
int
TimeoutInterval
=
500
;
/// <summary>
/// <summary>
/// 正常工作过程中判断位置是否到达时使用
/// 正常工作过程中判断位置是否到达时使用
...
@@ -30,7 +27,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -30,7 +27,7 @@ namespace OnlineStore.DeviceLibrary
private
bool
IsIntSlvBlock
=
false
;
private
bool
IsIntSlvBlock
=
false
;
public
bool
Open
(
bool
isCheck
,
out
string
Msg
)
public
bool
Open
(
bool
isCheck
,
out
string
Msg
)
{
{
Msg
=
""
;
Msg
=
""
;
string
portName
=
Config
.
DeviceName
;
string
portName
=
Config
.
DeviceName
;
...
@@ -64,7 +61,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -64,7 +61,7 @@ namespace OnlineStore.DeviceLibrary
/// 打开所有轴
/// 打开所有轴
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
private
bool
OpenAxis
(
out
string
msg
)
private
bool
OpenAxis
(
out
string
msg
)
{
{
msg
=
""
;
msg
=
""
;
//判断轴是否正常
//判断轴是否正常
...
@@ -72,12 +69,12 @@ namespace OnlineStore.DeviceLibrary
...
@@ -72,12 +69,12 @@ namespace OnlineStore.DeviceLibrary
int
slvAddr
=
Config
.
GetAxisValue
();
int
slvAddr
=
Config
.
GetAxisValue
();
if
(
ACServerManager
.
ServerOnStatus
(
portName
,
slvAddr
))
if
(
ACServerManager
.
ServerOnStatus
(
portName
,
slvAddr
))
{
{
LogUtil
.
info
(
AxisName
+
"成功打开"
);
LogUtil
.
info
(
AxisName
+
"成功打开"
);
}
}
else
else
{
{
//清理报警,再重新打开一次
//清理报警,再重新打开一次
LogUtil
.
info
(
AxisName
+
"第一次打开失败,先清理一下报警,再重新打开一次"
);
LogUtil
.
info
(
AxisName
+
"第一次打开失败,先清理一下报警,再重新打开一次"
);
ACServerManager
.
AlarmClear
(
portName
,
slvAddr
);
ACServerManager
.
AlarmClear
(
portName
,
slvAddr
);
System
.
Threading
.
Thread
.
Sleep
(
1200
);
System
.
Threading
.
Thread
.
Sleep
(
1200
);
ACServerManager
.
ServoOn
(
portName
,
slvAddr
);
ACServerManager
.
ServoOn
(
portName
,
slvAddr
);
...
@@ -89,7 +86,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -89,7 +86,7 @@ namespace OnlineStore.DeviceLibrary
else
else
{
{
ACServerManager
.
ServoOff
(
portName
,
slvAddr
);
ACServerManager
.
ServoOff
(
portName
,
slvAddr
);
msg
=
"打开轴"
+
Config
.
Explain
+
"失败 "
;
msg
=
"打开轴"
+
Config
.
Explain
+
"失败 "
;
LogUtil
.
info
(
AxisName
+
msg
);
LogUtil
.
info
(
AxisName
+
msg
);
return
false
;
return
false
;
}
}
...
@@ -130,7 +127,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -130,7 +127,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// <summary>
/// 判断AC伺服电机轴是否运动完成
/// 判断AC伺服电机轴是否运动完成
/// </summary>
/// </summary>
public
static
bool
ACAxisMoveIsEnd
(
LineMoveInfo
MoveInfo
,
ConfigMoveAxis
axis
,
int
targetPosition
,
int
targetSpeed
,
out
string
msg
)
public
static
bool
ACAxisMoveIsEnd
(
LineMoveInfo
MoveInfo
,
ConfigMoveAxis
axis
,
int
targetPosition
,
int
targetSpeed
,
out
string
msg
)
{
{
msg
=
""
;
msg
=
""
;
string
deviceName
=
axis
.
DeviceName
;
string
deviceName
=
axis
.
DeviceName
;
...
@@ -158,7 +155,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -158,7 +155,7 @@ namespace OnlineStore.DeviceLibrary
{
{
msg
=
" "
+
MoveInfo
.
SLog
+
axis
.
DisplayStr
+
",目标位置["
+
targetPosition
+
"]当前位置["
+
outCount
msg
=
" "
+
MoveInfo
.
SLog
+
axis
.
DisplayStr
+
",目标位置["
+
targetPosition
+
"]当前位置["
+
outCount
+
"],误差过大,需要报警"
;
+
"],误差过大,需要报警"
;
LogUtil
.
error
(
msg
,
1034
);
LogUtil
.
error
(
msg
,
1034
);
}
}
}
}
return
false
;
return
false
;
...
@@ -204,7 +201,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -204,7 +201,7 @@ namespace OnlineStore.DeviceLibrary
{
{
if
(
targetPos
.
Equals
(-
1
))
if
(
targetPos
.
Equals
(-
1
))
{
{
return
;
return
;
}
}
LastPosition
=
-
1
;
LastPosition
=
-
1
;
if
(
targetSpeed
>
Config
.
TargetSpeed
||
targetSpeed
<=
0
)
if
(
targetSpeed
>
Config
.
TargetSpeed
||
targetSpeed
<=
0
)
...
@@ -223,202 +220,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -223,202 +220,6 @@ namespace OnlineStore.DeviceLibrary
{
{
ACServerManager
.
SuddenStop
(
Config
.
DeviceName
,
Config
.
GetAxisValue
());
ACServerManager
.
SuddenStop
(
Config
.
DeviceName
,
Config
.
GetAxisValue
());
}
}
///// <summary>
///// 移动到某点,会等到到达位置后结束
///// </summary>
///// <param name="pos"></param>
///// <returns></returns>
//public string AbsMoveAndWait(int pos, double targetSpeed = 0)
//{
// string result = AbsMove(pos, targetSpeed);
// if (!result.Equals(""))
// {
// return result;
// }
// moveRunning = true;
// while (true)
// {
// if (!moveRunning)
// {
// moveRunning = false;
// return AxisName + "用户中止";
// }
// Thread.Sleep(100);
// if (HasAlarm())
// {
// moveRunning = false;
// return AxisName + "伺服报警";
// }
// //判断Buzy及位置是否结束
// if (IsMoveEnd(pos))
// {
// //移动完成
// moveRunning = false;
// return "";
// }
// }
//}
//public bool HasAlarm()
//{
// return ACServerManager.GetAlarmStatus(Config.DeviceName, Config.GetAxisValue()).Equals(1);
//}
///// <summary>
///// 获取位置
///// </summary>
///// <param name="tryTimes">尝试次数</param>
///// <returns></returns>
//public int GetPos(int tryTimes)
//{
// for (int i = 0; i < tryTimes; i++)
// {
// int pos = ACServerManager.GetActualtPosition(Config.DeviceName, Config.GetAxisValue());
// if (pos != -1)
// {
// LastPosition = pos;
// return pos;
// }
// LogUtil.info("获取" + AxisName + "当前位置[" + pos + "]");
// Thread.Sleep(120);
// }
// return -1;
//}
//public bool IsMoveEnd(int targetPos)
//{
// bool isEnd = ACServerManager.GetBusyStatus(Config.DeviceName, Config.GetAxisValue()) == 0;
// return isEnd;
//}
//public void SuddenStop()
//{
// if (homeRunning)
// {
// homeRunning = false;
// }
// if (moveRunning)
// {
// moveRunning = false;
// }
// if (isConnect)
// {
// ACServerManager.SuddenStop(Config.DeviceName, Config.GetAxisValue());
// }
//}
//private void Stop()
//{
// if (homeRunning)
// {
// homeRunning = false;
// }
// if (moveRunning)
// {
// moveRunning = false;
// }
// if (isConnect)
// {
// //ACServerManager.Stop(Config.DeviceName, axisNo);
// }
//}
//public bool IsInPosition(int positionX, int chaValue)
//{
// if (moveRunning)
// {
// return false;
// }
// if (positionX.Equals(-1))
// {
// return true;
// }
// if (!LastPosition.Equals(-1))
// {
// int cha1 = positionX - LastPosition;
// if (Math.Abs(cha1) <= chaValue)
// {
// return true;
// }
// }
// LastPosition = GetPos(2);
// int XCha = positionX - LastPosition;
// if (Math.Abs(XCha) <= chaValue)
// {
// return true;
// }
// return false;
//}
///// <summary>
///// 异步原点返回
///// </summary>
///// <param name="timeout">超时时间</param>
///// <returns></returns>
//public string Home(TimeSpan timeout)
//{
// if (!isConnect)
// {
// return AxisName + "未连接";
// }
// if (moveRunning)
// {
// return AxisName + "正在运动";
// }
// homeRunning = true;
// string result = "";
// ACServerManager.HomeMove(Config.DeviceName, Config.GetAxisValue(), Config.HomeHighSpeed);
// double outTime = timeout.TotalMilliseconds;
// int time = 0;
// while (true)
// {
// if (!homeRunning)
// {
// result = AxisName + "用户中止";
// break;
// }
// else
// {
// Thread.Sleep(TimeoutInterval);
// if (isHomeEnd())
// {
// //LogUtil.info(Config.DeviceName + "原点返回停止,对比实际位置");
// int currentPos = GetPos(2);
// if (currentPos != -1 && Math.Abs(currentPos) <= Config.CanErrorCountMax)
// {
// LogUtil.info(AxisName + "原点返回完成,当前位置【" + currentPos + "】");
// //原点返回完成
// result = "";
// break;
// };
// }
// if (HasAlarm())
// {
// result = AxisName + "报警";
// break;
// }
// time = time + TimeoutInterval;
// if (time >= outTime)
// {
// result = AxisName + "超时";
// break;
// }
// }
// }
// homeRunning = false;
// return result;
//}
//public bool isHomeEnd()
//{
// bool isEnd = ACServerManager.IsHomeMoveEnd(Config.DeviceName, Config.GetAxisValue());
// return isEnd;
//}
}
}
}
}
...
...
source/LoadCVSLibrary/storeConfig/ConfigItemBase.cs
查看文件 @
1f24869
...
@@ -52,7 +52,7 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -52,7 +52,7 @@ namespace OnlineStore.LoadCSVLibrary
{
{
if
(
String
.
IsNullOrEmpty
(
ProType
)
||
String
.
IsNullOrEmpty
(
ProName
)
||
String
.
IsNullOrEmpty
(
ProValue
))
if
(
String
.
IsNullOrEmpty
(
ProType
)
||
String
.
IsNullOrEmpty
(
ProName
)
||
String
.
IsNullOrEmpty
(
ProValue
))
{
{
throw
new
CVSFieldNotMatchingExection
(
ToString
()
+
",【类型:"
+
ProType
+
"】【名称:"
+
ProName
+
"】【属性值:"
+
ProValue
+
"】必须配置值!"
);
throw
new
CVSFieldNotMatchingExection
(
ToString
()
+
",【类型:"
+
ProType
+
"】【名称:"
+
ProName
+
"】【属性值:"
+
ProValue
+
"】必须配置值!"
);
}
}
}
}
}
}
...
@@ -64,7 +64,7 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -64,7 +64,7 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// <summary>
/// 伺服ON的Do信号
/// 伺服ON的Do信号
/// </summary>
/// </summary>
public
string
ServerOnDO
=
""
;
public
string
ServerOnDO
=
""
;
/// <summary>
/// <summary>
/// 伺服刹车信号
/// 伺服刹车信号
/// </summary>
/// </summary>
...
@@ -106,7 +106,7 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -106,7 +106,7 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// <summary>
/// 可以误差的脉冲范围的最大值
/// 可以误差的脉冲范围的最大值
/// </summary>
/// </summary>
public
int
CanErrorCountMax
=
1
00
;
public
int
CanErrorCountMax
=
5
00
;
/// <summary>
/// <summary>
/// 出入库目标值(只有出入库过程中才会有效)
/// 出入库目标值(只有出入库过程中才会有效)
...
@@ -162,7 +162,7 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -162,7 +162,7 @@ namespace OnlineStore.LoadCSVLibrary
}
}
public
override
void
CheckField
()
public
override
void
CheckField
()
{
{
if
(
String
.
IsNullOrEmpty
(
ProType
)
||
String
.
IsNullOrEmpty
(
ProName
)
||
String
.
IsNullOrEmpty
(
DeviceName
)
||
String
.
IsNullOrEmpty
(
ProValue
))
if
(
String
.
IsNullOrEmpty
(
ProType
)
||
String
.
IsNullOrEmpty
(
ProName
)
||
String
.
IsNullOrEmpty
(
DeviceName
)
||
String
.
IsNullOrEmpty
(
ProValue
))
{
{
throw
new
CVSFieldNotMatchingExection
(
ToString
()
+
",【类型:ProType】【名称:ProName】【属性值:ProVale】【设备名称:DeviceName】必须配置值!"
);
throw
new
CVSFieldNotMatchingExection
(
ToString
()
+
",【类型:ProType】【名称:ProName】【属性值:ProVale】【设备名称:DeviceName】必须配置值!"
);
}
}
...
@@ -229,13 +229,13 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -229,13 +229,13 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// <summary>
/// SlaveID
/// SlaveID
/// </summary>
/// </summary>
[
CSVAttribute
(
"SlaveID"
)
]
[
CSVAttribute
(
"SlaveID"
)]
public
byte
SlaveID
{
get
;
set
;
}
public
byte
SlaveID
{
get
;
set
;
}
public
string
DisplayStr
public
string
DisplayStr
{
{
get
get
{
{
return
ElectricalDefinition
+
"-"
+
Explain
+
"-"
+
ProName
+
""
;
return
ElectricalDefinition
+
"-"
+
Explain
+
"-"
+
ProName
+
""
;
}
}
set
set
{
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论