Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
1069_MIMO_PlUS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 80107032
由
张东亮
编写于
2023-10-26 09:05:28 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
添加agv对接逻辑
1 个父辈
a04de88a
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
45 行增加
和
188 行删除
1069_MIMO_G2.sln
Common/util/ConfigAppSettings.cs
DeviceLibrary/DeviceLibrary.csproj
DeviceLibrary/theMachine/MainMachine.cs
DeviceLibrary/theMachine/MainMachine_AGV.cs
DeviceLibrary/theMachine/MainMachine_String.cs
DeviceLibrary/theMachine/MoveStep.cs
TheMachine/SettingControl.cs
1069_MIMO_G2.sln
查看文件 @
8010703
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 1
6
VisualStudioVersion = 1
6.0.30907.101
# Visual Studio Version 1
7
VisualStudioVersion = 1
7.5.33414.496
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}"
EndProject
...
...
Common/util/ConfigAppSettings.cs
查看文件 @
8010703
...
...
@@ -22,188 +22,15 @@ namespace OnlineStore.Common
Interlocked
.
Increment
(
ref
seq
);
return
seq
;
}
public
static
string
GetValue
(
string
keyStr
,
string
storeStr
)
{
string
key
=
keyStr
+
storeStr
;
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
return
GetValue
(
keyStr
);
}
else
{
return
config
.
AppSettings
.
Settings
[
key
].
Value
;
}
}
public
static
decimal
GetNumValue
(
string
keyStr
,
string
storeStr
)
{
string
key
=
keyStr
+
storeStr
;
decimal
a
=
0
;
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
return
GetNumValue
(
keyStr
);
}
else
{
{
Decimal
.
TryParse
(
config
.
AppSettings
.
Settings
[
key
].
Value
,
out
a
);
}
}
return
a
;
}
public
static
int
GetIntValue
(
string
keyStr
,
string
storeStr
)
{
string
key
=
keyStr
+
storeStr
;
int
a
=
0
;
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
return
GetIntValue
(
keyStr
);
}
else
{
{
Int32
.
TryParse
(
config
.
AppSettings
.
Settings
[
key
].
Value
,
out
a
);
}
}
return
a
;
}
public
static
string
GetValue
(
string
key
)
{
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
LogUtil
.
error
(
"未找到配置:"
+
key
+
",请检查配置是否完整!"
);
return
""
;
}
else
{
return
config
.
AppSettings
.
Settings
[
key
].
Value
;
}
}
public
static
decimal
GetNumValue
(
string
key
)
{
decimal
a
=
0
;
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
LogUtil
.
error
(
"未找到配置:"
+
key
+
",请检查配置是否完整!"
);
return
a
;
}
else
{
{
Decimal
.
TryParse
(
config
.
AppSettings
.
Settings
[
key
].
Value
,
out
a
);
}
}
return
a
;
}
public
static
int
GetIntValue
(
string
key
)
{
int
a
=
0
;
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
LogUtil
.
error
(
"未找到配置:"
+
key
+
",请检查配置是否完整!"
);
return
a
;
}
else
{
{
Int32
.
TryParse
(
config
.
AppSettings
.
Settings
[
key
].
Value
,
out
a
);
}
}
return
a
;
}
public
static
void
SaveValue
(
string
key
,
int
value
)
{
SaveValue
(
key
,
value
.
ToString
());
}
public
static
void
SaveValue
(
string
key
,
string
value
)
{
try
{
if
(
key
.
Equals
(
""
)
||
value
.
Equals
(
""
))
{
return
;
}
//增加的内容写在appSettings段下 <add key="RegCode" value="0"/>
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
SetValue
(
key
,
value
);
}
else
{
UpdateConfig
(
key
,
value
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"SaveValue保存配置出错:AppKey="
+
key
+
",AppValue="
+
value
+
","
,
ex
);
}
}
public
static
string
GetValue
(
object
debugDeviceId
)
public
static
T
GetValue
<
T
>(
string
key
,
T
defaultVal
=
default
(
T
),
string
comment
=
""
)
{
throw
new
NotImplementedException
();
}
/// <summary>
/// 更新配置文件信息
/// </summary>
/// <param name="name">配置文件字段名称</param>
/// <param name="Xvalue">值</param>
private
static
void
UpdateConfig
(
string
name
,
string
Xvalue
)
{
try
{
XmlDocument
doc
=
new
XmlDocument
();
doc
.
Load
(
Application
.
ExecutablePath
+
".config"
);
XmlNode
node
=
doc
.
SelectSingleNode
(
@"//add[@key='"
+
name
+
"']"
);
XmlElement
ele
=
(
XmlElement
)
node
;
ele
.
SetAttribute
(
"value"
,
Xvalue
);
doc
.
Save
(
Application
.
ExecutablePath
+
".config"
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"UpdateConfig保存配置出错:name="
+
name
+
",Xvalue="
+
Xvalue
+
","
,
ex
);
}
ConfigHelper
.
Config
.
SetComment
(
key
,
comment
);
return
ConfigHelper
.
Config
.
Get
(
key
,
defaultVal
);
}
///<summary>
///向.config文件的appKey结写入信息AppValue 保存设置
///</summary>
///<param name="AppKey">节点名</param>
///<param name="AppValue">值</param>
private
static
void
SetValue
(
String
AppKey
,
String
AppValue
)
public
static
void
SetValue
<
T
>(
string
key
,
T
defaultVal
=
default
(
T
))
{
try
{
XmlDocument
xDoc
=
new
XmlDocument
();
xDoc
.
Load
(
System
.
Windows
.
Forms
.
Application
.
ExecutablePath
+
".config"
);
XmlNode
xNode
;
XmlElement
xElem1
;
XmlElement
xElem2
;
xNode
=
xDoc
.
SelectSingleNode
(
"//appSettings"
);
xElem1
=
(
XmlElement
)
xNode
.
SelectSingleNode
(
"//add[@key='"
+
AppKey
+
"']"
);
if
(
xElem1
!=
null
)
xElem1
.
SetAttribute
(
"value"
,
AppValue
);
else
{
xElem2
=
xDoc
.
CreateElement
(
"add"
);
xElem2
.
SetAttribute
(
"key"
,
AppKey
);
xElem2
.
SetAttribute
(
"value"
,
AppValue
);
xNode
.
AppendChild
(
xElem2
);
}
xDoc
.
Save
(
System
.
Windows
.
Forms
.
Application
.
ExecutablePath
+
".config"
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"SetValue保存配置出错:AppKey="
+
AppKey
+
",AppValue="
+
AppValue
+
","
,
ex
);
}
ConfigHelper
.
Config
.
Set
(
key
,
defaultVal
);
}
}
}
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
8010703
...
...
@@ -32,6 +32,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AGVLib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\DLL\AGVLib\AGVLib\bin\Debug\AGVLib.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary, Version=1.0.8384.25672, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DLL\CodeLibrary.dll</HintPath>
...
...
@@ -90,6 +94,7 @@
<Compile Include="theMachine\Common.cs" />
<Compile Include="theMachine\JobList.cs" />
<Compile Include="theMachine\LabelParam.cs" />
<Compile Include="theMachine\MainMachine_AGV.cs" />
<Compile Include="theMachine\MainMachine_ServerControl.cs" />
<Compile Include="theMachine\MainMachine _BtnProcess.cs" />
<Compile Include="theMachine\MainMachine _Common.cs" />
...
...
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
8010703
...
...
@@ -191,6 +191,7 @@ namespace DeviceLibrary
ConfigHelper
.
Config
.
Get
(
"CamTestReel_Ability"
,
false
);
ConfigHelper
.
Config
.
Set
(
"CamTestReel_debug"
,
false
);
ConfigHelper
.
Config
.
Get
(
"Device_1315_ReelHeight_Compensation"
,
0
);
initAgv
();
}
private
void
Crc_LanguageChangeEvent
(
object
sender
,
EventArgs
e
)
...
...
@@ -275,6 +276,7 @@ namespace DeviceLibrary
if
(
runStatus
==
RunStatus
.
Running
)
{
ioMonitor
();
AGVProcess
();
StringProcess
();
ClampProcess
();
boxTransport
.
Process
();
...
...
DeviceLibrary/theMachine/MainMachine_AGV.cs
0 → 100644
查看文件 @
8010703
此文件的差异被折叠,
点击展开。
DeviceLibrary/theMachine/MainMachine_String.cs
查看文件 @
8010703
...
...
@@ -121,6 +121,7 @@ namespace DeviceLibrary
StringMoveInfo
.
log
(
$
"当前没有料串"
);
StringState
=
StringStateE
.
None
;
LastStringState
=
StringStateE
.
None
;
needEnter
(
AGVLib
.
NodeStatus
.
NeedEnter
);
}
else
if
(
IOValue
(
IO_Type
.
StringFront_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
...
...
@@ -428,7 +429,9 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
StringOut_02
:
StringMoveInfo
.
NextMoveStep
(
MoveStep
.
StringOut_03
);
StringMoveInfo
.
log
(
$
"打开门"
);
needLeave
(
AGVLib
.
NodeStatus
.
NeedLeave
);
StringMoveInfo
.
log
(
$
"呼叫AGV取料串"
);
// StringMoveInfo.log($"打开门");
//CylinderMove(StringMoveInfo, IO_Type.StringDoor_Close, IO_Type.StringDoor_Open, IO_VALUE.HIGH);
break
;
case
MoveStep
.
StringOut_03
:
...
...
@@ -678,7 +681,7 @@ namespace DeviceLibrary
}
if
(
LastHeight
<=
8
)
{
LastHeight
=
8
;
}
//string code = CodeManager.ProcessCode(LastCodeList);
string
msg
=
Name
+
prefix
+
"上升前 ["
+
StartMovePosition
+
"]实时[ "
+
EndMovePosition
+
"]差值["
+
(
EndMovePosition
-
StartMovePosition
)
+
"]系数["
+
AxisChangeValue
+
"] 计算后"
+
"["
+
height
+
"],"
+
buchongStr
+
",归类为【"
+
LastHeight
+
"mm】条码【"
+
LastCode
+
"】"
;
string
msg
=
Name
+
prefix
+
"上升前 ["
+
StartMovePosition
+
"]实时[ "
+
EndMovePosition
+
"]差值["
+
(
EndMovePosition
-
StartMovePosition
)
+
"]系数["
+
AxisChangeValue
+
"] 计算后"
+
"["
+
height
+
"],"
+
buchongStr
+
",归类为【"
+
LastHeight
+
"mm】条码【"
+
LastCode
+
"】"
;
LogUtil
.
info
(
msg
);
return
LastHeight
;
}
...
...
DeviceLibrary/theMachine/MoveStep.cs
查看文件 @
8010703
...
...
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace
DeviceLibrary
{
public
enum
MoveStep
{
Wait
,
...
...
@@ -31,7 +31,7 @@ namespace DeviceLibrary
H16_HomeReset
,
HEND_HomeReset
,
StringLoad_01
,
StringLoad_01a
,
StringLoad_02
,
...
...
@@ -157,7 +157,27 @@ namespace DeviceLibrary
StoreTS16
,
StoreTS17
,
StoreTS18
,
//AGV
AGV_In01
,
AGV_In02
,
AGV_In03
,
AGV_In04
,
AGV_In05
,
AGV_In06
,
AGV_In07
,
AGV_In08
,
AGV_Out01
,
AGV_Out02
,
AGV_Out03
,
AGV_Out04
,
AGV_Out05
,
AGV_Out06
,
AGV_Out07
,
AGV_OpenDoor
,
AGV_DetachOK
,
AGV_CloseDoor
,
}
...
...
TheMachine/SettingControl.cs
查看文件 @
8010703
...
...
@@ -25,7 +25,7 @@ namespace TheMachine
InitializeComponent
();
RobotManage
.
LoadFinishEvent
+=
RobotManage_LoadFinishEvent
;
//chbAutoRun.Enabled = false;
chbAutoRun
.
Checked
=
Convert
.
ToBoolean
(
ConfigAppSettings
.
Get
IntValue
(
Setting_Init
.
App_AutoRun
));
chbAutoRun
.
Checked
=
Convert
.
ToBoolean
(
ConfigAppSettings
.
Get
Value
(
Setting_Init
.
App_AutoRun
,
0
,
"系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要"
));
this
.
chbAutoRun
.
CheckedChanged
+=
new
System
.
EventHandler
(
this
.
chbAutoRun_CheckedChanged
);
//chbAutoRun.Enabled = true;
for
(
int
i
=
0
;
i
<
20
;
i
++)
...
...
@@ -80,12 +80,12 @@ namespace TheMachine
{
if
(
chbAutoRun
.
Checked
)
{
ConfigAppSettings
.
S
ave
Value
(
Setting_Init
.
App_AutoRun
,
1
);
ConfigAppSettings
.
S
et
Value
(
Setting_Init
.
App_AutoRun
,
1
);
AutoRun
(
Application
.
ExecutablePath
,
true
);
}
else
{
ConfigAppSettings
.
S
ave
Value
(
Setting_Init
.
App_AutoRun
,
0
);
ConfigAppSettings
.
S
et
Value
(
Setting_Init
.
App_AutoRun
,
0
);
AutoRun
(
Application
.
ExecutablePath
,
false
);
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论