Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO1057_XLC_Store
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit a6c3be72
由
刘韬
编写于
2022-10-10 17:12:08 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
39717666
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
426 行增加
和
81 行删除
Common/Setting_Init.cs
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
DeviceLibrary/theMachine/InOutDevice.cs
DeviceLibrary/theMachine/MainMachine _IOMonitor.cs
DeviceLibrary/theMachine/MainMachine _LedProcess.cs
DeviceLibrary/theMachine/MainMachine.cs
DeviceLibrary/theMachine/RobotManage.cs
TheMachine/Form1.Designer.cs
TheMachine/Form1.cs
TheMachine/SettingControl.Designer.cs
TheMachine/SettingControl.cs
TheMachine/SettingControl.resx
Common/Setting_Init.cs
查看文件 @
a6c3be7
...
...
@@ -38,7 +38,13 @@ namespace OnlineStore.Common
[
MyConfigComment
(
"屏蔽进出轴伸出时的层信号检查"
)]
public
static
MyConfig
<
bool
>
Device_DisableFloorCheck
=
false
;
[
MyConfigComment
(
"温湿度传感器端口"
)]
public
static
MyConfig
<
string
>
Device_Humiture_Port
=
"COM5"
;
[
MyConfigComment
(
"湿度超限吹气启动相对值=服务器设定湿度报警值-本相对值"
)]
public
static
MyConfig
<
int
>
Device_HumidityStartOffser
=
1
;
[
MyConfigComment
(
"湿度超限吹气停止相对值=服务器设定湿度报警值-本相对值"
)]
public
static
MyConfig
<
int
>
Device_HumidityEndOffser
=
10
;
[
MyConfigComment
(
"扫码识别类型"
)]
public
static
MyConfig
<
string
[
]>
CodeScan_CodeType
=
new
string
[]
{
"QR Code"
};
...
...
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
查看文件 @
a6c3be7
...
...
@@ -580,12 +580,12 @@ namespace DeviceLibrary
}
public
class
DoorInfo
{
public
DoorInfo
(
doorIndexE
doorIndexE
)
{
doorIndex
=
doorIndexE
;
public
DoorInfo
()
{
status
=
doorStatusE
.
free
;
hasContainer
=
false
;
hSerial
=
""
;
}
public
string
doorType
;
public
doorIndexE
doorIndex
;
public
doorStatusE
status
;
public
bool
hasContainer
;
...
...
@@ -593,12 +593,8 @@ namespace DeviceLibrary
}
public
enum
doorIndexE
{
LeftIn
=
2
,
LeftOut
=
1
,
RightIn
=
4
,
RightOut
=
3
,
XLC_2
=
2
,
XLC_1
=
1
,
}
public
enum
doorStatusE
{
...
...
@@ -608,4 +604,9 @@ namespace DeviceLibrary
needBox
=
4
,
fullBoxNeedLeave
=
5
}
public
class
DoorTypeE
{
public
const
string
IN
=
"IN"
;
public
const
string
OUT
=
"OUT"
;
public
const
string
BOTH
=
"BOTH"
;
}
}
DeviceLibrary/theMachine/InOutDevice.cs
查看文件 @
a6c3be7
...
...
@@ -56,7 +56,7 @@ namespace DeviceLibrary
Robot_Config
Config
;
MainMachine
mainMachine
;
public
string
Name
;
public
DoorInfo
DoorInfo
=
new
DoorInfo
(
doorIndexE
.
LeftIn
);
public
DoorInfo
DoorInfo
=
new
DoorInfo
();
public
InOutDevice
(
InOutSideE
inOutSide
,
InOutModeE
inOutMode
,
Robot_Config
_Config
,
MainMachine
_mainMachine
)
{
AxisBean
Lift_Moto
;
...
...
@@ -116,6 +116,19 @@ namespace DeviceLibrary
Line
=
new
LineRunMonitor
(
Name
,
Config
.
DOList
[
DO_Moto_Run
].
GetIOAddr
(),
Config
.
DOList
[
DO_Moto_Rev
].
GetIOAddr
());
InOutDeviceList
.
Add
(
inOutSide
,
this
);
if
(
InOutSide
==
InOutSideE
.
Left
)
DoorInfo
.
doorIndex
=
doorIndexE
.
XLC_1
;
else
if
(
InOutSide
==
InOutSideE
.
Right
)
DoorInfo
.
doorIndex
=
doorIndexE
.
XLC_2
;
if
(
InOutMode
==
InOutModeE
.
Both
)
DoorInfo
.
doorType
=
DoorTypeE
.
BOTH
;
else
if
(
InOutMode
==
InOutModeE
.
OnlyIN
)
DoorInfo
.
doorType
=
DoorTypeE
.
IN
;
else
if
(
InOutMode
==
InOutModeE
.
OnlyOUT
)
DoorInfo
.
doorType
=
DoorTypeE
.
OUT
;
}
bool
SafeCheck
()
{
...
...
@@ -158,9 +171,10 @@ namespace DeviceLibrary
if
(
MoveInfo
.
MoveStep
==
MoveStep
.
Wait
)
{
DoorInfo
.
status
=
doorStatusE
.
free
;
DoorInfo
.
hasContainer
=
false
;
if
(
CanIn
(
out
string
msg
))
{
{
if
(
IOValue
(
IO_AgvIn_Req
).
Equals
(
IO_VALUE
.
HIGH
)
||
(
IOValue
(
IO_F_Stop_In
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Entry_SafetyGrating
).
Equals
(
IO_VALUE
.
LOW
)))
{
MoveInfo
.
NewMove
(
MoveStep
.
AgvIn01
);
...
...
@@ -184,21 +198,12 @@ namespace DeviceLibrary
if
(
CurrnetDirection
==
InOutDirectionE
.
IN
)
{
if
(
InOutSide
==
InOutSideE
.
Left
)
DoorInfo
.
doorIndex
=
doorIndexE
.
LeftIn
;
else
if
(
InOutSide
==
InOutSideE
.
Right
)
DoorInfo
.
doorIndex
=
doorIndexE
.
RightIn
;
DoorInfo
.
hSerial
=
MoveInfo
.
MoveParam
.
hSerial
;
DoorInfo
.
status
=
doorStatusE
.
inStore
;
DoorInfo
.
hasContainer
=
false
;
}
else
if
(
CurrnetDirection
==
InOutDirectionE
.
OUT
)
{
if
(
InOutSide
==
InOutSideE
.
Left
)
DoorInfo
.
doorIndex
=
doorIndexE
.
LeftOut
;
else
if
(
InOutSide
==
InOutSideE
.
Right
)
DoorInfo
.
doorIndex
=
doorIndexE
.
RightOut
;
DoorInfo
.
hSerial
=
MoveInfo
.
MoveParam
.
hSerial
;
DoorInfo
.
status
=
doorStatusE
.
outStore
;
DoorInfo
.
hasContainer
=
true
;
...
...
@@ -208,21 +213,10 @@ namespace DeviceLibrary
DoorInfo
.
status
=
doorStatusE
.
fullBoxNeedLeave
;
}
}
else
{
if
(
CanIn
(
out
string
msg
))
{
if
(
InOutSide
==
InOutSideE
.
Left
)
DoorInfo
.
doorIndex
=
doorIndexE
.
LeftIn
;
else
if
(
InOutSide
==
InOutSideE
.
Right
)
DoorInfo
.
doorIndex
=
doorIndexE
.
RightIn
;
DoorInfo
.
status
=
doorStatusE
.
needBox
;
DoorInfo
.
hasContainer
=
false
;
}
}
}
public
bool
CanIn
(
out
string
msg
)
{
...
...
DeviceLibrary/theMachine/MainMachine _IOMonitor.cs
查看文件 @
a6c3be7
...
...
@@ -18,6 +18,7 @@ namespace DeviceLibrary
BtnActionE
BtnAction
=
BtnActionE
.
None
;
void
ioMonitor
()
{
airprocess
();
var
btnUP_L
=
IOValue
(
IO_Type
.
Mid_Up_Btn1
).
Equals
(
IO_VALUE
.
HIGH
);
var
btnUP_R
=
IOValue
(
IO_Type
.
Mid_Up_Btn2
).
Equals
(
IO_VALUE
.
HIGH
);
var
btnDown_L
=
IOValue
(
IO_Type
.
Mid_Down_Btn1
).
Equals
(
IO_VALUE
.
HIGH
);
...
...
@@ -103,6 +104,63 @@ namespace DeviceLibrary
}
public
double
Current_Humidity
=
0
;
public
double
Current_Temperate
=
0
;
bool
airisopen
=
false
;
DateTime
lastAirprocesstime
=
DateTime
.
Now
;
void
airprocess
()
{
if
((
DateTime
.
Now
-
lastAirprocesstime
).
TotalSeconds
<
5
)
return
;
lastAirprocesstime
=
DateTime
.
Now
;
//var temp = HumitureController.QueryData();
var
temp
=
HumitureController
.
LastData
;
Current_Humidity
=
temp
.
Humidity
;
Current_Temperate
=
temp
.
Temperate
;
//var tempIsOK = Current_Temperate < ServerCM.Max_Temperature;
var
humiNeedStart
=
Current_Humidity
>
ServerCM
.
Max_Humidity
-
Setting_Init
.
Device_HumidityStartOffser
;
var
humiNeedStop
=
Current_Humidity
<
ServerCM
.
Max_Humidity
-
Setting_Init
.
Device_HumidityEndOffser
;
if
(
humiNeedStart
&&
!
airisopen
)
{
IOMove
(
IO_Type
.
AirValue
,
IO_VALUE
.
HIGH
);
airisopen
=
true
;
LogUtil
.
info
(
$
"开始吹气,当前最大湿度:{Current_Humidity} > {ServerCM.Max_Humidity}-{Setting_Init.Device_HumidityStartOffser}."
);
}
else
if
(
humiNeedStop
&&
airisopen
)
{
IOMove
(
IO_Type
.
AirValue
,
IO_VALUE
.
LOW
);
airisopen
=
false
;
LogUtil
.
info
(
$
"关闭吹气,当前最大湿度:{Current_Humidity} < {ServerCM.Max_Humidity}-{Setting_Init.Device_HumidityEndOffser}."
);
}
}
bool
lastTHoutRangeStatus
=
false
;
DateTime
lastTHoutRangeTime
=
DateTime
.
MaxValue
;
bool
IsTHoutRange
()
{
if
(
HumitureController
.
LastData
.
Humidity
>
ServerCM
.
Max_Humidity
// || HumitureController.LastData.Humidity < ServerCM.Min_Humidity
||
HumitureController
.
LastData
.
Temperate
>
ServerCM
.
Max_Temperature
)
{
if
(!
lastTHoutRangeStatus
)
lastTHoutRangeTime
=
DateTime
.
Now
;
lastTHoutRangeStatus
=
true
;
return
true
;
}
else
{
if
(
lastTHoutRangeStatus
)
lastTHoutRangeTime
=
DateTime
.
MaxValue
;
lastTHoutRangeStatus
=
false
;
return
false
;
}
}
bool
IsTHoutRangeOver30m
()
{
return
(
DateTime
.
Now
-
lastTHoutRangeTime
).
TotalMinutes
>
30
;
}
enum
BtnActionE
{
None
,
...
...
DeviceLibrary/theMachine/MainMachine _LedProcess.cs
查看文件 @
a6c3be7
using
CodeLibrary
;
using
Newtonsoft.Json
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
...
...
@@ -16,58 +18,199 @@ namespace DeviceLibrary
Led
AlarmLed
;
Led
StandbyLed
;
Led
RunningLed
;
public
Dictionary
<
MachineLedStateE
,
Dictionary
<
LedColor
,
LedState
>>
MachineLedState
=
new
Dictionary
<
MachineLedStateE
,
Dictionary
<
LedColor
,
LedState
>>();
public
Dictionary
<
MachineLedStateE
,
string
>
MachineLedStateName
=
new
Dictionary
<
MachineLedStateE
,
string
>();
System
.
Threading
.
Timer
ledtimer
;
void
LedProcessInit
()
{
DefaultLedCfg
();
LoadLedCfg
();
ledtimer
=
new
System
.
Threading
.
Timer
(
new
TimerCallback
(
LedProcess
),
null
,
0
,
1000
);
GC
.
KeepAlive
(
ledtimer
);
}
public
void
LoadLedCfg
()
{
if
(
File
.
Exists
(
"Config\\LedConfig.json"
))
{
var
s
=
File
.
ReadAllText
(
"Config\\LedConfig.json"
);
try
{
var
ledcfgs
=
JsonConvert
.
DeserializeObject
<
Dictionary
<
MachineLedStateE
,
Dictionary
<
LedColor
,
LedState
>>>(
s
);
if
(
ledcfgs
!=
null
)
foreach
(
var
key
in
ledcfgs
.
Keys
)
MachineLedState
[
key
]
=
ledcfgs
[
key
];
}
catch
(
Exception
e
)
{
LogUtil
.
info
(
"灯塔亮灯配置加载失败:"
+
e
.
ToString
());
}
}
}
public
bool
SaveLedCfg
()
{
try
{
var
cfgtxt
=
JsonConvert
.
SerializeObject
(
MachineLedState
);
File
.
WriteAllText
(
"Config\\LedConfig.json"
,
cfgtxt
);
return
true
;
}
catch
(
Exception
e
)
{
LogUtil
.
info
(
"灯塔亮灯配置保存失败:"
+
e
.
ToString
());
return
false
;
}
}
public
void
DefaultLedCfg
()
{
MachineLedState
.
Clear
();
//系统报警并停止,红亮
MachineLedStateName
[
MachineLedStateE
.
AlarmStop
]
=
"停机报警"
;
MachineLedState
.
Add
(
MachineLedStateE
.
AlarmStop
,
nls
(
LedState
.
on
,
LedState
.
off
,
LedState
.
off
));
//系统运行时报警, 绿亮,红闪
MachineLedStateName
[
MachineLedStateE
.
Alarm
]
=
"报警"
;
MachineLedState
.
Add
(
MachineLedStateE
.
Alarm
,
nls
(
LedState
.
blink
,
LedState
.
off
,
LedState
.
on
));
//系统复位中 绿闪
MachineLedStateName
[
MachineLedStateE
.
HomeReset
]
=
"复位"
;
MachineLedState
.
Add
(
MachineLedStateE
.
HomeReset
,
nls
(
LedState
.
off
,
LedState
.
off
,
LedState
.
blink
));
//系统正常运行
MachineLedStateName
[
MachineLedStateE
.
Running
]
=
"运行"
;
MachineLedState
.
Add
(
MachineLedStateE
.
Running
,
nls
(
LedState
.
none
,
LedState
.
none
,
LedState
.
on
));
//系统暂停, 绿闪,红闪
MachineLedStateName
[
MachineLedStateE
.
SystemPause
]
=
"暂停"
;
MachineLedState
.
Add
(
MachineLedStateE
.
SystemPause
,
nls
(
LedState
.
blink
,
LedState
.
off
,
LedState
.
blink
));
//温湿度超限30分钟. 红闪,黄闪
MachineLedStateName
[
MachineLedStateE
.
THoutRangeOver30m
]
=
"温湿度超限30分钟"
;
MachineLedState
.
Add
(
MachineLedStateE
.
THoutRangeOver30m
,
nls
(
LedState
.
blink
,
LedState
.
blink
,
LedState
.
none
));
//温湿度超限 绿闪黄闪
MachineLedStateName
[
MachineLedStateE
.
THoutRange
]
=
"温湿度超限"
;
MachineLedState
.
Add
(
MachineLedStateE
.
THoutRange
,
nls
(
LedState
.
none
,
LedState
.
blink
,
LedState
.
blink
));
//进出库, 绿亮,黄闪
MachineLedStateName
[
MachineLedStateE
.
InOut
]
=
"出入库中"
;
MachineLedState
.
Add
(
MachineLedStateE
.
InOut
,
nls
(
LedState
.
none
,
LedState
.
blink
,
LedState
.
on
));
}
Dictionary
<
LedColor
,
LedState
>
nls
(
LedState
AlarmLedstate
,
LedState
StandbyLedstate
,
LedState
RunningLedstate
)
{
var
a
=
new
Dictionary
<
LedColor
,
LedState
>();
a
.
Add
(
LedColor
.
red
,
AlarmLedstate
);
a
.
Add
(
LedColor
.
yellow
,
StandbyLedstate
);
a
.
Add
(
LedColor
.
green
,
RunningLedstate
);
return
a
;
}
void
ProcessLefCfg
(
MachineLedStateE
machineLedStateE
)
{
if
(!
MachineLedState
.
ContainsKey
(
machineLedStateE
))
{
LogUtil
.
info
(
"灯塔配置未包含:"
+
machineLedStateE
.
ToString
());
return
;
}
var
ledcfg
=
MachineLedState
[
machineLedStateE
];
foreach
(
var
ledcolor
in
ledcfg
.
Keys
)
{
if
(
ledcfg
[
ledcolor
]
==
LedState
.
none
)
return
;
Led
.
LedColors
[
ledcolor
].
LedState
=
ledcfg
[
ledcolor
];
}
}
void
LedProcess
(
object
o
)
{
StandbyLed
.
LedState
=
LedState
.
off
;
AlarmLed
.
LedState
=
LedState
.
off
;
RunningLed
.
LedState
=
LedState
.
off
;
//
无法运行,量报警灯
if
(
!
canRunning
)
//
回原 绿闪
if
(
runStatus
==
RunStatus
.
HomeReset
)
{
AlarmLed
.
LedState
=
LedState
.
on
;
//RunningLed.LedState = LedState.blink
;
ProcessLefCfg
(
MachineLedStateE
.
HomeReset
);
}
if
(
alarmType
!=
AlarmType
.
None
)
//正常 绿亮
else
if
(
runStatus
==
RunStatus
.
Running
)
{
AlarmLed
.
LedState
=
LedState
.
on
;
AlarmBuzzer
.
ON
();
}
else
{
AlarmBuzzer
.
OFF
();
ProcessLefCfg
(
MachineLedStateE
.
Running
);
//出入库 绿闪 黄闪
if
(
StoreMoveInfo
.
MoveStep
>
MoveStep
.
Wait
||
LeftInOut
.
MoveInfo
.
MoveStep
>
MoveStep
.
Wait
||
(
RightInOut
.
MoveInfo
.
MoveStep
>
MoveStep
.
Wait
&&
RightInOut
.
MoveInfo
.
MoveStep
<
MoveStep
.
OutWaitAgv
))
{
//RunningLed.LedState = LedState.blink;
//StandbyLed.LedState = LedState.blink;
ProcessLefCfg
(
MachineLedStateE
.
InOut
);
}
//温度超限 绿亮 黄闪
if
(
IsTHoutRange
())
{
//RunningLed.LedState = LedState.on;
//StandbyLed.LedState = LedState.blink;
ProcessLefCfg
(
MachineLedStateE
.
THoutRange
);
}
//温度超限30分钟 绿亮 黄闪 红闪
if
(
IsTHoutRangeOver30m
())
{
//RunningLed.LedState = LedState.on;
//StandbyLed.LedState = LedState.blink;
//AlarmLed.LedState = LedState.blink;
ProcessLefCfg
(
MachineLedStateE
.
THoutRangeOver30m
);
}
//系统暂停,说明书未定义, 绿闪, 红闪
if
(!
canRunning
||
UserPause
)
{
//RunningLed.LedState = LedState.blink;
//AlarmLed.LedState = LedState.blink;
ProcessLefCfg
(
MachineLedStateE
.
SystemPause
);
}
}
if
(
runStatus
==
RunStatus
.
HomeReset
)
else
if
(
runStatus
==
RunStatus
.
Stop
)
{
StandbyLed
.
LedState
=
LedState
.
blink
;
//系统停止时有报警, 红亮
if
(
hasAlarm
)
{
//RunningLed.LedState = LedState.off;
//StandbyLed.LedState = LedState.off;
//AlarmLed.LedState = LedState.on;
ProcessLefCfg
(
MachineLedStateE
.
AlarmStop
);
}
}
if
(
runStatus
==
RunStatus
.
Running
)
//系统运行时报警, 绿亮,红闪
if
(
runStatus
!=
RunStatus
.
Stop
&&
hasAlarm
)
{
RunningLed
.
LedState
=
LedState
.
on
;
//RunningLed.LedState = LedState.on;
//StandbyLed.LedState = LedState.off;
//AlarmLed.LedState = LedState.blink;
ProcessLefCfg
(
MachineLedStateE
.
Alarm
);
//if (UserPause) {
// RunningLed.LedState = LedState.blink;
// StandbyLed.LedState = LedState.blink;
//}
}
Led
.
LedGroup
.
ForEach
((
x
)
=>
{
x
.
run
();
});
}
}
public
class
Led
{
public
class
Led
{
public
static
List
<
Led
>
LedGroup
=
new
List
<
Led
>();
public
static
Dictionary
<
LedColor
,
Led
>
LedColors
=
new
Dictionary
<
LedColor
,
Led
>();
public
LedState
LedState
=
LedState
.
off
;
public
LedColor
Color
=
LedColor
.
green
;
ushort
ledio
;
public
Led
(
ushort
io
)
{
public
Led
(
ushort
io
,
LedColor
ledColor
)
{
Color
=
ledColor
;
ledio
=
io
;
LedGroup
.
Add
(
this
);
LedColors
.
Add
(
ledColor
,
this
);
}
IO_VALUE
iovalue
;
IO_VALUE
lastiovalue
;
public
void
run
()
{
if
(
this
.
LedState
==
LedState
.
on
)
{
public
void
run
()
{
if
(
this
.
LedState
==
LedState
.
on
)
{
iovalue
=
IO_VALUE
.
HIGH
;
}
if
(
this
.
LedState
==
LedState
.
off
)
...
...
@@ -80,19 +223,40 @@ namespace DeviceLibrary
{
iovalue
=
IO_VALUE
.
HIGH
;
}
else
{
else
{
iovalue
=
IO_VALUE
.
LOW
;
}
}
if
(
iovalue
!=
lastiovalue
)
{
if
(
iovalue
!=
lastiovalue
)
{
lastiovalue
=
iovalue
;
IOManager
.
WriteSingleDO
(
""
,
0x00
,
ledio
,
iovalue
);
}
}
}
public
enum
LedState
{
public
enum
LedState
{
none
,
off
,
on
,
blink
}
public
enum
LedColor
{
red
,
yellow
,
green
}
public
enum
MachineLedStateE
{
AlarmStop
,
Alarm
,
HomeReset
,
Running
,
SystemPause
,
THoutRangeOver30m
,
THoutRange
,
InOut
,
}
}
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
a6c3be7
...
...
@@ -78,9 +78,9 @@ namespace DeviceLibrary
AIOTMoveInfo
=
new
MoveInfo
(
"出入库测试"
);
#
region
初始化
led
灯
AlarmLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
Alarm_Led
].
GetIOAddr
());
StandbyLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
Standby_Led
].
GetIOAddr
());
RunningLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
Run_Led
].
GetIOAddr
());
AlarmLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
Alarm_Led
].
GetIOAddr
()
,
LedColor
.
red
);
StandbyLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
Standby_Led
].
GetIOAddr
()
,
LedColor
.
yellow
);
RunningLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
Run_Led
].
GetIOAddr
()
,
LedColor
.
green
);
#
endregion
#
region
初始化伺服轴
XAxis
=
new
AxisBean
(
Config
.
XAxis
,
Name
);
...
...
DeviceLibrary/theMachine/RobotManage.cs
查看文件 @
a6c3be7
...
...
@@ -61,14 +61,21 @@ namespace DeviceLibrary
IsLoadOk
=
false
;
msg
+=
"IO板卡初始化失败\n"
;
}
if
(
StoreType
==
StoreType
.
TypeA
)
if
(!
HumitureController
.
Init
(
Setting_Init
.
Device_Humiture_Port
))
{
if
(!
OKLEController
.
Init
(
Config
.
WeightSensorPort
))
{
IsLoadOk
=
false
;
msg
+=
$
"称重传感器初始化失败 Port:{Config.WeightSensorPort}\n"
;
}
IsLoadOk
=
false
;
msg
+=
"温湿度传感器初始化失败,端口:"
+
$
"{Setting_Init.Device_Humiture_Port}\n"
;
}
//if (StoreType == StoreType.TypeA)
//{
// if (!OKLEController.Init(Config.WeightSensorPort))
// {
// IsLoadOk = false;
// msg += $"称重传感器初始化失败 Port:{Config.WeightSensorPort}\n";
// }
//}
if
(!
CameraA
.
LoadCameraConfig
(
"CameraA"
,
out
string
errmsg
))
{
IsLoadOk
=
false
;
...
...
TheMachine/Form1.Designer.cs
查看文件 @
a6c3be7
...
...
@@ -87,6 +87,7 @@ namespace TheMachine
//
// 启用调试模式ToolStripMenuItem
//
this
.
启用调试模式
ToolStripMenuItem
.
Enabled
=
false
;
this
.
启用调试模式
ToolStripMenuItem
.
Name
=
"启用调试模式ToolStripMenuItem"
;
this
.
启用调试模式
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
192
,
26
);
this
.
启用调试模式
ToolStripMenuItem
.
Text
=
"启用配置模式"
;
...
...
@@ -229,7 +230,6 @@ namespace TheMachine
// cb_IgnoreSafecheck
//
this
.
cb_IgnoreSafecheck
.
AutoSize
=
true
;
this
.
cb_IgnoreSafecheck
.
Enabled
=
true
;
this
.
cb_IgnoreSafecheck
.
Location
=
new
System
.
Drawing
.
Point
(
657
,
47
);
this
.
cb_IgnoreSafecheck
.
Name
=
"cb_IgnoreSafecheck"
;
this
.
cb_IgnoreSafecheck
.
Size
=
new
System
.
Drawing
.
Size
(
215
,
25
);
...
...
TheMachine/Form1.cs
查看文件 @
a6c3be7
...
...
@@ -232,7 +232,7 @@ namespace TheMachine
});
return
;
}
启用调试模式
ToolStripMenuItem
.
Enabled
=
true
;
if
(
state
)
{
btn_run
.
Enabled
=
true
;
...
...
TheMachine/SettingControl.Designer.cs
查看文件 @
a6c3be7
...
...
@@ -29,7 +29,7 @@ namespace TheMachine
/// </summary>
private
void
InitializeComponent
()
{
this
.
c
hbAutoRun
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
c
omponents
=
new
System
.
ComponentModel
.
Container
();
this
.
cb_leftmode
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
cb_rightmode
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
label1
=
new
System
.
Windows
.
Forms
.
Label
();
...
...
@@ -37,19 +37,16 @@ namespace TheMachine
this
.
groupBox1
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
label3
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
tp
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
label_tempsensor
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
cb_tempsensorport
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
lbl_hmdstate
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
chbAutoRun
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
groupBox1
.
SuspendLayout
();
this
.
tp
.
SuspendLayout
();
this
.
SuspendLayout
();
//
// chbAutoRun
//
this
.
chbAutoRun
.
AutoSize
=
true
;
this
.
chbAutoRun
.
Location
=
new
System
.
Drawing
.
Point
(
20
,
22
);
this
.
chbAutoRun
.
Name
=
"chbAutoRun"
;
this
.
chbAutoRun
.
Size
=
new
System
.
Drawing
.
Size
(
107
,
20
);
this
.
chbAutoRun
.
TabIndex
=
1
;
this
.
chbAutoRun
.
Text
=
"开机自启动"
;
this
.
chbAutoRun
.
UseVisualStyleBackColor
=
true
;
//
// cb_leftmode
//
this
.
cb_leftmode
.
DropDownStyle
=
System
.
Windows
.
Forms
.
ComboBoxStyle
.
DropDownList
;
...
...
@@ -94,7 +91,7 @@ namespace TheMachine
this
.
groupBox1
.
Controls
.
Add
(
this
.
cb_leftmode
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
label1
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
cb_rightmode
);
this
.
groupBox1
.
Location
=
new
System
.
Drawing
.
Point
(
20
,
77
);
this
.
groupBox1
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
135
);
this
.
groupBox1
.
Name
=
"groupBox1"
;
this
.
groupBox1
.
Size
=
new
System
.
Drawing
.
Size
(
363
,
204
);
this
.
groupBox1
.
TabIndex
=
4
;
...
...
@@ -120,24 +117,105 @@ namespace TheMachine
this
.
button1
.
UseVisualStyleBackColor
=
true
;
this
.
button1
.
Click
+=
new
System
.
EventHandler
(
this
.
button1_Click
);
//
// tp
//
this
.
tp
.
AutoSize
=
true
;
this
.
tp
.
AutoSizeMode
=
System
.
Windows
.
Forms
.
AutoSizeMode
.
GrowAndShrink
;
this
.
tp
.
ColumnCount
=
2
;
this
.
tp
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
50F
));
this
.
tp
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
50F
));
this
.
tp
.
Controls
.
Add
(
this
.
label_tempsensor
,
0
,
0
);
this
.
tp
.
Controls
.
Add
(
this
.
cb_tempsensorport
,
1
,
0
);
this
.
tp
.
Controls
.
Add
(
this
.
lbl_hmdstate
,
0
,
4
);
this
.
tp
.
Controls
.
Add
(
this
.
chbAutoRun
,
0
,
7
);
this
.
tp
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
);
this
.
tp
.
Name
=
"tp"
;
this
.
tp
.
RowCount
=
9
;
this
.
tp
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tp
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tp
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tp
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tp
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tp
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tp
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tp
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tp
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tp
.
Size
=
new
System
.
Drawing
.
Size
(
328
,
112
);
this
.
tp
.
TabIndex
=
7
;
//
// label_tempsensor
//
this
.
label_tempsensor
.
AutoSize
=
true
;
this
.
label_tempsensor
.
Cursor
=
System
.
Windows
.
Forms
.
Cursors
.
Default
;
this
.
label_tempsensor
.
Location
=
new
System
.
Drawing
.
Point
(
10
,
10
);
this
.
label_tempsensor
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
10
);
this
.
label_tempsensor
.
Name
=
"label_tempsensor"
;
this
.
label_tempsensor
.
Size
=
new
System
.
Drawing
.
Size
(
144
,
16
);
this
.
label_tempsensor
.
TabIndex
=
3
;
this
.
label_tempsensor
.
Text
=
"温湿度控制器端口:"
;
this
.
label_tempsensor
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
TopRight
;
//
// cb_tempsensorport
//
this
.
cb_tempsensorport
.
DropDownStyle
=
System
.
Windows
.
Forms
.
ComboBoxStyle
.
DropDownList
;
this
.
cb_tempsensorport
.
FormattingEnabled
=
true
;
this
.
cb_tempsensorport
.
Location
=
new
System
.
Drawing
.
Point
(
170
,
6
);
this
.
cb_tempsensorport
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
6
);
this
.
cb_tempsensorport
.
Name
=
"cb_tempsensorport"
;
this
.
cb_tempsensorport
.
Size
=
new
System
.
Drawing
.
Size
(
121
,
24
);
this
.
cb_tempsensorport
.
TabIndex
=
2
;
this
.
cb_tempsensorport
.
Tag
=
"not"
;
this
.
cb_tempsensorport
.
SelectedIndexChanged
+=
new
System
.
EventHandler
(
this
.
cb_tempsensorport_SelectedIndexChanged
);
//
// lbl_hmdstate
//
this
.
lbl_hmdstate
.
AutoSize
=
true
;
this
.
tp
.
SetColumnSpan
(
this
.
lbl_hmdstate
,
2
);
this
.
lbl_hmdstate
.
Location
=
new
System
.
Drawing
.
Point
(
10
,
46
);
this
.
lbl_hmdstate
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
10
);
this
.
lbl_hmdstate
.
Name
=
"lbl_hmdstate"
;
this
.
lbl_hmdstate
.
Size
=
new
System
.
Drawing
.
Size
(
72
,
16
);
this
.
lbl_hmdstate
.
TabIndex
=
5
;
this
.
lbl_hmdstate
.
Tag
=
"not"
;
this
.
lbl_hmdstate
.
Text
=
"当前状态"
;
//
// chbAutoRun
//
this
.
chbAutoRun
.
AutoSize
=
true
;
this
.
tp
.
SetColumnSpan
(
this
.
chbAutoRun
,
2
);
this
.
chbAutoRun
.
Location
=
new
System
.
Drawing
.
Point
(
10
,
82
);
this
.
chbAutoRun
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
10
);
this
.
chbAutoRun
.
Name
=
"chbAutoRun"
;
this
.
chbAutoRun
.
Size
=
new
System
.
Drawing
.
Size
(
107
,
20
);
this
.
chbAutoRun
.
TabIndex
=
7
;
this
.
chbAutoRun
.
Text
=
"开机自启动"
;
this
.
chbAutoRun
.
UseVisualStyleBackColor
=
true
;
//
// timer1
//
this
.
timer1
.
Enabled
=
true
;
this
.
timer1
.
Interval
=
1000
;
this
.
timer1
.
Tick
+=
new
System
.
EventHandler
(
this
.
timer1_Tick
);
//
// SettingControl
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
Controls
.
Add
(
this
.
tp
);
this
.
Controls
.
Add
(
this
.
groupBox1
);
this
.
Controls
.
Add
(
this
.
chbAutoRun
);
this
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
Name
=
"SettingControl"
;
this
.
Size
=
new
System
.
Drawing
.
Size
(
1024
,
740
);
this
.
Load
+=
new
System
.
EventHandler
(
this
.
SettingControl_Load
);
this
.
groupBox1
.
ResumeLayout
(
false
);
this
.
groupBox1
.
PerformLayout
();
this
.
tp
.
ResumeLayout
(
false
);
this
.
tp
.
PerformLayout
();
this
.
ResumeLayout
(
false
);
this
.
PerformLayout
();
}
#
endregion
private
System
.
Windows
.
Forms
.
CheckBox
chbAutoRun
;
private
System
.
Windows
.
Forms
.
ComboBox
cb_leftmode
;
private
System
.
Windows
.
Forms
.
ComboBox
cb_rightmode
;
private
System
.
Windows
.
Forms
.
Label
label1
;
...
...
@@ -145,5 +223,11 @@ namespace TheMachine
private
System
.
Windows
.
Forms
.
GroupBox
groupBox1
;
private
System
.
Windows
.
Forms
.
Label
label3
;
private
System
.
Windows
.
Forms
.
Button
button1
;
private
System
.
Windows
.
Forms
.
TableLayoutPanel
tp
;
private
System
.
Windows
.
Forms
.
Label
label_tempsensor
;
private
System
.
Windows
.
Forms
.
ComboBox
cb_tempsensorport
;
private
System
.
Windows
.
Forms
.
Label
lbl_hmdstate
;
private
System
.
Windows
.
Forms
.
CheckBox
chbAutoRun
;
private
System
.
Windows
.
Forms
.
Timer
timer1
;
}
}
TheMachine/SettingControl.cs
查看文件 @
a6c3be7
using
CodeLibrary
;
using
ConfigHelper
;
using
DeviceLibrary
;
using
OnlineStore
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
...
...
@@ -26,6 +27,11 @@ namespace TheMachine
chbAutoRun
.
Checked
=
Setting_Init
.
App_AutoRun
;
this
.
chbAutoRun
.
CheckedChanged
+=
new
System
.
EventHandler
(
this
.
chbAutoRun_CheckedChanged
);
//chbAutoRun.Enabled = true;
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
cb_tempsensorport
.
Items
.
Add
(
"COM"
+
i
);
}
}
private
void
RobotManage_LoadFinishEvent
(
bool
state
,
string
msg
)
...
...
@@ -42,6 +48,8 @@ namespace TheMachine
cb_rightmode
.
Items
.
AddRange
(
InOutModeItem
.
Items
);
cb_rightmode
.
SelectedIndex
=
(
int
)((
InOutModeE
)
Setting_Init
.
Device_RightInoutMode
);
Config
.
PropertyBind
(
Setting_Init
.
Device_Humiture_Port
.
Key
,
cb_tempsensorport
,
"SelectedItem"
,
"SelectedIndexChanged"
);
}
...
...
@@ -104,5 +112,25 @@ namespace TheMachine
Setting_Init
.
Device_LeftInoutMode
=
((
InOutModeItem
)
cb_leftmode
.
SelectedItem
).
inOutModeItem
;
Setting_Init
.
Device_RightInoutMode
=
((
InOutModeItem
)
cb_rightmode
.
SelectedItem
).
inOutModeItem
;
}
private
void
cb_tempsensorport_SelectedIndexChanged
(
object
sender
,
EventArgs
e
)
{
HumitureController
.
Init
(
Setting_Init
.
Device_Humiture_Port
);
}
private
void
timer1_Tick
(
object
sender
,
EventArgs
e
)
{
if
(!
Visible
)
return
;
lbl_hmdstate
.
Text
=
"当前状态:"
;
if
(!
HumitureController
.
IsRun
)
{
lbl_hmdstate
.
Text
+=
"未成功连接"
;
return
;
}
var
t
=
HumitureController
.
LastData
;
lbl_hmdstate
.
Text
+=
"温度"
+
$
":{t.Temperate}℃, "
+
"湿度"
+
$
":{t.Humidity}%"
;
}
}
}
TheMachine/SettingControl.resx
查看文件 @
a6c3be7
...
...
@@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论