Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit a36a5372
由
LN
编写于
2019-10-31 17:15:18 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
c25d1b3f
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
172 行增加
和
84 行删除
doc/RC1250佳世达IO配置10-10.xlsx
source/DeviceLibrary/assemblyLine/FeedingEquip_Partial.cs
source/DeviceLibrary/assemblyLine/LineBean.cs
source/DeviceLibrary/assemblymanager/StoreServerManager.cs
doc/RC1250佳世达IO配置10-10.xlsx
查看文件 @
a36a537
此文件类型无法预览
source/DeviceLibrary/assemblyLine/FeedingEquip_Partial.cs
查看文件 @
a36a537
...
@@ -219,7 +219,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -219,7 +219,7 @@ namespace OnlineStore.DeviceLibrary
string
code
=
CodeManager
.
ProcessCode
(
LastCodeList
);
string
code
=
CodeManager
.
ProcessCode
(
LastCodeList
);
TrayManager
.
UpdateTrayCode
(
currMoveTrayNum
,
code
);
TrayManager
.
UpdateTrayCode
(
currMoveTrayNum
,
code
);
//从服务器获取库位号
//从服务器获取库位号
string
result
=
StoreServerManager
.
CodeReceived
(
Name
,
currMoveTrayNum
,
code
,
LastHeight
,
LastWidth
);
string
result
=
StoreServerManager
.
CodeReceived
(
Name
,
currMoveTrayNum
,
LastCodeList
,
LastHeight
,
LastWidth
);
if
(!
result
.
Equals
(
""
))
{
LogUtil
.
error
(
result
);
}
if
(!
result
.
Equals
(
""
))
{
LogUtil
.
error
(
result
);
}
InStoreLog
(
" SecondStoreMove=MO_12_LoactionCylinder_Down 上料横移机构上升,托盘开始放行,定位气缸下降"
);
InStoreLog
(
" SecondStoreMove=MO_12_LoactionCylinder_Down 上料横移机构上升,托盘开始放行,定位气缸下降"
);
...
...
source/DeviceLibrary/assemblyLine/LineBean.cs
查看文件 @
a36a537
...
@@ -750,80 +750,80 @@ namespace OnlineStore.DeviceLibrary
...
@@ -750,80 +750,80 @@ namespace OnlineStore.DeviceLibrary
#
region
扫码枪代码
#
region
扫码枪代码
/// <summary>
///
//
<summary>
/// 是否已经扫码
///
//
是否已经扫码
/// </summary>
///
//
</summary>
private
bool
IsScanCode
=
false
;
//
private bool IsScanCode = false;
private
string
CodeMsg
=
""
;
//
private string CodeMsg = "";
private
static
string
ACCode
=
""
;
//
private static string ACCode = "";
public
void
GetCameraCode
()
//
public void GetCameraCode()
{
//
{
if
(
IsInScan
())
//
if (IsInScan())
{
//
{
LogUtil
.
info
(
"上次扫码还未执行完毕,请稍后!"
);
//
LogUtil.info("上次扫码还未执行完毕,请稍后!");
return
;
//
return;
}
//
}
Task
.
Factory
.
StartNew
(
delegate
//
Task.Factory.StartNew(delegate
{
//
{
IsScanCode
=
true
;
//
IsScanCode = true;
LastScanTime
=
DateTime
.
Now
;
//
LastScanTime = DateTime.Now;
DateTime
date
=
DateTime
.
Now
;
//
DateTime date = DateTime.Now;
// IOMove(IO_Type.CameraLight_Power, IO_VALUE.HIGH);
//
// IOMove(IO_Type.CameraLight_Power, IO_VALUE.HIGH);
List
<
string
>
codeList
=
CodeManager
.
CameraScan
();
//
List<string> codeList = CodeManager.CameraScan();
if
(
codeList
.
Count
<=
0
)
//
if (codeList.Count <= 0)
{
//
{
codeList
=
CodeManager
.
CameraScan
();
//
codeList = CodeManager.CameraScan();
}
//
}
List
<
string
>
list
=
new
List
<
string
>();
//
List<string> list = new List<string>();
string
outMsg
=
""
;
//
string outMsg = "";
string
message
=
""
;
//
string message = "";
int
height
=
GetHeight
();
//
int height = GetHeight();
int
width
=
GetWidth
();
//
int width = GetWidth();
//= 1 + 123.4x100.5 - 7x12 = CODE
//
//= 1 + 123.4x100.5 - 7x12 = CODE
foreach
(
string
str
in
codeList
)
//
foreach (string str in codeList)
{
//
{
if
(
list
.
Contains
(
str
.
Trim
()))
//
if (list.Contains(str.Trim()))
{
//
{
continue
;
//
continue;
}
//
}
list
.
Add
(
str
.
Trim
());
//
list.Add(str.Trim());
//string code = "=1+0x0-" + width + "x" + height + "=" + str.Trim();
//
//string code = "=1+0x0-" + width + "x" + height + "=" + str.Trim();
string
code
=
width
+
"x"
+
height
+
"%3D"
+
str
.
Trim
();
//
string code = width + "x" + height + "%3D" + str.Trim();
message
=
message
+
code
+
spiltStr
;
//
message = message + code + spiltStr;
}
//
}
if
(!
outMsg
.
Equals
(
""
))
//
if (!outMsg.Equals(""))
{
//
{
CodeMsg
=
"盘尺寸错误,清理二维码【"
+
message
+
"】"
;
//
CodeMsg = "盘尺寸错误,清理二维码【" + message + "】";
LogUtil
.
error
(
"盘尺寸错误,清理二维码【"
+
message
+
"】"
);
//
LogUtil.error("盘尺寸错误,清理二维码【" + message + "】");
message
=
""
;
//
message = "";
}
//
}
// KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
//
// KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
onCodeReceived
(
message
,
height
,
width
);
//
onCodeReceived( message,height,width);
IsScanCode
=
false
;
//
IsScanCode = false;
});
//
});
}
//
}
private
string
spiltStr
=
"%23%23"
;
//
private string spiltStr = "%23%23";
private
DateTime
LastScanTime
=
DateTime
.
Now
;
//
private DateTime LastScanTime = DateTime.Now;
private
bool
IsInScan
()
//
private bool IsInScan()
{
//
{
if
(!
IsScanCode
)
//
if (!IsScanCode)
{
//
{
return
false
;
//
return false;
}
//
}
TimeSpan
span
=
DateTime
.
Now
-
LastScanTime
;
//
TimeSpan span = DateTime.Now - LastScanTime;
if
(
span
.
TotalSeconds
>
60
)
//
if (span.TotalSeconds > 60)
{
//
{
//大于60秒表示超时了,可以重新开始扫码
//
//大于60秒表示超时了,可以重新开始扫码
return
false
;
//
return false;
}
//
}
return
true
;
//
return true;
}
//
}
/// <summary>
/// <summary>
...
...
source/DeviceLibrary/assemblymanager/StoreServerManager.cs
查看文件 @
a36a537
...
@@ -7,25 +7,39 @@ using System.Threading.Tasks;
...
@@ -7,25 +7,39 @@ using System.Threading.Tasks;
namespace
OnlineStore.DeviceLibrary
namespace
OnlineStore.DeviceLibrary
{
{
public
class
StoreServerManager
public
class
StoreServerManager
{
{
public
static
string
CodeReceived
(
string
deviceName
,
int
trayNum
,
string
codeStr
,
int
height
,
int
width
)
private
static
string
spiltStr
=
"%23%23"
;
public
static
string
CodeReceived
(
string
deviceName
,
int
trayNum
,
List
<
string
>
codeList
,
int
height
,
int
width
)
{
{
string
msg
=
""
;
string
msg
=
""
;
try
try
{
{
string
codeStr
=
""
;
foreach
(
string
str
in
codeList
)
{
if
(
codeStr
.
Equals
(
""
))
{
codeStr
=
str
;
}
else
{
codeStr
+=
spiltStr
+
str
;
}
}
if
(
String
.
IsNullOrEmpty
(
codeStr
))
if
(
String
.
IsNullOrEmpty
(
codeStr
))
{
{
return
msg
=
deviceName
+
"托盘【"
+
trayNum
+
"】 没有扫码到条码"
;
return
msg
=
deviceName
+
"托盘【"
+
trayNum
+
"】 没有扫码到条码"
;
}
}
if
(
LineManager
.
Line
.
runStatus
.
Equals
(
LineRunStatus
.
Wait
))
if
(
LineManager
.
Line
.
runStatus
.
Equals
(
LineRunStatus
.
Wait
))
{
{
return
msg
=
deviceName
+
"托盘【"
+
trayNum
+
"】 收到条码<< "
+
codeStr
+
",暂未开启,不需要发送服务器"
;
return
msg
=
deviceName
+
"托盘【"
+
trayNum
+
"】 收到条码<< "
+
codeStr
+
",暂未开启,不需要发送服务器"
;
}
}
//http://localhost/myproject/service/store/emptyPosForPutin
//http://localhost/myproject/service/store/emptyPosForPutin
// 参数:cids: 多个 cid
// 参数:cids: 多个 cid
//code: 条码内容
//code: 条码内容
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
)
+
"?cids="
+
LineServer
.
GetAllCID
()
+
"&code=%3D"
+
codeStr
;
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
)
+
"?cids="
+
LineServer
.
GetAllCID
()
+
"&code=%3D"
+
codeStr
;
LogUtil
.
info
(
deviceName
+
"托盘【"
+
trayNum
+
"】 收到条码<< "
+
codeStr
+
",获取入库PosID:"
+
server
);
LogUtil
.
info
(
deviceName
+
"托盘【"
+
trayNum
+
"】 收到条码<< "
+
codeStr
+
",获取入库PosID:"
+
server
);
...
@@ -36,12 +50,12 @@ namespace OnlineStore.DeviceLibrary
...
@@ -36,12 +50,12 @@ namespace OnlineStore.DeviceLibrary
string
resultStr
=
HttpHelper
.
Post
(
server
,
""
);
string
resultStr
=
HttpHelper
.
Post
(
server
,
""
);
LineOperation
serverResult
=
JsonHelper
.
DeserializeJsonToObject
<
LineOperation
>(
resultStr
);
LineOperation
serverResult
=
JsonHelper
.
DeserializeJsonToObject
<
LineOperation
>(
resultStr
);
if
(
serverResult
==
null
)
if
(
serverResult
==
null
)
{
{
return
msg
=
deviceName
+
"托盘【"
+
trayNum
+
"】 条码【"
+
codeStr
+
"】没有收到服务器反馈"
;
return
msg
=
deviceName
+
"托盘【"
+
trayNum
+
"】 条码【"
+
codeStr
+
"】没有收到服务器反馈"
;
}
}
else
if
((!
string
.
IsNullOrEmpty
(
serverResult
.
msg
))
||
serverResult
.
result
.
Equals
(
0
).
Equals
(
false
))
else
if
((!
string
.
IsNullOrEmpty
(
serverResult
.
msg
))
||
serverResult
.
result
.
Equals
(
0
).
Equals
(
false
))
{
{
return
msg
=
deviceName
+
"托盘【"
+
trayNum
+
"】 条码【"
+
codeStr
+
"】 :"
+
serverResult
.
msg
;
return
msg
=
deviceName
+
"托盘【"
+
trayNum
+
"】 条码【"
+
codeStr
+
"】 :"
+
serverResult
.
msg
;
}
}
if
(!
serverResult
.
pos
.
Equals
(
""
))
if
(!
serverResult
.
pos
.
Equals
(
""
))
...
@@ -51,14 +65,14 @@ namespace OnlineStore.DeviceLibrary
...
@@ -51,14 +65,14 @@ namespace OnlineStore.DeviceLibrary
int
plateH
=
height
;
int
plateH
=
height
;
string
[]
posArray
=
posId
.
Split
(
'#'
);
string
[]
posArray
=
posId
.
Split
(
'#'
);
if
(!(
posArray
.
Length
==
2
))
if
(!(
posArray
.
Length
==
2
))
{
{
return
msg
=
deviceName
+
"托盘【"
+
trayNum
+
"】 入库库位格式错误:条码【"
+
codeStr
+
"】库位【"
+
posId
+
"】"
;
return
msg
=
deviceName
+
"托盘【"
+
trayNum
+
"】 入库库位格式错误:条码【"
+
codeStr
+
"】库位【"
+
posId
+
"】"
;
}
}
//判断盘是否过高(7*8的盘需要判断,如果盘过高,不让盘通过,直接显示报警信息)
//判断盘是否过高(7*8的盘需要判断,如果盘过高,不让盘通过,直接显示报警信息)
int
storeId
=
int
.
Parse
(
posArray
[
0
]);
int
storeId
=
int
.
Parse
(
posArray
[
0
]);
//根据库位号查找移栽
//根据库位号查找移栽
MoveEquip
moveEquip
=
LineManager
.
Line
.
MoveEquipMap
[
storeId
];
MoveEquip
moveEquip
=
LineManager
.
Line
.
MoveEquipMap
[
storeId
];
//取盘号
//取盘号
string
wareNum
=
serverResult
.
barcode
;
string
wareNum
=
serverResult
.
barcode
;
...
@@ -73,14 +87,14 @@ namespace OnlineStore.DeviceLibrary
...
@@ -73,14 +87,14 @@ namespace OnlineStore.DeviceLibrary
// 判断PosID是否已经在入库或者在排队列表中,如果已经存在,加入列表失败
// 判断PosID是否已经在入库或者在排队列表中,如果已经存在,加入列表失败
if
(
LineManager
.
Line
.
IsReviceInPosId
(
moveEquip
,
posId
))
if
(
LineManager
.
Line
.
IsReviceInPosId
(
moveEquip
,
posId
))
{
{
LineManager
.
Line
.
WarnMsg
=
"入库库位重复: "
+
param
.
ToStr
()
+
" ,入库失败!"
;
LineManager
.
Line
.
WarnMsg
=
"入库库位重复: "
+
param
.
ToStr
()
+
" ,入库失败!"
;
moveEquip
.
WarnMsg
=
"入库库位重复: "
+
param
.
ToStr
()
+
" ,入库失败!"
;
moveEquip
.
WarnMsg
=
"入库库位重复: "
+
param
.
ToStr
()
+
" ,入库失败!"
;
return
msg
=(
"收到服务器入库命令 "
+
"入库库位重复: "
+
param
.
ToStr
()
+
" ,入库失败!"
);
return
msg
=
(
"收到服务器入库命令 "
+
"入库库位重复: "
+
param
.
ToStr
()
+
" ,入库失败!"
);
}
}
LineServer
.
CheckInStorePos
(
storeId
,
param
);
LineServer
.
CheckInStorePos
(
storeId
,
param
);
//StartInStoreMove(param);
//StartInStoreMove(param);
TrayManager
.
UpdateTrayInfo
(
trayCode
,
true
,
1
,
codeStr
,
posId
,
plateH
,
plateW
);
TrayManager
.
UpdateTrayInfo
(
trayCode
,
true
,
1
,
codeStr
,
posId
,
plateH
,
plateW
);
}
}
}
}
}
}
...
@@ -91,5 +105,79 @@ namespace OnlineStore.DeviceLibrary
...
@@ -91,5 +105,79 @@ namespace OnlineStore.DeviceLibrary
return
""
;
return
""
;
}
}
///// <summary>
///// 是否已经扫码
///// </summary>
//private bool IsScanCode = false;
//private string CodeMsg = "";
//private static string ACCode = "";
//public void GetCameraCode()
//{
// if (IsInScan())
// {
// LogUtil.info("上次扫码还未执行完毕,请稍后!");
// return;
// }
// Task.Factory.StartNew(delegate
// {
// IsScanCode = true;
// LastScanTime = DateTime.Now;
// DateTime date = DateTime.Now;
// // IOMove(IO_Type.CameraLight_Power, IO_VALUE.HIGH);
// List<string> codeList = CodeManager.CameraScan();
// if (codeList.Count <= 0)
// {
// codeList = CodeManager.CameraScan();
// }
// List<string> list = new List<string>();
// string outMsg = "";
// string message = "";
// int height = GetHeight();
// int width = GetWidth();
// //= 1 + 123.4x100.5 - 7x12 = CODE
// foreach (string str in codeList)
// {
// if (list.Contains(str.Trim()))
// {
// continue;
// }
// list.Add(str.Trim());
// //string code = "=1+0x0-" + width + "x" + height + "=" + str.Trim();
// string code = width + "x" + height + "%3D" + str.Trim();
// message = message + code + spiltStr;
// }
// if (!outMsg.Equals(""))
// {
// CodeMsg = "盘尺寸错误,清理二维码【" + message + "】";
// LogUtil.error("盘尺寸错误,清理二维码【" + message + "】");
// message = "";
// }
// // KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
// onCodeReceived(message, height, width);
// IsScanCode = false;
// });
//}
//
//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;
//}
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论