Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
Line-Smart-Workstation
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 693f71b1
由
LN
编写于
2024-02-01 16:17:11 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
aoi界面打开时,关闭照明灯
1 个父辈
c12788e5
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
147 行增加
和
92 行删除
DeviceLibrary/deviceLibrary/ledLabel/LedLabelController.cs
TSA-V/workForm/FrmAOICheck.cs
TSA-V/workForm/FrmTSAV.cs
DeviceLibrary/deviceLibrary/ledLabel/LedLabelController.cs
查看文件 @
693f71b
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Net.Http
;
using
System.Net.Http
;
using
System.Threading.Tasks
;
using
TSA_V.Common
;
using
TSA_V.Common
;
using
TSA_V.LoadCSVLibrary
;
using
TSA_V.LoadCSVLibrary
;
namespace
TSA_V.DeviceLibrary
namespace
TSA_V.DeviceLibrary
{
{
public
class
LedLabelController
public
class
LedLabelController
{
{
public
static
void
OpenAll
()
public
static
void
OpenAll
()
{
{
OpenOrCloseAll
(
true
);
OpenOrCloseAll
(
true
);
...
@@ -37,10 +38,10 @@ namespace TSA_V.DeviceLibrary
...
@@ -37,10 +38,10 @@ namespace TSA_V.DeviceLibrary
{
{
string
url
=
$
"http://{ip}/wms/associate/lightTagsLed"
;
string
url
=
$
"http://{ip}/wms/associate/lightTagsLed"
;
string
json
=
JsonHelper
.
SerializeObject
(
getLedMaps
(
macs
,
ledvs
));
string
json
=
JsonHelper
.
SerializeObject
(
getLedMaps
(
macs
,
ledvs
));
Post
(
url
,
json
,
(
open
?
"打开所有"
:
"关闭所有"
));
Post
(
url
,
json
,
(
open
?
"打开所有"
:
"关闭所有"
));
}
}
}
}
public
static
LabelInfo
GetLabel
(
TSAVPosition
position
,
ComponetInfo
com
,
bool
opendLed
)
public
static
LabelInfo
GetLabel
(
TSAVPosition
position
,
ComponetInfo
com
,
bool
opendLed
)
{
{
if
(
com
==
null
)
if
(
com
==
null
)
{
{
...
@@ -108,7 +109,7 @@ namespace TSA_V.DeviceLibrary
...
@@ -108,7 +109,7 @@ namespace TSA_V.DeviceLibrary
Dictionary
<
string
,
object
>
keyValuePairss
=
getLedMap
(
mac
,
ledrgb
);
Dictionary
<
string
,
object
>
keyValuePairss
=
getLedMap
(
mac
,
ledrgb
);
string
json
=
JsonHelper
.
SerializeObject
(
keyValuePairss
);
string
json
=
JsonHelper
.
SerializeObject
(
keyValuePairss
);
string
value
=
$
"[{json}]"
;
string
value
=
$
"[{json}]"
;
Post
(
url
,
value
,
mac
+
(
openLed
?
"开灯"
:
"关灯"
));
Post
(
url
,
value
,
mac
+
(
openLed
?
"开灯"
:
"关灯"
));
}
}
public
static
void
UpdateScreen
(
LabelInfo
label
)
public
static
void
UpdateScreen
(
LabelInfo
label
)
{
{
...
@@ -142,13 +143,13 @@ namespace TSA_V.DeviceLibrary
...
@@ -142,13 +143,13 @@ namespace TSA_V.DeviceLibrary
}
}
string
json
=
JsonHelper
.
SerializeObject
(
dic
);
string
json
=
JsonHelper
.
SerializeObject
(
dic
);
string
value
=
$
"[{json}]"
;
string
value
=
$
"[{json}]"
;
Post
(
url
,
value
,
"更新屏幕"
);
Post
(
url
,
value
,
"更新屏幕"
);
}
}
public
static
async
void
Post
(
string
url
,
string
json
,
string
opName
=
""
)
public
static
async
Task
<
string
>
Post
(
string
url
,
string
json
,
string
opName
=
""
)
{
{
try
try
{
{
using
(
var
client
=
new
HttpClient
())
using
(
var
client
=
new
HttpClient
())
{
{
using
(
var
request
=
new
HttpRequestMessage
(
HttpMethod
.
Post
,
url
))
using
(
var
request
=
new
HttpRequestMessage
(
HttpMethod
.
Post
,
url
))
...
@@ -161,12 +162,14 @@ namespace TSA_V.DeviceLibrary
...
@@ -161,12 +162,14 @@ namespace TSA_V.DeviceLibrary
{
{
string
jsonResponse
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
string
jsonResponse
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
LogUtil
.
info
(
$
"电子屏 {opName} 发送{json} 结果 {response.IsSuccessStatusCode}: "
+
jsonResponse
);
LogUtil
.
info
(
$
"电子屏 {opName} 发送{json} 结果 {response.IsSuccessStatusCode}: "
+
jsonResponse
);
return
jsonResponse
;
}
}
else
else
{
{
string
jsonResponse
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
string
jsonResponse
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
LogUtil
.
info
(
$
"电子屏 {opName} 发送{json} 结果 {response.IsSuccessStatusCode}: "
+
jsonResponse
);
LogUtil
.
info
(
$
"电子屏 {opName} 发送{json} 结果 {response.IsSuccessStatusCode}: "
+
jsonResponse
);
}
return
jsonResponse
;
}
}
}
}
}
}
}
...
@@ -175,6 +178,7 @@ namespace TSA_V.DeviceLibrary
...
@@ -175,6 +178,7 @@ namespace TSA_V.DeviceLibrary
{
{
LogUtil
.
info
(
$
"电子屏 {opName} 发送{json} 出错 {ex.ToString()}"
);
LogUtil
.
info
(
$
"电子屏 {opName} 发送{json} 出错 {ex.ToString()}"
);
}
}
return
""
;
}
}
// {
// {
// "mac":"99.96.19.64",
// "mac":"99.96.19.64",
...
@@ -194,89 +198,130 @@ namespace TSA_V.DeviceLibrary
...
@@ -194,89 +198,130 @@ namespace TSA_V.DeviceLibrary
// "ledstate":"0",
// "ledstate":"0",
// "outtime":"0"
// "outtime":"0"
//}
//}
private
static
List
<
DataInfo
>
queryState
(
string
ip
,
List
<
string
>
ids
)
{
try
{
if
(
ids
==
null
)
{
ids
=
new
List
<
string
>();
}
string
url
=
$
"http://{ip}/wms/associate/queryTagsInRouterId"
;
string
value
=
JsonHelper
.
SerializeObject
(
ids
);
//private static void controlLed(string ip, string mac, bool openLed)
Task
<
string
>
task
=
Post
(
url
,
value
,
"查询状态信息"
);
//{
task
.
Wait
();
// string ledrgb = openLed ? "ff00" : "0";
string
resutljson
=
task
.
Result
;
// using (var client = new HttpClient())
ReturnData
data
=
JsonHelper
.
DeserializeJsonToObject
<
ReturnData
>(
resutljson
);
// {
if
(
data
!=
null
&&
data
.
DataList
!=
null
)
// string url = $"http://{ip}/wms/associate/lightTagsLed";
{
// using (var requests = new HttpRequestMessage(HttpMethod.Post, url))
return
data
.
DataList
;
// {
}
// Dictionary<string, object> keyValuePairss = getLedMap(mac, ledrgb);
return
new
List
<
DataInfo
>();
// string json = JsonHelper.SerializeObject(keyValuePairss);
// var contents = new StringContent($"[{json}]", null, "application/json");
// LogUtil.info($"电子屏 {ip}-{mac} : {(openLed ? "开灯" : "关灯")} url:{url}, 发送内容:{json}");
// requests.Content = contents;
// using (HttpResponseMessage response = client.SendAsync(requests).Result)
// {
// if (response.IsSuccessStatusCode)
// {
// string jsonResponse = response.Content.ReadAsStringAsync().Result;
// LogUtil.info($"电子屏 {ip}-{mac} : {(openLed ? "开灯" : "关灯")} 结果: " + jsonResponse);
// }
// else
// {
// LogUtil.info($"电子屏 {ip}-{mac} : {(openLed ? "开灯" : "关灯")} 结果: " + response.RequestMessage.ToString());
// }
// }
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
$
"查询标签{string.Join("
,
", ids)}状态出错:"
+
ex
.
ToString
());
}
return
new
List
<
DataInfo
>();
}
}
public
class
ReturnData
{
public
List
<
DataInfo
>
DataList
{
get
;
set
;
}
/// <summary>
/// 返回码
/// </summary>
public
int
ResultCode
{
get
;
set
;
}
/// <summary>
/// 接口响应信息
/// </summary>
public
string
ResultMsg
{
get
;
set
;
}
}
// requests.Dispose();
// { "datalist": [
// }
//{ "hardwareVersion": "4.5", "height": 128, "mac": "99.26.17.85", "manufacture": "CoreWind31", "power": 100, "productionBatch": "20-08-29", "routerId": 1, "rssi": -21, "screenType": 1, "serialNumber": "CNSHZH1000", "shopNumber": "A0015", "showStyle": "拣货模板单列", "softwareVersion": "7.0", "state": true, "status": 4, "tagRegisterEN": 1, "width": 296
// }
//},{ "hardwareVersion": "4.5", "height": 128, "mac": "99.26.18.21", "manufacture": "CoreWind31", "power": 87, "productionBatch": "20-08-29", "routerId": 1, "rssi": -19, "screenType": 1, "serialNumber": "CNSHZH1000", "shopNumber": "A0015", "showStyle": "拣货模板单列", "softwareVersion": "7.0", "state": true, "status": 4, "tagRegisterEN": 1, "width": 296
//},{
// "hardwareVersion": "4.5", "height": 128, "mac": "99.26.18.36", "manufacture": "CoreWind31", "power": 100, "productionBatch": "20-08-29",
//"routerId": 1, "rssi": -25, "screenType": 1, "serialNumber": "CNSHZH1000", "shopNumber": "A0015", "showStyle": "拣货模板单列", "softwareVersion": "7.0", "state": true, "status": 4, "tagRegisterEN": 0, "width": 296
//}
//}
//public static void UpdateScreen(LabelInfo label)
//],"resultCode": 10, "resultMsg": "success"
//{
// string ledrgb = label.openLed ? "ff00" : "0";
// using (var client = new HttpClient())
// {
// string url = $"http://{label.ip}/wms/associate/updateScreen";
// using (var request = new HttpRequestMessage(HttpMethod.Post, url))
// {
// Dictionary<string, object> dic = new Dictionary<string, object>();
// dic.Add("mac", label.mac);
// dic.Add("mappingtype", "868");
// dic.Add("styleid", 47);
// dic.Add("ledrgb", "0");
// dic.Add("ledstate", "0");
// dic.Add("outtime", "0");
// Dictionary<string, object> lmap = label.toMap();
// foreach (string key in lmap.Keys)
// {
// if (dic.ContainsKey(key))
// {
// dic[key] = lmap[key];
// }
// else
// {
// dic.Add(key, lmap[key]);
// }
// }
// string json = JsonHelper.SerializeObject(dic);
// var contents = new StringContent($"[{json}]", null, "application/json");
// LogUtil.info($"电子屏 {label.ip}-{label.mac} : 更改屏幕内容 url:{url}, 发送内容:{json}");
// request.Content = contents;
// using (HttpResponseMessage response = client.SendAsync(request).Result)
// {
// if (response.IsSuccessStatusCode)
// {
// string jsonResponse = response.Content.ReadAsStringAsync().Result;
// LogUtil.info($"电子屏 {label.ip}-{label.mac} : 更改屏幕结果: " + jsonResponse);
// }
// else
// {
// LogUtil.info($"电子屏 {label.ip}-{label.mac} : 更改屏幕失败: " + response.RequestMessage.ToString());
// }
// }
// }
// }
//}
//}
}
public
class
DataInfo
{
/// <summary>
/// 硬件版本号
/// </summary>
public
string
HardwareVersion
{
get
;
set
;
}
/// <summary>
/// 分辨率(高)
/// </summary>
public
int
Height
{
get
;
set
;
}
/// <summary>
/// 标签id号
/// </summary>
public
string
Mac
{
get
;
set
;
}
/// <summary>
/// 型号标识
/// </summary>
public
string
Manufacture
{
get
;
set
;
}
/// <summary>
/// 标签电量
/// </summary>
public
int
Power
{
get
;
set
;
}
/// <summary>
/// 生产批次
/// </summary>
public
string
ProductionBatch
{
get
;
set
;
}
/// <summary>
/// 绑定基站ID
/// </summary>
public
int
RouterId
{
get
;
set
;
}
/// <summary>
/// 信号强度
/// </summary>
public
int
Rssi
{
get
;
set
;
}
/// <summary>
/// 屏幕类型
/// </summary>
public
int
ScreenType
{
get
;
set
;
}
/// <summary>
/// 序列号
/// </summary>
public
string
SerialNumber
{
get
;
set
;
}
/// <summary>
/// 所属店铺
/// </summary>
public
string
ShopNumber
{
get
;
set
;
}
/// <summary>
/// 使用模板名称
/// </summary>
public
string
ShowStyle
{
get
;
set
;
}
/// <summary>
/// 软件版本号
/// </summary>
public
string
SoftwareVersion
{
get
;
set
;
}
/// <summary>
/// 在线状态
/// </summary>
public
bool
State
{
get
;
set
;
}
/// <summary>
/// 更新状态
/// </summary>
public
int
Status
{
get
;
set
;
}
/// <summary>
/// 允许标签注册开关
/// </summary>
public
int
TagRegisterEN
{
get
;
set
;
}
/// <summary>
/// 分辨率(宽)
/// </summary>
public
int
Width
{
get
;
set
;
}
}
}
}
TSA-V/workForm/FrmAOICheck.cs
查看文件 @
693f71b
...
@@ -30,7 +30,7 @@ namespace TSA_V
...
@@ -30,7 +30,7 @@ namespace TSA_V
/// 检测结果,0=未知,1=OK,2=NG
/// 检测结果,0=未知,1=OK,2=NG
/// </summary>
/// </summary>
private
int
CheckResult
=
0
;
private
int
CheckResult
=
0
;
private
int
waitSeconds
=
1
;
private
int
waitSeconds
=
0
;
public
FrmAOICheck
(
AoiProject
currAoi
)
public
FrmAOICheck
(
AoiProject
currAoi
)
{
{
InitializeComponent
();
InitializeComponent
();
...
@@ -166,6 +166,8 @@ namespace TSA_V
...
@@ -166,6 +166,8 @@ namespace TSA_V
{
{
camera
=
AccAOI
.
camera
.
CameraManager
.
hikNameList
.
ToArray
().
FirstOrDefault
();
camera
=
AccAOI
.
camera
.
CameraManager
.
hikNameList
.
ToArray
().
FirstOrDefault
();
}
}
DateTime
startTime
=
DateTime
.
Now
;
LogUtil
.
info
(
"AOICheck : 开始获取图片"
);
Image
currImage
=
CameraManager
.
GetCamerImage
(
camera
);
Image
currImage
=
CameraManager
.
GetCamerImage
(
camera
);
if
(
currImage
==
null
)
if
(
currImage
==
null
)
...
@@ -181,9 +183,13 @@ namespace TSA_V
...
@@ -181,9 +183,13 @@ namespace TSA_V
if
(
currImage
!=
null
)
if
(
currImage
!=
null
)
{
{
TimeSpan
span1
=
DateTime
.
Now
-
startTime
;
LogUtil
.
info
(
$
"AOICheck : 图片获取完成, {Math.Round( span1.TotalMilliseconds,1)}ms, 开始check"
);
//Bitmap bitmap = new Bitmap(currImage);
//Bitmap bitmap = new Bitmap(currImage);
Image
outImage
=
null
;
Image
outImage
=
null
;
List
<
ResultBean
>
resultBean
=
CurrProject
.
CheckAll
(
currImage
,
out
outImage
);
List
<
ResultBean
>
resultBean
=
CurrProject
.
CheckAll
(
currImage
,
out
outImage
);
span1
=
DateTime
.
Now
-
startTime
;
LogUtil
.
info
(
$
"AOICheck : check完成, {Math.Round(span1.TotalMilliseconds, 1)}ms"
);
currImage
.
Dispose
();
currImage
.
Dispose
();
ResultList
=
resultBean
;
ResultList
=
resultBean
;
if
(
outImage
!=
null
)
if
(
outImage
!=
null
)
...
...
TSA-V/workForm/FrmTSAV.cs
查看文件 @
693f71b
...
@@ -338,11 +338,13 @@ namespace TSA_V
...
@@ -338,11 +338,13 @@ namespace TSA_V
LogUtil
.
info
(
" 工作完成, 清理投影内容,弹出 提示框提示进入AOI检测 ,设置 AOIopen = true;"
);
LogUtil
.
info
(
" 工作完成, 清理投影内容,弹出 提示框提示进入AOI检测 ,设置 AOIopen = true;"
);
ProjectorProcess
.
AOIopen
=
true
;
ProjectorProcess
.
AOIopen
=
true
;
IOManager
.
IOMove
(
IOManager
.
Device_Led
,
IO_VALUE
.
LOW
);
FrmProjectorScreen
.
instance
.
ClearPoint
();
FrmProjectorScreen
.
instance
.
ClearPoint
();
//IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.HIGH);
//IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.HIGH);
FrmAOICheck
frm
=
new
FrmAOICheck
(
CurrProject
);
FrmAOICheck
frm
=
new
FrmAOICheck
(
CurrProject
);
frm
.
ShowDialog
();
frm
.
ShowDialog
();
IOManager
.
IOMove
(
IOManager
.
Device_Led
,
IO_VALUE
.
HIGH
);
ProjectorProcess
.
AOIopen
=
false
;
ProjectorProcess
.
AOIopen
=
false
;
LogUtil
.
info
(
"AOI检测已关闭 ,设置 AOIopen = false;"
);
LogUtil
.
info
(
"AOI检测已关闭 ,设置 AOIopen = false;"
);
// IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.LOW);
// IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.LOW);
...
@@ -899,12 +901,14 @@ namespace TSA_V
...
@@ -899,12 +901,14 @@ namespace TSA_V
if
(
TSAVBean
.
IsNeedAOI
)
if
(
TSAVBean
.
IsNeedAOI
)
{
{
LogUtil
.
info
(
"点击【"
+
btnCamera
.
Text
+
"】,清理投影内容,进入AOI检测 , 设置AOIopen = true"
);
LogUtil
.
info
(
"点击【"
+
btnCamera
.
Text
+
"】,清理投影内容,进入AOI检测 , 设置AOIopen = true"
);
IOManager
.
IOMove
(
IOManager
.
Device_Led
,
IO_VALUE
.
LOW
);
ProjectorProcess
.
AOIopen
=
true
;
ProjectorProcess
.
AOIopen
=
true
;
FrmProjectorScreen
.
instance
.
ClearPoint
();
FrmProjectorScreen
.
instance
.
ClearPoint
();
// IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.HIGH);
// IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.HIGH);
FrmAOICheck
frm
=
new
FrmAOICheck
(
CurrProject
);
FrmAOICheck
frm
=
new
FrmAOICheck
(
CurrProject
);
frm
.
ShowDialog
();
frm
.
ShowDialog
();
ProjectorProcess
.
AOIopen
=
false
;
ProjectorProcess
.
AOIopen
=
false
;
IOManager
.
IOMove
(
IOManager
.
Device_Led
,
IO_VALUE
.
HIGH
);
LogUtil
.
info
(
"点击【"
+
btnCamera
.
Text
+
"】,AOI检测已关闭 , 设置AOIopen = false"
);
LogUtil
.
info
(
"点击【"
+
btnCamera
.
Text
+
"】,AOI检测已关闭 , 设置AOIopen = false"
);
// IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.LOW);
// IOManager.IOMove(IOManager.Camera_Led, IO_VALUE.LOW);
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论