Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
1053_CycleLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 40e19609
由
刘韬
编写于
2023-02-28 21:46:17 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
稳定版
1 个父辈
1587d8a9
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
35 个修改的文件
包含
613 行增加
和
123 行删除
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
...
@@ -36,6 +36,12 @@ namespace OnlineStore.Common
[
MyConfigComment
(
"屏蔽日志窗口"
)]
[
MyConfigComment
(
"屏蔽日志窗口"
)]
public
static
MyConfig
<
bool
>
Device_DisableLogWindow
=
true
;
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"
)]
[
MyConfigComment
(
"URRobot_MI1_IP"
)]
public
static
MyConfig
<
string
>
URRobot_MI1_IP
;
public
static
MyConfig
<
string
>
URRobot_MI1_IP
;
[
MyConfigComment
(
"URRobot_MI1_速度倍率"
)]
[
MyConfigComment
(
"URRobot_MI1_速度倍率"
)]
...
...
Common/util/MyWebClient.cs
查看文件 @
40e1960
...
@@ -139,18 +139,16 @@ namespace OnlineStore.Common
...
@@ -139,18 +139,16 @@ namespace OnlineStore.Common
return
result
;
return
result
;
}
}
static
object
lockpost
=
new
object
();
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
try
{
{
string
json
=
JsonHelper
.
SerializeObject
(
operation
);
string
json
=
JsonHelper
.
SerializeObject
(
operation
);
string
result
=
Post
(
url
,
json
,
timeout
);
string
result
=
Post
(
url
,
json
,
timeout
);
Operation
op
=
JsonHelper
.
DeserializeJsonToObject
<
Operation
>(
result
);
Operation
op
=
JsonHelper
.
DeserializeJsonToObject
<
Operation
>(
result
);
if
(
printlog
)
log
=
"Send ["
+
json
+
"] Revice ["
+
result
+
"]"
;
{
LogUtil
.
info
(
"Send ["
+
json
+
"] Revice ["
+
result
+
"]"
);
}
return
op
;
return
op
;
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
...
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
40e1960
...
@@ -156,6 +156,7 @@
...
@@ -156,6 +156,7 @@
<Compile Include="userControl\FixtureSizeConfigControl.Designer.cs">
<Compile Include="userControl\FixtureSizeConfigControl.Designer.cs">
<DependentUpon>FixtureSizeConfigControl.cs</DependentUpon>
<DependentUpon>FixtureSizeConfigControl.cs</DependentUpon>
</Compile>
</Compile>
<Compile Include="VirtuallyStore\BufferSlotsManger.cs" />
<Compile Include="VirtuallyStore\CommandList.cs" />
<Compile Include="VirtuallyStore\CommandList.cs" />
<Compile Include="VirtuallyStore\Reference.cs" />
<Compile Include="VirtuallyStore\Reference.cs" />
<Compile Include="VirtuallyStore\VMsg.cs" />
<Compile Include="VirtuallyStore\VMsg.cs" />
...
...
DeviceLibrary/DeviceLibrary/LineRunMonitor.cs
查看文件 @
40e1960
...
@@ -43,7 +43,7 @@ namespace DeviceLibrary
...
@@ -43,7 +43,7 @@ namespace DeviceLibrary
if
(
canStopLine
(
out
_
)
&&
isIOon
)
//(DOValue(LineIO).Equals(IO_VALUE.HIGH) || DOValue(LineRevIO).Equals(IO_VALUE.HIGH)))
if
(
canStopLine
(
out
_
)
&&
isIOon
)
//(DOValue(LineIO).Equals(IO_VALUE.HIGH) || DOValue(LineRevIO).Equals(IO_VALUE.HIGH)))
{
{
IOSTOP
();
IOSTOP
();
LogUtil
.
info
(
Name
+
$
" 线体管理器 停止线体."
);
LogUtil
.
info
(
"["
+
Name
+
"]"
+
$
" 线体管理器 停止线体."
);
}
}
}
}
}
}
...
...
DeviceLibrary/DeviceLibrary/RobotMoveHelper.cs
查看文件 @
40e1960
using
OnlineStore.Common
;
using
OnlineStore
;
using
OnlineStore.Common
;
using
Robot.UR
;
using
Robot.UR
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -48,12 +49,14 @@ namespace DeviceLibrary
...
@@ -48,12 +49,14 @@ namespace DeviceLibrary
{
{
RobotStatus
=
false
;
RobotStatus
=
false
;
//Msg.add(POS_Start + "机器人状态异常:" + Robot.CurDashboardReponse, MsgLevel.alarm);
//Msg.add(POS_Start + "机器人状态异常:" + Robot.CurDashboardReponse, MsgLevel.alarm);
robot
.
Play
Program
();
robot
.
Stop
Program
();
}
}
else
if
(!
robot
.
ClientIsConnected
)
{
else
if
(!
robot
.
ClientIsConnected
)
{
RobotStatus
=
false
;
RobotStatus
=
false
;
robot
.
StopProgram
();
robot
.
StopProgram
();
Thread
.
Sleep
(
300
);
robot
.
StopRobot
();
}
}
else
else
RobotStatus
=
true
;
RobotStatus
=
true
;
...
@@ -61,7 +64,7 @@ namespace DeviceLibrary
...
@@ -61,7 +64,7 @@ namespace DeviceLibrary
public
void
Move
(
MoveInfo
moveInfo
,
int
movecmd
)
{
public
void
Move
(
MoveInfo
moveInfo
,
int
movecmd
)
{
if
(
moveInfo
!=
null
)
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
;
lastMoveCmd
=
movecmd
;
robot
.
SendMoveCmd
(
movecmd
,
Setting_Init
.
URRobot_MI1_Speed_Rate
);
robot
.
SendMoveCmd
(
movecmd
,
Setting_Init
.
URRobot_MI1_Speed_Rate
);
...
@@ -91,4 +94,4 @@ namespace DeviceLibrary
...
@@ -91,4 +94,4 @@ namespace DeviceLibrary
RobotCheck
.
Enabled
=
false
;
RobotCheck
.
Enabled
=
false
;
}
}
}
}
}
}
\ No newline at end of file
\ No newline at end of file
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
查看文件 @
40e1960
using
OnlineStore
;
using
OnlineStore
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
RemoteSheardObject
;
using
System
;
using
System
;
using
System.Collections.Concurrent
;
using
System.Collections.Concurrent
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -12,7 +13,7 @@ using System.Threading.Tasks;
...
@@ -12,7 +13,7 @@ using System.Threading.Tasks;
namespace
DeviceLibrary
namespace
DeviceLibrary
{
{
class
ServerCommunication
public
class
ServerCommunication
{
{
volatile
StoreStatus
_storeStatus
=
StoreStatus
.
Debugging
;
volatile
StoreStatus
_storeStatus
=
StoreStatus
.
Debugging
;
public
StoreStatus
storeStatus
{
public
StoreStatus
storeStatus
{
...
@@ -41,10 +42,18 @@ namespace DeviceLibrary
...
@@ -41,10 +42,18 @@ namespace DeviceLibrary
GC
.
KeepAlive
(
serverConnectTimer
);
GC
.
KeepAlive
(
serverConnectTimer
);
LogUtil
.
info
(
$
"server:{server},cid:{CID}"
);
LogUtil
.
info
(
$
"server:{server},cid:{CID}"
);
}
}
public
int
OutMaterialTaskCount
=
0
;
public
int
OutReelTaskCount
=
0
;
private
void
ServerConnectTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
private
void
ServerConnectTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
{
try
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)
//if (!RobotManage.isRunning)
// ProcessMsg(MsgService.MSList);
// ProcessMsg(MsgService.MSList);
//if (!string.IsNullOrWhiteSpace(server))
//if (!string.IsNullOrWhiteSpace(server))
...
@@ -54,7 +63,8 @@ namespace DeviceLibrary
...
@@ -54,7 +63,8 @@ namespace DeviceLibrary
{
{
LogUtil
.
info
(
$
"ServerConnectTimer_Elapsed:{ex}"
);
LogUtil
.
info
(
$
"ServerConnectTimer_Elapsed:{ex}"
);
}
}
finally
{
finally
{
//Monitor.Exit(serverConnectTimer);
//Monitor.Exit(serverConnectTimer);
}
}
}
}
...
@@ -75,7 +85,7 @@ namespace DeviceLibrary
...
@@ -75,7 +85,7 @@ namespace DeviceLibrary
}
}
).
Where
(
x
=>!
string
.
IsNullOrEmpty
(
x
)));
).
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
)
if
(
RobotManage
.
InoutDebugMode
)
return
;
return
;
...
@@ -86,11 +96,12 @@ namespace DeviceLibrary
...
@@ -86,11 +96,12 @@ namespace DeviceLibrary
operation
.
op
=
1
;
operation
.
op
=
1
;
operation
.
data
=
new
Dictionary
<
string
,
string
>()
{
{
"code"
,
code
},
{
"boxId"
,
StoreID
.
ToString
()
},
{
"doorReelSignal"
,
"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
)
if
(
resultOperation
==
null
||
operation
.
seq
!=
resultOperation
.
seq
)
{
{
LogUtil
.
error
(
log
);
Thread
.
Sleep
(
1000
);
Thread
.
Sleep
(
1000
);
SendInStoreRequest
(
codelist
,
reel
,
printlog
);
SendInStoreRequest
(
codelist
,
reel
);
return
;
return
;
}
}
ResultProcess
(
resultOperation
);
ResultProcess
(
resultOperation
);
...
@@ -109,7 +120,7 @@ namespace DeviceLibrary
...
@@ -109,7 +120,7 @@ namespace DeviceLibrary
LogUtil
.
info
(
JsonHelper
.
SerializeObject
(
operation
));
LogUtil
.
info
(
JsonHelper
.
SerializeObject
(
operation
));
if
(
RobotManage
.
InoutDebugMode
)
if
(
RobotManage
.
InoutDebugMode
)
return
true
;
return
true
;
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
15000
);
Operation
resultOperation
=
OnlineStore
.
Common
.
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
15000
,
out
_
);
if
(
resultOperation
==
null
)
if
(
resultOperation
==
null
)
{
{
...
@@ -253,7 +264,7 @@ namespace DeviceLibrary
...
@@ -253,7 +264,7 @@ namespace DeviceLibrary
printlog
=
true
;
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
)
if
(
resultOperation
!=
null
)
getthtime
=
0
;
getthtime
=
0
;
//LogUtil.info(JsonHelper.SerializeObject(resultOperation.data));
//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
...
@@ -15,14 +15,20 @@ namespace DeviceLibrary
Prefix
=
prefix
;
Prefix
=
prefix
;
log
=
LogManager
.
GetLogger
(
logname
);
log
=
LogManager
.
GetLogger
(
logname
);
}
}
string
lastinfo
=
""
;
public
void
Info
(
string
txt
)
{
public
void
Info
(
string
txt
)
{
if
(
String
.
Compare
(
lastinfo
,
txt
,
StringComparison
.
Ordinal
)
==
0
)
return
;
if
(
Prefix
!=
""
)
if
(
Prefix
!=
""
)
txt
=
$
"[{Prefix}] "
+
txt
;
txt
=
$
"[{Prefix}] "
+
txt
;
log
.
Info
(
txt
);
log
.
Info
(
txt
);
}
}
string
lasterr
=
""
;
public
void
Error
(
string
txt
)
public
void
Error
(
string
txt
)
{
{
if
(
String
.
Compare
(
lasterr
,
txt
,
StringComparison
.
Ordinal
)
==
0
)
return
;
if
(
Prefix
!=
""
)
if
(
Prefix
!=
""
)
txt
=
$
"[{Prefix}] "
+
txt
;
txt
=
$
"[{Prefix}] "
+
txt
;
log
.
Error
(
txt
);
log
.
Error
(
txt
);
...
...
DeviceLibrary/VirtuallyStore/VServerComm.cs
查看文件 @
40e1960
...
@@ -114,20 +114,20 @@ namespace DeviceLibrary
...
@@ -114,20 +114,20 @@ namespace DeviceLibrary
LogUtil
.
info
(
JsonHelper
.
SerializeObject
(
operation
));
LogUtil
.
info
(
JsonHelper
.
SerializeObject
(
operation
));
if
(
RobotManage
.
InoutDebugMode
)
if
(
RobotManage
.
InoutDebugMode
)
return
true
;
return
true
;
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
5000
);
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
5000
,
out
string
log
);
if
(
resultOperation
==
null
)
if
(
resultOperation
==
null
)
{
{
LogUtil
.
info
(
$
"SendStoreState error,posid:{barcode}, storeStatus:{storeStatus}"
);
VLog
.
Error
(
$
"SendStoreState error,posid:{barcode}, storeStatus:{storeStatus}"
);
return
false
;
return
false
;
}
}
if
(
operation
.
seq
!=
resultOperation
.
seq
)
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
;
return
false
;
}
}
VLog
.
Info
(
log
);
LogUtil
.
i
nfo
(
$
"SendStoreState success,posid:{barcode}, storeStatus:{storeStatus}"
);
VLog
.
I
nfo
(
$
"SendStoreState success,posid:{barcode}, storeStatus:{storeStatus}"
);
ResultProcess
(
resultOperation
);
ResultProcess
(
resultOperation
);
}
}
return
true
;
return
true
;
...
@@ -238,7 +238,7 @@ namespace DeviceLibrary
...
@@ -238,7 +238,7 @@ namespace DeviceLibrary
printlog
=
true
;
printlog
=
true
;
}
}
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
lineOperation
,
700
,
print
log
);
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
lineOperation
,
700
,
out
string
log
);
if
(
resultOperation
!=
null
)
if
(
resultOperation
!=
null
)
getthtime
=
0
;
getthtime
=
0
;
//LogUtil.info(JsonHelper.SerializeObject(resultOperation.data));
//LogUtil.info(JsonHelper.SerializeObject(resultOperation.data));
...
@@ -407,7 +407,7 @@ namespace DeviceLibrary
...
@@ -407,7 +407,7 @@ namespace DeviceLibrary
else
else
{
{
JobInfo
jobInfo
=
new
JobInfo
(
code
,
posIdStr
,
plateW
,
plateH
);
JobInfo
jobInfo
=
new
JobInfo
(
code
,
posIdStr
,
plateW
,
plateH
);
OutStoreEvent
?.
Invoke
(
"服务器"
,
jobInfo
);
OutStoreEvent
?.
Invoke
(
crc
.
GetString
(
"Res0064"
,
"服务器"
)
,
jobInfo
);
}
}
TimeSpan
span
=
DateTime
.
Now
-
time
;
TimeSpan
span
=
DateTime
.
Now
-
time
;
...
...
DeviceLibrary/VirtuallyStore/VStore.cs
查看文件 @
40e1960
此文件的差异被折叠,
点击展开。
DeviceLibrary/VirtuallyStore/VStoreCollection.cs
查看文件 @
40e1960
...
@@ -92,7 +92,12 @@ namespace DeviceLibrary
...
@@ -92,7 +92,12 @@ namespace DeviceLibrary
MsgService
.
MSList
[
"RT-"
+
vs
.
CID
].
clear
();
MsgService
.
MSList
[
"RT-"
+
vs
.
CID
].
clear
();
vs
.
VTowerProcess
();
vs
.
VTowerProcess
();
}
}
finally
{
catch
(
Exception
ex
)
{
VLog
.
Error
(
"VTowerProcess error:"
+
ex
);
}
finally
{
MsgService
.
MSList
[
"RT-"
+
vs
.
CID
].
Show
();
MsgService
.
MSList
[
"RT-"
+
vs
.
CID
].
Show
();
}
}
});
});
...
...
DeviceLibrary/theMachine/DeviceRunControl.cs
查看文件 @
40e1960
...
@@ -33,10 +33,18 @@ namespace DeviceLibrary
...
@@ -33,10 +33,18 @@ namespace DeviceLibrary
LogUtil
.
info
(
$
"{DeviceListName}设备线程启动"
);
LogUtil
.
info
(
$
"{DeviceListName}设备线程启动"
);
while
(
RobotManage
.
mainMachine
.
mstart
)
while
(
RobotManage
.
mainMachine
.
mstart
)
{
{
Thread
.
Sleep
(
20
0
);
Thread
.
Sleep
(
15
0
);
ManualResetEvent
.
WaitAll
(
new
ManualResetEvent
[]
{
RobotManage
.
mainMachine
.
ResetEvent
});
ManualResetEvent
.
WaitAll
(
new
ManualResetEvent
[]
{
RobotManage
.
mainMachine
.
ResetEvent
});
if
(!
RobotManage
.
mainMachine
.
canRunning
||
!
RobotManage
.
mainMachine
.
mstart
)
if
(!
RobotManage
.
mainMachine
.
canRunning
||
!
RobotManage
.
mainMachine
.
mstart
)
continue
;
{
if
(
RobotManage
.
mainMachine
.
mstart
)
{
DevicesList
.
ForEach
(
x
=>
{
x
.
FrontStopProcess
();
});
}
continue
;
}
DevicesList
.
ForEach
(
x
=>
DevicesList
.
ForEach
(
x
=>
{
{
try
try
...
@@ -47,6 +55,7 @@ namespace DeviceLibrary
...
@@ -47,6 +55,7 @@ namespace DeviceLibrary
{
{
MsgService
.
MSList
[
x
.
GroupName
].
add
(
ex
.
ToString
(),
MsgLevel
.
warning
);
MsgService
.
MSList
[
x
.
GroupName
].
add
(
ex
.
ToString
(),
MsgLevel
.
warning
);
MsgService
.
MSList
[
x
.
GroupName
].
setlogones
();
MsgService
.
MSList
[
x
.
GroupName
].
setlogones
();
LogUtil
.
error
(
$
"{DeviceListName} 出错:"
+
ex
);
}
}
finally
finally
{
{
...
...
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
40e1960
...
@@ -33,7 +33,7 @@ namespace DeviceLibrary
...
@@ -33,7 +33,7 @@ namespace DeviceLibrary
public
Dictionary
<
string
,
DeviceGroup
>
DeviceGroup
{
get
=>
RobotManage
.
DeviceGroup
;
}
public
Dictionary
<
string
,
DeviceGroup
>
DeviceGroup
{
get
=>
RobotManage
.
DeviceGroup
;
}
public
bool
UserPause
{
get
;
set
;
}
=
false
;
public
bool
UserPause
{
get
;
set
;
}
=
false
;
ServerCommunication
ServerCM
;
public
ServerCommunication
ServerCM
;
public
ManualResetEvent
ResetEvent
=
new
ManualResetEvent
(
true
);
public
ManualResetEvent
ResetEvent
=
new
ManualResetEvent
(
true
);
...
@@ -90,14 +90,15 @@ namespace DeviceLibrary
...
@@ -90,14 +90,15 @@ namespace DeviceLibrary
while
(
mstart
)
{
while
(
mstart
)
{
try
try
{
{
canRunning
=
DeviceCheck
();
canRunning
=
DeviceCheck
();
if
(
canRunning
)
if
(
canRunning
)
{
{
ResetEvent
.
Set
();
BtnProcess
();
BtnProcess
();
canRunning
=
SafeCheck
();
canRunning
=
SafeCheck
();
}
}
Thread
.
Sleep
(
200
);
Thread
.
Sleep
(
150
);
ResetEvent
.
Set
();
if
(!
canRunning
||
!
mstart
)
if
(!
canRunning
||
!
mstart
)
continue
;
continue
;
if
(
runStatus
==
RunStatus
.
Running
)
if
(
runStatus
==
RunStatus
.
Running
)
...
@@ -155,6 +156,11 @@ namespace DeviceLibrary
...
@@ -155,6 +156,11 @@ namespace DeviceLibrary
}
}
public
void
Stop
()
{
public
void
Stop
()
{
mstart
=
false
;
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
);
IOMove
(
IO_Type
.
Line_Run
,
IO_VALUE
.
LOW
);
ResetEvent
.
Set
();
ResetEvent
.
Set
();
Alarm
(
AlarmType
.
None
);
Alarm
(
AlarmType
.
None
);
...
@@ -290,5 +296,34 @@ namespace DeviceLibrary
...
@@ -290,5 +296,34 @@ namespace DeviceLibrary
}
}
return
ok
;
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
\ No newline at end of file
DeviceLibrary/theMachine/MoveStep.cs
查看文件 @
40e1960
...
@@ -116,6 +116,7 @@ namespace DeviceLibrary
...
@@ -116,6 +116,7 @@ namespace DeviceLibrary
MI_08
,
MI_08
,
MI_09
,
MI_09
,
MI_10
,
MI_10
,
MI_ReelTacked
,
MI_11
,
MI_11
,
MI_12
,
MI_12
,
MI_13
,
MI_13
,
...
...
DeviceLibrary/theMachine/RemoteService.cs
查看文件 @
40e1960
...
@@ -74,10 +74,13 @@ namespace DeviceLibrary
...
@@ -74,10 +74,13 @@ namespace DeviceLibrary
case
"IsFree"
:
case
"IsFree"
:
isok
=
TrayManager
.
IsFree
(
remoteLoad
);
isok
=
TrayManager
.
IsFree
(
remoteLoad
);
break
;
break
;
case
"IsNeedProcessNG"
:
isok
=
TrayManager
.
IsNeedProcessNG
(
remoteLoad
);
break
;
case
"OK"
:
case
"OK"
:
case
"FAIL"
:
case
"FAIL"
:
lastresult
[
Seq
]
=
remoteLoad
.
Action
==
"OK"
?
RemoteResult
.
True
:
RemoteResult
.
False
;
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
;
return
;
default
:
default
:
break
;
break
;
...
@@ -100,7 +103,7 @@ namespace DeviceLibrary
...
@@ -100,7 +103,7 @@ namespace DeviceLibrary
allClients
[
deviceGroupName
].
Send
(
JsonConvert
.
SerializeObject
(
message
));
allClients
[
deviceGroupName
].
Send
(
JsonConvert
.
SerializeObject
(
message
));
}
}
catch
(
Exception
ex
){
catch
(
Exception
ex
){
LogUtil
.
info
(
$
"设备:{deviceGroupName} 消息发送出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
$
"设备:{deviceGroupName} 消息发送出错:"
+
ex
.
ToString
());
}
}
}
}
...
@@ -109,7 +112,7 @@ namespace DeviceLibrary
...
@@ -109,7 +112,7 @@ namespace DeviceLibrary
remoteLoad
.
GroupName
=
GroupName
;
remoteLoad
.
GroupName
=
GroupName
;
if
(
remoteLoad
.
RequestLoadInfo
!=
null
&&
string
.
IsNullOrEmpty
(
remoteLoad
.
RequestLoadInfo
.
DeviceGroupName
))
if
(
remoteLoad
.
RequestLoadInfo
!=
null
&&
string
.
IsNullOrEmpty
(
remoteLoad
.
RequestLoadInfo
.
DeviceGroupName
))
remoteLoad
.
RequestLoadInfo
.
DeviceGroupName
=
GroupName
;
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
;
lastresult
[
remoteLoad
.
Seq
]
=
RemoteResult
.
None
;
SendMessage
(
GroupName
,
remoteLoad
);
SendMessage
(
GroupName
,
remoteLoad
);
return
WaitResult
(
GroupName
,
remoteLoad
.
Seq
,
waittime
);
return
WaitResult
(
GroupName
,
remoteLoad
.
Seq
,
waittime
);
...
@@ -118,22 +121,30 @@ namespace DeviceLibrary
...
@@ -118,22 +121,30 @@ namespace DeviceLibrary
{
{
if
(!
lastresult
.
ContainsKey
(
seq
))
if
(!
lastresult
.
ContainsKey
(
seq
))
return
RemoteResult
.
Timeout
;
return
RemoteResult
.
Timeout
;
while
(
lastresult
[
seq
]
==
RemoteResult
.
None
&&
waittime
>
0
)
try
{
System
.
Threading
.
Thread
.
Sleep
(
50
);
waittime
=
waittime
-
50
;
}
if
(
lastresult
[
seq
]
==
RemoteResult
.
None
)
{
LogUtil
.
info
(
$
"等待{GroupName}反馈超时 seq:"
+
seq
);
lastresult
[
seq
]
=
RemoteResult
.
Timeout
;
}
var
result
=
lastresult
[
seq
];
lock
(
lastresult
)
{
{
lastresult
.
Remove
(
seq
);
while
(
lastresult
[
seq
]
==
RemoteResult
.
None
&&
waittime
>
0
)
{
System
.
Threading
.
Thread
.
Sleep
(
50
);
waittime
=
waittime
-
50
;
}
if
(
lastresult
[
seq
]
==
RemoteResult
.
None
)
{
LogUtil
.
info
(
$
"等待{GroupName}反馈超时 seq:"
+
seq
);
lastresult
[
seq
]
=
RemoteResult
.
Timeout
;
}
var
result
=
lastresult
[
seq
];
lock
(
lastresult
)
{
lastresult
.
Remove
(
seq
);
}
return
result
;
}
}
return
result
;
catch
(
Exception
ex
)
{
LogUtil
.
error
(
$
"等待{GroupName}反馈超时 seq:"
+
seq
+
" 出错:"
+
ex
);
return
RemoteResult
.
Timeout
;
}
}
}
public
static
void
SendResult
(
string
deviceGroupName
,
bool
result
,
long
Seq
)
public
static
void
SendResult
(
string
deviceGroupName
,
bool
result
,
long
Seq
)
{
{
...
...
DeviceLibrary/theMachine/RobotManage.cs
查看文件 @
40e1960
...
@@ -190,6 +190,7 @@ namespace DeviceLibrary
...
@@ -190,6 +190,7 @@ namespace DeviceLibrary
LogUtil
.
info
(
"用户暂停"
);
LogUtil
.
info
(
"用户暂停"
);
else
else
LogUtil
.
info
(
"系统暂停: "
+
msg
);
LogUtil
.
info
(
"系统暂停: "
+
msg
);
mainMachine
.
DeviceSnapshot
();
Thread
.
Sleep
(
500
);
Thread
.
Sleep
(
500
);
}
}
else
else
...
...
DeviceLibrary/theMachine/TrayManager.cs
查看文件 @
40e1960
...
@@ -37,10 +37,11 @@ namespace DeviceLibrary
...
@@ -37,10 +37,11 @@ namespace DeviceLibrary
Traylist
[
rfid
].
LastAddr
=
addr
;
Traylist
[
rfid
].
LastAddr
=
addr
;
Traylist
[
rfid
].
Destination
=
TrayManager
.
AddrDesc
[
Traylist
[
rfid
].
DestinationAddr
];
Traylist
[
rfid
].
Destination
=
TrayManager
.
AddrDesc
[
Traylist
[
rfid
].
DestinationAddr
];
Traylist
[
rfid
].
LastPosition
=
TrayManager
.
AddrDesc
[
Traylist
[
rfid
].
LastAddr
];
Traylist
[
rfid
].
LastPosition
=
TrayManager
.
AddrDesc
[
Traylist
[
rfid
].
LastAddr
];
if
(
reelcheck
==
0
)
if
(
Traylist
[
rfid
].
TrayType
==
TrayTypeE
.
MTP1
&&
(
addr
==
16
||
addr
==
20
||
addr
==
5
||
addr
==
3
))
Traylist
[
rfid
].
HasLoadCheck
--;
Traylist
[
rfid
].
HasLoadCheck
+=
reelcheck
==
0
?
-
1
:
1
;
else
if
(
reelcheck
==
1
)
else
if
(
Traylist
[
rfid
].
TrayType
==
TrayTypeE
.
MTP2
)
Traylist
[
rfid
].
HasLoadCheck
=
1
;
Traylist
[
rfid
].
HasLoadCheck
+=
reelcheck
==
0
?
-
1
:
1
;
trayInfo
=
Traylist
[
rfid
];
trayInfo
=
Traylist
[
rfid
];
//Statistics();
//Statistics();
}
}
...
@@ -56,6 +57,12 @@ namespace DeviceLibrary
...
@@ -56,6 +57,12 @@ namespace DeviceLibrary
lock
(
Traylist
)
lock
(
Traylist
)
{
{
LogUtil
.
info
(
$
"SetTrayLoadInfo:{rfid},{requestLoadInfo?.LoadParam?.ToStr()},{requestLoadInfo?.DeviceGroupName}"
);
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
)
if
(
requestLoadInfo
==
null
)
{
{
Traylist
[
rfid
].
SetToEmpty
();
Traylist
[
rfid
].
SetToEmpty
();
...
@@ -131,13 +138,21 @@ namespace DeviceLibrary
...
@@ -131,13 +138,21 @@ namespace DeviceLibrary
TrayRequest
[
remoteLoad
.
GroupName
]
=
remoteLoad
.
RequestLoadInfo
;
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
)
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
)
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
)
if
(
trayaddrs
.
Count
==
0
)
return
false
;
return
false
;
...
@@ -252,6 +267,17 @@ namespace DeviceLibrary
...
@@ -252,6 +267,17 @@ namespace DeviceLibrary
}
}
return
false
;
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>
/// <summary>
/// 空托盘数量
/// 空托盘数量
...
...
DeviceLibrary/theMachine/sub/IDevice.cs
查看文件 @
40e1960
...
@@ -17,6 +17,7 @@ namespace DeviceLibrary
...
@@ -17,6 +17,7 @@ namespace DeviceLibrary
void
TrayRelease
();
void
TrayRelease
();
bool
IsFree
();
bool
IsFree
();
bool
FrontCheck
(
int
curaddr
);
bool
FrontCheck
(
int
curaddr
);
void
FrontStopProcess
();
}
}
public
enum
DeviceStateE
public
enum
DeviceStateE
...
...
DeviceLibrary/theMachine/sub/MI.cs
查看文件 @
40e1960
此文件的差异被折叠,
点击展开。
DeviceLibrary/theMachine/sub/SideMove.cs
查看文件 @
40e1960
此文件的差异被折叠,
点击展开。
DeviceLibrary/theMachine/sub/TransplantMove.cs
查看文件 @
40e1960
...
@@ -69,6 +69,8 @@ namespace DeviceLibrary
...
@@ -69,6 +69,8 @@ namespace DeviceLibrary
{
{
DeviceState
=
DeviceStateE
.
Stop
;
DeviceState
=
DeviceStateE
.
Stop
;
MoveInfo
.
log
(
"停止运行"
);
MoveInfo
.
log
(
"停止运行"
);
Task
.
Run
(()
=>
{
Task
.
Delay
(
1000
).
Wait
();
IOMove
(
IO_Type
.
AMH_Front_Stop
,
IO_VALUE
.
LOW
);
});
}
}
public
void
Process
()
public
void
Process
()
{
{
...
@@ -147,7 +149,7 @@ namespace DeviceLibrary
...
@@ -147,7 +149,7 @@ namespace DeviceLibrary
if
(
IOValue
(
IO_Type
.
AMH_Reel_Check
).
Equals
(
IO_VALUE
.
HIGH
))
if
(
IOValue
(
IO_Type
.
AMH_Reel_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
{
RemoteLoad
remoteLoad1
=
new
RemoteLoad
();
RemoteLoad
remoteLoad1
=
new
RemoteLoad
();
remoteLoad1
.
Seq
=
DateTime
.
Now
.
Ticks
;
remoteLoad1
.
Seq
=
Snowflake
.
Instance
().
GetId
()
;
remoteLoad1
.
Action
=
"DoorLock"
;
remoteLoad1
.
Action
=
"DoorLock"
;
remoteLoad1
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad1
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad1
.
RequestLoadInfo
.
IsEmpty
=
false
;
remoteLoad1
.
RequestLoadInfo
.
IsEmpty
=
false
;
...
@@ -188,7 +190,7 @@ namespace DeviceLibrary
...
@@ -188,7 +190,7 @@ namespace DeviceLibrary
if
(
IOValue
(
IO_Type
.
AMH_Reel_Check
).
Equals
(
IO_VALUE
.
LOW
))
if
(
IOValue
(
IO_Type
.
AMH_Reel_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
{
RemoteLoad
remoteLoad2
=
new
RemoteLoad
();
RemoteLoad
remoteLoad2
=
new
RemoteLoad
();
remoteLoad2
.
Seq
=
DateTime
.
Now
.
Ticks
;
remoteLoad2
.
Seq
=
Snowflake
.
Instance
().
GetId
()
;
remoteLoad2
.
Action
=
"DoorLock"
;
remoteLoad2
.
Action
=
"DoorLock"
;
remoteLoad2
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad2
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad2
.
RequestLoadInfo
.
IsEmpty
=
true
;
remoteLoad2
.
RequestLoadInfo
.
IsEmpty
=
true
;
...
@@ -248,7 +250,7 @@ namespace DeviceLibrary
...
@@ -248,7 +250,7 @@ namespace DeviceLibrary
IOMove
(
IO_Type
.
AMH_Tray_Stop
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
AMH_Tray_Stop
,
IO_VALUE
.
LOW
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
if
(
GroupName
==
"AMH-SBSH2"
)
if
(
GroupName
==
"AMH-SBSH2"
)
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3
000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
4
000
));
MoveInfo
.
log
(
"托盘已放行"
);
MoveInfo
.
log
(
"托盘已放行"
);
}
else
if
(
MoveInfo
.
IsTimeOut
(
10
))
{
}
else
if
(
MoveInfo
.
IsTimeOut
(
10
))
{
MoveInfo
.
log
(
"托盘放行失败,重新放行"
);
MoveInfo
.
log
(
"托盘放行失败,重新放行"
);
...
@@ -293,7 +295,7 @@ namespace DeviceLibrary
...
@@ -293,7 +295,7 @@ namespace DeviceLibrary
MoveInfo
.
NextMoveStep
(
MoveStep
.
TransplantMove_14
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
TransplantMove_14
);
MoveInfo
.
log
(
"检测到物料已离开"
);
MoveInfo
.
log
(
"检测到物料已离开"
);
}
}
else
{
else
if
(
MoveInfo
.
IsTimeOut
(
1
))
{
MetrialGetRetry
++;
MetrialGetRetry
++;
if
(
MetrialGetRetry
>
3
)
{
if
(
MetrialGetRetry
>
3
)
{
Msg
.
add
(
$
"{MoveInfo.Name}取料失败"
,
MsgLevel
.
alarm
);
Msg
.
add
(
$
"{MoveInfo.Name}取料失败"
,
MsgLevel
.
alarm
);
...
@@ -368,7 +370,7 @@ namespace DeviceLibrary
...
@@ -368,7 +370,7 @@ namespace DeviceLibrary
MoveInfo
.
NextMoveStep
(
MoveStep
.
TransplantMove_24
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
TransplantMove_24
);
var
remoteLoad
=
new
RemoteLoad
();
var
remoteLoad
=
new
RemoteLoad
();
remoteLoad
.
Seq
=
DateTime
.
Now
.
Ticks
;
remoteLoad
.
Seq
=
Snowflake
.
Instance
().
GetId
()
;
remoteLoad
.
Action
=
"DoorRelease"
;
remoteLoad
.
Action
=
"DoorRelease"
;
remoteLoad
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad
.
RequestLoadInfo
.
IsEmpty
=
true
;
//true出库 false入库
remoteLoad
.
RequestLoadInfo
.
IsEmpty
=
true
;
//true出库 false入库
...
@@ -427,7 +429,7 @@ namespace DeviceLibrary
...
@@ -427,7 +429,7 @@ namespace DeviceLibrary
IOMove
(
IO_Type
.
AMH_Sucker
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
AMH_Sucker
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
AMH_Sucker_Release
,
IO_VALUE
.
HIGH
,
2000
);
IOMove
(
IO_Type
.
AMH_Sucker_Release
,
IO_VALUE
.
HIGH
,
2000
);
ConfigHelper
.
Config
.
Set
(
$
"Runtime_{GroupName}_IsSucker"
,
false
);
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
;
break
;
case
MoveStep
.
TransplantMove_27
:
case
MoveStep
.
TransplantMove_27
:
...
@@ -502,7 +504,7 @@ namespace DeviceLibrary
...
@@ -502,7 +504,7 @@ namespace DeviceLibrary
case
MoveStep
.
TransplantMove_06
:
case
MoveStep
.
TransplantMove_06
:
RemoteLoad
remoteLoad
=
new
RemoteLoad
();
RemoteLoad
remoteLoad
=
new
RemoteLoad
();
remoteLoad
.
Action
=
"DoorRelease"
;
remoteLoad
.
Action
=
"DoorRelease"
;
remoteLoad
.
Seq
=
DateTime
.
Now
.
Ticks
;
remoteLoad
.
Seq
=
Snowflake
.
Instance
().
GetId
()
;
remoteLoad
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad
.
RequestLoadInfo
.
IsEmpty
=
false
;
remoteLoad
.
RequestLoadInfo
.
IsEmpty
=
false
;
remoteLoad
.
RequestLoadInfo
.
LoadParam
=
MoveInfo2
.
MoveParam
.
clone
();
remoteLoad
.
RequestLoadInfo
.
LoadParam
=
MoveInfo2
.
MoveParam
.
clone
();
...
@@ -607,10 +609,12 @@ namespace DeviceLibrary
...
@@ -607,10 +609,12 @@ namespace DeviceLibrary
public
bool
IsFree
()
public
bool
IsFree
()
{
{
if
(
MoveInfo2
.
MoveStep
!=
MoveStep
.
Wait
)
{
if
(
MoveInfo2
.
MoveStep
!=
MoveStep
.
Wait
||
MoveInfo
.
MoveStep
>
MoveStep
.
TransplantMove_26
)
{
return
false
;
return
false
;
}
}
if
(
MoveInfo
.
MoveStep
>=
MoveStep
.
TransplantMove_10
&&
MoveInfo
.
MoveStep
<=
MoveStep
.
TransplantMove_20
)
return
false
;
return
true
;
return
true
;
}
}
...
@@ -624,5 +628,13 @@ namespace DeviceLibrary
...
@@ -624,5 +628,13 @@ namespace DeviceLibrary
MoveInfo
.
NewMove
(
MoveStep
.
H01_HomeReset
);
MoveInfo
.
NewMove
(
MoveStep
.
H01_HomeReset
);
MoveInfo
.
log
(
"开始重置"
);
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
\ No newline at end of file
DeviceLibrary/theMachine/sub/TrayStop.cs
查看文件 @
40e1960
...
@@ -72,6 +72,8 @@ namespace DeviceLibrary
...
@@ -72,6 +72,8 @@ namespace DeviceLibrary
{
{
DeviceState
=
DeviceStateE
.
Stop
;
DeviceState
=
DeviceStateE
.
Stop
;
MoveInfo
.
log
(
"停止运行"
);
MoveInfo
.
log
(
"停止运行"
);
Task
.
Run
(()
=>
{
Task
.
Delay
(
1000
).
Wait
();
IOMove
(
IO_Type
.
AMH_Front_Stop
,
IO_VALUE
.
LOW
);
});
}
}
public
void
Process
()
public
void
Process
()
{
{
...
@@ -211,7 +213,7 @@ namespace DeviceLibrary
...
@@ -211,7 +213,7 @@ namespace DeviceLibrary
//空托盘
//空托盘
MoveInfo
.
NextMoveStep
(
MoveStep
.
TrayStop_07
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
TrayStop_07
);
RemoteLoad
remoteLoad
=
new
RemoteLoad
();
RemoteLoad
remoteLoad
=
new
RemoteLoad
();
remoteLoad
.
Seq
=
DateTime
.
Now
.
Ticks
;
remoteLoad
.
Seq
=
Snowflake
.
Instance
().
GetId
()
;
remoteLoad
.
Action
=
"TrayReady"
;
remoteLoad
.
Action
=
"TrayReady"
;
remoteLoad
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad
.
RequestLoadInfo
.
TrayType
=
trayInfo
.
TrayType
.
ToString
();
remoteLoad
.
RequestLoadInfo
.
TrayType
=
trayInfo
.
TrayType
.
ToString
();
...
@@ -229,7 +231,7 @@ namespace DeviceLibrary
...
@@ -229,7 +231,7 @@ namespace DeviceLibrary
//有物料
//有物料
MoveInfo
.
NextMoveStep
(
MoveStep
.
TrayStop_07
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
TrayStop_07
);
RemoteLoad
remoteLoad
=
new
RemoteLoad
();
RemoteLoad
remoteLoad
=
new
RemoteLoad
();
remoteLoad
.
Seq
=
DateTime
.
Now
.
Ticks
;
remoteLoad
.
Seq
=
Snowflake
.
Instance
().
GetId
()
;
remoteLoad
.
Action
=
"TrayReady"
;
remoteLoad
.
Action
=
"TrayReady"
;
remoteLoad
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad
.
RequestLoadInfo
.
TrayType
=
trayInfo
.
TrayType
.
ToString
();
remoteLoad
.
RequestLoadInfo
.
TrayType
=
trayInfo
.
TrayType
.
ToString
();
...
@@ -368,7 +370,7 @@ namespace DeviceLibrary
...
@@ -368,7 +370,7 @@ namespace DeviceLibrary
{
{
if
(
IOValue
(
IO_Type
.
MI_Reel_Check
).
Equals
(
IO_VALUE
.
LOW
))
if
(
IOValue
(
IO_Type
.
MI_Reel_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
{
Msg
.
add
(
"托盘放料后没有检测到物料"
,
MsgLevel
.
alarm
);
Msg
.
add
(
crc
.
GetString
(
"Res0062"
,
"托盘放料后没有检测到物料"
)
,
MsgLevel
.
alarm
);
return
;
return
;
}
}
}
}
...
@@ -383,7 +385,7 @@ namespace DeviceLibrary
...
@@ -383,7 +385,7 @@ namespace DeviceLibrary
if
(
GroupName
==
"AMH-ML5-1"
||
GroupName
==
"AMH-ML5-2"
)
if
(
GroupName
==
"AMH-ML5-1"
||
GroupName
==
"AMH-ML5-2"
)
{
{
var
remoteLoad
=
new
RemoteLoad
();
var
remoteLoad
=
new
RemoteLoad
();
remoteLoad
.
Seq
=
DateTime
.
Now
.
Ticks
;
remoteLoad
.
Seq
=
Snowflake
.
Instance
().
GetId
()
;
remoteLoad
.
Action
=
"IsSafe"
;
remoteLoad
.
Action
=
"IsSafe"
;
remoteLoad
.
RequestLoadInfo
=
new
RequestLoadInfo
();
remoteLoad
.
RequestLoadInfo
=
new
RequestLoadInfo
();
var
result
=
RemoteService
.
SendAndWait
(
GroupName
,
remoteLoad
,
6000
);
var
result
=
RemoteService
.
SendAndWait
(
GroupName
,
remoteLoad
,
6000
);
...
@@ -421,7 +423,7 @@ namespace DeviceLibrary
...
@@ -421,7 +423,7 @@ namespace DeviceLibrary
/// 释放托盘
/// 释放托盘
/// </summary>
/// </summary>
public
void
TrayRelease
()
{
public
void
TrayRelease
()
{
MoveInfo
.
log
(
"释放托盘
"
);
MoveInfo
.
log
(
"释放托盘
:"
+
CurrrentRFID
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
TrayStop_LoadProcessed
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
TrayStop_LoadProcessed
);
if
(
TrayManager
.
Traylist
.
ContainsKey
(
CurrrentRFID
)
&&
TrayManager
.
Traylist
[
CurrrentRFID
].
HasLoad
)
if
(
TrayManager
.
Traylist
.
ContainsKey
(
CurrrentRFID
)
&&
TrayManager
.
Traylist
[
CurrrentRFID
].
HasLoad
)
{
{
...
@@ -453,7 +455,7 @@ namespace DeviceLibrary
...
@@ -453,7 +455,7 @@ namespace DeviceLibrary
if
(
GroupName
==
d
&&
MI
.
DeviceList
[
d
].
DeviceState
!=
DeviceStateE
.
Run
if
(
GroupName
==
d
&&
MI
.
DeviceList
[
d
].
DeviceState
!=
DeviceStateE
.
Run
&&
MI
.
DeviceList
[
d
].
MoveInfo
.
MoveStep
!=
MoveStep
.
Wait
)
&&
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
else
if
(
GroupName
==
d
&&
MI
.
DeviceList
[
d
].
DeviceState
==
DeviceStateE
.
Run
&&
MI
.
DeviceList
[
d
].
MoveInfo
.
MoveStep
!=
MoveStep
.
Wait
)
&&
MI
.
DeviceList
[
d
].
MoveInfo
.
MoveStep
!=
MoveStep
.
Wait
)
...
@@ -497,5 +499,13 @@ namespace DeviceLibrary
...
@@ -497,5 +499,13 @@ namespace DeviceLibrary
{
{
return
IOValue
(
IO_Type
.
MI_Front_Check
).
Equals
(
IO_VALUE
.
LOW
);
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
\ No newline at end of file
DeviceLibrary/userControl/AxisMoveControl.Designer.cs
查看文件 @
40e1960
此文件的差异被折叠,
点击展开。
DeviceLibrary/userControl/AxisMoveControl.cs
查看文件 @
40e1960
...
@@ -26,9 +26,6 @@ namespace DeviceLibrary
...
@@ -26,9 +26,6 @@ namespace DeviceLibrary
public
AxisMoveControl
()
public
AxisMoveControl
()
{
{
InitializeComponent
();
InitializeComponent
();
if
(
DesignMode
)
return
;
this
.
Tag
=
"not"
;
crc
.
OpenResourceLog
=
true
;
crc
.
OpenResourceLog
=
true
;
crc
.
LanguageChangeEvent
+=
Crc_LanguageChangeEvent
;
crc
.
LanguageChangeEvent
+=
Crc_LanguageChangeEvent
;
crc
.
CurrLanguage
=
Setting_Init
.
Device_Default_Language
;
crc
.
CurrLanguage
=
Setting_Init
.
Device_Default_Language
;
...
@@ -56,7 +53,7 @@ namespace DeviceLibrary
...
@@ -56,7 +53,7 @@ namespace DeviceLibrary
currentAxis
=
axisList
[
0
];
currentAxis
=
axisList
[
0
];
PortName
=
axisList
[
0
].
Config
.
DeviceName
;
PortName
=
axisList
[
0
].
Config
.
DeviceName
;
SlvAddr
=
axisList
[
0
].
Config
.
GetAxisValue
();
SlvAddr
=
axisList
[
0
].
Config
.
GetAxisValue
();
txtAxisDeviceName
.
Text
=
PortName
;
//
txtAxisDeviceName.Text = PortName;
txtAxisValue
.
Text
=
SlvAddr
.
ToString
();
txtAxisValue
.
Text
=
SlvAddr
.
ToString
();
}
}
btnAddMove
.
BackColor
=
Color
.
White
;
btnAddMove
.
BackColor
=
Color
.
White
;
...
@@ -227,7 +224,7 @@ namespace DeviceLibrary
...
@@ -227,7 +224,7 @@ namespace DeviceLibrary
axis
=
axisList
[
cmbAxis
.
SelectedIndex
].
Config
;
axis
=
axisList
[
cmbAxis
.
SelectedIndex
].
Config
;
PortName
=
axis
.
DeviceName
;
PortName
=
axis
.
DeviceName
;
SlvAddr
=
axis
.
GetAxisValue
();
SlvAddr
=
axis
.
GetAxisValue
();
txtAxisDeviceName
.
Text
=
PortName
;
//
txtAxisDeviceName.Text = PortName;
txtAxisValue
.
Text
=
SlvAddr
.
ToString
();
txtAxisValue
.
Text
=
SlvAddr
.
ToString
();
Color
color
=
Color
.
Black
;
Color
color
=
Color
.
Black
;
...
@@ -348,15 +345,15 @@ namespace DeviceLibrary
...
@@ -348,15 +345,15 @@ namespace DeviceLibrary
private
void
timer1_Tick
(
object
sender
,
EventArgs
e
)
private
void
timer1_Tick
(
object
sender
,
EventArgs
e
)
{
{
//
LogUtil.OutputDebugString($"timer1_Tick:{this.Visible}");
LogUtil
.
OutputDebugString
(
$
"timer1_Tick:{this.Visible}"
);
if
(
this
.
Visible
&&
!
DesignMode
)
if
(
this
.
Visible
)
{
{
ReadAxisStatus
();
ReadAxisStatus
();
}
}
}
}
private
void
ReadAxisStatus
()
private
void
ReadAxisStatus
()
{
{
groupBox2
.
Text
=
cmbAxis
.
Text
+
"-"
+
crc
.
GetString
(
"Res0189
"
,
"状态监控"
);
groupBox2
.
Text
=
cmbAxis
.
Text
+
"-"
+
crc
.
GetString
(
"AxisMoveControl_groupAxis_groupBox2_Text
"
,
"状态监控"
);
//【1】更新轴号
//【1】更新轴号
short
axisNo
=
SlvAddr
;
short
axisNo
=
SlvAddr
;
if
(
axisNo
<
0
)
if
(
axisNo
<
0
)
...
@@ -396,9 +393,9 @@ namespace DeviceLibrary
...
@@ -396,9 +393,9 @@ namespace DeviceLibrary
{
{
return
;
return
;
}
}
ShowlbSts
(
lblPEL
,
sts
.
PEL
);
//正限位信号
//
ShowlbSts(lblPEL, sts.PEL); //正限位信号
ShowlbSts
(
lblORG
,
sts
.
ORG
);
//原点信号
ShowlbSts
(
lblORG
,
sts
.
ORG
);
//原点信号
ShowlbSts
(
lblNEL
,
sts
.
NEL
);
//负限位信号
//
ShowlbSts(lblNEL, sts.NEL); //负限位信号
//label59.Text = ConvertDecimalToBinary(nTimerAxSts[0]); //轴状态是按bit进行解读,因此这里将AxSts转换为二进制bit进行显示
//label59.Text = ConvertDecimalToBinary(nTimerAxSts[0]); //轴状态是按bit进行解读,因此这里将AxSts转换为二进制bit进行显示
lblAxPrfPos
.
Text
=
HCBoardManager
.
GetAxisPrfPos
(
axisNo
).
ToString
();
lblAxPrfPos
.
Text
=
HCBoardManager
.
GetAxisPrfPos
(
axisNo
).
ToString
();
...
@@ -447,12 +444,5 @@ namespace DeviceLibrary
...
@@ -447,12 +444,5 @@ namespace DeviceLibrary
lbl
.
BackColor
=
this
.
BackColor
;
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
\ No newline at end of file
RemoteSheardObject/Class1.cs
查看文件 @
40e1960
...
@@ -206,7 +206,36 @@ public class ReelParam
...
@@ -206,7 +206,36 @@ public class ReelParam
return
$
":[{PosID}][{WareCode}][{RFID}][{PlateW}x{PlateH}]"
;
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
{
public
enum
DoorStatusE
{
Busy
,
Busy
,
...
...
RemoteSheardObject/RemoteClient.cs
查看文件 @
40e1960
...
@@ -46,7 +46,7 @@ public class RemoteClient
...
@@ -46,7 +46,7 @@ public class RemoteClient
{
{
if
(
LastState
!=
webSocket
.
State
)
if
(
LastState
!=
webSocket
.
State
)
{
{
LOGGER
.
Info
(
$
"Remote:{GroupName} 掉线了"
);
LOGGER
.
Error
(
$
"Remote:{GroupName} 掉线了"
);
}
}
LastState
=
webSocket
.
State
;
LastState
=
webSocket
.
State
;
}
}
...
@@ -68,7 +68,7 @@ public class RemoteClient
...
@@ -68,7 +68,7 @@ public class RemoteClient
else
if
(
webSocket
.
State
==
WebSocket4Net
.
WebSocketState
.
Connecting
)
{
else
if
(
webSocket
.
State
==
WebSocket4Net
.
WebSocketState
.
Connecting
)
{
errstatuscounr
++;
errstatuscounr
++;
if
(
errstatuscounr
>
5
)
{
if
(
errstatuscounr
>
5
)
{
LOGGER
.
Info
(
$
"Remote:{GroupName} Connecting 超时"
);
LOGGER
.
Error
(
$
"Remote:{GroupName} Connecting 超时"
);
try
{
webSocket
.
Close
();
}
catch
{
}
try
{
webSocket
.
Close
();
}
catch
{
}
webSocket
.
Open
();
webSocket
.
Open
();
errstatuscounr
=
0
;
errstatuscounr
=
0
;
...
@@ -87,7 +87,7 @@ public class RemoteClient
...
@@ -87,7 +87,7 @@ public class RemoteClient
}
}
catch
catch
{
{
LOGGER
.
Info
(
"Cant Deserialize remote command:"
+
e
.
Message
);
LOGGER
.
Error
(
"Cant Deserialize remote command:"
+
e
.
Message
);
return
;
return
;
}
}
switch
(
remoteLoad
.
Action
)
switch
(
remoteLoad
.
Action
)
...
@@ -124,7 +124,7 @@ public class RemoteClient
...
@@ -124,7 +124,7 @@ public class RemoteClient
}
}
if
(
lastresult
==
RemoteResult
.
None
)
if
(
lastresult
==
RemoteResult
.
None
)
{
{
LOGGER
.
Info
(
"等待远程反馈超时"
);
LOGGER
.
Error
(
"等待远程反馈超时"
);
timeoutCount
++;
timeoutCount
++;
lastresult
=
RemoteResult
.
Timeout
;
lastresult
=
RemoteResult
.
Timeout
;
if
(
timeoutCount
>
3
)
if
(
timeoutCount
>
3
)
...
...
RemoteSheardObject/RemoteSheardObject.csproj
查看文件 @
40e1960
...
@@ -94,6 +94,7 @@
...
@@ -94,6 +94,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RemoteClient.cs" />
<Compile Include="RemoteClient.cs" />
<Compile Include="SLog.cs" />
<Compile Include="SLog.cs" />
<Compile Include="Snowflake.cs" />
<Compile Include="StoreCID.cs" />
<Compile Include="StoreCID.cs" />
<Compile Include="TheLine.cs" />
<Compile Include="TheLine.cs" />
</ItemGroup>
</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
Newtonsoft.Json
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -33,6 +33,10 @@ namespace RemoteSheardObject
...
@@ -33,6 +33,10 @@ namespace RemoteSheardObject
return
!
string
.
IsNullOrEmpty
(
SubmitPostData
(
"/service/store/robotBox/updateLocInfo"
,
postData
));
return
!
string
.
IsNullOrEmpty
(
SubmitPostData
(
"/service/store/robotBox/updateLocInfo"
,
postData
));
}
}
/// <summary>
/// 获取正在进行的任务数量
/// </summary>
/// <returns></returns>
public
static
Dictionary
<
string
,
int
>
GetTaskCount
()
public
static
Dictionary
<
string
,
int
>
GetTaskCount
()
{
{
//pizzaBox,pcb,tray,reel
//pizzaBox,pcb,tray,reel
...
@@ -46,13 +50,13 @@ namespace RemoteSheardObject
...
@@ -46,13 +50,13 @@ namespace RemoteSheardObject
taskdata
[
"reel"
]
=
0
;
taskdata
[
"reel"
]
=
0
;
var
result
=
JsonConvert
.
DeserializeObject
<
ResultData
>(
SubmitPostData
(
"/rest/micron/device/getTaskCount"
,
postData
));
var
result
=
JsonConvert
.
DeserializeObject
<
ResultData
>(
SubmitPostData
(
"/rest/micron/device/getTaskCount"
,
postData
));
if
(
result
.
code
!=
0
)
if
(
result
==
null
||
result
.
code
!=
0
)
return
taskdata
;
return
taskdata
;
foreach
(
var
k
in
taskdata
.
Keys
)
foreach
(
var
k
in
taskdata
.
Keys
.
ToArray
()
)
{
{
if
(
result
.
data
.
ContainsKey
(
k
))
if
(
result
.
data
.
ContainsKey
(
k
+
"_out"
))
taskdata
[
k
]
=
int
.
Parse
(
result
.
data
[
k
]);
taskdata
[
k
]
=
int
.
Parse
(
result
.
data
[
k
+
"_out"
]);
}
}
return
taskdata
;
return
taskdata
;
}
}
...
@@ -129,7 +133,8 @@ namespace RemoteSheardObject
...
@@ -129,7 +133,8 @@ namespace RemoteSheardObject
}
}
//去掉最后一个"&"符号
//去掉最后一个"&"符号
postDataString
.
Length
--;
if
(
postDataString
.
Length
>
0
)
postDataString
.
Length
--;
//将POST请求参数转换为字节数组
//将POST请求参数转换为字节数组
byte
[]
bytes
=
Encoding
.
UTF8
.
GetBytes
(
postDataString
.
ToString
());
byte
[]
bytes
=
Encoding
.
UTF8
.
GetBytes
(
postDataString
.
ToString
());
...
@@ -144,7 +149,7 @@ namespace RemoteSheardObject
...
@@ -144,7 +149,7 @@ namespace RemoteSheardObject
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
// 捕获任何网络异常,并输出错误信息
// 捕获任何网络异常,并输出错误信息
Console
.
WriteLine
(
"提交POST请求时发生错误:"
+
ex
.
Message
);
//Console.WriteLine(crc.GetString("Res0071","提交POST请求时发生错误:")
+ ex.Message);
// 请求失败,返回false
// 请求失败,返回false
return
""
;
return
""
;
...
@@ -152,4 +157,4 @@ namespace RemoteSheardObject
...
@@ -152,4 +157,4 @@ namespace RemoteSheardObject
}
}
}
}
}
}
}
}
\ No newline at end of file
\ No newline at end of file
TheMachine/Form1.cs
查看文件 @
40e1960
...
@@ -58,7 +58,14 @@ namespace TheMachine
...
@@ -58,7 +58,14 @@ namespace TheMachine
{
{
e
.
Cancel
=
true
;
e
.
Cancel
=
true
;
this
.
WindowState
=
FormWindowState
.
Minimized
;
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();
//LogControl lc = new LogControl();
...
@@ -355,18 +362,7 @@ namespace TheMachine
...
@@ -355,18 +362,7 @@ namespace TheMachine
{
{
if
(!
RobotManage
.
isRunning
)
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
());
LogUtil
.
info
(
"用户按下启动:"
+
sender
.
ToString
());
RobotManage
.
Start
();
RobotManage
.
Start
();
userpause
=
false
;
userpause
=
false
;
...
...
TheMachine/Program.cs
查看文件 @
40e1960
using
ConfigHelper
;
using
ConfigHelper
;
using
log4net.Config
;
using
log4net.Config
;
using
Microsoft.Win32.TaskScheduler
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -46,8 +47,7 @@ namespace TheMachine
...
@@ -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
());
Config
.
LoadMyConfig
(
new
Setting_Init
().
GetType
());
Application
.
ThreadException
+=
Application_ThreadException
;
Application
.
ThreadException
+=
Application_ThreadException
;
Application
.
SetUnhandledExceptionMode
(
UnhandledExceptionMode
.
CatchException
);
Application
.
SetUnhandledExceptionMode
(
UnhandledExceptionMode
.
CatchException
);
...
@@ -103,6 +103,43 @@ namespace TheMachine
...
@@ -103,6 +103,43 @@ namespace TheMachine
public
const
int
SW_RESTORE
=
9
;
public
const
int
SW_RESTORE
=
9
;
#
endregion
#
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 @@
...
@@ -7,7 +7,7 @@
<ProjectGuid>{61FDFF14-8BB7-439A-85A0-592E3011F4C4}</ProjectGuid>
<ProjectGuid>{61FDFF14-8BB7-439A-85A0-592E3011F4C4}</ProjectGuid>
<OutputType>WinExe</OutputType>
<OutputType>WinExe</OutputType>
<RootNamespace>TheMachine</RootNamespace>
<RootNamespace>TheMachine</RootNamespace>
<AssemblyName>
CycleLine
</AssemblyName>
<AssemblyName>
MT
</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
...
@@ -60,6 +60,9 @@
...
@@ -60,6 +60,9 @@
<SpecificVersion>False</SpecificVersion>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
</Reference>
</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">
<Reference Include="Neotel.Rmaxis">
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\Neotel.Rmaxis.dll</HintPath>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\Neotel.Rmaxis.dll</HintPath>
</Reference>
</Reference>
...
@@ -68,6 +71,7 @@
...
@@ -68,6 +71,7 @@
</Reference>
</Reference>
<Reference Include="System" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.CSharp" />
...
@@ -292,6 +296,7 @@
...
@@ -292,6 +296,7 @@
<DependentUpon>uc_boxdebug.cs</DependentUpon>
<DependentUpon>uc_boxdebug.cs</DependentUpon>
</EmbeddedResource>
</EmbeddedResource>
<None Include="app.manifest" />
<None Include="app.manifest" />
<None Include="packages.config" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="App.config" />
...
...
TheMachine/TrayManagerControl.cs
查看文件 @
40e1960
...
@@ -145,9 +145,12 @@ namespace TheMachine
...
@@ -145,9 +145,12 @@ namespace TheMachine
listView1
.
Items
[
ti
.
RFID
].
ForeColor
=
Color
.
DarkGray
;
listView1
.
Items
[
ti
.
RFID
].
ForeColor
=
Color
.
DarkGray
;
else
else
listView1
.
Items
[
ti
.
RFID
].
ForeColor
=
Color
.
Black
;
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
)
if
(
ti
.
HasLoad
&&
ti
.
HasLoadCheck
<
0
)
listView1
.
Items
[
ti
.
RFID
].
ForeColor
=
Color
.
Red
;
listView1
.
Items
[
ti
.
RFID
].
ForeColor
=
Color
.
Red
;
}
}
ListView2
.
Items
.
Clear
();
ListView2
.
Items
.
Clear
();
foreach
(
var
tivk
in
TrayManager
.
TrayRequest
.
ToArray
())
foreach
(
var
tivk
in
TrayManager
.
TrayRequest
.
ToArray
())
...
@@ -181,13 +184,15 @@ namespace TheMachine
...
@@ -181,13 +184,15 @@ namespace TheMachine
gb_trayinfo
.
Visible
=
false
;
gb_trayinfo
.
Visible
=
false
;
return
;
return
;
}
}
var
ti
=
TrayManager
.
Traylist
[
listView1
.
SelectedItems
[
0
].
Text
];
string
txt
=
"RFID"
+
": "
+
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
(
"Res0021"
,
"托盘类型"
)
+
": "
+
listView1
.
SelectedItems
[
0
].
SubItems
[
2
].
Text
;
txt
+=
"\r\n"
+
crc
.
GetString
(
"Res0055"
,
"物料"
)
+
": "
+
listView1
.
SelectedItems
[
0
].
SubItems
[
3
].
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"
+
crc
.
GetString
(
"Res0023"
,
"目的地"
)
+
": "
+
listView1
.
SelectedItems
[
0
].
SubItems
[
4
].
Text
;
txt
+=
"\r\n"
+
"Code"
+
": "
+
listView1
.
SelectedItems
[
0
].
SubItems
[
6
].
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
;
lbl_info
.
Text
=
txt
;
gb_trayinfo
.
Visible
=
true
;
gb_trayinfo
.
Visible
=
true
;
}
}
...
...
TheMachine/device/Other/MycronicControl.cs
查看文件 @
40e1960
using
DeviceLibrary
;
using
DeviceLibrary
;
using
OnlineStore
;
using
OnlineStore
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -75,8 +75,8 @@ namespace TheMachine.device.Other
...
@@ -75,8 +75,8 @@ namespace TheMachine.device.Other
{
{
stateView
.
Items
.
Clear
();
stateView
.
Items
.
Clear
();
foreach
(
var
store
in
VStoreCollection
.
VStoreList
.
Values
.
ToList
())
{
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
);
stateView
.
Items
.
Add
(
lvi
);
}
}
}
}
...
@@ -85,11 +85,11 @@ namespace TheMachine.device.Other
...
@@ -85,11 +85,11 @@ namespace TheMachine.device.Other
{
{
if
(
RobotManage
.
isRunning
)
if
(
RobotManage
.
isRunning
)
{
{
MessageBox
.
Show
(
"请先停止系统运行"
);
MessageBox
.
Show
(
crc
.
GetString
(
"Res0072"
,
"请先停止系统运行"
)
);
return
;
return
;
}
}
MI
.
DeviceList
[
"AMH-MI1"
].
MI
.
DeviceList
[
"AMH-MI1"
].
Reset
();
}
}
}
}
}
}
\ No newline at end of file
\ 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
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论