Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 4d9b62ca
由
几米阳光
编写于
2018-08-14 10:16:20 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
温湿度数据随机
1 个父辈
39260445
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
197 行增加
和
9 行删除
source/ACSingleStore/App.config
source/Common/util/HumitureServer.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Partial.cs
source/ACSingleStore/App.config
查看文件 @
4d9b62c
...
...
@@ -35,7 +35,12 @@
<
add
key
=
"KTK_MOVE_Distance"
value
=
"10000"
/>
<
add
key
=
"KTK_MOVE_AxisNo"
value
=
"1"
/>
<!--摄像机名称列表配置,用
#分割-->
<
add
key
=
"CameraName"
value
=
"192168024#192168025"
/>
<!--二维码类型列表配置,用
#分割-->
<
add
key
=
"CodeType"
value
=
"QR Code#Data Matrix ECC 200"
/>
<!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<
add
key
=
"CodeParamPath"
value
=
"\StoreConfig\AC\"
/>
</
appSettings
>
<
log4net
>
<
appender
name
=
"RollingLogFileAppender"
type
=
"log4net.Appender.RollingFileAppender"
>
...
...
source/Common/util/HumitureServer.cs
查看文件 @
4d9b62c
...
...
@@ -115,7 +115,6 @@ namespace OnlineStore.Common
}
}
private
static
double
PreShiDu
=
7
;
/// <summary>
/// 温湿度传感器 服务器回调函数
/// </summary>
...
...
@@ -156,13 +155,44 @@ namespace OnlineStore.Common
LogUtil
.
error
(
LOGGER
,
ex
.
ToString
());
}
}
private
static
double
PreShiDu
=
7
;
private
static
double
PreWenDu
=
25
;
public
static
void
RandomData
(
List
<
string
>
ipAddrList
)
{
try
{
foreach
(
string
IP
in
ipAddrList
)
{
double
newShiDu
=
GetRandomSD
();
double
newWenDu
=
GetRandomWD
();
ASTemperateParam
ast
=
new
ASTemperateParam
(
IP
,
""
,
""
,
newWenDu
,
newShiDu
,
DateTime
.
Now
);
if
(
TemperateParamMap
.
ContainsKey
(
IP
))
{
TemperateParamMap
.
Remove
(
IP
);
}
TemperateParamMap
.
Add
(
IP
,
ast
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"温湿度数据保存出错:"
+
ex
.
ToString
());
}
}
public
static
double
GetRandomWD
()
{
Random
rd
=
new
Random
((
int
)
DateTime
.
Now
.
Ticks
+
99
);
int
num
=
rd
.
Next
(-
20
,
20
);
double
newWendu
=
PreWenDu
+
(
double
)
num
/
1000F
;
if
(
newWendu
>
25.5
||
newWendu
<
24.5
)
{
newWendu
=
PreWenDu
;
}
return
newWendu
;
}
public
static
double
GetRandomSD
()
{
Random
rd
=
new
Random
((
int
)
DateTime
.
Now
.
Ticks
);
int
num
=
rd
.
Next
(-
20
,
20
);
double
newShiDu
=
PreShiDu
+
(
double
)
num
/
100F
;
double
newShiDu
=
PreShiDu
+
(
double
)
num
/
100
0
F
;
if
(
newShiDu
>
9
||
newShiDu
<
6
)
{
newShiDu
=
PreShiDu
;
...
...
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
查看文件 @
4d9b62c
using
OnlineStore.Common
;
using
HalconDotNet
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -80,6 +81,8 @@ namespace OnlineStore.DeviceLibrary
}
}
////初始化摄像机配置
//HDevelopExport.LoadConfig();
//初始化 //连接设备
KNDManager
.
ConnectionKND
(
Config
.
DIODeviceNameList
);
...
...
@@ -1206,7 +1209,7 @@ namespace OnlineStore.DeviceLibrary
}
#
region
扫码枪代码
#
region
datalogic
扫码枪代码
private
bool
isWaitScan
=
false
;
private
DateTime
StartWaitScanTime
=
DateTime
.
Now
;
private
bool
IsNotScanCode
=
false
;
...
...
@@ -1215,7 +1218,7 @@ namespace OnlineStore.DeviceLibrary
/// 扫码枪数据接收
/// </summary>
/// <param name="message"></param>
private
void
onCodeReceived
(
string
message
)
private
void
onCodeReceived
(
string
message
)
{
try
{
...
...
@@ -1309,6 +1312,156 @@ namespace OnlineStore.DeviceLibrary
#
endregion
#
region
Halcon
扫码枪代码
//public bool IsTestCamera = false;
//private System.Timers.Timer scanTimer = null;
//public void GetCameraCode()
//{
// if (IsTestCamera && IsInScan())
// {
// LogUtil.info("上次扫码还未执行完毕,请稍后!");
// return;
// }
// if (scanTimer == null)
// {
// scanTimer = new System.Timers.Timer();
// scanTimer.Interval = 10;
// scanTimer.AutoReset = false;
// scanTimer.Enabled = false;
// scanTimer.Elapsed += scanTimer_Elapsed;
// }
// scanTimer.Enabled = true;
//}
public
static
Dictionary
<
string
,
List
<
string
>>
codeMap
=
new
Dictionary
<
string
,
List
<
string
>>();
//public static object codeMapLock = "";
//private void scanTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
//{
// DateTime date = DateTime.Now;
// scanTimer.Enabled = false;
// //打开光源
// KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.HIGH);
// //打开所有摄像机
// foreach (string cameraName in HDevelopExport.cameraNameList)
// {
// if (!HDevelopExport.IsOpen(cameraName))
// {
// HDevelopExport.OpenCamera(cameraName);
// LogUtil.debug("扫码中:结束打开摄像机[" + cameraName + "],已耗时:" + (DateTime.Now - date).ToString());
// }
// }
// List<string> codeList = new List<string>();
// Dictionary<string, int> hasList = new Dictionary<string, int>();
// //int maxCodeCount = 10;
// string spiltStr = "##";
// string message = "";
// try
// {
// int cindex = 0;
// codeMap = new Dictionary<string, List<string>>();
// foreach (string cameraName in HDevelopExport.cameraNameList)
// {
// cindex++;
// int cameraIndex = cindex;
// string newName = cameraName;
// HObject ho_Image = HDevelopExport.GrabImage(newName);
// LogUtil.debug("扫码中:结束摄像机[" + newName + "] 读取图片,已耗时:" + (DateTime.Now - date).ToString());
// HObject image = ho_Image;
// List<object> param = new List<object>() { image, cameraIndex, cameraName };
// ThreadPool.QueueUserWorkItem(new WaitCallback(HDevelopExport.GetCode), param);
// ho_Image = null;
// }
// //等待两个图片都识别完成,大概需要15秒,等待30秒还未结束直接结束
// Thread.Sleep(500);
// int i = 0;
// int needCount = cindex;
// for (; i < 80; i++)
// {
// if (codeMap.Count >= needCount)
// {
// break;
// }
// Thread.Sleep(100);
// }
// LogUtil.info("扫码中:结束等待识别二维码,循环次数i=" + i + ",已耗时:" + (DateTime.Now - date).ToString());
// //如果等待300次,超时,需要关闭摄像机
// if (i >= 80)
// {
// LogUtil.info("扫码中:等待时间超时,关闭所有摄像机");
// HDevelopExport.CloseAllCamera();
// }
// foreach (List<string> codeArray in codeMap.Values)
// {
// //List<string> codeArray = HDevelopExport.GetCode(ho_Image, cindex);
// if (codeArray != null && codeArray.Count > 0)
// {
// foreach (string str in codeArray)
// {
// string[] array = str.Split('=');
// string code = array[1];
// if (array.Length >= 1)
// {
// if (!hasList.ContainsKey(code))
// {
// hasList.Add(code, codeList.Count);
// codeList.Add(str);
// }
// else
// {
// //替换原来的
// int index = hasList[code];
// if (codeList.Count > index)
// {
// LOGGER.Info(StoreName + "重复二维码【" + codeList[index] + "】【" + str + "】,使用【" + str + "】");
// codeList[index] = str;
// }
// }
// }
// }
// }
// }
// }
// catch (Exception ex)
// {
// LogUtil.error(StoreName + "从摄像机获取二维码出错:" + ex.ToString());
// LogUtil.error(StoreName + "关闭摄像机");
// HDevelopExport.CloseAllCamera();
// }
// finally
// {
// }
// foreach (string str in codeList)
// {
// message = message + str + spiltStr;
// }
// LogUtil.info("扫码中 开始从服务器获取库位,共耗时:" + (DateTime.Now - date).ToString());
// onCodeReceived(message);
//}
//private DateTime LastScanTime = DateTime.Now;
//private bool IsInScan()
//{
// if (!IsScanCode)
// {
// return false;
// }
// TimeSpan span = DateTime.Now - LastScanTime;
// if (span.TotalSeconds > 60)
// {
// //大于60秒表示超时了,可以重新开始扫码
// return false;
// }
// return true;
//}
#
endregion
#
region
温湿度处理
/// <summary>
/// 湿度标准,超过后需要报警
...
...
@@ -1436,6 +1589,7 @@ namespace OnlineStore.DeviceLibrary
{
return
;
}
HumitureServer
.
RandomData
(
Config
.
GetTempAddrList
());
HumidityProcess
();
LedProcess
();
isInProcess
=
true
;
...
...
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Partial.cs
查看文件 @
4d9b62c
...
...
@@ -731,7 +731,6 @@ namespace OnlineStore.DeviceLibrary
public
List
<
FixtureCodeInfo
>
waitOutStoreList
=
new
List
<
FixtureCodeInfo
>();
public
object
waitOutListLock
=
""
;
public
static
Dictionary
<
string
,
List
<
string
>>
codeMap
=
new
Dictionary
<
string
,
List
<
string
>>();
public
void
AddWaitOutInfo
(
FixtureCodeInfo
code
)
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论