Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO1057_XLC_Store
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 3a0bb722
由
张东亮
编写于
2023-02-21 11:38:04 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
称重逻辑加入入库
1 个父辈
8fd26869
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
130 行增加
和
78 行删除
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
DeviceLibrary/theMachine/InOutDevice_IN.cs
DeviceLibrary/theMachine/MoveStep.cs
TheMachine/AxisControl.Designer.cs
TheMachine/Form1.cs
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
查看文件 @
3a0bb72
...
@@ -29,13 +29,14 @@ namespace DeviceLibrary
...
@@ -29,13 +29,14 @@ namespace DeviceLibrary
static
string
server
=
Setting_Init
.
Server_Addr
;
static
string
server
=
Setting_Init
.
Server_Addr
;
static
string
CID
=
Setting_Init
.
Server_CID
;
static
string
CID
=
Setting_Init
.
Server_CID
;
int
StoreID
=
1
;
int
StoreID
=
1
;
string
StoreName
=
""
;
string
StoreName
=
""
;
string
WarnMsg
=
""
;
string
WarnMsg
=
""
;
private
System
.
Timers
.
Timer
serverConnectTimer
=
new
System
.
Timers
.
Timer
();
private
System
.
Timers
.
Timer
serverConnectTimer
=
new
System
.
Timers
.
Timer
();
object
serverclock
=
new
object
();
object
serverclock
=
new
object
();
public
ServerCommunication
()
{
public
ServerCommunication
()
{
serverConnectTimer
.
Interval
=
1000
;
serverConnectTimer
.
Interval
=
1000
;
serverConnectTimer
.
AutoReset
=
true
;
serverConnectTimer
.
AutoReset
=
true
;
serverConnectTimer
.
Enabled
=
true
;
serverConnectTimer
.
Enabled
=
true
;
...
@@ -61,13 +62,17 @@ namespace DeviceLibrary
...
@@ -61,13 +62,17 @@ namespace DeviceLibrary
LogUtil
.
info
(
$
"ServerConnectTimer_Elapsed:{ex}"
);
LogUtil
.
info
(
$
"ServerConnectTimer_Elapsed:{ex}"
);
}
}
}
}
public
void
StartConnectServer
()
{
public
void
StartConnectServer
()
{
//serverConnectTimer.Enabled = true;
//serverConnectTimer.Enabled = true;
}
public
void
StopConnectServer
()
{
}
public
void
StopConnectServer
()
{
//serverConnectTimer.Enabled = false;
//serverConnectTimer.Enabled = false;
}
}
public
void
ProcessMsg
(
List
<
Msg
>
msg
)
{
public
void
ProcessMsg
(
List
<
Msg
>
msg
)
{
WarnMsg
=
string
.
Join
(
","
,
msg
.
Select
(
x
=>
WarnMsg
=
string
.
Join
(
","
,
msg
.
Select
(
x
=>
{
{
if
(
x
.
msgLevel
==
MsgLevel
.
warning
||
x
.
msgLevel
==
MsgLevel
.
alarm
)
if
(
x
.
msgLevel
==
MsgLevel
.
warning
||
x
.
msgLevel
==
MsgLevel
.
alarm
)
...
@@ -76,9 +81,10 @@ namespace DeviceLibrary
...
@@ -76,9 +81,10 @@ namespace DeviceLibrary
}
}
return
null
;
return
null
;
}
}
).
Where
(
x
=>
!
string
.
IsNullOrEmpty
(
x
)));
).
Where
(
x
=>
!
string
.
IsNullOrEmpty
(
x
)));
}
}
public
void
SendInStoreRequest
(
string
[]
codelist
,
InOutDevice
inOutDevice
,
bool
printlog
=
false
,
double
weight
=
0.0
)
{
public
void
SendInStoreRequest
(
string
[]
codelist
,
InOutDevice
inOutDevice
,
bool
printlog
=
false
,
double
weight
=
0.0
)
{
if
(
RobotManage
.
InoutDebugMode
)
if
(
RobotManage
.
InoutDebugMode
)
return
;
return
;
...
@@ -87,13 +93,13 @@ namespace DeviceLibrary
...
@@ -87,13 +93,13 @@ namespace DeviceLibrary
var
code
=
ProcessCode
(
codelist
,
0
,
0
);
var
code
=
ProcessCode
(
codelist
,
0
,
0
);
Operation
operation
=
getLineBoxStatus
();
Operation
operation
=
getLineBoxStatus
();
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
+
spiltStr
+
weight
},
{
"boxId"
,
StoreID
.
ToString
()
},
{
"doorReelSignal"
,
"1"
}
};
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
false
,
printlog
);
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
false
,
printlog
);
if
(
operation
.
seq
!=
resultOperation
.
seq
)
if
(
operation
.
seq
!=
resultOperation
.
seq
)
{
{
Thread
.
Sleep
(
500
);
Thread
.
Sleep
(
500
);
SendInStoreRequest
(
codelist
,
inOutDevice
,
printlog
);
SendInStoreRequest
(
codelist
,
inOutDevice
,
printlog
);
return
;
return
;
}
}
ResultProcess
(
resultOperation
,
inOutDevice
);
ResultProcess
(
resultOperation
,
inOutDevice
);
...
@@ -114,7 +120,7 @@ namespace DeviceLibrary
...
@@ -114,7 +120,7 @@ namespace DeviceLibrary
if
(
RobotManage
.
InoutDebugMode
)
if
(
RobotManage
.
InoutDebugMode
)
return
;
return
;
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
false
);
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
false
);
ResultProcess
(
resultOperation
,
null
);
ResultProcess
(
resultOperation
,
null
);
if
(
storeStatus
==
StoreStatus
.
OutStoreEnd
||
if
(
storeStatus
==
StoreStatus
.
OutStoreEnd
||
storeStatus
==
StoreStatus
.
OutStoreBoxEnd
||
storeStatus
==
StoreStatus
.
OutStoreBoxEnd
||
...
@@ -125,15 +131,15 @@ namespace DeviceLibrary
...
@@ -125,15 +131,15 @@ namespace DeviceLibrary
}
}
}
}
public
string
spiltStr
=
"##"
;
public
string
spiltStr
=
"##"
;
private
string
ProcessCode
(
string
[]
codeList
,
int
reelw
,
int
reelh
)
private
string
ProcessCode
(
string
[]
codeList
,
int
reelw
,
int
reelh
)
{
{
string
message
=
""
;
string
message
=
""
;
//= 7x12 = CODE
//= 7x12 = CODE
foreach
(
string
str
in
codeList
)
foreach
(
string
str
in
codeList
)
{
{
string
code
=
str
.
Replace
(
"\r"
,
""
);
string
code
=
str
.
Replace
(
"\r"
,
""
);
code
=
code
.
Replace
(
"\n"
,
""
);
code
=
code
.
Replace
(
"\n"
,
""
);
//根据二维码开头获取固定尺寸
//根据二维码开头获取固定尺寸
string
codeSize
=
$
"{reelw}x{reelh}"
;
string
codeSize
=
$
"{reelw}x{reelh}"
;
message
=
message
+
"="
+
"1+0x0-"
+
codeSize
+
"="
+
code
+
spiltStr
;
message
=
message
+
"="
+
"1+0x0-"
+
codeSize
+
"="
+
code
+
spiltStr
;
...
@@ -173,9 +179,10 @@ namespace DeviceLibrary
...
@@ -173,9 +179,10 @@ namespace DeviceLibrary
boxStatus
.
temperature
=
RobotManage
.
humitureControllers
.
Average
(
x
=>
x
.
LastData
.
Temperate
).
ToString
();
boxStatus
.
temperature
=
RobotManage
.
humitureControllers
.
Average
(
x
=>
x
.
LastData
.
Temperate
).
ToString
();
}
}
List
<
humidata
>
humidatas
=
new
List
<
humidata
>();
List
<
humidata
>
humidatas
=
new
List
<
humidata
>();
for
(
int
i
=
0
;
i
<
RobotManage
.
humitureControllers
.
Count
;
i
++)
{
for
(
int
i
=
0
;
i
<
RobotManage
.
humitureControllers
.
Count
;
i
++)
{
var
v
=
RobotManage
.
humitureControllers
[
i
].
LastData
;
var
v
=
RobotManage
.
humitureControllers
[
i
].
LastData
;
humidatas
.
Add
(
new
humidata
{
id
=
(
i
+
1
).
ToString
(),
humidity
=
v
.
Humidity
.
ToString
(),
temperature
=
v
.
Temperate
.
ToString
()
});
humidatas
.
Add
(
new
humidata
{
id
=
(
i
+
1
).
ToString
(),
humidity
=
v
.
Humidity
.
ToString
(),
temperature
=
v
.
Temperate
.
ToString
()
});
}
}
boxStatus
.
data
.
Add
(
"humiAndtempList"
,
JsonConvert
.
SerializeObject
(
humidatas
));
boxStatus
.
data
.
Add
(
"humiAndtempList"
,
JsonConvert
.
SerializeObject
(
humidatas
));
//状态
//状态
...
@@ -202,7 +209,8 @@ namespace DeviceLibrary
...
@@ -202,7 +209,8 @@ namespace DeviceLibrary
//lineOperation.msgData["jp"] = lineOperation.msg;
//lineOperation.msgData["jp"] = lineOperation.msg;
//lineOperation.status = (int)StoreStatus.Warning;
//lineOperation.status = (int)StoreStatus.Warning;
}
}
else
if
(!
RobotManage
.
isRunning
){
else
if
(!
RobotManage
.
isRunning
)
{
sendmsg
=
"设备未启动"
;
sendmsg
=
"设备未启动"
;
}
}
...
@@ -216,7 +224,8 @@ namespace DeviceLibrary
...
@@ -216,7 +224,8 @@ namespace DeviceLibrary
lineOperation
.
boxStatus
.
Add
(
StoreID
,
boxStatus
);
lineOperation
.
boxStatus
.
Add
(
StoreID
,
boxStatus
);
return
lineOperation
;
return
lineOperation
;
}
}
class
humidata
{
class
humidata
{
public
string
id
;
public
string
id
;
public
string
humidity
;
public
string
humidity
;
public
string
temperature
;
public
string
temperature
;
...
@@ -277,7 +286,7 @@ namespace DeviceLibrary
...
@@ -277,7 +286,7 @@ namespace DeviceLibrary
if
(
resultOperation
!=
null
)
if
(
resultOperation
!=
null
)
getthtime
=
0
;
getthtime
=
0
;
//LogUtil.info(JsonHelper.SerializeObject(resultOperation.data));
//LogUtil.info(JsonHelper.SerializeObject(resultOperation.data));
ResultProcess
(
resultOperation
,
null
);
ResultProcess
(
resultOperation
,
null
);
TimeSpan
span
=
DateTime
.
Now
-
time
;
TimeSpan
span
=
DateTime
.
Now
-
time
;
if
(
span
.
TotalMilliseconds
>
700
)
if
(
span
.
TotalMilliseconds
>
700
)
{
{
...
@@ -286,14 +295,15 @@ namespace DeviceLibrary
...
@@ -286,14 +295,15 @@ namespace DeviceLibrary
}
}
}
}
ConcurrentQueue
<
string
>
commandResultMsg
=
new
ConcurrentQueue
<
string
>();
ConcurrentQueue
<
string
>
commandResultMsg
=
new
ConcurrentQueue
<
string
>();
void
ResultProcess
(
Operation
resultOperation
,
InOutDevice
inOutDevice
)
{
void
ResultProcess
(
Operation
resultOperation
,
InOutDevice
inOutDevice
)
{
//发送状态信息到服务器
//发送状态信息到服务器
if
(
resultOperation
==
null
)
if
(
resultOperation
==
null
)
{
{
//判断服务端是否返回出库操作
//判断服务端是否返回出库操作
return
;
return
;
}
}
if
(
resultOperation
.
op
.
Equals
(
1
)
&&
inOutDevice
!=
null
)
if
(
resultOperation
.
op
.
Equals
(
1
)
&&
inOutDevice
!=
null
)
{
{
var
barcode
=
""
;
var
barcode
=
""
;
if
(
resultOperation
.
data
.
ContainsKey
(
"code"
))
if
(
resultOperation
.
data
.
ContainsKey
(
"code"
))
...
@@ -343,7 +353,7 @@ namespace DeviceLibrary
...
@@ -343,7 +353,7 @@ namespace DeviceLibrary
{
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
//SetWarnMsg(ResourceControl.InStoreNoPosition, message, posId);
//SetWarnMsg(ResourceControl.InStoreNoPosition, message, posId);
WarnMsg
=
crc
.
GetString
(
L
.
in_store_nothave_position
,
"入库未找到库位:"
)
+
posId
;
//0505
WarnMsg
=
crc
.
GetString
(
L
.
in_store_nothave_position
,
"入库未找到库位:"
)
+
posId
;
//0505
LogUtil
.
info
(
"收到服务器入库命令:入库未找到库位:二维码【"
+
message
+
"】库位【"
+
posId
+
"】"
);
LogUtil
.
info
(
"收到服务器入库命令:入库未找到库位:二维码【"
+
message
+
"】库位【"
+
posId
+
"】"
);
return
;
return
;
}
}
...
@@ -351,10 +361,10 @@ namespace DeviceLibrary
...
@@ -351,10 +361,10 @@ namespace DeviceLibrary
if
(
inOutDevice
.
IsInStoreReady
)
if
(
inOutDevice
.
IsInStoreReady
)
{
{
WarnMsg
=
""
;
WarnMsg
=
""
;
JobInfo
inStoreJob
=
new
JobInfo
(
message
,
posId
,
hSerial
);
JobInfo
inStoreJob
=
new
JobInfo
(
message
,
posId
,
hSerial
);
inOutDevice
.
StartInStore
(
inStoreJob
);
inOutDevice
.
StartInStore
(
inStoreJob
);
//如果当前正在出入库中,需要记录下来,等待空闲时执行
//如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil
.
info
(
StoreName
+
" 收到服务器入库命令:库位号【"
+
posId
+
"】二维码【"
+
message
+
"】 工单号[+"
+
hSerial
+
"]开始入库!"
);
LogUtil
.
info
(
StoreName
+
" 收到服务器入库命令:库位号【"
+
posId
+
"】二维码【"
+
message
+
"】 工单号[+"
+
hSerial
+
"]开始入库!"
);
}
}
else
else
{
{
...
@@ -369,7 +379,8 @@ namespace DeviceLibrary
...
@@ -369,7 +379,8 @@ namespace DeviceLibrary
LogUtil
.
info
(
"服务器没有正确返回库位."
);
LogUtil
.
info
(
"服务器没有正确返回库位."
);
inOutDevice
.
Rescan
();
inOutDevice
.
Rescan
();
}
}
else
{
else
{
LogUtil
.
info
(
"扫码时状态错误."
);
LogUtil
.
info
(
"扫码时状态错误."
);
}
}
...
@@ -388,13 +399,13 @@ namespace DeviceLibrary
...
@@ -388,13 +399,13 @@ namespace DeviceLibrary
{
{
string
maxHumidity
=
data
[
ParamDefine
.
maxHumidity
];
string
maxHumidity
=
data
[
ParamDefine
.
maxHumidity
];
string
maxTemp
=
data
[
ParamDefine
.
maxTemperature
];
string
maxTemp
=
data
[
ParamDefine
.
maxTemperature
];
LogUtil
.
info
(
"收到服务器温湿度预警值:maxHumidity="
+
maxHumidity
+
",maxTemperature="
+
maxTemp
);
LogUtil
.
info
(
"收到服务器温湿度预警值:maxHumidity="
+
maxHumidity
+
",maxTemperature="
+
maxTemp
);
try
try
{
{
this
.
Max_Humidity
=
(
float
)
Convert
.
ToDouble
(
maxHumidity
);
this
.
Max_Humidity
=
(
float
)
Convert
.
ToDouble
(
maxHumidity
);
this
.
Max_Temperature
=
(
float
)
Convert
.
ToDouble
(
maxTemp
);
this
.
Max_Temperature
=
(
float
)
Convert
.
ToDouble
(
maxTemp
);
LogUtil
.
info
(
"保存温湿度预警值:Max_Humidity="
+
Max_Humidity
+
",Max_Temperature="
+
Max_Temperature
);
LogUtil
.
info
(
"保存温湿度预警值:Max_Humidity="
+
Max_Humidity
+
",Max_Temperature="
+
Max_Temperature
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -446,7 +457,7 @@ namespace DeviceLibrary
...
@@ -446,7 +457,7 @@ namespace DeviceLibrary
{
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg
=
StoreName
+
"出库未找库位:【"
+
posId
+
"】"
;
WarnMsg
=
StoreName
+
"出库未找库位:【"
+
posId
+
"】"
;
LogUtil
.
error
(
"收到服务器出库命令:未找到【"
+
posId
+
"】的库位信息"
);
LogUtil
.
error
(
"收到服务器出库命令:未找到【"
+
posId
+
"】的库位信息"
);
continue
;
continue
;
}
}
else
else
...
@@ -513,7 +524,8 @@ namespace DeviceLibrary
...
@@ -513,7 +524,8 @@ namespace DeviceLibrary
}
}
public
void
SendDoorStatus
()
public
void
SendDoorStatus
()
{
{
foreach
(
var
dev
in
InOutDevice
.
InOutDeviceList
)
{
foreach
(
var
dev
in
InOutDevice
.
InOutDeviceList
)
{
HttpHelper
.
Post
<
DoorInfo
>(
GetPostApi
(
"/api/xlc/updateDoorInfo"
),
dev
.
Value
.
DoorInfo
,
false
);
HttpHelper
.
Post
<
DoorInfo
>(
GetPostApi
(
"/api/xlc/updateDoorInfo"
),
dev
.
Value
.
DoorInfo
,
false
);
}
}
}
}
...
@@ -593,8 +605,10 @@ namespace DeviceLibrary
...
@@ -593,8 +605,10 @@ namespace DeviceLibrary
InStoreError
=
14
,
InStoreError
=
14
,
}
}
public
class
DoorInfo
{
public
class
DoorInfo
public
DoorInfo
()
{
{
public
DoorInfo
()
{
status
=
doorStatusE
.
free
;
status
=
doorStatusE
.
free
;
hasContainer
=
false
;
hasContainer
=
false
;
hSerial
=
""
;
hSerial
=
""
;
...
@@ -606,19 +620,21 @@ namespace DeviceLibrary
...
@@ -606,19 +620,21 @@ namespace DeviceLibrary
public
string
hSerial
;
public
string
hSerial
;
}
}
public
enum
doorIndexE
{
public
enum
doorIndexE
XLC_2
=
2
,
{
XLC_1
=
1
,
XLC_2
=
2
,
XLC_1
=
1
,
}
}
public
enum
doorStatusE
public
enum
doorStatusE
{
{
free
=
1
,
free
=
1
,
inStore
=
2
,
inStore
=
2
,
outStore
=
3
,
outStore
=
3
,
needBox
=
4
,
needBox
=
4
,
fullBoxNeedLeave
=
5
fullBoxNeedLeave
=
5
}
}
public
class
DoorTypeE
{
public
class
DoorTypeE
{
public
const
string
IN
=
"IN"
;
public
const
string
IN
=
"IN"
;
public
const
string
OUT
=
"OUT"
;
public
const
string
OUT
=
"OUT"
;
public
const
string
BOTH
=
"BOTH"
;
public
const
string
BOTH
=
"BOTH"
;
...
...
DeviceLibrary/theMachine/InOutDevice_IN.cs
查看文件 @
3a0bb72
...
@@ -23,7 +23,8 @@ namespace DeviceLibrary
...
@@ -23,7 +23,8 @@ namespace DeviceLibrary
{
{
get
=>
MoveInfo
.
MoveStep
==
MoveStep
.
InWaitBoxLeave
;
get
=>
MoveInfo
.
MoveStep
==
MoveStep
.
InWaitBoxLeave
;
}
}
public
void
OpenDoor
(
MoveInfo
moveInfo
)
{
public
void
OpenDoor
(
MoveInfo
moveInfo
)
{
LogUtil
.
info
(
$
"OpenDoor:low:{DO_Door_Down},up:{DO_Door_Up}"
);
LogUtil
.
info
(
$
"OpenDoor:low:{DO_Door_Down},up:{DO_Door_Up}"
);
MainMachine
.
CylinderMove
(
moveInfo
,
DO_Door_Down
,
DO_Door_Up
,
IO_VALUE
.
HIGH
);
MainMachine
.
CylinderMove
(
moveInfo
,
DO_Door_Down
,
DO_Door_Up
,
IO_VALUE
.
HIGH
);
...
@@ -49,7 +50,8 @@ namespace DeviceLibrary
...
@@ -49,7 +50,8 @@ namespace DeviceLibrary
}
}
return
false
;
return
false
;
}
}
public
void
Rescan
()
{
public
void
Rescan
()
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
In03
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
In03
);
MoveInfo
.
log
(
"扫码失败重新扫码"
);
MoveInfo
.
log
(
"扫码失败重新扫码"
);
}
}
...
@@ -126,13 +128,11 @@ namespace DeviceLibrary
...
@@ -126,13 +128,11 @@ namespace DeviceLibrary
}
}
else
else
{
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
InWaitServerCallback
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
In05
);
MoveInfo
.
log
(
$
"已完成扫码,等待服务器反馈库位 Count={x.Count}"
);
Lift
.
LiftDown
(
MoveInfo
);
MoveInfo
.
MoveParam
.
IsNg
=
false
;
MoveInfo
.
log
(
$
"放下入料阻挡"
);
MoveInfo
.
MoveParam
.
codeInfos
=
x
;
var
cc
=
x
.
Select
((
a
)
=>
a
.
CodeStr
);
mainMachine
.
ServerCM
.
SendInStoreRequest
(
cc
.
ToArray
(),
this
,
true
);
}
}
}
}
else
if
(
MoveInfo
.
IsTimeOut
(
10
))
else
if
(
MoveInfo
.
IsTimeOut
(
10
))
{
{
...
@@ -140,25 +140,6 @@ namespace DeviceLibrary
...
@@ -140,25 +140,6 @@ namespace DeviceLibrary
MoveInfo
.
log
(
$
"等待扫码超时,重新扫码"
);
MoveInfo
.
log
(
$
"等待扫码超时,重新扫码"
);
}
}
break
;
break
;
case
MoveStep
.
InWaitServerCallback
:
if
(
RobotManage
.
InoutDebugMode
)
{
//Msg.add("等待手动选择入库库位", MsgLevel.info);
MoveInfo
.
NextMoveStep
(
MoveStep
.
StartInStore
);
}
else
if
(
MoveInfo
.
IsTimeOut
(
5
))
Msg
.
add
(
"等待服务器返回库位"
,
MsgLevel
.
info
);
else
if
(
MoveInfo
.
IsTimeOut
(
15
))
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
MoveInfo
.
log
(
$
"等待服务器返回库位超时"
);
}
break
;
case
MoveStep
.
StartInStore
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
In05
);
Lift
.
LiftDown
(
MoveInfo
);
MoveInfo
.
log
(
$
"放下入料阻挡"
);
break
;
case
MoveStep
.
In05
:
case
MoveStep
.
In05
:
Line
.
LineRun
(
"work"
,
false
,
999
);
Line
.
LineRun
(
"work"
,
false
,
999
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
In06
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
In06
);
...
@@ -179,7 +160,7 @@ namespace DeviceLibrary
...
@@ -179,7 +160,7 @@ namespace DeviceLibrary
{
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
In09
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
In09
);
MiddleStop
(
MoveInfo
,
IO_VALUE
.
HIGH
);
MiddleStop
(
MoveInfo
,
IO_VALUE
.
HIGH
);
Line
.
LineRun
(
"work"
,
false
,
2
);
Line
.
LineRun
(
"work"
,
false
,
2
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
}
}
else
if
(
MoveInfo
.
IsTimeOut
(
15
))
else
if
(
MoveInfo
.
IsTimeOut
(
15
))
...
@@ -195,6 +176,57 @@ namespace DeviceLibrary
...
@@ -195,6 +176,57 @@ namespace DeviceLibrary
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_EndMaterialTop_Check
,
IO_VALUE
.
HIGH
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_EndMaterialTop_Check
,
IO_VALUE
.
HIGH
));
break
;
break
;
case
MoveStep
.
In10
:
case
MoveStep
.
In10
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
In11
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
break
;
case
MoveStep
.
In11
:
//读取称重
bool
res
=
BSQController
.
queryData
(
Config
.
WeightSensorPort
,
out
double
weight
);
if
(
res
)
{
if
(
weight
>
0
&&
weight
<=
Config
.
StoreWeightLimited
)
{
var
x
=
InScanTask
.
Result
;
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
InWaitServerCallback
);
MoveInfo
.
log
(
$
"已完成扫码,并称重完成 {weight}kg,等待服务器反馈库位 Count={x.Count}"
);
MoveInfo
.
MoveParam
.
IsNg
=
false
;
MoveInfo
.
MoveParam
.
codeInfos
=
x
;
var
cc
=
x
.
Select
((
a
)
=>
a
.
CodeStr
);
mainMachine
.
ServerCM
.
SendInStoreRequest
(
cc
.
ToArray
(),
this
,
true
,
weight
);
}
}
else
//超重
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
Out05
);
Lift
.
LiftDown
(
MoveInfo
);
Msg
.
add
(
"周转箱超重,退出"
,
MsgLevel
.
alarm
);
MoveInfo
.
log
(
$
"周转箱当前重量{weight},超重。顶升下降,出库该周转箱"
);
}
}
else
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
In10
);
MoveInfo
.
log
(
$
"获取周转箱重量失败,重新读取"
);
}
break
;
case
MoveStep
.
InWaitServerCallback
:
if
(
RobotManage
.
InoutDebugMode
)
{
//Msg.add("等待手动选择入库库位", MsgLevel.info);
MoveInfo
.
NextMoveStep
(
MoveStep
.
StartInStore
);
}
else
if
(
MoveInfo
.
IsTimeOut
(
5
))
Msg
.
add
(
"等待服务器返回库位"
,
MsgLevel
.
info
);
else
if
(
MoveInfo
.
IsTimeOut
(
15
))
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
MoveInfo
.
log
(
$
"等待服务器返回库位超时"
);
}
break
;
case
MoveStep
.
StartInStore
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
InWaitBoxLeave
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
InWaitBoxLeave
);
break
;
break
;
case
MoveStep
.
InWaitBoxLeave
:
case
MoveStep
.
InWaitBoxLeave
:
...
@@ -252,7 +284,7 @@ namespace DeviceLibrary
...
@@ -252,7 +284,7 @@ namespace DeviceLibrary
Task
.
Delay
(
delay
).
Wait
();
Task
.
Delay
(
delay
).
Wait
();
List
<
CodeInfo
>
LastCodeList
;
List
<
CodeInfo
>
LastCodeList
;
CodeManager
.
CloseCamera
(
InOutSide
==
InOutSideE
.
Left
?
Config
.
CameraName_Left
:
Config
.
CameraName_Right
);
CodeManager
.
CloseCamera
(
InOutSide
==
InOutSideE
.
Left
?
Config
.
CameraName_Left
:
Config
.
CameraName_Right
);
LastCodeList
=
CodeManager
.
CameraScan
(
new
List
<
string
>
{
InOutSide
==
InOutSideE
.
Left
?
Config
.
CameraName_Left
:
Config
.
CameraName_Right
});
LastCodeList
=
CodeManager
.
CameraScan
(
new
List
<
string
>
{
InOutSide
==
InOutSideE
.
Left
?
Config
.
CameraName_Left
:
Config
.
CameraName_Right
});
return
LastCodeList
;
return
LastCodeList
;
}));
}));
...
...
DeviceLibrary/theMachine/MoveStep.cs
查看文件 @
3a0bb72
...
@@ -38,6 +38,9 @@ namespace DeviceLibrary
...
@@ -38,6 +38,9 @@ namespace DeviceLibrary
In08
,
In08
,
In09
,
In09
,
In10
,
In10
,
In11
,
In12
,
In13
,
InWaitBoxLeave
,
//等待料箱入库
InWaitBoxLeave
,
//等待料箱入库
InBoxLeaved
,
//料箱已取走
InBoxLeaved
,
//料箱已取走
InOverHead
,
InOverHead
,
...
...
TheMachine/AxisControl.Designer.cs
查看文件 @
3a0bb72
...
@@ -31,8 +31,8 @@ namespace TheMachine
...
@@ -31,8 +31,8 @@ namespace TheMachine
{
{
this
.
axisMoveControl1
=
new
DeviceLibrary
.
AxisMoveControl
();
this
.
axisMoveControl1
=
new
DeviceLibrary
.
AxisMoveControl
();
this
.
panel1
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
panel1
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
configControl1
=
new
TheMachine
.
ConfigControl
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
configControl1
=
new
TheMachine
.
ConfigControl
();
this
.
panel1
.
SuspendLayout
();
this
.
panel1
.
SuspendLayout
();
this
.
SuspendLayout
();
this
.
SuspendLayout
();
//
//
...
@@ -55,15 +55,6 @@ namespace TheMachine
...
@@ -55,15 +55,6 @@ namespace TheMachine
this
.
panel1
.
Size
=
new
System
.
Drawing
.
Size
(
1234
,
924
);
this
.
panel1
.
Size
=
new
System
.
Drawing
.
Size
(
1234
,
924
);
this
.
panel1
.
TabIndex
=
2
;
this
.
panel1
.
TabIndex
=
2
;
//
//
// configControl1
//
this
.
configControl1
.
Config
=
null
;
this
.
configControl1
.
Location
=
new
System
.
Drawing
.
Point
(
568
,
3
);
this
.
configControl1
.
Name
=
"configControl1"
;
this
.
configControl1
.
Size
=
new
System
.
Drawing
.
Size
(
647
,
474
);
this
.
configControl1
.
TabIndex
=
1
;
this
.
configControl1
.
Tag
=
"not"
;
//
// button1
// button1
//
//
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
16
,
409
);
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
16
,
409
);
...
@@ -74,6 +65,15 @@ namespace TheMachine
...
@@ -74,6 +65,15 @@ namespace TheMachine
this
.
button1
.
UseVisualStyleBackColor
=
true
;
this
.
button1
.
UseVisualStyleBackColor
=
true
;
this
.
button1
.
Click
+=
new
System
.
EventHandler
(
this
.
button1_Click
);
this
.
button1
.
Click
+=
new
System
.
EventHandler
(
this
.
button1_Click
);
//
//
// configControl1
//
this
.
configControl1
.
Config
=
null
;
this
.
configControl1
.
Location
=
new
System
.
Drawing
.
Point
(
568
,
3
);
this
.
configControl1
.
Name
=
"configControl1"
;
this
.
configControl1
.
Size
=
new
System
.
Drawing
.
Size
(
647
,
474
);
this
.
configControl1
.
TabIndex
=
1
;
this
.
configControl1
.
Tag
=
"not"
;
//
// AxisControl
// AxisControl
//
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
...
...
TheMachine/Form1.cs
查看文件 @
3a0bb72
...
@@ -20,6 +20,7 @@ namespace TheMachine
...
@@ -20,6 +20,7 @@ namespace TheMachine
{
{
public
Form1
()
public
Form1
()
{
{
Control
.
CheckForIllegalCrossThreadCalls
=
false
;
InitializeComponent
();
InitializeComponent
();
this
.
FormClosing
+=
Form1_FormClosing
;
this
.
FormClosing
+=
Form1_FormClosing
;
this
.
Text
=
Setting_Init
.
App_Title
+
" "
+
Setting_Init
.
Server_CID
;
this
.
Text
=
Setting_Init
.
App_Title
+
" "
+
Setting_Init
.
Server_CID
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论