Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
SO908-XLRStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit e06f51f9
由
张东亮
编写于
2022-04-25 11:21:32 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
appconfig读取与写入冲突问题修复,加锁
1 个父辈
52918c31
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
54 行增加
和
63 行删除
source/Common/util/ConfigAppSettings.cs
source/DeviceLibrary/storeBean/inputBean/BatchMoveBean_Partial.cs
source/Common/util/ConfigAppSettings.cs
查看文件 @
e06f51f
...
...
@@ -39,67 +39,51 @@ namespace OnlineStore.Common
return
config
.
AppSettings
.
Settings
[
key
].
Value
;
}
}
public
static
decimal
GetNumValue
(
string
keyStr
,
string
storeStr
)
public
static
string
GetValue
(
string
key
)
{
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
string
res
=
""
;
if
(
Monitor
.
TryEnter
(
lockobj
,
500
))
{
try
{
Decimal
.
TryParse
(
config
.
AppSettings
.
Settings
[
key
].
Value
,
out
a
);
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
LogUtil
.
error
(
"未找到配置:"
+
key
+
",请检查配置是否完整!"
);
}
else
{
res
=
config
.
AppSettings
.
Settings
[
key
].
Value
;
}
}
}
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
{
finally
{
Int32
.
TryParse
(
config
.
AppSettings
.
Settings
[
key
].
Value
,
out
a
);
Monitor
.
Exit
(
lockobj
);
}
}
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
;
}
return
res
;
}
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
if
(
Monitor
.
TryEnter
(
lockobj
,
500
))
{
try
{
Decimal
.
TryParse
(
config
.
AppSettings
.
Settings
[
key
].
Value
,
out
a
);
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
LogUtil
.
error
(
"未找到配置:"
+
key
+
",请检查配置是否完整!"
);
}
else
{
Decimal
.
TryParse
(
config
.
AppSettings
.
Settings
[
key
].
Value
,
out
a
);
}
}
finally
{
Monitor
.
Exit
(
lockobj
);
}
}
return
a
;
...
...
@@ -107,18 +91,26 @@ namespace OnlineStore.Common
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
if
(
Monitor
.
TryEnter
(
lockobj
,
500
))
{
try
{
System
.
Configuration
.
Configuration
config
=
ConfigurationManager
.
OpenExeConfiguration
(
ConfigurationUserLevel
.
None
);
if
(
config
.
AppSettings
.
Settings
[
key
]
==
null
)
{
LogUtil
.
error
(
"未找到配置:"
+
key
+
",请检查配置是否完整!"
);
}
else
{
Int32
.
TryParse
(
config
.
AppSettings
.
Settings
[
key
].
Value
,
out
a
);
}
}
finally
{
Int32
.
TryParse
(
config
.
AppSettings
.
Settings
[
key
].
Value
,
out
a
);
Monitor
.
Exit
(
lockobj
);
}
}
return
a
;
}
return
a
;
}
public
static
void
SaveValue
(
string
key
,
int
value
)
{
...
...
@@ -150,8 +142,8 @@ namespace OnlineStore.Common
{
LogUtil
.
error
(
"SaveValue保存配置出错:AppKey="
+
key
+
",AppValue="
+
value
+
","
,
ex
);
}
finally
{
finally
{
Monitor
.
Exit
(
lockobj
);
}
}
...
...
@@ -181,10 +173,10 @@ namespace OnlineStore.Common
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"UpdateConfig保存配置出错:name="
+
name
+
",Xvalue="
+
Xvalue
+
","
,
ex
);
LogUtil
.
error
(
"UpdateConfig保存配置出错:name="
+
name
+
",Xvalue="
+
Xvalue
+
","
,
ex
);
}
}
///<summary>
///向.config文件的appKey结写入信息AppValue 保存设置
...
...
@@ -215,7 +207,7 @@ namespace OnlineStore.Common
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"SetValue保存配置出错:AppKey="
+
AppKey
+
",AppValue="
+
AppValue
+
","
,
ex
);
LogUtil
.
error
(
"SetValue保存配置出错:AppKey="
+
AppKey
+
",AppValue="
+
AppValue
+
","
,
ex
);
}
}
}
...
...
source/DeviceLibrary/storeBean/inputBean/BatchMoveBean_Partial.cs
查看文件 @
e06f51f
...
...
@@ -332,12 +332,11 @@ namespace OnlineStore.DeviceLibrary
}
return
false
;
}
bool
isScan
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
NeedScanCode
).
Equals
(
1
);
private
void
IB11_ScanCode
()
{
ClearWarnMsg
(
"等待旋转轴离开料串超时"
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
IB11_ScanCode
);
bool
isScan
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
NeedScanCode
).
Equals
(
1
);
LastCodeList
=
new
List
<
string
>();
//if (NextCodeList.Count > 0)
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论