Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO1196_X800
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 291c42bb
由
刘韬
编写于
2022-12-20 16:16:24 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
f436ade8
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
61 行增加
和
21 行删除
DeviceLibrary/DeviceLibrary/AlgoPNMatch.cs
DeviceLibrary/DeviceLibrary/CodeManager.cs
DeviceLibrary/DeviceLibrary/PrinterHelper.cs
DeviceLibrary/theMachine/Common.cs
DeviceLibrary/theMachine/MainMachine _Common.cs
DeviceLibrary/theMachine/MainMachine_Counting.cs
DeviceLibrary/theMachine/MainMachine_InCar.cs
DeviceLibrary/theMachine/MainMachine_OutCar.cs
DeviceLibrary/theMachine/RobotManage.cs
DeviceLibrary/DeviceLibrary/AlgoPNMatch.cs
查看文件 @
291c42b
...
@@ -26,14 +26,21 @@ namespace OnlineStore.Common
...
@@ -26,14 +26,21 @@ namespace OnlineStore.Common
}
}
var
ls
=
File
.
ReadAllText
(
algopnFile
);
var
ls
=
File
.
ReadAllText
(
algopnFile
);
algopnList
=
JsonConvert
.
DeserializeObject
<
Dictionary
<
string
,
string
>>(
ls
);
algopnList
=
JsonConvert
.
DeserializeObject
<
Dictionary
<
string
,
string
>>(
ls
);
if
(
algopnList
==
null
)
algopnList
=
new
Dictionary
<
string
,
string
>();
}
}
static
void
SaveFile
()
static
void
SaveFile
()
{
{
Directory
.
CreateDirectory
(
Path
.
GetDirectoryName
(
algopnFile
));
Directory
.
CreateDirectory
(
Path
.
GetDirectoryName
(
algopnFile
));
string
s
=
JsonConvert
.
SerializeObject
(
algopnList
);
File
.
WriteAllText
(
algopnFile
+
".ready"
,
JsonConvert
.
SerializeObject
(
algopnList
));
File
.
WriteAllText
(
algopnFile
,
s
);
try
File
.
Copy
(
algopnFile
,
algopnFile
+
"."
+
DateTime
.
Now
.
ToShortDateString
(),
true
);
{
File
.
Delete
(
algopnFile
+
".bck"
);
File
.
Move
(
algopnFile
,
algopnFile
+
".bck"
);
File
.
Move
(
algopnFile
+
".ready"
,
algopnFile
);
}
catch
{
}
}
}
public
static
void
Set
(
string
pn
,
string
value
,
double
?
finetuning
=
null
)
public
static
void
Set
(
string
pn
,
string
value
,
double
?
finetuning
=
null
)
{
{
...
@@ -42,7 +49,7 @@ namespace OnlineStore.Common
...
@@ -42,7 +49,7 @@ namespace OnlineStore.Common
if
(
string
.
IsNullOrEmpty
(
value
))
if
(
string
.
IsNullOrEmpty
(
value
))
return
;
return
;
//Common.LOG.I
nfo($"set pnalgo pn:{pn}, algo:{value}, finetuning:{finetuning}");
LogUtil
.
i
nfo
(
$
"set pnalgo pn:{pn}, algo:{value}, finetuning:{finetuning}"
);
if
(
finetuning
!=
null
)
if
(
finetuning
!=
null
)
value
=
value
+
","
+
finetuning
.
ToString
();
value
=
value
+
","
+
finetuning
.
ToString
();
...
@@ -58,6 +65,7 @@ namespace OnlineStore.Common
...
@@ -58,6 +65,7 @@ namespace OnlineStore.Common
{
{
hasMatch
=
false
;
hasMatch
=
false
;
finetuning
=
null
;
finetuning
=
null
;
if
(
algopnList
.
ContainsKey
(
pn
))
if
(
algopnList
.
ContainsKey
(
pn
))
{
{
hasMatch
=
true
;
hasMatch
=
true
;
...
@@ -65,9 +73,10 @@ namespace OnlineStore.Common
...
@@ -65,9 +73,10 @@ namespace OnlineStore.Common
if
(
value
.
IndexOf
(
","
)
>
0
)
if
(
value
.
IndexOf
(
","
)
>
0
)
{
{
var
vs
=
value
.
Split
(
','
);
var
vs
=
value
.
Split
(
','
);
if
(
double
.
TryParse
(
vs
[
1
],
out
double
result
))
if
(
vs
.
Length
==
3
&&
double
.
TryParse
(
vs
[
2
],
out
double
result
))
{
{
value
=
vs
[
0
];
value
=
vs
[
0
]
+
","
+
vs
[
1
]
;
finetuning
=
result
;
finetuning
=
result
;
}
}
}
}
...
...
DeviceLibrary/DeviceLibrary/CodeManager.cs
查看文件 @
291c42b
此文件的差异被折叠,
点击展开。
DeviceLibrary/DeviceLibrary/PrinterHelper.cs
查看文件 @
291c42b
...
@@ -14,8 +14,7 @@ namespace DeviceLibrary
...
@@ -14,8 +14,7 @@ namespace DeviceLibrary
ZebraPrinterHelper
.
ZebraManger
zebraManger
;
ZebraPrinterHelper
.
ZebraManger
zebraManger
;
string
Port
;
string
Port
;
public
PrinterHelper
()
{
public
PrinterHelper
()
{
print
=
new
Asa
.
PrintLabel
(
Application
.
StartupPath
+
"\\Label"
,
300
);
print
=
new
Asa
.
PrintLabel
(
Application
.
StartupPath
+
"\\Label"
,
300
);
}
}
public
bool
Connection
(
string
port
)
{
public
bool
Connection
(
string
port
)
{
...
@@ -28,7 +27,10 @@ namespace DeviceLibrary
...
@@ -28,7 +27,10 @@ namespace DeviceLibrary
return
false
;
return
false
;
}
}
else
else
{
print
=
new
Asa
.
PrintLabel
(
Application
.
StartupPath
+
"\\Label"
,
zebraManger
.
PrinterDPI
);
return
true
;
return
true
;
}
}
}
public
void
Close
()
{
public
void
Close
()
{
zebraManger
.
Close
();
zebraManger
.
Close
();
...
...
DeviceLibrary/theMachine/Common.cs
查看文件 @
291c42b
...
@@ -302,7 +302,7 @@ namespace DeviceLibrary
...
@@ -302,7 +302,7 @@ namespace DeviceLibrary
}
}
else
{
else
{
if
(
angleblock
[
180
].
Count
==
0
)
if
(
angleblock
[
180
].
Count
==
0
)
return
rightangle
+
1
8
0
;
return
rightangle
+
1
2
0
;
else
else
return
GetAngleAvg
(
angleblock
[
180
]);
return
GetAngleAvg
(
angleblock
[
180
]);
}
}
...
...
DeviceLibrary/theMachine/MainMachine _Common.cs
查看文件 @
291c42b
...
@@ -150,7 +150,7 @@ namespace DeviceLibrary
...
@@ -150,7 +150,7 @@ namespace DeviceLibrary
}
}
else
else
{
{
LogUtil
.
info
(
$
"{wait.AxisInfo.
DeviceName
},继续上升:{wait.TargetPosition}"
);
LogUtil
.
info
(
$
"{wait.AxisInfo.
Explain
},继续上升:{wait.TargetPosition}"
);
axisBean
.
AbsMove
(
null
,
wait
.
TargetPosition
,
wait
.
TargetSpeed
);
axisBean
.
AbsMove
(
null
,
wait
.
TargetPosition
,
wait
.
TargetSpeed
);
wait
.
IsEnd
=
false
;
wait
.
IsEnd
=
false
;
}
}
...
...
DeviceLibrary/theMachine/MainMachine_Counting.cs
查看文件 @
291c42b
...
@@ -59,6 +59,7 @@ namespace DeviceLibrary
...
@@ -59,6 +59,7 @@ namespace DeviceLibrary
{
{
Setting_Init
.
Temp_Last_Reel_Height
=
8
;
Setting_Init
.
Temp_Last_Reel_Height
=
8
;
}
}
scantrytimes
=
0
;
}
}
else
{
else
{
Msg
.
add
(
"点料机放料位没有检测到料盘"
,
MsgLevel
.
alarm
);
Msg
.
add
(
"点料机放料位没有检测到料盘"
,
MsgLevel
.
alarm
);
...
@@ -71,19 +72,21 @@ namespace DeviceLibrary
...
@@ -71,19 +72,21 @@ namespace DeviceLibrary
ScanCode
();
ScanCode
();
CountMoveInfo
.
log
(
$
"开始扫码"
);
CountMoveInfo
.
log
(
$
"开始扫码"
);
break
;
break
;
case
MoveStep
.
Count_03
:
case
MoveStep
.
Count_03
:
CountMoveInfo
.
NextMoveStep
(
MoveStep
.
Count_04
);
int
retrytime
=
0
;
int
retrytime
=
0
;
retry
:
retry
:
if
(
RobotManage
.
XRay
.
Start
())
if
(
RobotManage
.
XRay
.
Start
())
{
{
CountMoveInfo
.
NextMoveStep
(
MoveStep
.
Count_04
);
CountMoveInfo
.
log
(
$
"打开X光"
);
CountMoveInfo
.
log
(
$
"打开X光"
);
CountMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
Setting_Init
.
XRay_Light_Delay
));
CountMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
Setting_Init
.
XRay_Light_Delay
));
return
;
}
}
else
{
else
{
if
(
RobotManage
.
XRay
.
Start
())
if
(
RobotManage
.
XRay
.
Start
())
{
{
CountMoveInfo
.
log
(
$
"打开X光第2次"
);
CountMoveInfo
.
NextMoveStep
(
MoveStep
.
Count_04
);
CountMoveInfo
.
log
(
$
"打开X光第{retrytime}次"
);
CountMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
Setting_Init
.
XRay_Light_Delay
));
CountMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
Setting_Init
.
XRay_Light_Delay
));
return
;
return
;
}
}
...
@@ -138,8 +141,11 @@ namespace DeviceLibrary
...
@@ -138,8 +141,11 @@ namespace DeviceLibrary
CountMoveInfo
.
MoveParam
.
PN
=
CountMoveInfo
.
MoveParam
.
codeInfos
.
Where
(
c
=>
c
.
CodeStr
.
StartsWith
(
"AT"
)).
FirstOrDefault
()?.
CodeStr
;
CountMoveInfo
.
MoveParam
.
PN
=
CountMoveInfo
.
MoveParam
.
codeInfos
.
Where
(
c
=>
c
.
CodeStr
.
StartsWith
(
"AT"
)).
FirstOrDefault
()?.
CodeStr
;
if
(
string
.
IsNullOrWhiteSpace
(
CountMoveInfo
.
MoveParam
.
PN
))
{
if
(
string
.
IsNullOrWhiteSpace
(
CountMoveInfo
.
MoveParam
.
PN
))
{
var
hc
=
CountMoveInfo
.
MoveParam
.
codeInfos
.
Where
(
c
=>
Regex
.
IsMatch
(
c
.
CodeStr
,
@"(?:@@|-)(AT\w*)(?:@@|-)"
)).
FirstOrDefault
()?.
CodeStr
;
var
hc
=
CountMoveInfo
.
MoveParam
.
codeInfos
.
Where
(
c
=>
Regex
.
IsMatch
(
c
.
CodeStr
,
@"(?:@@|-)(AT\w*)(?:@@|-)"
)).
FirstOrDefault
()?.
CodeStr
;
var
pn
=
Regex
.
Match
(
hc
,
"@@(AT\\w*)@@"
).
Groups
[
1
].
Value
;
if
(!
string
.
IsNullOrEmpty
(
hc
))
CountMoveInfo
.
MoveParam
.
PN
=
pn
;
{
var
pn
=
Regex
.
Match
(
hc
,
"@@(AT\\w*)@@"
).
Groups
[
1
].
Value
;
CountMoveInfo
.
MoveParam
.
PN
=
pn
;
}
}
}
//var xx = CountMoveInfo.MoveParam.codeInfos.Find(c=> { return c.CodeStr.StartsWith("S20") && c.CodeType == "barcode"; });
//var xx = CountMoveInfo.MoveParam.codeInfos.Find(c=> { return c.CodeStr.StartsWith("S20") && c.CodeType == "barcode"; });
//if (xx != null)
//if (xx != null)
...
@@ -280,7 +286,7 @@ namespace DeviceLibrary
...
@@ -280,7 +286,7 @@ namespace DeviceLibrary
IOMove
(
IO_Type
.
Counting_Camera_Led
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
Counting_Camera_Led
,
IO_VALUE
.
HIGH
);
var
(
LastCodeList
,
filename
)
=
CodeManager
.
CameraScan
(
CodeManager
.
hikNameList
);
var
(
LastCodeList
,
filename
)
=
CodeManager
.
CameraScan
(
CodeManager
.
hikNameList
);
LogUtil
.
info
(
"扫码完成:"
+
filename
);
return
(
LastCodeList
,
filename
);
return
(
LastCodeList
,
filename
);
}));
}));
}
}
...
...
DeviceLibrary/theMachine/MainMachine_InCar.cs
查看文件 @
291c42b
...
@@ -197,6 +197,7 @@ namespace DeviceLibrary
...
@@ -197,6 +197,7 @@ namespace DeviceLibrary
case
MoveStep
.
InCarOut_01
:
case
MoveStep
.
InCarOut_01
:
InCarMoveInfo
.
NextMoveStep
(
MoveStep
.
InCarOut_02
);
InCarMoveInfo
.
NextMoveStep
(
MoveStep
.
InCarOut_02
);
incarProcessFinish
=
true
;
InCarMoveInfo
.
log
(
$
"料串下降到P1点"
);
InCarMoveInfo
.
log
(
$
"料串下降到P1点"
);
Loading_Batch_Axis
.
AbsMove
(
InCarMoveInfo
,
Config
.
Loading_Batch_Axis_P1
,
Config
.
Loading_Batch_Axis_P1_speed
);
Loading_Batch_Axis
.
AbsMove
(
InCarMoveInfo
,
Config
.
Loading_Batch_Axis_P1
,
Config
.
Loading_Batch_Axis_P1_speed
);
InCarMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitMsg
(
"料串正在下降"
,
MsgLevel
.
warning
));
InCarMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitMsg
(
"料串正在下降"
,
MsgLevel
.
warning
));
...
...
DeviceLibrary/theMachine/MainMachine_OutCar.cs
查看文件 @
291c42b
...
@@ -20,6 +20,10 @@ namespace DeviceLibrary
...
@@ -20,6 +20,10 @@ namespace DeviceLibrary
public
CarTypeE
OutCarType
=
CarTypeE
.
None
;
public
CarTypeE
OutCarType
=
CarTypeE
.
None
;
public
int
OutCurrentStringNum
=
0
;
public
int
OutCurrentStringNum
=
0
;
bool
outnewreel
=
false
;
bool
outnewreel
=
false
;
/// <summary>
/// 指示入料车是否已经处理完毕
/// </summary>
bool
incarProcessFinish
=
false
;
void
OutCarProcess
()
void
OutCarProcess
()
{
{
if
(
CheckWait
(
OutCarMoveInfo
))
if
(
CheckWait
(
OutCarMoveInfo
))
...
@@ -73,15 +77,23 @@ namespace DeviceLibrary
...
@@ -73,15 +77,23 @@ namespace DeviceLibrary
case
MoveStep
.
OutCar_03
:
case
MoveStep
.
OutCar_03
:
OutCarMoveInfo
.
NextMoveStep
(
MoveStep
.
OutCar_04
);
OutCarMoveInfo
.
NextMoveStep
(
MoveStep
.
OutCar_04
);
outnewreel
=
true
;
outnewreel
=
true
;
incarProcessFinish
=
true
;
OutCarMoveInfo
.
log
(
$
"新料串"
);
OutCarMoveInfo
.
log
(
$
"新料串"
);
break
;
break
;
case
MoveStep
.
OutCar_04
:
case
MoveStep
.
OutCar_04
:
OutCarMoveInfo
.
NextMoveStep
(
MoveStep
.
OutCar_05
);
OutCarMoveInfo
.
NextMoveStep
(
MoveStep
.
OutCar_05
);
OutCarMoveInfo
.
log
(
$
"批量轴高速上升到顶部检测点"
);
var
lowlist
=
OutGetLowReelCheckIOList
();
BatchAxisToP2
(
OutCarMoveInfo
,
Unloading_Batch_Axis
,
OutGetLowReelCheckIOList
(),
IO_VALUE
.
HIGH
,
Config
.
Unloading_Batch_Axis_P2
,
Config
.
Unloading_Batch_Axis_P1_speed
);
if
(
lowlist
.
Length
>
0
)
{
OutCarMoveInfo
.
log
(
$
"批量轴高速上升到顶部检测点"
);
BatchAxisToP2
(
OutCarMoveInfo
,
Unloading_Batch_Axis
,
OutGetLowReelCheckIOList
(),
IO_VALUE
.
HIGH
,
Config
.
Unloading_Batch_Axis_P2
,
Config
.
Unloading_Batch_Axis_P1_speed
);
}
else
{
OutCarMoveInfo
.
log
(
$
"批量轴所有监测点都已Low"
);
}
break
;
break
;
case
MoveStep
.
OutCar_05
:
case
MoveStep
.
OutCar_05
:
var
lowlist
=
OutGetLowReelCheckIOList
();
lowlist
=
OutGetLowReelCheckIOList
();
if
(
Unloading_Batch_Axis
.
IsInPosition
(
Config
.
Unloading_Batch_Axis_P2
))
{
if
(
Unloading_Batch_Axis
.
IsInPosition
(
Config
.
Unloading_Batch_Axis_P2
))
{
OutCarMoveInfo
.
NextMoveStep
(
MoveStep
.
OutCar_06
);
OutCarMoveInfo
.
NextMoveStep
(
MoveStep
.
OutCar_06
);
OutCarMoveInfo
.
log
(
$
"批量轴已到顶,可放料位置有:{string.Join("
,
", lowlist)}"
);
OutCarMoveInfo
.
log
(
$
"批量轴已到顶,可放料位置有:{string.Join("
,
", lowlist)}"
);
...
@@ -140,6 +152,10 @@ namespace DeviceLibrary
...
@@ -140,6 +152,10 @@ namespace DeviceLibrary
break
;
break
;
case
MoveStep
.
OutCarReadyPut
:
case
MoveStep
.
OutCarReadyPut
:
Msg
.
add
(
"出口料串放料准备就绪"
,
MsgLevel
.
info
);
Msg
.
add
(
"出口料串放料准备就绪"
,
MsgLevel
.
info
);
if
(
incarProcessFinish
&&
InMoveInfo
.
MoveStep
==
MoveStep
.
Wait
&&
CountMoveInfo
.
MoveStep
==
MoveStep
.
Wait
&&
OutMoveInfo
.
MoveStep
==
MoveStep
.
Wait
)
{
OutCarMoveInfo
.
NextMoveStep
(
MoveStep
.
OutCarOut_01
);
OutCarMoveInfo
.
log
(
$
"入料车已处理完毕"
);
}
break
;
break
;
case
MoveStep
.
OutCarReelPut
:
case
MoveStep
.
OutCarReelPut
:
OutCarMoveInfo
.
NextMoveStep
(
MoveStep
.
OutCar_04
);
OutCarMoveInfo
.
NextMoveStep
(
MoveStep
.
OutCar_04
);
...
...
DeviceLibrary/theMachine/RobotManage.cs
查看文件 @
291c42b
...
@@ -130,11 +130,17 @@ namespace DeviceLibrary
...
@@ -130,11 +130,17 @@ namespace DeviceLibrary
}
else
}
else
LogUtil
.
info
(
"图像平板打开成功"
);
LogUtil
.
info
(
"图像平板打开成功"
);
if
(!
printerHelper
.
Connection
(
Setting_Init
.
Printer_IP
))
{
if
(!
printerHelper
.
Connection
(
Setting_Init
.
Printer_IP
))
{
msg
+=
"标签打印机打开失败"
+
"\n"
;
msg
+=
"标签打印机打开失败"
+
"\n"
;
IsLoadOk
=
false
;
IsLoadOk
=
false
;
}
else
}
else
{
LogUtil
.
info
(
"标签打印机打开成功"
);
LogUtil
.
info
(
"标签打印机打开成功"
);
}
LogUtil
.
info
(
"设备初始化完成"
);
LogUtil
.
info
(
"设备初始化完成"
);
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论