Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
1053_CycleLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 40e19609
由
刘韬
编写于
2023-02-28 21:46:17 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
稳定版
1 个父辈
1587d8a9
显示空白字符变更
内嵌
并排
正在显示
35 个修改的文件
包含
825 行增加
和
264 行删除
Common/Setting_Init.cs
Common/util/MyWebClient.cs
DeviceLibrary/DeviceLibrary.csproj
DeviceLibrary/DeviceLibrary/LineRunMonitor.cs
DeviceLibrary/DeviceLibrary/RobotMoveHelper.cs
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
DeviceLibrary/VirtuallyStore/BufferSlotsManger.cs
DeviceLibrary/VirtuallyStore/VLog.cs
DeviceLibrary/VirtuallyStore/VServerComm.cs
DeviceLibrary/VirtuallyStore/VStore.cs
DeviceLibrary/VirtuallyStore/VStoreCollection.cs
DeviceLibrary/theMachine/DeviceRunControl.cs
DeviceLibrary/theMachine/MainMachine.cs
DeviceLibrary/theMachine/MoveStep.cs
DeviceLibrary/theMachine/RemoteService.cs
DeviceLibrary/theMachine/RobotManage.cs
DeviceLibrary/theMachine/TrayManager.cs
DeviceLibrary/theMachine/sub/IDevice.cs
DeviceLibrary/theMachine/sub/MI.cs
DeviceLibrary/theMachine/sub/SideMove.cs
DeviceLibrary/theMachine/sub/TransplantMove.cs
DeviceLibrary/theMachine/sub/TrayStop.cs
DeviceLibrary/userControl/AxisMoveControl.Designer.cs
DeviceLibrary/userControl/AxisMoveControl.cs
RemoteSheardObject/Class1.cs
RemoteSheardObject/RemoteClient.cs
RemoteSheardObject/RemoteSheardObject.csproj
RemoteSheardObject/Snowflake.cs
RemoteSheardObject/TheLine.cs
TheMachine/Form1.cs
TheMachine/Program.cs
TheMachine/TheMachine.csproj
TheMachine/TrayManagerControl.cs
TheMachine/device/Other/MycronicControl.cs
TheMachine/packages.config
Common/Setting_Init.cs
查看文件 @
40e1960
...
...
@@ -36,6 +36,12 @@ namespace OnlineStore.Common
[
MyConfigComment
(
"屏蔽日志窗口"
)]
public
static
MyConfig
<
bool
>
Device_DisableLogWindow
=
true
;
[
MyConfigComment
(
"出库任务数量大于值时治具托盘全部从LS3转移走"
)]
public
static
MyConfig
<
int
>
Device_LS3_MTP2_OutTaskMaxCount
=
5
;
[
MyConfigComment
(
"出库任务数量大于值时料盘托盘全部从LS3转移走"
)]
public
static
MyConfig
<
int
>
Device_LS3_MTP1_OutTaskMaxCount
=
5
;
[
MyConfigComment
(
"URRobot_MI1_IP"
)]
public
static
MyConfig
<
string
>
URRobot_MI1_IP
;
[
MyConfigComment
(
"URRobot_MI1_速度倍率"
)]
...
...
Common/util/MyWebClient.cs
查看文件 @
40e1960
...
...
@@ -139,18 +139,16 @@ namespace OnlineStore.Common
return
result
;
}
static
object
lockpost
=
new
object
();
public
static
Operation
Post
(
string
url
,
Operation
operation
,
int
timeout
=
5000
,
bool
printlog
=
false
)
public
static
Operation
Post
(
string
url
,
Operation
operation
,
int
timeout
,
out
string
log
)
{
log
=
""
;
try
{
string
json
=
JsonHelper
.
SerializeObject
(
operation
);
string
result
=
Post
(
url
,
json
,
timeout
);
Operation
op
=
JsonHelper
.
DeserializeJsonToObject
<
Operation
>(
result
);
if
(
printlog
)
{
LogUtil
.
info
(
"Send ["
+
json
+
"] Revice ["
+
result
+
"]"
);
}
log
=
"Send ["
+
json
+
"] Revice ["
+
result
+
"]"
;
return
op
;
}
catch
(
Exception
ex
)
...
...
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
40e1960
...
...
@@ -156,6 +156,7 @@
<Compile Include="userControl\FixtureSizeConfigControl.Designer.cs">
<DependentUpon>FixtureSizeConfigControl.cs</DependentUpon>
</Compile>
<Compile Include="VirtuallyStore\BufferSlotsManger.cs" />
<Compile Include="VirtuallyStore\CommandList.cs" />
<Compile Include="VirtuallyStore\Reference.cs" />
<Compile Include="VirtuallyStore\VMsg.cs" />
...
...
DeviceLibrary/DeviceLibrary/LineRunMonitor.cs
查看文件 @
40e1960
...
...
@@ -43,7 +43,7 @@ namespace DeviceLibrary
if
(
canStopLine
(
out
_
)
&&
isIOon
)
//(DOValue(LineIO).Equals(IO_VALUE.HIGH) || DOValue(LineRevIO).Equals(IO_VALUE.HIGH)))
{
IOSTOP
();
LogUtil
.
info
(
Name
+
$
" 线体管理器 停止线体."
);
LogUtil
.
info
(
"["
+
Name
+
"]"
+
$
" 线体管理器 停止线体."
);
}
}
}
...
...
DeviceLibrary/DeviceLibrary/RobotMoveHelper.cs
查看文件 @
40e1960
using
OnlineStore.Common
;
using
OnlineStore
;
using
OnlineStore.Common
;
using
Robot.UR
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -48,12 +49,14 @@ namespace DeviceLibrary
{
RobotStatus
=
false
;
//Msg.add(POS_Start + "机器人状态异常:" + Robot.CurDashboardReponse, MsgLevel.alarm);
robot
.
Play
Program
();
robot
.
Stop
Program
();
}
else
if
(!
robot
.
ClientIsConnected
)
{
RobotStatus
=
false
;
robot
.
StopProgram
();
Thread
.
Sleep
(
300
);
robot
.
StopRobot
();
}
else
RobotStatus
=
true
;
...
...
@@ -61,7 +64,7 @@ namespace DeviceLibrary
public
void
Move
(
MoveInfo
moveInfo
,
int
movecmd
)
{
if
(
moveInfo
!=
null
)
{
moveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAction
(
new
Func
<
WaitResultInfo
,
bool
>(
IsMoveOk
),
"等待"
+
$
"[{robot.Name}]"
+
"移动到位"
));
moveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAction
(
new
Func
<
WaitResultInfo
,
bool
>(
IsMoveOk
),
crc
.
GetString
(
"Res0157"
,
"等待"
)
+
$
"[{robot.Name}]"
+
crc
.
GetString
(
"Res0057"
,
"移动到位"
)
));
}
lastMoveCmd
=
movecmd
;
robot
.
SendMoveCmd
(
movecmd
,
Setting_Init
.
URRobot_MI1_Speed_Rate
);
...
...
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
查看文件 @
40e1960
using
OnlineStore
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
RemoteSheardObject
;
using
System
;
using
System.Collections.Concurrent
;
using
System.Collections.Generic
;
...
...
@@ -12,7 +13,7 @@ using System.Threading.Tasks;
namespace
DeviceLibrary
{
class
ServerCommunication
public
class
ServerCommunication
{
volatile
StoreStatus
_storeStatus
=
StoreStatus
.
Debugging
;
public
StoreStatus
storeStatus
{
...
...
@@ -41,10 +42,18 @@ namespace DeviceLibrary
GC
.
KeepAlive
(
serverConnectTimer
);
LogUtil
.
info
(
$
"server:{server},cid:{CID}"
);
}
public
int
OutMaterialTaskCount
=
0
;
public
int
OutReelTaskCount
=
0
;
private
void
ServerConnectTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
try
{
if
(!
string
.
IsNullOrEmpty
(
server
)
&&
server
.
ToLower
().
StartsWith
(
"http"
))
{
var
data
=
TheLine
.
GetTaskCount
();
OutMaterialTaskCount
=
data
[
"pizzaBox"
]
+
data
[
"pcb"
]
+
data
[
"tray"
];
OutReelTaskCount
=
data
[
"reel"
];
}
//if (!RobotManage.isRunning)
// ProcessMsg(MsgService.MSList);
//if (!string.IsNullOrWhiteSpace(server))
...
...
@@ -54,7 +63,8 @@ namespace DeviceLibrary
{
LogUtil
.
info
(
$
"ServerConnectTimer_Elapsed:{ex}"
);
}
finally
{
finally
{
//Monitor.Exit(serverConnectTimer);
}
}
...
...
@@ -75,7 +85,7 @@ namespace DeviceLibrary
}
).
Where
(
x
=>!
string
.
IsNullOrEmpty
(
x
)));
}
public
void
SendInStoreRequest
(
string
[]
codelist
,
ReelParam
reel
,
bool
printlog
=
false
)
{
public
void
SendInStoreRequest
(
string
[]
codelist
,
ReelParam
reel
)
{
if
(
RobotManage
.
InoutDebugMode
)
return
;
...
...
@@ -86,11 +96,12 @@ namespace DeviceLibrary
operation
.
op
=
1
;
operation
.
data
=
new
Dictionary
<
string
,
string
>()
{
{
"code"
,
code
},
{
"boxId"
,
StoreID
.
ToString
()
},
{
"doorReelSignal"
,
"1"
}
};
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
15000
,
print
log
);
Operation
resultOperation
=
OnlineStore
.
Common
.
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
15000
,
out
string
log
);
if
(
resultOperation
==
null
||
operation
.
seq
!=
resultOperation
.
seq
)
{
LogUtil
.
error
(
log
);
Thread
.
Sleep
(
1000
);
SendInStoreRequest
(
codelist
,
reel
,
printlog
);
SendInStoreRequest
(
codelist
,
reel
);
return
;
}
ResultProcess
(
resultOperation
);
...
...
@@ -109,7 +120,7 @@ namespace DeviceLibrary
LogUtil
.
info
(
JsonHelper
.
SerializeObject
(
operation
));
if
(
RobotManage
.
InoutDebugMode
)
return
true
;
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
15000
);
Operation
resultOperation
=
OnlineStore
.
Common
.
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
15000
,
out
_
);
if
(
resultOperation
==
null
)
{
...
...
@@ -253,7 +264,7 @@ namespace DeviceLibrary
printlog
=
true
;
}
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
lineOperation
,
700
,
print
log
);
Operation
resultOperation
=
OnlineStore
.
Common
.
HttpHelper
.
Post
(
GetPostApi
(),
lineOperation
,
700
,
out
string
log
);
if
(
resultOperation
!=
null
)
getthtime
=
0
;
//LogUtil.info(JsonHelper.SerializeObject(resultOperation.data));
...
...
DeviceLibrary/VirtuallyStore/BufferSlotsManger.cs
0 → 100644
查看文件 @
40e1960
using
Newtonsoft.Json
;
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
DeviceLibrary
{
class
BufferSlotsManger
{
Dictionary
<
string
,
BufferSlotInfo
>
bufferSlotInfos
=
new
Dictionary
<
string
,
BufferSlotInfo
>();
string
DeviceName
;
public
BufferSlotsManger
(
string
devicename
)
{
DeviceName
=
devicename
;
LoadData
();
for
(
int
i
=
0
;
i
<
8
;
i
++)
{
string
sloatkey
=
DeviceName
+
"_B0"
+
(
i
+
1
);
if
(!
bufferSlotInfos
.
ContainsKey
(
sloatkey
))
{
bufferSlotInfos
.
Add
(
sloatkey
,
new
BufferSlotInfo
(
sloatkey
));
}
}
}
public
string
GetFreeSlot
()
{
lock
(
bufferSlotInfos
)
{
var
slot
=
bufferSlotInfos
.
Values
.
ToList
().
Find
(
s
=>
!
s
.
HasReel
);
return
slot
?.
Name
;
}
}
public
string
GetInstoreSlot
(
out
JobInfo
jobInfo
)
{
lock
(
bufferSlotInfos
)
{
var
slot
=
bufferSlotInfos
.
Values
.
ToList
().
Find
(
s
=>
s
.
HasReel
&&
s
.
IsInstore
);
jobInfo
=
slot
?.
JobInfo
.
Clone
();
return
slot
?.
Name
;
}
}
public
string
GetOutstoreSlot
(
out
JobInfo
jobInfo
)
{
lock
(
bufferSlotInfos
)
{
var
slot
=
bufferSlotInfos
.
Values
.
ToList
().
Find
(
s
=>
s
.
HasReel
&&
!
s
.
IsInstore
);
jobInfo
=
slot
?.
JobInfo
.
Clone
();
return
slot
?.
Name
;
}
}
public
void
SetSlotInfo
(
string
name
,
bool
isinstore
,
JobInfo
jobInfo
)
{
lock
(
bufferSlotInfos
)
{
bufferSlotInfos
[
name
].
IsInstore
=
isinstore
;
bufferSlotInfos
[
name
].
JobInfo
=
jobInfo
.
Clone
();
bufferSlotInfos
[
name
].
HasReel
=
true
;
}
SaveData
();
}
public
void
ClearSlot
(
string
name
)
{
lock
(
bufferSlotInfos
)
{
bufferSlotInfos
[
name
].
HasReel
=
false
;
}
SaveData
();
}
void
LoadData
()
{
string
filename
=
$
"Config\\BufferSlotsList_{DeviceName}.temp"
;
if
(
File
.
Exists
(
filename
))
{
bool
isreadok
=
false
;
try
{
var
tl
=
File
.
ReadAllText
(
filename
);
bufferSlotInfos
=
JsonConvert
.
DeserializeObject
<
Dictionary
<
string
,
BufferSlotInfo
>>(
tl
);
isreadok
=
bufferSlotInfos
!=
null
;
if
(!
isreadok
)
LogUtil
.
error
(
"启动时缓存料盘信息加载失败:"
+
DeviceName
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"启动时缓存料盘信息加载失败:"
+
DeviceName
+
ex
);
}
if
(
isreadok
)
return
;
try
{
var
tl
=
File
.
ReadAllText
(
filename
+
"~"
);
bufferSlotInfos
=
JsonConvert
.
DeserializeObject
<
Dictionary
<
string
,
BufferSlotInfo
>>(
tl
);
if
(
bufferSlotInfos
==
null
)
{
LogUtil
.
error
(
"启动时备份缓存料盘加载失败:"
+
DeviceName
);
bufferSlotInfos
=
new
Dictionary
<
string
,
BufferSlotInfo
>();
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"启动时托盘备份信息加载失败:"
+
ex
);
bufferSlotInfos
=
new
Dictionary
<
string
,
BufferSlotInfo
>();
}
}
}
void
SaveData
()
{
string
filename
=
$
"Config\\BufferSlotsList_{DeviceName}.temp"
;
try
{
var
TL
=
bufferSlotInfos
.
Where
(
t
=>
t
.
Value
.
HasReel
).
ToDictionary
(
a
=>
a
.
Key
,
a
=>
a
.
Value
);
ConfigHelper
.
Config
.
FileSave
(
JsonConvert
.
SerializeObject
(
TL
),
filename
+
"~"
);
ConfigHelper
.
Config
.
FileSave
(
JsonConvert
.
SerializeObject
(
TL
),
filename
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"托盘信息保存失败:"
+
ex
);
}
}
}
class
BufferSlotInfo
{
public
string
Name
;
public
bool
HasReel
;
public
bool
IsInstore
;
public
JobInfo
JobInfo
;
public
BufferSlotInfo
(
string
name
)
{
Name
=
name
;
}
}
}
DeviceLibrary/VirtuallyStore/VLog.cs
查看文件 @
40e1960
...
...
@@ -15,14 +15,20 @@ namespace DeviceLibrary
Prefix
=
prefix
;
log
=
LogManager
.
GetLogger
(
logname
);
}
string
lastinfo
=
""
;
public
void
Info
(
string
txt
)
{
if
(
String
.
Compare
(
lastinfo
,
txt
,
StringComparison
.
Ordinal
)
==
0
)
return
;
if
(
Prefix
!=
""
)
txt
=
$
"[{Prefix}] "
+
txt
;
log
.
Info
(
txt
);
}
string
lasterr
=
""
;
public
void
Error
(
string
txt
)
{
if
(
String
.
Compare
(
lasterr
,
txt
,
StringComparison
.
Ordinal
)
==
0
)
return
;
if
(
Prefix
!=
""
)
txt
=
$
"[{Prefix}] "
+
txt
;
log
.
Error
(
txt
);
...
...
DeviceLibrary/VirtuallyStore/VServerComm.cs
查看文件 @
40e1960
...
...
@@ -114,20 +114,20 @@ namespace DeviceLibrary
LogUtil
.
info
(
JsonHelper
.
SerializeObject
(
operation
));
if
(
RobotManage
.
InoutDebugMode
)
return
true
;
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
5000
);
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
5000
,
out
string
log
);
if
(
resultOperation
==
null
)
{
LogUtil
.
info
(
$
"SendStoreState error,posid:{barcode}, storeStatus:{storeStatus}"
);
VLog
.
Error
(
$
"SendStoreState error,posid:{barcode}, storeStatus:{storeStatus}"
);
return
false
;
}
if
(
operation
.
seq
!=
resultOperation
.
seq
)
{
LogUtil
.
info
(
$
"SendStoreState seq error,posid:{barcode}, storeStatus:{storeStatus}"
);
VLog
.
Error
(
$
"SendStoreState seq error,posid:{barcode}, storeStatus:{storeStatus}"
);
return
false
;
}
LogUtil
.
i
nfo
(
$
"SendStoreState success,posid:{barcode}, storeStatus:{storeStatus}"
);
VLog
.
Info
(
log
);
VLog
.
I
nfo
(
$
"SendStoreState success,posid:{barcode}, storeStatus:{storeStatus}"
);
ResultProcess
(
resultOperation
);
}
return
true
;
...
...
@@ -238,7 +238,7 @@ namespace DeviceLibrary
printlog
=
true
;
}
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
lineOperation
,
700
,
print
log
);
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
lineOperation
,
700
,
out
string
log
);
if
(
resultOperation
!=
null
)
getthtime
=
0
;
//LogUtil.info(JsonHelper.SerializeObject(resultOperation.data));
...
...
@@ -407,7 +407,7 @@ namespace DeviceLibrary
else
{
JobInfo
jobInfo
=
new
JobInfo
(
code
,
posIdStr
,
plateW
,
plateH
);
OutStoreEvent
?.
Invoke
(
"服务器"
,
jobInfo
);
OutStoreEvent
?.
Invoke
(
crc
.
GetString
(
"Res0064"
,
"服务器"
)
,
jobInfo
);
}
TimeSpan
span
=
DateTime
.
Now
-
time
;
...
...
DeviceLibrary/VirtuallyStore/VStore.cs
查看文件 @
40e1960
...
...
@@ -47,28 +47,42 @@ namespace DeviceLibrary
//MI.DeviceList[TowerList.List[CurrentOutJobInfo.CID].DeviceGroupName].EnqueueOutStore(CurrentOutJobInfo);
}
public
string
CurrentTowerStatusText
=
""
;
public
RTStoreStatus
RTStoreStatus
=
RTStoreStatus
.
Offline
;
public
volatile
bool
TerminalError
=
false
;
DateTime
LastStatusTime
=
DateTime
.
Now
;
int
LastStatusCode
=
0
;
internal
void
VTowerProcess
()
{
try
{
var
ti
=
ServerCM
.
GetTowerDetailInformation
(
CID
);
if
(
ti
!=
null
)
{
if
(
LastStatusCode
!=
ti
.
StatusCode
)
{
LastStatusCode
=
ti
.
StatusCode
;
VLog
.
Info
(
$
"RTStoreStatus:{RTStoreStatus},StatusCode:{ti.StatusCode},StatusText:{ti.StatusText},OnlineStatus:{ti.OnlineStatus}"
);
}
CurrentTowerStatusText
=
$
"[TI={ti.StatusCode}-{ti.StatusText}]"
;
ServerCM
.
Temperature
=
ti
.
Temperature
;
ServerCM
.
Humidity
=
ti
.
Humidity
;
if
(
ti
.
StatusCode
==
26
)
{
ServerCM
.
storeStatus
=
StoreStatus
.
StoreOnline
;
if
(
RTStoreStatus
!=
RTStoreStatus
.
LockToInStore
)
if
(
RTStoreStatus
!=
RTStoreStatus
.
LockToInStore
&&
RTStoreStatus
!=
RTStoreStatus
.
InStoreReady
)
{
if
(
RTStoreStatus
!=
RTStoreStatus
.
Ready
)
VLog
.
Info
(
"料仓已空闲"
);
RTStoreStatus
=
RTStoreStatus
.
Ready
;
TerminalError
=
false
;
LastStatusTime
=
DateTime
.
Now
;
if
(
OutStoreJobList
.
Count
>
0
)
{
if
(
OutStoreJobList
.
Dequeue
(
out
JobInfo
jobInfo
))
{
RTStoreStatus
=
RTStoreStatus
.
LockToInStore
;
if
(!
ServerCM
.
BeginOutStore
(
jobInfo
.
Clone
(),
VLog
))
{
if
(!
ServerCM
.
BeginOutStore
(
jobInfo
.
Clone
(),
VLog
))
{
RTStoreStatus
=
RTStoreStatus
.
Ready
;
}
CurrentTerminalReelID
=
jobInfo
.
WareNum
;
...
...
@@ -86,9 +100,23 @@ namespace DeviceLibrary
InStoreJobInfo
=
null
;
}
}
else
if
((
DateTime
.
Now
-
LastStatusTime
).
TotalSeconds
>
30
)
{
TerminalError
=
true
;
if
(
RTStoreStatus
==
RTStoreStatus
.
InStoreReady
)
{
VLog
.
Error
(
$
"入库超时出错,没有执行入库过程,RTStoreStatus={RTStoreStatus}:"
+
InStoreJobInfo
?.
ToStr
());
CurrentTowerStatusText
=
crc
.
GetString
(
"Res0065"
,
"入库错误,没有执行入库过程"
);
}
else
if
(
RTStoreStatus
==
RTStoreStatus
.
LockToInStore
)
{
VLog
.
Error
(
$
"入库超时出错,没有检测到料盘,RTStoreStatus={RTStoreStatus}:"
+
InStoreJobInfo
?.
ToStr
());
CurrentTowerStatusText
=
crc
.
GetString
(
"Res0065"
,
"入库错误,没有执行入库过程"
);
}
else
{
Msg
.
add
(
"料仓为入库锁定状态,请检查舱门口料盘状态"
,
MsgLevel
.
alarm
);
VLog
.
Error
(
$
"未知状态超时,RTStoreStatus={RTStoreStatus}:"
+
InStoreJobInfo
?.
ToStr
());
}
}
}
else
if
(
ti
.
StatusCode
==
1031
)
...
...
@@ -101,7 +129,8 @@ namespace DeviceLibrary
}
else
if
(
ti
.
StatusCode
==
1032
)
{
if
((
DateTime
.
Now
-
LastStatusTime
).
TotalSeconds
>
30
)
{
if
((
DateTime
.
Now
-
LastStatusTime
).
TotalSeconds
>
30
)
{
RTStoreStatus
=
RTStoreStatus
.
InStoreDataTimeOut
;
}
if
(
RTStoreStatus
!=
RTStoreStatus
.
InStoreReady
&&
InStoreJobInfo
!=
null
)
...
...
@@ -133,6 +162,7 @@ namespace DeviceLibrary
if
(
RTStoreStatus
!=
RTStoreStatus
.
OutStoreReady
)
{
VLog
.
Info
(
"出库已完成"
);
InStoreJobInfo
=
null
;
OutStoreEnd
(
CurrentTerminalReelID
,
CID
);
}
...
...
@@ -144,25 +174,28 @@ namespace DeviceLibrary
{
RTStoreStatus
=
RTStoreStatus
.
Offline
;
ServerCM
.
storeStatus
=
StoreStatus
.
None
;
}
else
if
(
ti
.
StatusCode
==
310117
)
}
else
if
(
ti
.
StatusCode
==
310117
||
ti
.
StatusCode
==
310249
)
{
RTStoreStatus
=
RTStoreStatus
.
InStoreError
;
ServerCM
.
storeStatus
=
StoreStatus
.
InStoreError
;
InStoreJobInfo
=
null
;
}
else
if
(
ti
.
StatusCode
<
10000
)
{
RTStoreStatus
=
RTStoreStatus
.
Busy
;
ServerCM
.
storeStatus
=
StoreStatus
.
None
;
VLog
.
Info
(
$
"StatusCode:{ti.StatusCode},StatusText:{ti.StatusText},OnlineStatus:{ti.OnlineStatus}"
);
//
VLog.Info($"StatusCode:{ti.StatusCode},StatusText:{ti.StatusText},OnlineStatus:{ti.OnlineStatus}");
}
else
{
VLog
.
Error
(
$
"StatusCode:{ti.StatusCode},StatusText:{ti.StatusText},OnlineStatus:{ti.OnlineStatus}"
);
//
VLog.Error($"StatusCode:{ti.StatusCode},StatusText:{ti.StatusText},OnlineStatus:{ti.OnlineStatus}");
ServerCM
.
storeStatus
=
StoreStatus
.
InTrouble
;
RTStoreStatus
=
RTStoreStatus
.
Error
;
}
}
else
{
else
{
ServerCM
.
storeStatus
=
StoreStatus
.
None
;
RTStoreStatus
=
RTStoreStatus
.
Offline
;
...
...
@@ -177,26 +210,55 @@ namespace DeviceLibrary
1042 material unloaded to Terminal from Tower 物料已取走
6015 Reel already loaded.
3068 初始化中
310249 Error Reel Sensor (249)
*/
//统计剩余容量
for
(
int
i
=
0
;
i
<
ti
.
Slots
.
Count
;
i
++)
{
var
sn
=
ti
.
Slots
[
i
].
Slotname
;
int
w
=
0
;
int
h
=
0
;
if
(
sn
.
StartsWith
(
"s15"
))
{
w
=
15
;
int
.
TryParse
(
sn
.
Substring
(
3
),
out
h
);
}
else
if
(
sn
.
StartsWith
(
"s13"
))
{
w
=
13
;
int
.
TryParse
(
sn
.
Substring
(
3
),
out
h
);
}
else
if
(
sn
.
StartsWith
(
"s7"
))
{
w
=
7
;
int
.
TryParse
(
sn
.
Substring
(
2
),
out
h
);
}
//boxStatus.data.Add("capacity", "7X8=1000;7X12=345;13X32=100;");
SlotsInfo
[
$
"{w}x{h}"
]
=
$
"{ti.Slots[i].Slots_used}/{ti.Slots[i].Slots_free}"
;
}
}
catch
(
Exception
ex
)
{
VLog
.
Error
(
"VStore Error:"
+
ex
);
}
}
public
Dictionary
<
string
,
string
>
SlotsInfo
=
new
Dictionary
<
string
,
string
>();
public
string
GetStateStr
()
{
if
(
RTStoreStatus
==
RTStoreStatus
.
OutStoreReady
)
return
"出库中"
+
(!
string
.
IsNullOrEmpty
(
CurrentTerminalReelID
)?
"SN:"
+
CurrentTerminalReelID
:
""
);
return
crc
.
GetString
(
"Res0066"
,
"出库中"
)
+
(!
string
.
IsNullOrEmpty
(
CurrentTerminalReelID
)?
"SN:"
+
CurrentTerminalReelID
:
""
);
if
(
RTStoreStatus
==
RTStoreStatus
.
LockToInStore
)
{
return
"等待入库信息"
;
return
crc
.
GetString
(
"Res0067"
,
"等待入库信息"
)
;
}
if
(
RTStoreStatus
==
RTStoreStatus
.
InStoreExecute
||
RTStoreStatus
==
RTStoreStatus
.
InStoreReady
)
{
return
"入库中"
+
" Barcode:"
+
InStoreJobInfo
?.
WareNum
;
return
crc
.
GetString
(
"Res0068"
,
"入库中"
)
+
" Barcode:"
+
InStoreJobInfo
?.
WareNum
;
}
if
(
RTStoreStatus
==
RTStoreStatus
.
InStoreError
)
{
return
"入库出错,物料NG"
;
return
crc
.
GetString
(
"Res0069"
,
"入库出错,物料NG"
)
;
}
return
"空闲中"
;
return
crc
.
GetString
(
"Res0070"
,
"空闲中"
)
;
}
public
volatile
JobInfo
InStoreJobInfo
;
...
...
DeviceLibrary/VirtuallyStore/VStoreCollection.cs
查看文件 @
40e1960
...
...
@@ -92,7 +92,12 @@ namespace DeviceLibrary
MsgService
.
MSList
[
"RT-"
+
vs
.
CID
].
clear
();
vs
.
VTowerProcess
();
}
finally
{
catch
(
Exception
ex
)
{
VLog
.
Error
(
"VTowerProcess error:"
+
ex
);
}
finally
{
MsgService
.
MSList
[
"RT-"
+
vs
.
CID
].
Show
();
}
});
...
...
DeviceLibrary/theMachine/DeviceRunControl.cs
查看文件 @
40e1960
...
...
@@ -33,10 +33,18 @@ namespace DeviceLibrary
LogUtil
.
info
(
$
"{DeviceListName}设备线程启动"
);
while
(
RobotManage
.
mainMachine
.
mstart
)
{
Thread
.
Sleep
(
20
0
);
Thread
.
Sleep
(
15
0
);
ManualResetEvent
.
WaitAll
(
new
ManualResetEvent
[]
{
RobotManage
.
mainMachine
.
ResetEvent
});
if
(!
RobotManage
.
mainMachine
.
canRunning
||
!
RobotManage
.
mainMachine
.
mstart
)
{
if
(
RobotManage
.
mainMachine
.
mstart
)
{
DevicesList
.
ForEach
(
x
=>
{
x
.
FrontStopProcess
();
});
}
continue
;
}
DevicesList
.
ForEach
(
x
=>
{
try
...
...
@@ -47,6 +55,7 @@ namespace DeviceLibrary
{
MsgService
.
MSList
[
x
.
GroupName
].
add
(
ex
.
ToString
(),
MsgLevel
.
warning
);
MsgService
.
MSList
[
x
.
GroupName
].
setlogones
();
LogUtil
.
error
(
$
"{DeviceListName} 出错:"
+
ex
);
}
finally
{
...
...
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
40e1960
...
...
@@ -33,7 +33,7 @@ namespace DeviceLibrary
public
Dictionary
<
string
,
DeviceGroup
>
DeviceGroup
{
get
=>
RobotManage
.
DeviceGroup
;
}
public
bool
UserPause
{
get
;
set
;
}
=
false
;
ServerCommunication
ServerCM
;
public
ServerCommunication
ServerCM
;
public
ManualResetEvent
ResetEvent
=
new
ManualResetEvent
(
true
);
...
...
@@ -93,11 +93,12 @@ namespace DeviceLibrary
canRunning
=
DeviceCheck
();
if
(
canRunning
)
{
ResetEvent
.
Set
();
BtnProcess
();
canRunning
=
SafeCheck
();
}
Thread
.
Sleep
(
200
);
Thread
.
Sleep
(
150
);
ResetEvent
.
Set
();
if
(!
canRunning
||
!
mstart
)
continue
;
if
(
runStatus
==
RunStatus
.
Running
)
...
...
@@ -155,6 +156,11 @@ namespace DeviceLibrary
}
public
void
Stop
()
{
mstart
=
false
;
DeviceSnapshot
();
SideMove
.
DeviceList
.
Values
.
ToList
().
ForEach
(
s
=>
s
.
Stop
());
TransplantMove
.
DeviceList
.
Values
.
ToList
().
ForEach
(
s
=>
s
.
Stop
());
TrayStop
.
DeviceList
.
Values
.
ToList
().
ForEach
(
s
=>
s
.
Stop
());
MI
.
DeviceList
.
Values
.
ToList
().
ForEach
(
s
=>
s
.
Stop
());
IOMove
(
IO_Type
.
Line_Run
,
IO_VALUE
.
LOW
);
ResetEvent
.
Set
();
Alarm
(
AlarmType
.
None
);
...
...
@@ -290,5 +296,34 @@ namespace DeviceLibrary
}
return
ok
;
}
public
void
DeviceSnapshot
()
{
LogUtil
.
info
(
"===开始记录系统当前情况.==="
);
MoveInfo
.
List
.
ForEach
(
m
=>
{
LogUtil
.
info
(
$
"\t{m.Name}: {m.MoveStep}\t{m.MoveParam.ToStr()}"
);
});
AxisBean
.
List
.
ToList
().
ForEach
(
al
=>
{
al
.
Value
.
ForEach
(
ax
=>
{
LogUtil
.
info
(
$
"\t{ax.AxisName}: {ax.GetAclPosition()}"
);
});
});
VStoreCollection
.
VStoreList
.
Values
.
ToList
().
ForEach
(
vs
=>
{
LogUtil
.
info
(
$
"\t{vs.TowerName}\t{vs.CID}: {vs.RTStoreStatus}\tCurrentTerminalReelID:{vs.CurrentTerminalReelID}\tInStoreJobInfo:{vs.InStoreJobInfo?.ToStr()}"
);
});
ConfigHelper
.
Config
.
Configlist
.
ToList
().
ForEach
(
cc
=>
{
LogUtil
.
info
(
$
"\t{cc.Key}: {cc.Value}"
);
});
MsgService
.
MSList
.
ToList
().
ForEach
(
msl
=>
{
msl
.
Value
.
get
().
ToList
().
ForEach
(
cc
=>
{
LogUtil
.
info
(
$
"\t{cc.datetime}\t{cc.msgLevel}\t{cc.msgtxt} "
);
});
});
LogUtil
.
info
(
"===记录结束.==="
);
}
}
}
\ No newline at end of file
DeviceLibrary/theMachine/MoveStep.cs
查看文件 @
40e1960
...
...
@@ -116,6 +116,7 @@ namespace DeviceLibrary
MI_08
,
MI_09
,
MI_10
,
MI_ReelTacked
,
MI_11
,
MI_12
,
MI_13
,
...
...
DeviceLibrary/theMachine/RemoteService.cs
查看文件 @
40e1960
...
...
@@ -74,10 +74,13 @@ namespace DeviceLibrary
case
"IsFree"
:
isok
=
TrayManager
.
IsFree
(
remoteLoad
);
break
;
case
"IsNeedProcessNG"
:
isok
=
TrayManager
.
IsNeedProcessNG
(
remoteLoad
);
break
;
case
"OK"
:
case
"FAIL"
:
lastresult
[
Seq
]
=
remoteLoad
.
Action
==
"OK"
?
RemoteResult
.
True
:
RemoteResult
.
False
;
LogUtil
.
info
(
"Revice Command Callback:"
+
remoteLoad
.
GroupName
+
" -
"
+
remoteLoad
.
Action
);
LogUtil
.
info
(
$
"[{remoteLoad.GroupName}] Revice Command Callback:
"
+
remoteLoad
.
Action
);
return
;
default
:
break
;
...
...
@@ -100,7 +103,7 @@ namespace DeviceLibrary
allClients
[
deviceGroupName
].
Send
(
JsonConvert
.
SerializeObject
(
message
));
}
catch
(
Exception
ex
){
LogUtil
.
info
(
$
"设备:{deviceGroupName} 消息发送出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
$
"设备:{deviceGroupName} 消息发送出错:"
+
ex
.
ToString
());
}
}
...
...
@@ -109,7 +112,7 @@ namespace DeviceLibrary
remoteLoad
.
GroupName
=
GroupName
;
if
(
remoteLoad
.
RequestLoadInfo
!=
null
&&
string
.
IsNullOrEmpty
(
remoteLoad
.
RequestLoadInfo
.
DeviceGroupName
))
remoteLoad
.
RequestLoadInfo
.
DeviceGroupName
=
GroupName
;
LogUtil
.
info
(
$
"
{GroupName}
,发送:{remoteLoad.Action},Seq:{remoteLoad.Seq}"
);
LogUtil
.
info
(
$
"
[{GroupName}]
,发送:{remoteLoad.Action},Seq:{remoteLoad.Seq}"
);
lastresult
[
remoteLoad
.
Seq
]
=
RemoteResult
.
None
;
SendMessage
(
GroupName
,
remoteLoad
);
return
WaitResult
(
GroupName
,
remoteLoad
.
Seq
,
waittime
);
...
...
@@ -118,6 +121,8 @@ namespace DeviceLibrary
{
if
(!
lastresult
.
ContainsKey
(
seq
))
return
RemoteResult
.
Timeout
;
try
{
while
(
lastresult
[
seq
]
==
RemoteResult
.
None
&&
waittime
>
0
)
{
System
.
Threading
.
Thread
.
Sleep
(
50
);
...
...
@@ -125,9 +130,10 @@ namespace DeviceLibrary
}
if
(
lastresult
[
seq
]
==
RemoteResult
.
None
)
{
LogUtil
.
info
(
$
"等待{GroupName}反馈超时 seq:"
+
seq
);
LogUtil
.
info
(
$
"等待{GroupName}反馈超时 seq:"
+
seq
);
lastresult
[
seq
]
=
RemoteResult
.
Timeout
;
}
var
result
=
lastresult
[
seq
];
lock
(
lastresult
)
{
...
...
@@ -135,6 +141,11 @@ namespace DeviceLibrary
}
return
result
;
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
$
"等待{GroupName}反馈超时 seq:"
+
seq
+
" 出错:"
+
ex
);
return
RemoteResult
.
Timeout
;
}
}
public
static
void
SendResult
(
string
deviceGroupName
,
bool
result
,
long
Seq
)
{
RemoteLoad
remoteLoad
=
new
RemoteLoad
();
...
...
DeviceLibrary/theMachine/RobotManage.cs
查看文件 @
40e1960
...
...
@@ -190,6 +190,7 @@ namespace DeviceLibrary
LogUtil
.
info
(
"用户暂停"
);
else
LogUtil
.
info
(
"系统暂停: "
+
msg
);
mainMachine
.
DeviceSnapshot
();
Thread
.
Sleep
(
500
);
}
else
...
...
DeviceLibrary/theMachine/TrayManager.cs
查看文件 @
40e1960
...
...
@@ -37,10 +37,11 @@ namespace DeviceLibrary
Traylist
[
rfid
].
LastAddr
=
addr
;
Traylist
[
rfid
].
Destination
=
TrayManager
.
AddrDesc
[
Traylist
[
rfid
].
DestinationAddr
];
Traylist
[
rfid
].
LastPosition
=
TrayManager
.
AddrDesc
[
Traylist
[
rfid
].
LastAddr
];
if
(
reelcheck
==
0
)
Traylist
[
rfid
].
HasLoadCheck
--;
else
if
(
reelcheck
==
1
)
Traylist
[
rfid
].
HasLoadCheck
=
1
;
if
(
Traylist
[
rfid
].
TrayType
==
TrayTypeE
.
MTP1
&&
(
addr
==
16
||
addr
==
20
||
addr
==
5
||
addr
==
3
))
Traylist
[
rfid
].
HasLoadCheck
+=
reelcheck
==
0
?
-
1
:
1
;
else
if
(
Traylist
[
rfid
].
TrayType
==
TrayTypeE
.
MTP2
)
Traylist
[
rfid
].
HasLoadCheck
+=
reelcheck
==
0
?
-
1
:
1
;
trayInfo
=
Traylist
[
rfid
];
//Statistics();
}
...
...
@@ -56,6 +57,12 @@ namespace DeviceLibrary
lock
(
Traylist
)
{
LogUtil
.
info
(
$
"SetTrayLoadInfo:{rfid},{requestLoadInfo?.LoadParam?.ToStr()},{requestLoadInfo?.DeviceGroupName}"
);
if
(!
Traylist
.
ContainsKey
(
rfid
))
{
Traylist
.
Add
(
rfid
,
new
TrayInfo
());
Traylist
[
rfid
].
RFID
=
rfid
;
Traylist
[
rfid
].
LastUpdateTime
=
DateTime
.
Now
;
}
if
(
requestLoadInfo
==
null
)
{
Traylist
[
rfid
].
SetToEmpty
();
...
...
@@ -131,13 +138,21 @@ namespace DeviceLibrary
TrayRequest
[
remoteLoad
.
GroupName
]
=
remoteLoad
.
RequestLoadInfo
;
}
}
public
static
bool
CalcNeedTrans
(
int
curaddr1
,
int
destaddr1
,
bool
hasload
)
{
public
static
bool
CalcNeedTrans
(
int
curaddr1
,
int
destaddr1
,
bool
hasload
,
TrayTypeE
trayType
)
{
if
(!
hasload
)
{
var
addrs
=
TrayRequest
.
Values
.
Select
(
x
=>
new
{
TaryType
=
x
.
GetTrayType
,
Addr
=
GetAddrByGroupName
(
x
.
DeviceGroupName
)
}).
ToList
();
if
(
curaddr1
==
19
&&
RobotManage
.
mainMachine
.
ServerCM
.
OutMaterialTaskCount
>
Setting_Init
.
Device_LS3_MTP2_OutTaskMaxCount
&&
trayType
==
TrayTypeE
.
MTP2
)
{
return
true
;
}
if
(
curaddr1
==
19
&&
RobotManage
.
mainMachine
.
ServerCM
.
OutReelTaskCount
>
Setting_Init
.
Device_LS3_MTP1_OutTaskMaxCount
&&
trayType
==
TrayTypeE
.
MTP1
)
{
return
true
;
}
var
addrs
=
TrayRequest
.
Values
.
Where
(
x
=>
x
.
TrayType
==
trayType
.
ToString
()).
Select
(
x
=>
new
{
TaryType
=
x
.
GetTrayType
,
Addr
=
GetAddrByGroupName
(
x
.
DeviceGroupName
)
}).
ToList
();
foreach
(
var
a
in
addrs
)
{
var
trayaddrs
=
TrayManager
.
Traylist
.
Values
.
Where
(
t
=>
(
DateTime
.
Now
-
t
.
LastUpdateTime
).
TotalSeconds
<
3
0
&&
t
.
TrayType
==
a
.
TaryType
&&
!
hasload
).
Select
(
t
=>
t
.
LastAddr
).
ToList
();
var
trayaddrs
=
TrayManager
.
Traylist
.
Values
.
Where
(
t
=>
(
DateTime
.
Now
-
t
.
LastUpdateTime
).
TotalSeconds
<
6
0
&&
t
.
TrayType
==
a
.
TaryType
&&
!
hasload
).
Select
(
t
=>
t
.
LastAddr
).
ToList
();
if
(
trayaddrs
.
Count
==
0
)
return
false
;
...
...
@@ -252,6 +267,17 @@ namespace DeviceLibrary
}
return
false
;
}
/// <summary>
/// 是否需要等待处理NG物料
/// </summary>
/// <param name="remoteLoad"></param>
/// <returns></returns>
public
static
bool
IsNeedProcessNG
(
RemoteLoad
remoteLoad
)
{
var
requestLoadInfo
=
remoteLoad
.
RequestLoadInfo
;
var
xx
=
TrayManager
.
Traylist
.
Values
.
ToList
().
Where
(
t
=>
t
.
HasLoad
&&
t
.
LoadType
==
requestLoadInfo
.
GetTrayType
&&
(
t
.
LastAddr
>=
20
||
t
.
LastAddr
<
2
));
return
xx
.
Count
()
>
0
;
}
/// <summary>
/// 空托盘数量
...
...
DeviceLibrary/theMachine/sub/IDevice.cs
查看文件 @
40e1960
...
...
@@ -17,6 +17,7 @@ namespace DeviceLibrary
void
TrayRelease
();
bool
IsFree
();
bool
FrontCheck
(
int
curaddr
);
void
FrontStopProcess
();
}
public
enum
DeviceStateE
...
...
DeviceLibrary/theMachine/sub/MI.cs
查看文件 @
40e1960
...
...
@@ -32,9 +32,10 @@ namespace DeviceLibrary
MoveInfo
RoboMoveInfo
;
//CylinderManger Location;
public
AxisBean
Comp
;
public
AxisBean
Rotate
;
//
public AxisBean Rotate;
URRobotControl
Robot
;
RobotHelper
robotHelper
;
BufferSlotsManger
BufferSlotsManger
;
string
POS_Start
=
"MI1"
;
public
MI
(
DeviceGroup
device
,
out
string
msg
)
:
base
()
{
...
...
@@ -56,7 +57,8 @@ namespace DeviceLibrary
}
robotHelper
=
new
RobotHelper
(
Robot
);
Comp
=
AxisBean
.
List
[
DeviceGroup
.
GroupName
][
0
];
Rotate
=
AxisBean
.
List
[
DeviceGroup
.
GroupName
][
1
];
//Rotate = AxisBean.List[DeviceGroup.GroupName][1];
BufferSlotsManger
=
new
BufferSlotsManger
(
POS_Start
);
}
...
...
@@ -102,6 +104,14 @@ namespace DeviceLibrary
MsgService
.
MSList
[
GroupName
+
"-T"
].
Show
();
}
}
public
void
Reset
()
{
Robot
.
SendMoveCmd
(
1
,
Setting_Init
.
URRobot_CI_Speed_Rate
);
Config
.
Set
(
"RuntimeRobot_MoveStep"
,
"Wait"
);
Config
.
Set
(
"RuntimeRobot_Arm_MoveStep"
,
"Wait"
);
}
private
bool
DeviceCheck
()
{
...
...
@@ -111,7 +121,7 @@ namespace DeviceLibrary
return
false
;
}
if
(!
robotHelper
.
RobotStatus
)
{
Msg
.
add
(
POS_Start
+
"机器人当前不可用"
,
MsgLevel
.
alarm
);
Msg
.
add
(
POS_Start
+
crc
.
GetString
(
"Res0058"
,
"机器人当前不可用"
)
,
MsgLevel
.
alarm
);
return
false
;
}
return
true
;
...
...
@@ -161,15 +171,14 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
MI_01
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
MI_02
);
//Location.ToHigh(MoveInfo);
RoboMoveInfo
.
MoveParam
=
MoveInfo
.
MoveParam
.
clone
();
RoboMoveInfo
.
NextMoveStep
(
MoveStep
.
MI_01
);
MoveInfo
.
log
(
"机器人开始取料"
);
break
;
case
MoveStep
.
MI_02
:
if
(
RoboMoveInfo
.
MoveStep
>=
MoveStep
.
MI_40
)
if
(
RoboMoveInfo
.
MoveStep
==
MoveStep
.
MI_ReelTacked
)
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
MI_0
3
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
MI_0
4
);
if
(
FromPos
.
PositionNum
.
EndsWith
(
"MT"
))
{
RemoteLoad
remoteLoad
=
new
RemoteLoad
();
...
...
@@ -189,15 +198,19 @@ namespace DeviceLibrary
}
break
;
case
MoveStep
.
MI_0
3
:
if
(
RoboMoveInfo
.
MoveStep
>=
MoveStep
.
MI_44
)
case
MoveStep
.
MI_0
4
:
if
(
CurrentVStore
.
RTStoreStatus
==
RTStoreStatus
.
Ready
||
CurrentVStore
.
RTStoreStatus
==
RTStoreStatus
.
LockToInStore
)
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
MI_04
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
MI_05
);
RoboMoveInfo
.
NextMoveStep
(
MoveStep
.
MI_40
);
MoveInfo
.
log
(
"机器人开始放料"
);
CurrentVStore
.
RequestInStore
(
new
JobInfo
(
RoboMoveInfo
.
MoveParam
.
WareCode
,
""
,
RoboMoveInfo
.
MoveParam
.
PlateW
,
RoboMoveInfo
.
MoveParam
.
PlateH
));
}
else
{
MoveInfo
.
log
(
"机器人放料时发现舱门口有料"
);
}
break
;
case
MoveStep
.
MI_0
4
:
case
MoveStep
.
MI_0
5
:
if
(
RoboMoveInfo
.
MoveStep
==
MoveStep
.
Wait
)
{
MoveInfo
.
log
(
"放入料仓口完成:"
+
RoboMoveInfo
.
MoveParam
.
ToStr
());
...
...
@@ -206,7 +219,32 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
MI_50
:
CurrntOutReadyStore
=
VStoreCollection
.
VStoreList
.
Values
.
ToList
().
Find
(
vs
=>
vs
.
RTStoreStatus
==
RTStoreStatus
.
OutStoreReady
);
var
InStoreError
=
VStoreCollection
.
VStoreList
.
Values
.
ToList
().
Find
(
vs
=>
vs
.
RTStoreStatus
==
RTStoreStatus
.
InStoreError
||
vs
.
RTStoreStatus
==
RTStoreStatus
.
InStoreDataTimeOut
||
vs
.
TerminalError
);
if
(
InStoreError
!=
null
)
{
var
result
=
TheLine
.
GetReelSize
<
ResultData
>(
InStoreError
.
CurrentTerminalReelID
);
if
(
result
!=
null
&&
result
.
code
==
0
)
{
CurrntOutReadyStore
=
InStoreError
;
InStoreError
.
ServerCM
.
cancelPutInTask
(
InStoreError
.
CurrentTerminalReelID
);
CurrentJobInfo
=
new
JobInfo
(
InStoreError
.
CurrentTerminalReelID
,
""
,
int
.
Parse
(
result
.
data
[
"plateW"
]),
int
.
Parse
(
result
.
data
[
"plateH"
]));
InStoreError
.
InStoreJobInfo
=
null
;
MoveInfo
.
log
(
"从服务器检索到物料数据:"
+
CurrentJobInfo
.
ToStr
());
MoveInfo
.
MoveParam
.
IsNg
=
true
;
MoveInfo
.
MoveParam
.
NgMsg
=
InStoreError
.
CID
+
"-"
+
InStoreError
.
CurrentTowerStatusText
;
MoveInfo
.
log
(
"检测到有料仓入库NG:"
+
MoveInfo
.
MoveParam
.
NgMsg
);
}
else
{
MoveInfo
.
log
(
"没有找到,在等待出库的料仓"
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
TrayStop
.
DeviceList
[
GroupName
].
TrayRelease
();
return
;
}
}
else
{
var
random
=
new
Random
(
DateTime
.
Now
.
Millisecond
);
CurrntOutReadyStore
=
VStoreCollection
.
VStoreList
.
Values
.
ToList
().
FindAll
(
vs
=>
vs
.
RTStoreStatus
==
RTStoreStatus
.
OutStoreReady
).
OrderBy
(
x
=>
random
.
Next
()).
FirstOrDefault
();
if
(
CurrntOutReadyStore
!=
null
)
{
if
(
string
.
IsNullOrEmpty
(
CurrntOutReadyStore
.
CurrentTerminalReelID
))
...
...
@@ -235,32 +273,6 @@ namespace DeviceLibrary
}
else
{
var
InStoreError
=
VStoreCollection
.
VStoreList
.
Values
.
ToList
().
Find
(
vs
=>
vs
.
RTStoreStatus
==
RTStoreStatus
.
InStoreError
||
vs
.
RTStoreStatus
==
RTStoreStatus
.
InStoreDataTimeOut
);
if
(
InStoreError
!=
null
)
{
var
result
=
TheLine
.
GetReelSize
<
ResultData
>(
InStoreError
.
CurrentTerminalReelID
);
if
(
result
!=
null
&&
result
.
code
==
0
)
{
CurrntOutReadyStore
=
InStoreError
;
InStoreError
.
ServerCM
.
cancelPutInTask
(
InStoreError
.
CurrentTerminalReelID
);
CurrentJobInfo
=
new
JobInfo
(
InStoreError
.
CurrentTerminalReelID
,
""
,
int
.
Parse
(
result
.
data
[
"plateW"
]),
int
.
Parse
(
result
.
data
[
"plateH"
]));
InStoreError
.
InStoreJobInfo
=
null
;
MoveInfo
.
log
(
"从服务器检索到物料数据:"
+
CurrentJobInfo
.
ToStr
());
MoveInfo
.
MoveParam
.
IsNg
=
true
;
MoveInfo
.
MoveParam
.
NgMsg
=
InStoreError
.
CID
+
"入库异常"
;
MoveInfo
.
log
(
"检测到有料仓入库NG:"
+
InStoreError
.
CID
);
}
else
{
MoveInfo
.
log
(
"没有找到,在等待出库的料仓"
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
TrayStop
.
DeviceList
[
GroupName
].
TrayRelease
();
return
;
}
}
else
{
MoveInfo
.
log
(
"没有找到,在等待出库的料仓"
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
TrayStop
.
DeviceList
[
GroupName
].
TrayRelease
();
...
...
@@ -285,10 +297,10 @@ namespace DeviceLibrary
MoveInfo
.
NextMoveStep
(
MoveStep
.
MI_52
);
RoboMoveInfo
.
MoveParam
=
MoveInfo
.
MoveParam
.
clone
();
RoboMoveInfo
.
NextMoveStep
(
MoveStep
.
MI_01
);
MoveInfo
.
log
(
"机器人开始取
放
料"
);
MoveInfo
.
log
(
"机器人开始取料"
);
break
;
case
MoveStep
.
MI_52
:
if
(
RoboMoveInfo
.
MoveStep
>=
MoveStep
.
MI_40
)
if
(
RoboMoveInfo
.
MoveStep
==
MoveStep
.
MI_ReelTacked
)
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
MI_53
);
lock
(
VStoreCollection
.
OutStoreReelInfo
)
...
...
@@ -297,11 +309,26 @@ namespace DeviceLibrary
//CurrntOutReadyStore.CurrentTerminalReelID = "";
}
TheLine
.
UpdateLocInfo
(
""
,
MoveInfo
.
MoveParam
.
WareCode
,
TheLine
.
LineStatusE
.
INROBOT
,
GroupName
);
MoveInfo
.
log
(
"机器人已取到料"
);
if
(
CurrntOutReadyStore
.
TerminalError
)
{
MoveInfo
.
log
(
$
"当前出库料仓[{CurrntOutReadyStore.CID}]存在状态错误:"
+
CurrntOutReadyStore
.
RTStoreStatus
);
CurrntOutReadyStore
.
RTStoreStatus
=
RTStoreStatus
.
Busy
;
}
if
(
MoveInfo
.
MoveParam
.
IsNg
&&
CurrntOutReadyStore
.
TerminalError
&&
IOValue
(
IO_Type
.
MI_Robot_Reel_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
MI_Robot_Clamp_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
MoveInfo
.
log
(
"机器人抓取NG料后发现夹爪上没有料,流程结束处理"
);
RoboMoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
}
}
break
;
case
MoveStep
.
MI_53
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
MI_54
);
RoboMoveInfo
.
NextMoveStep
(
MoveStep
.
MI_40
);
MoveInfo
.
log
(
"机器人开始放料"
);
break
;
case
MoveStep
.
MI_54
:
if
(
RoboMoveInfo
.
MoveStep
>=
MoveStep
.
MI_44
)
{
MoveInfo
.
log
(
"机器人完成放料"
);
...
...
@@ -315,10 +342,10 @@ namespace DeviceLibrary
TrayManager
.
TrayRelease
(
remoteLoad
);
//这条会自动放行托盘并且写入托盘目的地
TheLine
.
UpdateLocInfo
(
""
,
MoveInfo
.
MoveParam
.
WareCode
,
TheLine
.
LineStatusE
.
INLINE
,
CurrrentRFID
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
MI_5
4
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
MI_5
5
);
}
break
;
case
MoveStep
.
MI_5
4
:
case
MoveStep
.
MI_5
5
:
if
(
RoboMoveInfo
.
MoveStep
==
MoveStep
.
Wait
)
{
MoveInfo
.
log
(
"机器人任务结束"
);
...
...
@@ -388,11 +415,11 @@ namespace DeviceLibrary
RoboMoveInfo
.
log
(
"机器人到P1"
);
break
;
case
MoveStep
.
MI_08
:
RoboMoveInfo
.
NextMoveStep
(
MoveStep
.
MI_
40
);
RoboMoveInfo
.
NextMoveStep
(
MoveStep
.
MI_
ReelTacked
);
RoboMoveInfo
.
log
(
"机器人取料完成"
);
break
;
//
放料到缓存位置
//
机器人放料
case
MoveStep
.
MI_40
:
RoboMoveInfo
.
NextMoveStep
(
MoveStep
.
MI_41
);
robotHelper
.
Move
(
RoboMoveInfo
,
ToPos
.
Put_P2
);
...
...
@@ -646,7 +673,7 @@ namespace DeviceLibrary
MoveInfo
.
NextMoveStep
(
MoveStep
.
H02_HomeReset
);
}
else
{
Msg
.
add
(
"机器人状态异常:"
+
Robot
.
CurDashboardReponse
,
MsgLevel
.
alarm
);
Msg
.
add
(
crc
.
GetString
(
"Res0059"
,
"机器人状态异常:"
)
+
Robot
.
CurDashboardReponse
,
MsgLevel
.
alarm
);
}
break
;
case
MoveStep
.
H12_HomeReset
:
...
...
@@ -686,9 +713,13 @@ namespace DeviceLibrary
if
(
reelParam
==
null
)
{
//空托盘,判断有没有出库任务
var
sc
=
VStoreCollection
.
VStoreList
.
Values
.
ToList
().
Find
(
vs
=>
vs
.
RTStoreStatus
==
RTStoreStatus
.
OutStoreReady
||
vs
.
RTStoreStatus
==
RTStoreStatus
.
InStoreError
);
var
sc
=
VStoreCollection
.
VStoreList
.
Values
.
ToList
().
Find
(
vs
=>
vs
.
RTStoreStatus
==
RTStoreStatus
.
OutStoreReady
||
vs
.
RTStoreStatus
==
RTStoreStatus
.
InStoreError
||
vs
.
RTStoreStatus
==
RTStoreStatus
.
InStoreDataTimeOut
||
vs
.
TerminalError
);
return
(
sc
!=
null
);
}
if
(
string
.
IsNullOrEmpty
(
reelParam
.
SubCID
))
{
MoveInfo
.
log
(
"SubCID为空"
);
return
false
;
}
if
(!
VStoreCollection
.
VStoreList
.
ContainsKey
(
reelParam
.
SubCID
))
{
MoveInfo
.
log
(
"RT料仓CID不存在:"
+
reelParam
.
SubCID
);
...
...
@@ -736,5 +767,10 @@ namespace DeviceLibrary
return
RobotManage
.
CIPostion
[
pos
];
}
public
void
FrontStopProcess
()
{
//throw new NotImplementedException();
}
}
}
\ No newline at end of file
DeviceLibrary/theMachine/sub/SideMove.cs
查看文件 @
40e1960
...
...
@@ -41,8 +41,8 @@ namespace DeviceLibrary
DeviceGroup
=
device
;
GroupName
=
DeviceGroup
.
GroupName
;
Msg
=
new
MsgService
(
GroupName
);
LSAMoveInfo
=
new
MoveInfo
(
GroupName
+
"_
A
"
);
LSBMoveInfo
=
new
MoveInfo
(
GroupName
+
"_
B
"
);
LSAMoveInfo
=
new
MoveInfo
(
GroupName
+
"_
1
"
);
LSBMoveInfo
=
new
MoveInfo
(
GroupName
+
"_
2
"
);
Location_A
=
new
CylinderManger
(
$
"A侧顶升"
,
GroupName
,
IO_Type
.
Ls_A_Location_Up
,
IO_Type
.
Ls_A_Location_Down
);
Location_B
=
new
CylinderManger
(
$
"B侧顶升"
,
GroupName
,
IO_Type
.
Ls_B_Location_Up
,
IO_Type
.
Ls_B_Location_Down
);
...
...
@@ -86,6 +86,8 @@ namespace DeviceLibrary
DeviceState
=
DeviceStateE
.
Stop
;
Line
.
LineStop
(
"n"
);
LSAMoveInfo
.
log
(
"停止运行"
);
Task
.
Run
(()
=>
{
Task
.
Delay
(
1000
).
Wait
();
IOMove
(
IO_Type
.
Ls_A_Front_Stop
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
Ls_B_Front_Stop
,
IO_VALUE
.
LOW
);
Line
.
LineStop
(
"n"
);
});
}
public
void
Process
()
{
...
...
@@ -123,16 +125,16 @@ namespace DeviceLibrary
case
MoveStep
.
SideMove_01
:
LSAMoveInfo
.
NextMoveStep
(
MoveStep
.
SideMove_01
);
bool
Forcetry
=
false
;
if
(
LastGoInFail
&&
(
LastGoInFailTime
-
DateTime
.
Now
).
TotalSeconds
>
10
)
{
Forcetry
=
true
;
LSAMoveInfo
.
log
(
"上次托盘进入失败本次重试"
);
}
if
(
IOValue
(
IO_Type
.
Ls_B_Tray_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
break
;
}
else
//
if (LastGoInFail && (LastGoInFailTime - DateTime.Now).TotalSeconds > 10)
//
{
//
Forcetry = true;
//
LSAMoveInfo.log("上次托盘进入失败本次重试");
//
}
//
if (IOValue(IO_Type.Ls_B_Tray_Check).Equals(IO_VALUE.HIGH))
//
{
//
break;
//
}
//
else
if
(
IOValue
(
IO_Type
.
Ls_A_Tray_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
LSAMoveInfo
.
NextMoveStep
(
MoveStep
.
SideMove_04
);
...
...
@@ -145,8 +147,7 @@ namespace DeviceLibrary
Location_A
.
ToLow
(
LSAMoveInfo
);
//Location_B.ToLow(LSAMoveInfo);
LSAMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
500
));
//LSAMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
else
{
...
...
@@ -164,7 +165,7 @@ namespace DeviceLibrary
{
IOMove
(
IO_Type
.
Ls_A_Front_Stop
,
IO_VALUE
.
LOW
);
}
if
(
IO
Value
(
IO_Type
.
Ls_A_Tray_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
if
(
IO
Monitor
.
IODebound
(
IO_Type
.
Ls_A_Tray_Check
,
GroupName
,
IO_VALUE
.
HIGH
))
{
LSAMoveInfo
.
NextMoveStep
(
MoveStep
.
SideMove_04
);
LSAMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1500
));
LastGoInFail
=
false
;
...
...
@@ -183,7 +184,7 @@ namespace DeviceLibrary
case
MoveStep
.
SideMove_04
:
if
(!
FwdFree
(
DeviceGroup
.
addr_1
))
return
;
if
(
LSBMoveInfo
.
MoveStep
==
MoveStep
.
Wait
)
if
(
LSBMoveInfo
.
MoveStep
==
MoveStep
.
Wait
&&
IOMonitor
.
IODebound
(
IO_Type
.
Ls_B_Tray_Check
,
GroupName
,
IO_VALUE
.
LOW
,
1000
)
)
{
LSAMoveInfo
.
NextMoveStep
(
MoveStep
.
SideMove_06
);
IOMove
(
IO_Type
.
Ls_B_BufStop_Fwd
,
IO_VALUE
.
HIGH
,
500
);
...
...
@@ -204,6 +205,7 @@ namespace DeviceLibrary
case
MoveStep
.
SideMove_07
:
LSAMoveInfo
.
NextMoveStep
(
MoveStep
.
SideMove_08
);
LSAMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
Ls_B_Tray_Check
,
IO_VALUE
.
HIGH
));
LSAMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
Ls_A_Tray_Check
,
IO_VALUE
.
LOW
));
break
;
case
MoveStep
.
SideMove_08
:
LSAMoveInfo
.
NextMoveStep
(
MoveStep
.
SideMove_09
);
...
...
@@ -218,6 +220,7 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
SideMove_10
:
LSAMoveInfo
.
NextMoveStep
(
MoveStep
.
SideMove_01
);
break
;
}
}
...
...
@@ -282,16 +285,17 @@ namespace DeviceLibrary
Minfo
.
NextMoveStep
(
MoveStep
.
SideMove_01
);
bool
Forcetry
=
false
;
if
(
LastGoInFail
&&
(
LastGoInFailTime
-
DateTime
.
Now
).
TotalSeconds
>
5
)
{
Forcetry
=
true
;
LSAMoveInfo
.
log
(
"上次托盘进入失败本次重试"
);
}
//
if (LastGoInFail && (LastGoInFailTime - DateTime.Now).TotalSeconds > 5)
//
{
//
Forcetry = true;
//
LSAMoveInfo.log("上次托盘进入失败本次重试");
//
}
if
(
lsb
.
MoveStep
>=
MoveStep
.
SideMove_10
&&
lsb
.
MoveStep
<
MoveStep
.
SideMove_50
)
{
Msg
.
add
(
sideb
+
crc
.
GetString
(
"Res0015"
,
"侧穿越中"
),
MsgLevel
.
info
);
}
else
if
(
IOValue
(
Ls_A_Tray_Check
).
Equals
(
IO_VALUE
.
HIGH
))
}
else
if
(
IOValue
(
Ls_A_Tray_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
Minfo
.
log
(
"中间检测到托盘"
);
Minfo
.
NextMoveStep
(
MoveStep
.
SideMove_06
);
...
...
@@ -301,6 +305,7 @@ namespace DeviceLibrary
{
Minfo
.
NextMoveStep
(
MoveStep
.
SideMove_02
);
Location_a
.
ToLow
(
Minfo
);
if
(
LS_Type
==
LS_TypeE
.
OneWay
&&
Minfo
==
LSAMoveInfo
)
IOMove
(
Ls_A_Stop
,
IO_VALUE
.
LOW
);
}
else
...
...
@@ -313,6 +318,7 @@ namespace DeviceLibrary
Minfo
.
log
(
$
"{Ls_A_Front_Stop}下降,{Ls_A_BufStop_Rwd}回退"
);
//IOMove(Ls_A_Front_Stop, IO_VALUE.HIGH, Ls_A_Front_Check, IO_VALUE.LOW, StopDelayMS);
IOMove
(
Ls_A_Front_Stop
,
IO_VALUE
.
HIGH
);
if
(
LS_Type
==
LS_TypeE
.
OneWay
&&
Minfo
==
LSAMoveInfo
)
IOMove
(
Ls_A_BufStop_Rwd
,
IO_VALUE
.
HIGH
,
StopBufDelayMS
);
break
;
case
MoveStep
.
SideMove_03
:
...
...
@@ -355,7 +361,7 @@ namespace DeviceLibrary
var
rfid
=
Common
.
RfidFilter
(
data
);
TrayManager
.
Process
(
Minfo
,
rfid
,
addr
,-
1
,
out
TrayInfo
trayInfo
);
if
(
TrayManager
.
CalcNeedTrans
(
addr
,
trayInfo
.
DestinationAddr
,
trayInfo
.
HasLoad
))
if
(
TrayManager
.
CalcNeedTrans
(
addr
,
trayInfo
.
DestinationAddr
,
trayInfo
.
HasLoad
,
trayInfo
.
TrayType
))
Minfo
.
NextMoveStep
(
MoveStep
.
SideMove_10
);
else
Minfo
.
NextMoveStep
(
MoveStep
.
SideMove_06
);
...
...
@@ -393,7 +399,7 @@ namespace DeviceLibrary
IOMove
(
Ls_A_Stop
,
IO_VALUE
.
LOW
);
Minfo
.
NextMoveStep
(
MoveStep
.
SideMove_08
);
}
else
if
(
Minfo
.
IsTimeOut
(
5
))
{
else
if
(
Minfo
.
IsTimeOut
(
10
))
{
Minfo
.
NextMoveStep
(
MoveStep
.
SideMove_06
);
}
break
;
...
...
@@ -412,28 +418,35 @@ namespace DeviceLibrary
else
if
(
lsb
.
MoveStep
>=
MoveStep
.
SideMove_10
)
{
Minfo
.
NextMoveStep
(
MoveStep
.
SideMove_06
);
Minfo
.
log
(
$
"{sideb}侧也在等待横移,本侧直接穿过"
);
Minfo
.
log
(
string
.
Format
(
"{0}侧也在等待横移,本侧直接穿过"
,
sideb
)
);
}
else
if
(
LSBMoveInfo
.
MoveStep
==
MoveStep
.
SideMove_10
&&
Minfo
==
LSAMoveInfo
)
{
Minfo
.
NextMoveStep
(
MoveStep
.
SideMove_11
);
}
else
{
Msg
.
add
(
$
"等待{sideb}侧空闲"
,
MsgLevel
.
info
);
Msg
.
add
(
string
.
Format
(
crc
.
GetString
(
"Res0060"
,
"等待{0}侧空闲"
),
sideb
)
,
MsgLevel
.
info
);
}
break
;
case
MoveStep
.
SideMove_11
:
if
(
IOMonitor
.
IODebound
(
Ls_B_Tray_Check
,
GroupName
,
IO_VALUE
.
LOW
))
{
Minfo
.
NextMoveStep
(
MoveStep
.
SideMove_12
);
Location_a
.
ToHigh
(
Minfo
);
Location_b
.
ToHigh
(
Minfo
);
IOMove
(
Ls_B_BufStop_Fwd
,
IO_VALUE
.
HIGH
,
StopBufDelayMS
);
//Minfo.log($"2侧顶升升起");
Minfo
.
log
(
$
"{sideb}侧已无托盘"
);
}
else
{
Msg
.
add
(
string
.
Format
(
crc
.
GetString
(
"Res0061"
,
"等待{0}侧托盘离开"
),
sideb
),
MsgLevel
.
info
);
}
break
;
case
MoveStep
.
SideMove_12
:
Minfo
.
NextMoveStep
(
MoveStep
.
SideMove_13
);
Line
.
LineRun
(
"n"
,
Minfo
==
LSAMoveInfo
?
false
:
true
,
999
);
Minfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
Ls_B_Tray_Check
,
IO_VALUE
.
HIGH
));
Minfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1500
));
//Minfo.log($"横移线体运行");
break
;
case
MoveStep
.
SideMove_13
:
...
...
@@ -441,6 +454,7 @@ namespace DeviceLibrary
Location_a
.
ToLow
(
Minfo
);
Minfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
500
));
lsb
.
NextMoveStep
(
MoveStep
.
SideMove_50
);
lsb
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
Minfo
.
log
(
$
"横移本侧结束"
);
break
;
///本侧接管横移后通过
...
...
@@ -594,9 +608,24 @@ namespace DeviceLibrary
{
if
(
DeviceGroup
.
addr_1
==
curaddr
)
return
IOValue
(
IO_Type
.
Ls_A_Front_Check
).
Equals
(
IO_VALUE
.
LOW
);
else
else
if
(
LS_Type
!=
LS_TypeE
.
NoRfid
)
return
IOValue
(
IO_Type
.
Ls_B_Front_Check
).
Equals
(
IO_VALUE
.
LOW
);
else
return
true
;
}
public
void
FrontStopProcess
()
{
if
(
IOValue
(
IO_Type
.
Ls_A_Front_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
IOMove
(
IO_Type
.
Ls_A_Front_Stop
,
IO_VALUE
.
LOW
);
}
if
(
LS_Type
!=
LS_TypeE
.
NoRfid
&&
IOValue
(
IO_Type
.
Ls_B_Front_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
IOMove
(
IO_Type
.
Ls_B_Front_Stop
,
IO_VALUE
.
LOW
);
}
}
enum
LS_TypeE
{
NoRfid
,
OneWay
,
...
...
DeviceLibrary/theMachine/sub/TransplantMove.cs
查看文件 @
40e1960
...
...
@@ -69,6 +69,8 @@ namespace DeviceLibrary
{
DeviceState
=
DeviceStateE
.
Stop
;
MoveInfo
.
log
(
"停止运行"
);
Task
.
Run
(()
=>
{
Task
.
Delay
(
1000
).
Wait
();
IOMove
(
IO_Type
.
AMH_Front_Stop
,
IO_VALUE
.
LOW
);
});
}
public
void
Process
()
{
...
...
@@ -147,7 +149,7 @@ namespace DeviceLibrary
if
(
IOValue
(
IO_Type
.
AMH_Reel_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
RemoteLoad
remoteLoad1
=
new
RemoteLoad
();
remoteLoad1
.
Seq
=
DateTime
.
Now
.
Ticks
;
remoteLoad1
.
Seq
=
Snowflake
.
Instance
().
GetId
()
;
remoteLoad1
.
Action
=
"DoorLock"
;
remoteLoad1
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad1
.
RequestLoadInfo
.
IsEmpty
=
false
;
...
...
@@ -188,7 +190,7 @@ namespace DeviceLibrary
if
(
IOValue
(
IO_Type
.
AMH_Reel_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
RemoteLoad
remoteLoad2
=
new
RemoteLoad
();
remoteLoad2
.
Seq
=
DateTime
.
Now
.
Ticks
;
remoteLoad2
.
Seq
=
Snowflake
.
Instance
().
GetId
()
;
remoteLoad2
.
Action
=
"DoorLock"
;
remoteLoad2
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad2
.
RequestLoadInfo
.
IsEmpty
=
true
;
...
...
@@ -248,7 +250,7 @@ namespace DeviceLibrary
IOMove
(
IO_Type
.
AMH_Tray_Stop
,
IO_VALUE
.
LOW
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
if
(
GroupName
==
"AMH-SBSH2"
)
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3
000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
4
000
));
MoveInfo
.
log
(
"托盘已放行"
);
}
else
if
(
MoveInfo
.
IsTimeOut
(
10
))
{
MoveInfo
.
log
(
"托盘放行失败,重新放行"
);
...
...
@@ -293,7 +295,7 @@ namespace DeviceLibrary
MoveInfo
.
NextMoveStep
(
MoveStep
.
TransplantMove_14
);
MoveInfo
.
log
(
"检测到物料已离开"
);
}
else
{
else
if
(
MoveInfo
.
IsTimeOut
(
1
))
{
MetrialGetRetry
++;
if
(
MetrialGetRetry
>
3
)
{
Msg
.
add
(
$
"{MoveInfo.Name}取料失败"
,
MsgLevel
.
alarm
);
...
...
@@ -368,7 +370,7 @@ namespace DeviceLibrary
MoveInfo
.
NextMoveStep
(
MoveStep
.
TransplantMove_24
);
var
remoteLoad
=
new
RemoteLoad
();
remoteLoad
.
Seq
=
DateTime
.
Now
.
Ticks
;
remoteLoad
.
Seq
=
Snowflake
.
Instance
().
GetId
()
;
remoteLoad
.
Action
=
"DoorRelease"
;
remoteLoad
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad
.
RequestLoadInfo
.
IsEmpty
=
true
;
//true出库 false入库
...
...
@@ -427,7 +429,7 @@ namespace DeviceLibrary
IOMove
(
IO_Type
.
AMH_Sucker
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
AMH_Sucker_Release
,
IO_VALUE
.
HIGH
,
2000
);
ConfigHelper
.
Config
.
Set
(
$
"Runtime_{GroupName}_IsSucker"
,
false
);
TheLine
.
UpdateLocInfo
(
""
,
MoveInfo
.
MoveParam
.
WareCode
,
TheLine
.
LineStatusE
.
BOXDOOR
,
GroupName
);
//
TheLine.UpdateLocInfo("", MoveInfo.MoveParam.WareCode, TheLine.LineStatusE.BOXDOOR, GroupName);
break
;
case
MoveStep
.
TransplantMove_27
:
...
...
@@ -502,7 +504,7 @@ namespace DeviceLibrary
case
MoveStep
.
TransplantMove_06
:
RemoteLoad
remoteLoad
=
new
RemoteLoad
();
remoteLoad
.
Action
=
"DoorRelease"
;
remoteLoad
.
Seq
=
DateTime
.
Now
.
Ticks
;
remoteLoad
.
Seq
=
Snowflake
.
Instance
().
GetId
()
;
remoteLoad
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad
.
RequestLoadInfo
.
IsEmpty
=
false
;
remoteLoad
.
RequestLoadInfo
.
LoadParam
=
MoveInfo2
.
MoveParam
.
clone
();
...
...
@@ -607,10 +609,12 @@ namespace DeviceLibrary
public
bool
IsFree
()
{
if
(
MoveInfo2
.
MoveStep
!=
MoveStep
.
Wait
)
{
if
(
MoveInfo2
.
MoveStep
!=
MoveStep
.
Wait
||
MoveInfo
.
MoveStep
>
MoveStep
.
TransplantMove_26
)
{
return
false
;
}
if
(
MoveInfo
.
MoveStep
>=
MoveStep
.
TransplantMove_10
&&
MoveInfo
.
MoveStep
<=
MoveStep
.
TransplantMove_20
)
return
false
;
return
true
;
}
...
...
@@ -624,5 +628,13 @@ namespace DeviceLibrary
MoveInfo
.
NewMove
(
MoveStep
.
H01_HomeReset
);
MoveInfo
.
log
(
"开始重置"
);
}
public
void
FrontStopProcess
()
{
if
(
IOValue
(
IO_Type
.
AMH_Front_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
IOMove
(
IO_Type
.
AMH_Front_Stop
,
IO_VALUE
.
LOW
);
}
}
}
}
\ No newline at end of file
DeviceLibrary/theMachine/sub/TrayStop.cs
查看文件 @
40e1960
...
...
@@ -72,6 +72,8 @@ namespace DeviceLibrary
{
DeviceState
=
DeviceStateE
.
Stop
;
MoveInfo
.
log
(
"停止运行"
);
Task
.
Run
(()
=>
{
Task
.
Delay
(
1000
).
Wait
();
IOMove
(
IO_Type
.
AMH_Front_Stop
,
IO_VALUE
.
LOW
);
});
}
public
void
Process
()
{
...
...
@@ -211,7 +213,7 @@ namespace DeviceLibrary
//空托盘
MoveInfo
.
NextMoveStep
(
MoveStep
.
TrayStop_07
);
RemoteLoad
remoteLoad
=
new
RemoteLoad
();
remoteLoad
.
Seq
=
DateTime
.
Now
.
Ticks
;
remoteLoad
.
Seq
=
Snowflake
.
Instance
().
GetId
()
;
remoteLoad
.
Action
=
"TrayReady"
;
remoteLoad
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad
.
RequestLoadInfo
.
TrayType
=
trayInfo
.
TrayType
.
ToString
();
...
...
@@ -229,7 +231,7 @@ namespace DeviceLibrary
//有物料
MoveInfo
.
NextMoveStep
(
MoveStep
.
TrayStop_07
);
RemoteLoad
remoteLoad
=
new
RemoteLoad
();
remoteLoad
.
Seq
=
DateTime
.
Now
.
Ticks
;
remoteLoad
.
Seq
=
Snowflake
.
Instance
().
GetId
()
;
remoteLoad
.
Action
=
"TrayReady"
;
remoteLoad
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad
.
RequestLoadInfo
.
TrayType
=
trayInfo
.
TrayType
.
ToString
();
...
...
@@ -368,7 +370,7 @@ namespace DeviceLibrary
{
if
(
IOValue
(
IO_Type
.
MI_Reel_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
Msg
.
add
(
"托盘放料后没有检测到物料"
,
MsgLevel
.
alarm
);
Msg
.
add
(
crc
.
GetString
(
"Res0062"
,
"托盘放料后没有检测到物料"
)
,
MsgLevel
.
alarm
);
return
;
}
}
...
...
@@ -383,7 +385,7 @@ namespace DeviceLibrary
if
(
GroupName
==
"AMH-ML5-1"
||
GroupName
==
"AMH-ML5-2"
)
{
var
remoteLoad
=
new
RemoteLoad
();
remoteLoad
.
Seq
=
DateTime
.
Now
.
Ticks
;
remoteLoad
.
Seq
=
Snowflake
.
Instance
().
GetId
()
;
remoteLoad
.
Action
=
"IsSafe"
;
remoteLoad
.
RequestLoadInfo
=
new
RequestLoadInfo
();
var
result
=
RemoteService
.
SendAndWait
(
GroupName
,
remoteLoad
,
6000
);
...
...
@@ -421,7 +423,7 @@ namespace DeviceLibrary
/// 释放托盘
/// </summary>
public
void
TrayRelease
()
{
MoveInfo
.
log
(
"释放托盘
"
);
MoveInfo
.
log
(
"释放托盘
:"
+
CurrrentRFID
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
TrayStop_LoadProcessed
);
if
(
TrayManager
.
Traylist
.
ContainsKey
(
CurrrentRFID
)
&&
TrayManager
.
Traylist
[
CurrrentRFID
].
HasLoad
)
{
...
...
@@ -453,7 +455,7 @@ namespace DeviceLibrary
if
(
GroupName
==
d
&&
MI
.
DeviceList
[
d
].
DeviceState
!=
DeviceStateE
.
Run
&&
MI
.
DeviceList
[
d
].
MoveInfo
.
MoveStep
!=
MoveStep
.
Wait
)
{
Msg
.
add
(
"等待"
+
d
+
"完成复位"
,
MsgLevel
.
warning
);
Msg
.
add
(
crc
.
GetString
(
"Res0157"
,
"等待"
)
+
d
+
crc
.
GetString
(
"Res0063"
,
"完成复位"
)
,
MsgLevel
.
warning
);
}
else
if
(
GroupName
==
d
&&
MI
.
DeviceList
[
d
].
DeviceState
==
DeviceStateE
.
Run
&&
MI
.
DeviceList
[
d
].
MoveInfo
.
MoveStep
!=
MoveStep
.
Wait
)
...
...
@@ -497,5 +499,13 @@ namespace DeviceLibrary
{
return
IOValue
(
IO_Type
.
MI_Front_Check
).
Equals
(
IO_VALUE
.
LOW
);
}
public
void
FrontStopProcess
()
{
if
(
IOValue
(
IO_Type
.
MI_Front_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
IOMove
(
IO_Type
.
AMH_Front_Stop
,
IO_VALUE
.
LOW
);
}
}
}
}
\ No newline at end of file
DeviceLibrary/userControl/AxisMoveControl.Designer.cs
查看文件 @
40e1960
...
...
@@ -38,9 +38,7 @@
this
.
lblAxEncAcc
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblINP
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblBUSY
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblNEL
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblORG
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblPEL
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblSvOn
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblEMG
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblWARN
=
new
System
.
Windows
.
Forms
.
Label
();
...
...
@@ -94,9 +92,7 @@
this
.
txtAPosition
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
label46
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label48
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label45
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
txtAxisValue
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
txtAxisDeviceName
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
lblServerOn
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
groupAxis
.
SuspendLayout
();
...
...
@@ -132,9 +128,7 @@
this
.
groupBox2
.
Controls
.
Add
(
this
.
lblAxEncAcc
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
lblINP
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
lblBUSY
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
lblNEL
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
lblORG
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
lblPEL
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
lblSvOn
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
lblEMG
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
lblWARN
);
...
...
@@ -169,7 +163,6 @@
this
.
lblAlarmcode
.
Tag
=
"not"
;
this
.
lblAlarmcode
.
Text
=
"ErrCode:160"
;
this
.
lblAlarmcode
.
Visible
=
false
;
this
.
lblAlarmcode
.
Click
+=
new
System
.
EventHandler
(
this
.
lblAlarmcode_Click
);
//
// label4
//
...
...
@@ -218,9 +211,9 @@
// lblINP
//
this
.
lblINP
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
FixedSingle
;
this
.
lblINP
.
Location
=
new
System
.
Drawing
.
Point
(
414
,
24
);
this
.
lblINP
.
Location
=
new
System
.
Drawing
.
Point
(
388
,
24
);
this
.
lblINP
.
Name
=
"lblINP"
;
this
.
lblINP
.
Size
=
new
System
.
Drawing
.
Size
(
56
,
30
);
this
.
lblINP
.
Size
=
new
System
.
Drawing
.
Size
(
70
,
30
);
this
.
lblINP
.
TabIndex
=
10
;
this
.
lblINP
.
Text
=
"到位"
;
this
.
lblINP
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
...
...
@@ -228,49 +221,29 @@
// lblBUSY
//
this
.
lblBUSY
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
FixedSingle
;
this
.
lblBUSY
.
Location
=
new
System
.
Drawing
.
Point
(
3
56
,
24
);
this
.
lblBUSY
.
Location
=
new
System
.
Drawing
.
Point
(
3
12
,
24
);
this
.
lblBUSY
.
Name
=
"lblBUSY"
;
this
.
lblBUSY
.
Size
=
new
System
.
Drawing
.
Size
(
56
,
30
);
this
.
lblBUSY
.
Size
=
new
System
.
Drawing
.
Size
(
70
,
30
);
this
.
lblBUSY
.
TabIndex
=
9
;
this
.
lblBUSY
.
Text
=
"忙碌"
;
this
.
lblBUSY
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
//
// lblNEL
//
this
.
lblNEL
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
FixedSingle
;
this
.
lblNEL
.
Location
=
new
System
.
Drawing
.
Point
(
298
,
24
);
this
.
lblNEL
.
Name
=
"lblNEL"
;
this
.
lblNEL
.
Size
=
new
System
.
Drawing
.
Size
(
56
,
30
);
this
.
lblNEL
.
TabIndex
=
8
;
this
.
lblNEL
.
Text
=
"负极限"
;
this
.
lblNEL
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
//
// lblORG
//
this
.
lblORG
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
FixedSingle
;
this
.
lblORG
.
Location
=
new
System
.
Drawing
.
Point
(
2
40
,
24
);
this
.
lblORG
.
Location
=
new
System
.
Drawing
.
Point
(
2
36
,
24
);
this
.
lblORG
.
Name
=
"lblORG"
;
this
.
lblORG
.
Size
=
new
System
.
Drawing
.
Size
(
56
,
30
);
this
.
lblORG
.
Size
=
new
System
.
Drawing
.
Size
(
70
,
30
);
this
.
lblORG
.
TabIndex
=
7
;
this
.
lblORG
.
Text
=
"原点"
;
this
.
lblORG
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
//
// lblPEL
//
this
.
lblPEL
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
FixedSingle
;
this
.
lblPEL
.
Location
=
new
System
.
Drawing
.
Point
(
182
,
24
);
this
.
lblPEL
.
Name
=
"lblPEL"
;
this
.
lblPEL
.
Size
=
new
System
.
Drawing
.
Size
(
56
,
30
);
this
.
lblPEL
.
TabIndex
=
6
;
this
.
lblPEL
.
Text
=
"正极限"
;
this
.
lblPEL
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
//
// lblSvOn
//
this
.
lblSvOn
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
FixedSingle
;
this
.
lblSvOn
.
Location
=
new
System
.
Drawing
.
Point
(
8
,
24
);
this
.
lblSvOn
.
Name
=
"lblSvOn"
;
this
.
lblSvOn
.
Size
=
new
System
.
Drawing
.
Size
(
56
,
30
);
this
.
lblSvOn
.
Size
=
new
System
.
Drawing
.
Size
(
70
,
30
);
this
.
lblSvOn
.
TabIndex
=
5
;
this
.
lblSvOn
.
Text
=
"伺服"
;
this
.
lblSvOn
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
...
...
@@ -278,9 +251,9 @@
// lblEMG
//
this
.
lblEMG
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
FixedSingle
;
this
.
lblEMG
.
Location
=
new
System
.
Drawing
.
Point
(
1
24
,
24
);
this
.
lblEMG
.
Location
=
new
System
.
Drawing
.
Point
(
1
60
,
24
);
this
.
lblEMG
.
Name
=
"lblEMG"
;
this
.
lblEMG
.
Size
=
new
System
.
Drawing
.
Size
(
56
,
30
);
this
.
lblEMG
.
Size
=
new
System
.
Drawing
.
Size
(
70
,
30
);
this
.
lblEMG
.
TabIndex
=
4
;
this
.
lblEMG
.
Text
=
"急停"
;
this
.
lblEMG
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
...
...
@@ -288,9 +261,9 @@
// lblWARN
//
this
.
lblWARN
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
FixedSingle
;
this
.
lblWARN
.
Location
=
new
System
.
Drawing
.
Point
(
4
72
,
24
);
this
.
lblWARN
.
Location
=
new
System
.
Drawing
.
Point
(
4
64
,
24
);
this
.
lblWARN
.
Name
=
"lblWARN"
;
this
.
lblWARN
.
Size
=
new
System
.
Drawing
.
Size
(
56
,
30
);
this
.
lblWARN
.
Size
=
new
System
.
Drawing
.
Size
(
70
,
30
);
this
.
lblWARN
.
TabIndex
=
3
;
this
.
lblWARN
.
Text
=
"警告"
;
this
.
lblWARN
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
...
...
@@ -298,9 +271,9 @@
// lblALM
//
this
.
lblALM
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
FixedSingle
;
this
.
lblALM
.
Location
=
new
System
.
Drawing
.
Point
(
66
,
24
);
this
.
lblALM
.
Location
=
new
System
.
Drawing
.
Point
(
84
,
24
);
this
.
lblALM
.
Name
=
"lblALM"
;
this
.
lblALM
.
Size
=
new
System
.
Drawing
.
Size
(
56
,
30
);
this
.
lblALM
.
Size
=
new
System
.
Drawing
.
Size
(
70
,
30
);
this
.
lblALM
.
TabIndex
=
2
;
this
.
lblALM
.
Text
=
"报警"
;
this
.
lblALM
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
...
...
@@ -592,9 +565,7 @@
this
.
panel1
.
Controls
.
Add
(
this
.
txtAPosition
);
this
.
panel1
.
Controls
.
Add
(
this
.
label46
);
this
.
panel1
.
Controls
.
Add
(
this
.
label48
);
this
.
panel1
.
Controls
.
Add
(
this
.
label45
);
this
.
panel1
.
Controls
.
Add
(
this
.
txtAxisValue
);
this
.
panel1
.
Controls
.
Add
(
this
.
txtAxisDeviceName
);
this
.
panel1
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
panel1
.
Location
=
new
System
.
Drawing
.
Point
(
7
,
17
);
this
.
panel1
.
Name
=
"panel1"
;
...
...
@@ -875,7 +846,7 @@
//
this
.
label46
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label46
.
ImageAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
this
.
label46
.
Location
=
new
System
.
Drawing
.
Point
(
6
,
93
);
this
.
label46
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
54
);
this
.
label46
.
Name
=
"label46"
;
this
.
label46
.
Size
=
new
System
.
Drawing
.
Size
(
71
,
17
);
this
.
label46
.
TabIndex
=
239
;
...
...
@@ -896,21 +867,10 @@
this
.
label48
.
Text
=
"目标位置:"
;
this
.
label48
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
//
// label45
//
this
.
label45
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label45
.
ImageAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
this
.
label45
.
Location
=
new
System
.
Drawing
.
Point
(
8
,
53
);
this
.
label45
.
Name
=
"label45"
;
this
.
label45
.
Size
=
new
System
.
Drawing
.
Size
(
69
,
20
);
this
.
label45
.
TabIndex
=
240
;
this
.
label45
.
Text
=
"端口号:"
;
this
.
label45
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
TopRight
;
//
// txtAxisValue
//
this
.
txtAxisValue
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
txtAxisValue
.
Location
=
new
System
.
Drawing
.
Point
(
8
3
,
87
);
this
.
txtAxisValue
.
Location
=
new
System
.
Drawing
.
Point
(
8
1
,
48
);
this
.
txtAxisValue
.
MaxLength
=
10
;
this
.
txtAxisValue
.
Name
=
"txtAxisValue"
;
this
.
txtAxisValue
.
ReadOnly
=
true
;
...
...
@@ -919,18 +879,6 @@
this
.
txtAxisValue
.
Tag
=
"not"
;
this
.
txtAxisValue
.
Text
=
"0"
;
//
// txtAxisDeviceName
//
this
.
txtAxisDeviceName
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
txtAxisDeviceName
.
Location
=
new
System
.
Drawing
.
Point
(
83
,
48
);
this
.
txtAxisDeviceName
.
MaxLength
=
10
;
this
.
txtAxisDeviceName
.
Name
=
"txtAxisDeviceName"
;
this
.
txtAxisDeviceName
.
ReadOnly
=
true
;
this
.
txtAxisDeviceName
.
Size
=
new
System
.
Drawing
.
Size
(
50
,
26
);
this
.
txtAxisDeviceName
.
TabIndex
=
241
;
this
.
txtAxisDeviceName
.
Tag
=
"not"
;
this
.
txtAxisDeviceName
.
Text
=
"0"
;
//
// lblServerOn
//
this
.
lblServerOn
.
AutoSize
=
true
;
...
...
@@ -995,8 +943,6 @@
internal
System
.
Windows
.
Forms
.
Label
label48
;
internal
System
.
Windows
.
Forms
.
Button
btnAxisStop
;
private
System
.
Windows
.
Forms
.
TextBox
txtAxisValue
;
private
System
.
Windows
.
Forms
.
TextBox
txtAxisDeviceName
;
private
System
.
Windows
.
Forms
.
Label
label45
;
private
System
.
Windows
.
Forms
.
Label
label46
;
private
System
.
Windows
.
Forms
.
Label
label49
;
private
System
.
Windows
.
Forms
.
Label
label24
;
...
...
@@ -1019,9 +965,7 @@
private
System
.
Windows
.
Forms
.
Label
lblAxEncAcc
;
private
System
.
Windows
.
Forms
.
Label
lblINP
;
private
System
.
Windows
.
Forms
.
Label
lblBUSY
;
private
System
.
Windows
.
Forms
.
Label
lblNEL
;
private
System
.
Windows
.
Forms
.
Label
lblORG
;
private
System
.
Windows
.
Forms
.
Label
lblPEL
;
private
System
.
Windows
.
Forms
.
Label
lblSvOn
;
private
System
.
Windows
.
Forms
.
Label
lblEMG
;
private
System
.
Windows
.
Forms
.
Label
lblWARN
;
...
...
DeviceLibrary/userControl/AxisMoveControl.cs
查看文件 @
40e1960
...
...
@@ -26,9 +26,6 @@ namespace DeviceLibrary
public
AxisMoveControl
()
{
InitializeComponent
();
if
(
DesignMode
)
return
;
this
.
Tag
=
"not"
;
crc
.
OpenResourceLog
=
true
;
crc
.
LanguageChangeEvent
+=
Crc_LanguageChangeEvent
;
crc
.
CurrLanguage
=
Setting_Init
.
Device_Default_Language
;
...
...
@@ -56,7 +53,7 @@ namespace DeviceLibrary
currentAxis
=
axisList
[
0
];
PortName
=
axisList
[
0
].
Config
.
DeviceName
;
SlvAddr
=
axisList
[
0
].
Config
.
GetAxisValue
();
txtAxisDeviceName
.
Text
=
PortName
;
//
txtAxisDeviceName.Text = PortName;
txtAxisValue
.
Text
=
SlvAddr
.
ToString
();
}
btnAddMove
.
BackColor
=
Color
.
White
;
...
...
@@ -227,7 +224,7 @@ namespace DeviceLibrary
axis
=
axisList
[
cmbAxis
.
SelectedIndex
].
Config
;
PortName
=
axis
.
DeviceName
;
SlvAddr
=
axis
.
GetAxisValue
();
txtAxisDeviceName
.
Text
=
PortName
;
//
txtAxisDeviceName.Text = PortName;
txtAxisValue
.
Text
=
SlvAddr
.
ToString
();
Color
color
=
Color
.
Black
;
...
...
@@ -348,15 +345,15 @@ namespace DeviceLibrary
private
void
timer1_Tick
(
object
sender
,
EventArgs
e
)
{
//
LogUtil.OutputDebugString($"timer1_Tick:{this.Visible}");
if
(
this
.
Visible
&&
!
DesignMode
)
LogUtil
.
OutputDebugString
(
$
"timer1_Tick:{this.Visible}"
);
if
(
this
.
Visible
)
{
ReadAxisStatus
();
}
}
private
void
ReadAxisStatus
()
{
groupBox2
.
Text
=
cmbAxis
.
Text
+
"-"
+
crc
.
GetString
(
"Res0189
"
,
"状态监控"
);
groupBox2
.
Text
=
cmbAxis
.
Text
+
"-"
+
crc
.
GetString
(
"AxisMoveControl_groupAxis_groupBox2_Text
"
,
"状态监控"
);
//【1】更新轴号
short
axisNo
=
SlvAddr
;
if
(
axisNo
<
0
)
...
...
@@ -396,9 +393,9 @@ namespace DeviceLibrary
{
return
;
}
ShowlbSts
(
lblPEL
,
sts
.
PEL
);
//正限位信号
//
ShowlbSts(lblPEL, sts.PEL); //正限位信号
ShowlbSts
(
lblORG
,
sts
.
ORG
);
//原点信号
ShowlbSts
(
lblNEL
,
sts
.
NEL
);
//负限位信号
//
ShowlbSts(lblNEL, sts.NEL); //负限位信号
//label59.Text = ConvertDecimalToBinary(nTimerAxSts[0]); //轴状态是按bit进行解读,因此这里将AxSts转换为二进制bit进行显示
lblAxPrfPos
.
Text
=
HCBoardManager
.
GetAxisPrfPos
(
axisNo
).
ToString
();
...
...
@@ -447,12 +444,5 @@ namespace DeviceLibrary
lbl
.
BackColor
=
this
.
BackColor
;
}
}
private
void
lblAlarmcode_Click
(
object
sender
,
EventArgs
e
)
{
var
s
=
string
.
Join
(
","
,
HuichuanLibrary
.
HCBoardManager
.
GetAxisErrorDetail
(
SlvAddr
));
MessageBox
.
Show
(
s
);
LogUtil
.
error
(
s
);
}
}
}
\ No newline at end of file
RemoteSheardObject/Class1.cs
查看文件 @
40e1960
...
...
@@ -206,7 +206,36 @@ public class ReelParam
return
$
":[{PosID}][{WareCode}][{RFID}][{PlateW}x{PlateH}]"
;
}
}
bool
islog
=
false
;
public
void
logresult
()
{
if
(!
islog
)
{
islog
=
true
;
var
datetime
=
DateTime
.
Now
;
string
countfile
=
$
"\\Logs\\NGLOG_{datetime:yyyyMMdd}.csv"
;
Directory
.
CreateDirectory
(
"\\Logs\\"
);
if
(!
File
.
Exists
(
countfile
))
{
StreamWriter
sw1
=
new
StreamWriter
(
countfile
,
true
,
Encoding
.
GetEncoding
(
"GB2312"
));
sw1
.
WriteLine
(
$
"WareCode,SN,PN,Date,NgMsg"
);
sw1
.
Close
();
sw1
.
Dispose
();
}
try
{
var
sw
=
new
StreamWriter
(
countfile
,
true
,
Encoding
.
GetEncoding
(
"GB2312"
));
//var sw = File.Open(countfile, FileMode.Append, FileAccess.Write);
// string s = $"\r\n{ReeID},{PN},{PlateW}x{PlateH},{ReelDest},{NgMsg},{QTY},{WareCode}";
//var b = Encoding.GetEncoding("gb2312").GetBytes(s);
//sw.Write(b, 0, b.Length);
sw
.
WriteLine
(
$
"{WareCode},{RI},{PN},{datetime:yyyy/MM/dd HH:mm:ss},{NgMsg}"
);
sw
.
Close
();
sw
.
Dispose
();
}
catch
{
}
}
}
}
public
enum
DoorStatusE
{
Busy
,
...
...
RemoteSheardObject/RemoteClient.cs
查看文件 @
40e1960
...
...
@@ -46,7 +46,7 @@ public class RemoteClient
{
if
(
LastState
!=
webSocket
.
State
)
{
LOGGER
.
Info
(
$
"Remote:{GroupName} 掉线了"
);
LOGGER
.
Error
(
$
"Remote:{GroupName} 掉线了"
);
}
LastState
=
webSocket
.
State
;
}
...
...
@@ -68,7 +68,7 @@ public class RemoteClient
else
if
(
webSocket
.
State
==
WebSocket4Net
.
WebSocketState
.
Connecting
)
{
errstatuscounr
++;
if
(
errstatuscounr
>
5
)
{
LOGGER
.
Info
(
$
"Remote:{GroupName} Connecting 超时"
);
LOGGER
.
Error
(
$
"Remote:{GroupName} Connecting 超时"
);
try
{
webSocket
.
Close
();
}
catch
{
}
webSocket
.
Open
();
errstatuscounr
=
0
;
...
...
@@ -87,7 +87,7 @@ public class RemoteClient
}
catch
{
LOGGER
.
Info
(
"Cant Deserialize remote command:"
+
e
.
Message
);
LOGGER
.
Error
(
"Cant Deserialize remote command:"
+
e
.
Message
);
return
;
}
switch
(
remoteLoad
.
Action
)
...
...
@@ -124,7 +124,7 @@ public class RemoteClient
}
if
(
lastresult
==
RemoteResult
.
None
)
{
LOGGER
.
Info
(
"等待远程反馈超时"
);
LOGGER
.
Error
(
"等待远程反馈超时"
);
timeoutCount
++;
lastresult
=
RemoteResult
.
Timeout
;
if
(
timeoutCount
>
3
)
...
...
RemoteSheardObject/RemoteSheardObject.csproj
查看文件 @
40e1960
...
...
@@ -94,6 +94,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RemoteClient.cs" />
<Compile Include="SLog.cs" />
<Compile Include="Snowflake.cs" />
<Compile Include="StoreCID.cs" />
<Compile Include="TheLine.cs" />
</ItemGroup>
...
...
RemoteSheardObject/Snowflake.cs
0 → 100644
查看文件 @
40e1960
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
RemoteSheardObject
{
/// <summary>
/// 动态生产有规律的ID Snowflake算法是Twitter的工程师为实现递增而不重复的ID实现的
/// http://blog.csdn.net/w200221626/article/details/52064976
/// C# 实现 Snowflake算法
/// </summary>
public
class
Snowflake
{
private
static
long
machineId
;
//机器ID
private
static
long
datacenterId
=
0L
;
//数据ID
private
static
long
sequence
=
0L
;
//计数从零开始
private
static
long
twepoch
=
687888001020L
;
//唯一时间随机量
private
static
long
machineIdBits
=
5L
;
//机器码字节数
private
static
long
datacenterIdBits
=
5L
;
//数据字节数
public
static
long
maxMachineId
=
-
1L
^
-
1L
<<
(
int
)
machineIdBits
;
//最大机器ID
private
static
long
maxDatacenterId
=
-
1L
^
(-
1L
<<
(
int
)
datacenterIdBits
);
//最大数据ID
private
static
long
sequenceBits
=
12L
;
//计数器字节数,12个字节用来保存计数码
private
static
long
machineIdShift
=
sequenceBits
;
//机器码数据左移位数,就是后面计数器占用的位数
private
static
long
datacenterIdShift
=
sequenceBits
+
machineIdBits
;
private
static
long
timestampLeftShift
=
sequenceBits
+
machineIdBits
+
datacenterIdBits
;
//时间戳左移动位数就是机器码+计数器总字节数+数据字节数
public
static
long
sequenceMask
=
-
1L
^
-
1L
<<
(
int
)
sequenceBits
;
//一微秒内可以产生计数,如果达到该值则等到下一微妙在进行生成
private
static
long
lastTimestamp
=
-
1L
;
//最后时间戳
private
static
object
syncRoot
=
new
object
();
//加锁对象
static
Snowflake
snowflake
;
public
static
Snowflake
Instance
()
{
if
(
snowflake
==
null
)
snowflake
=
new
Snowflake
();
return
snowflake
;
}
public
Snowflake
()
{
Snowflakes
(
0L
,
-
1
);
}
public
Snowflake
(
long
machineId
)
{
Snowflakes
(
machineId
,
-
1
);
}
public
Snowflake
(
long
machineId
,
long
datacenterId
)
{
Snowflakes
(
machineId
,
datacenterId
);
}
private
void
Snowflakes
(
long
machineId
,
long
datacenterId
)
{
if
(
machineId
>=
0
)
{
if
(
machineId
>
maxMachineId
)
{
throw
new
Exception
(
"机器码ID非法"
);
}
Snowflake
.
machineId
=
machineId
;
}
if
(
datacenterId
>=
0
)
{
if
(
datacenterId
>
maxDatacenterId
)
{
throw
new
Exception
(
"数据中心ID非法"
);
}
Snowflake
.
datacenterId
=
datacenterId
;
}
}
/// <summary>
/// 生成当前时间戳
/// </summary>
/// <returns>毫秒</returns>
private
static
long
GetTimestamp
()
{
//让他2000年开始
return
(
long
)(
DateTime
.
UtcNow
-
new
DateTime
(
2000
,
1
,
1
,
0
,
0
,
0
,
DateTimeKind
.
Utc
)).
TotalMilliseconds
;
}
/// <summary>
/// 获取下一微秒时间戳
/// </summary>
/// <param name="lastTimestamp"></param>
/// <returns></returns>
private
static
long
GetNextTimestamp
(
long
lastTimestamp
)
{
long
timestamp
=
GetTimestamp
();
int
count
=
0
;
while
(
timestamp
<=
lastTimestamp
)
//这里获取新的时间,可能会有错,这算法与comb一样对机器时间的要求很严格
{
count
++;
if
(
count
>
10
)
throw
new
Exception
(
"机器的时间可能不对"
);
Thread
.
Sleep
(
1
);
timestamp
=
GetTimestamp
();
}
return
timestamp
;
}
/// <summary>
/// 获取长整形的ID
/// </summary>
/// <returns></returns>
public
long
GetId
()
{
lock
(
syncRoot
)
{
long
timestamp
=
GetTimestamp
();
if
(
Snowflake
.
lastTimestamp
==
timestamp
)
{
//同一微妙中生成ID
sequence
=
(
sequence
+
1
)
&
sequenceMask
;
//用&运算计算该微秒内产生的计数是否已经到达上限
if
(
sequence
==
0
)
{
//一微妙内产生的ID计数已达上限,等待下一微妙
timestamp
=
GetNextTimestamp
(
Snowflake
.
lastTimestamp
);
}
}
else
{
//不同微秒生成ID
sequence
=
0L
;
}
if
(
timestamp
<
lastTimestamp
)
{
throw
new
Exception
(
"时间戳比上一次生成ID时时间戳还小,故异常"
);
}
Snowflake
.
lastTimestamp
=
timestamp
;
//把当前时间戳保存为最后生成ID的时间戳
long
Id
=
((
timestamp
-
twepoch
)
<<
(
int
)
timestampLeftShift
)
|
(
datacenterId
<<
(
int
)
datacenterIdShift
)
|
(
machineId
<<
(
int
)
machineIdShift
)
|
sequence
;
return
Id
;
}
}
}
}
RemoteSheardObject/TheLine.cs
查看文件 @
40e1960
using
ConfigHelper
;
using
ConfigHelper
;
using
Newtonsoft.Json
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -33,6 +33,10 @@ namespace RemoteSheardObject
return
!
string
.
IsNullOrEmpty
(
SubmitPostData
(
"/service/store/robotBox/updateLocInfo"
,
postData
));
}
/// <summary>
/// 获取正在进行的任务数量
/// </summary>
/// <returns></returns>
public
static
Dictionary
<
string
,
int
>
GetTaskCount
()
{
//pizzaBox,pcb,tray,reel
...
...
@@ -46,13 +50,13 @@ namespace RemoteSheardObject
taskdata
[
"reel"
]
=
0
;
var
result
=
JsonConvert
.
DeserializeObject
<
ResultData
>(
SubmitPostData
(
"/rest/micron/device/getTaskCount"
,
postData
));
if
(
result
.
code
!=
0
)
if
(
result
==
null
||
result
.
code
!=
0
)
return
taskdata
;
foreach
(
var
k
in
taskdata
.
Keys
)
foreach
(
var
k
in
taskdata
.
Keys
.
ToArray
()
)
{
if
(
result
.
data
.
ContainsKey
(
k
))
taskdata
[
k
]
=
int
.
Parse
(
result
.
data
[
k
]);
if
(
result
.
data
.
ContainsKey
(
k
+
"_out"
))
taskdata
[
k
]
=
int
.
Parse
(
result
.
data
[
k
+
"_out"
]);
}
return
taskdata
;
}
...
...
@@ -129,6 +133,7 @@ namespace RemoteSheardObject
}
//去掉最后一个"&"符号
if
(
postDataString
.
Length
>
0
)
postDataString
.
Length
--;
//将POST请求参数转换为字节数组
...
...
@@ -144,7 +149,7 @@ namespace RemoteSheardObject
catch
(
Exception
ex
)
{
// 捕获任何网络异常,并输出错误信息
Console
.
WriteLine
(
"提交POST请求时发生错误:"
+
ex
.
Message
);
//Console.WriteLine(crc.GetString("Res0071","提交POST请求时发生错误:")
+ ex.Message);
// 请求失败,返回false
return
""
;
...
...
TheMachine/Form1.cs
查看文件 @
40e1960
...
...
@@ -58,7 +58,14 @@ namespace TheMachine
{
e
.
Cancel
=
true
;
this
.
WindowState
=
FormWindowState
.
Minimized
;
return
;
}
LogUtil
.
info
(
"系统强制退出应用 step1"
);
btn_stop_Click
(
sender
,
EventArgs
.
Empty
);
Thread
.
Sleep
(
2000
);
LogUtil
.
info
(
"系统强制退出应用 step2"
);
Application
.
Exit
();
LogUtil
.
info
(
"系统强制退出应用 step3"
);
}
//LogControl lc = new LogControl();
...
...
@@ -355,18 +362,7 @@ namespace TheMachine
{
if
(!
RobotManage
.
isRunning
)
{
//if (RobotManage.mainMachine.IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
//{
// RobotManage.mainMachine.Msg.add(crc.GetString("Res0017","急停中,无法启动"), MsgLevel.warning);
// RobotManage.mainMachine.Msg.Show();
// //return;
//}
//if (RobotManage.mainMachine.IOValue(IO_Type.AutoRun_Single).Equals(IO_VALUE.LOW))
//{
// RobotManage.mainMachine.Msg.add(crc.GetString("Res0018","运行开关没有打开,无法启动"), MsgLevel.warning);
// RobotManage.mainMachine.Msg.Show();
// //return;
//}
LogUtil
.
info
(
"用户按下启动:"
+
sender
.
ToString
());
RobotManage
.
Start
();
userpause
=
false
;
...
...
TheMachine/Program.cs
查看文件 @
40e1960
using
ConfigHelper
;
using
log4net.Config
;
using
Microsoft.Win32.TaskScheduler
;
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -46,8 +47,7 @@ namespace TheMachine
}
}
}
Microsoft
.
Win32
.
Registry
.
CurrentUser
.
OpenSubKey
(
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"
,
true
).
SetValue
(
Application
.
ProductName
,
Application
.
ExecutablePath
);
AddOrUpdateStartupTask
();
Config
.
LoadMyConfig
(
new
Setting_Init
().
GetType
());
Application
.
ThreadException
+=
Application_ThreadException
;
Application
.
SetUnhandledExceptionMode
(
UnhandledExceptionMode
.
CatchException
);
...
...
@@ -103,6 +103,43 @@ namespace TheMachine
public
const
int
SW_RESTORE
=
9
;
#
endregion
public
static
void
AddOrUpdateStartupTask
()
{
// 获取当前程序的路径和名称
string
appPath
=
Process
.
GetCurrentProcess
().
MainModule
.
FileName
;
string
TaskName
=
"AutoStartup_"
+
Process
.
GetCurrentProcess
().
MainModule
.
ModuleName
;
// 创建或更新计划任务
using
(
TaskService
taskService
=
new
TaskService
())
{
// 获取任务定义,如果不存在则创建新的任务定义
TaskDefinition
taskDefinition
;
if
(
taskService
.
GetTask
(
TaskName
)
!=
null
)
{
taskDefinition
=
taskService
.
GetTask
(
TaskName
).
Definition
;
}
else
{
taskDefinition
=
taskService
.
NewTask
();
taskDefinition
.
RegistrationInfo
.
Description
=
TaskName
;
}
if
(
taskDefinition
.
Triggers
.
Count
==
0
||
taskDefinition
.
Triggers
[
0
].
TriggerType
!=
TaskTriggerType
.
Logon
)
{
// 设置触发器为用户登录后启动
LogonTrigger
logonTrigger
=
(
LogonTrigger
)
taskDefinition
.
Triggers
.
Add
(
new
LogonTrigger
());
logonTrigger
.
Delay
=
TimeSpan
.
FromSeconds
(
5
);
}
// 设置操作为启动应用程序
taskDefinition
.
Actions
.
Clear
();
taskDefinition
.
Actions
.
Add
(
new
ExecAction
(
appPath
,
null
,
System
.
IO
.
Path
.
GetDirectoryName
(
appPath
)));
// 设置任务的运行权限为管理员权限
taskDefinition
.
Principal
.
RunLevel
=
TaskRunLevel
.
Highest
;
// 保存任务
taskService
.
RootFolder
.
RegisterTaskDefinition
(
TaskName
,
taskDefinition
,
TaskCreation
.
CreateOrUpdate
,
null
,
null
,
TaskLogonType
.
InteractiveToken
,
null
);
}
}
}
}
TheMachine/TheMachine.csproj
查看文件 @
40e1960
...
...
@@ -7,7 +7,7 @@
<ProjectGuid>{61FDFF14-8BB7-439A-85A0-592E3011F4C4}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>TheMachine</RootNamespace>
<AssemblyName>
CycleLine
</AssemblyName>
<AssemblyName>
MT
</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
...
...
@@ -60,6 +60,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Win32.TaskScheduler, Version=2.10.1.0, Culture=neutral, PublicKeyToken=e25603a88b3aa7da, processorArchitecture=MSIL">
<HintPath>..\packages\TaskScheduler.2.10.1\lib\net452\Microsoft.Win32.TaskScheduler.dll</HintPath>
</Reference>
<Reference Include="Neotel.Rmaxis">
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\Neotel.Rmaxis.dll</HintPath>
</Reference>
...
...
@@ -68,6 +71,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
...
...
@@ -292,6 +296,7 @@
<DependentUpon>uc_boxdebug.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.manifest" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
...
...
TheMachine/TrayManagerControl.cs
查看文件 @
40e1960
...
...
@@ -145,9 +145,12 @@ namespace TheMachine
listView1
.
Items
[
ti
.
RFID
].
ForeColor
=
Color
.
DarkGray
;
else
listView1
.
Items
[
ti
.
RFID
].
ForeColor
=
Color
.
Black
;
if
(
ti
.
HasLoad
&&
ti
.
TrayParam
.
IsNg
)
{
listView1
.
Items
[
ti
.
RFID
].
ForeColor
=
Color
.
Orange
;
}
if
(
ti
.
HasLoad
&&
ti
.
HasLoadCheck
<
0
)
listView1
.
Items
[
ti
.
RFID
].
ForeColor
=
Color
.
Red
;
}
ListView2
.
Items
.
Clear
();
foreach
(
var
tivk
in
TrayManager
.
TrayRequest
.
ToArray
())
...
...
@@ -181,13 +184,15 @@ namespace TheMachine
gb_trayinfo
.
Visible
=
false
;
return
;
}
var
ti
=
TrayManager
.
Traylist
[
listView1
.
SelectedItems
[
0
].
Text
];
string
txt
=
"RFID"
+
": "
+
listView1
.
SelectedItems
[
0
].
Text
;
txt
+=
"\r\n"
+
crc
.
GetString
(
"Res0021"
,
"托盘类型"
)
+
": "
+
listView1
.
SelectedItems
[
0
].
SubItems
[
2
].
Text
;
txt
+=
"\r\n"
+
crc
.
GetString
(
"Res0055"
,
"物料"
)
+
": "
+
listView1
.
SelectedItems
[
0
].
SubItems
[
3
].
Text
;
txt
+=
"\r\n"
+
crc
.
GetString
(
"Res0023"
,
"目的地"
)
+
": "
+
listView1
.
SelectedItems
[
0
].
SubItems
[
4
].
Text
;
txt
+=
"\r\n"
+
"Code"
+
": "
+
listView1
.
SelectedItems
[
0
].
SubItems
[
6
].
Text
;
if
(
ti
.
HasLoad
&&
ti
.
TrayParam
.
IsNg
)
{
txt
+=
"\r\n"
+
"NgMsg"
+
": "
+
ti
.
TrayParam
.
NgMsg
;
}
lbl_info
.
Text
=
txt
;
gb_trayinfo
.
Visible
=
true
;
}
...
...
TheMachine/device/Other/MycronicControl.cs
查看文件 @
40e1960
using
DeviceLibrary
;
using
DeviceLibrary
;
using
OnlineStore
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -76,7 +76,7 @@ namespace TheMachine.device.Other
stateView
.
Items
.
Clear
();
foreach
(
var
store
in
VStoreCollection
.
VStoreList
.
Values
.
ToList
())
{
ListViewItem
lvi
=
new
ListViewItem
(
new
string
[]
{
""
,
store
.
CID
,
store
.
RTStoreStatus
.
ToString
(),
store
.
GetStateStr
()
});
ListViewItem
lvi
=
new
ListViewItem
(
new
string
[]
{
""
,
TowerList
.
List
[
store
.
CID
].
TowerName
+
"-"
+
store
.
CID
,
store
.
RTStoreStatus
.
ToString
(),
store
.
GetStateStr
()
});
stateView
.
Items
.
Add
(
lvi
);
}
}
...
...
@@ -85,11 +85,11 @@ namespace TheMachine.device.Other
{
if
(
RobotManage
.
isRunning
)
{
MessageBox
.
Show
(
"请先停止系统运行"
);
MessageBox
.
Show
(
crc
.
GetString
(
"Res0072"
,
"请先停止系统运行"
)
);
return
;
}
MI
.
DeviceList
[
"AMH-MI1"
].
MI
.
DeviceList
[
"AMH-MI1"
].
Reset
();
}
}
}
\ No newline at end of file
TheMachine/packages.config
0 → 100644
查看文件 @
40e1960
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
package
id
=
"TaskScheduler"
version
=
"2.10.1"
targetFramework
=
"net461"
/>
</
packages
>
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论