Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 8a97fd81
由
LN
编写于
2020-01-14 15:46:33 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
新建分支
1 个父辈
de588989
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
179 行增加
和
1 行删除
RC1258-ACSingleStore.sln → RC-DL-ACSingleStore.sln
source/ACSingleStore/记录.txt
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/dataLogic/DLScanSocket.cs
RC
1258
-ACSingleStore.sln
→
RC
-DL
-ACSingleStore.sln
查看文件 @
8a97fd8
文件被删除
source/ACSingleStore/记录.txt
查看文件 @
8a97fd8
...
@@ -91,4 +91,6 @@ DeCodeType=解码类型,0=halcon,1=zxing解码 西安料仓解析方式。2=
...
@@ -91,4 +91,6 @@ DeCodeType=解码类型,0=halcon,1=zxing解码 西安料仓解析方式。2=
20191102修改:
20191102修改:
在RC-29-32-ACSingleStore基础上新建分支:RC1258-ACSingleStore
在RC-29-32-ACSingleStore基础上新建分支:RC1258-ACSingleStore
主要修改内容:压紧轴改为伺服控制。IO模块使用零点模块。
主要修改内容:压紧轴改为伺服控制。IO模块使用零点模块。
使用新IO定义。增加蜂鸣器处理
\ No newline at end of file
\ No newline at end of file
使用新IO定义。增加蜂鸣器处理
20200114 在RC1258-ACSingleStore 的基础上新建分支,扫码枪改为datalogic扫码枪。
\ No newline at end of file
\ No newline at end of file
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
8a97fd8
...
@@ -65,6 +65,7 @@
...
@@ -65,6 +65,7 @@
<Compile Include="acSingleStore\AC_SA_BoxBean.cs" />
<Compile Include="acSingleStore\AC_SA_BoxBean.cs" />
<Compile Include="acSingleStore\AC_SA_BoxBean_Partial.cs" />
<Compile Include="acSingleStore\AC_SA_BoxBean_Partial.cs" />
<Compile Include="acSingleStore\StoreManager.cs" />
<Compile Include="acSingleStore\StoreManager.cs" />
<Compile Include="dataLogic\DLScanSocket.cs" />
<Compile Include="halcon\CodeManager.cs" />
<Compile Include="halcon\CodeManager.cs" />
<Compile Include="IO\AIManager.cs" />
<Compile Include="IO\AIManager.cs" />
<Compile Include="IO\AIOBOX\AIOAIManager.cs" />
<Compile Include="IO\AIOBOX\AIOAIManager.cs" />
...
...
source/DeviceLibrary/dataLogic/DLScanSocket.cs
0 → 100644
查看文件 @
8a97fd8
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary
{
public
class
DLScanSocket
{
/// <summary>
/// 扫码枪链接
/// </summary>
private
TcpClient
scannerSocket
;
/// <summary>
/// 扫描枪 是否开始运行
/// </summary>
private
bool
isScannerRun
=
false
;
private
string
ScannerIP
=
""
;
private
int
ScannerPort
=
0
;
public
delegate
void
OnCodeRevice
(
string
[]
codeList
);
public
event
OnCodeRevice
CodeReviceEvent
;
public
DLScanSocket
(
string
serverIp
,
int
port
,
OnCodeRevice
revicePro
)
{
this
.
ScannerIP
=
serverIp
;
this
.
ScannerPort
=
port
;
this
.
CodeReviceEvent
+=
revicePro
;
}
/// <summary>
/// 开启扫码枪
/// </summary>
public
bool
StartConnect
(
bool
isMustCon
=
false
)
{
bool
result
=
true
;
try
{
if
(!
isScannerRun
||
isMustCon
)
{
if
(
scannerSocket
==
null
)
{
scannerSocket
=
new
TcpClient
();
}
result
=
scannerSocket
.
connect
(
ScannerIP
,
ScannerPort
,
new
TcpClient
.
HandleMessage
(
onCodeReceived
));
if
(
result
)
{
isScannerRun
=
true
;
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"出错:"
+
ex
);
}
return
result
;
}
public
void
TimerCheck
()
{
if
(!
scannerSocket
.
IsConnected
())
{
StartConnect
(
true
);
LogUtil
.
info
(
"重新连接扫码枪【"
+
ScannerIP
+
"】 "
);
}
}
/// <summary>
/// 停止扫码枪
/// </summary>
public
void
Close
()
{
try
{
scannerSocket
.
close
();
isScannerRun
=
false
;
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"出错:"
+
ex
);
}
}
/// <summary>
/// 发送扫码命令开始扫码
/// </summary>
public
void
BeginScan
()
{
try
{
string
str
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
scanner_start_command
);
scannerSocket
.
send
(
str
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"【"
+
ScannerIP
+
"】开始扫码错误:"
+
ex
.
ToString
());
}
}
public
string
spiltStr
=
"##"
;
/// <summary>
/// 扫码枪数据接收
/// </summary>
/// <param name="message"></param>
protected
virtual
void
onCodeReceived
(
string
message
)
{
try
{
//message = message.Replace("\r", "");
//message = message.Replace("\n", "");
//char a = (char)02;
//message = message.Replace(a.ToString(), "");
//message = message.Trim();
//if (!string.IsNullOrEmpty(message))
//{
// LogUtil.info("收到DL数据<< \n" + message);
//}
//else
//{
// LogUtil.error("没有收到二维码信息,请重新放入料盘");
// return;
//}
message
=
message
.
Trim
();
message
=
message
.
Replace
(
"\r"
,
""
);
message
=
message
.
Replace
(
"\n"
,
""
);
char
a
=
(
char
)
02
;
message
=
message
.
Replace
(
a
.
ToString
(),
""
);
message
=
message
.
Trim
();
System
.
Text
.
ASCIIEncoding
asciiEncoding
=
new
System
.
Text
.
ASCIIEncoding
();
byte
[]
bytes
=
asciiEncoding
.
GetBytes
(
message
);
List
<
byte
>
newBytes
=
new
List
<
byte
>();
foreach
(
byte
by
in
bytes
)
{
if
(!
by
.
Equals
(
24
))
{
newBytes
.
Add
(
by
);
}
}
message
=
asciiEncoding
.
GetString
(
newBytes
.
ToArray
());
string
[]
codeList
=
message
.
Split
(
new
string
[]
{
spiltStr
},
StringSplitOptions
.
RemoveEmptyEntries
);
CodeReviceEvent
?.
Invoke
(
codeList
);
// return message;
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
ex
.
ToString
());
}
}
/// <summary>
/// 处理接收后的二维码
/// </summary>
/// <param name="message"></param>
/// <returns></returns>
public
static
string
ReplaceCode
(
string
message
)
{
message
=
message
.
Trim
();
message
=
message
.
Replace
(
"\r"
,
""
);
message
=
message
.
Replace
(
"\n"
,
""
);
char
a
=
(
char
)
02
;
message
=
message
.
Replace
(
a
.
ToString
(),
""
);
message
=
message
.
Trim
();
System
.
Text
.
ASCIIEncoding
asciiEncoding
=
new
System
.
Text
.
ASCIIEncoding
();
byte
[]
bytes
=
asciiEncoding
.
GetBytes
(
message
);
List
<
byte
>
newBytes
=
new
List
<
byte
>();
foreach
(
byte
by
in
bytes
)
{
if
(!
by
.
Equals
(
24
))
{
newBytes
.
Add
(
by
);
}
}
message
=
asciiEncoding
.
GetString
(
newBytes
.
ToArray
());
return
message
;
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论