Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 24b7bfb3
由
LN
编写于
2019-08-14 11:20:30 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
二维码特殊尺寸改为可配置
1 个父辈
475ba646
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
118 行增加
和
48 行删除
source/ACSingleStore/记录.txt
source/Common/util/AcSerialBean.cs
source/DeviceLibrary/PanasonicServo/ACServerManager_Partial.cs
source/DeviceLibrary/StoreConfig/AC/StoreConfig.csv
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
source/LoadCVSLibrary/storeConfig/config/AC_SA_Config.cs
source/ACSingleStore/记录.txt
查看文件 @
24b7bfb
...
...
@@ -88,4 +88,8 @@
XA 开头的二维码,默认为 13*48
XB 开头的二维码,默认为 13*
20190812修改: StoreConfig增加配置
PRO,默认的料盘宽度(多种尺寸为0),Default_TrayWidth,0,,,,,,,
PRO,特殊二维码尺寸配置,CodeSizeConfig,XA=13x48#XB=13x32#FA=7x32,,,,,,,
二维码特殊尺寸改为可配置。
\ No newline at end of file
source/Common/util/AcSerialBean.cs
查看文件 @
24b7bfb
...
...
@@ -282,13 +282,13 @@ namespace OnlineStore.Common
/// <param name="ReceiveData">接收数据</param>
/// <param name="Overtime">超时时间</param>
/// <returns></returns>
public
int
SendCommand
(
byte
[]
SendData
,
ref
byte
[]
ReceiveData
,
int
Overtime
,
out
bool
isOk
)
public
int
SendCommand
(
byte
[]
SendData
,
ref
byte
[]
ReceiveData
,
int
Overtime
,
out
bool
isOk
)
{
isOk
=
false
;
if
(
_serialPort
.
IsOpen
)
{
//lock (lockObj)
if
(
Monitor
.
TryEnter
(
lockObj
,
10
))
if
(
Monitor
.
TryEnter
(
lockObj
,
10
))
{
//Monitor.Enter(lockObj);
try
...
...
@@ -352,15 +352,14 @@ namespace OnlineStore.Common
{
if
(
_serialPort
==
null
)
{
LogUtil
.
error
(
PortName
+
" 发送数据"
+
ByteToString
(
SendData
)
+
"失败,_serialPort=null"
);
LogUtil
.
error
(
PortName
+
" 发送数据"
+
ByteToString
(
SendData
)
+
"失败,_serialPort=null"
);
return
-
1
;
}
if
(
_serialPort
.
IsOpen
)
{
if
(
Monitor
.
TryEnter
(
lockObj
,
1
0
))
if
(
Monitor
.
TryEnter
(
lockObj
,
20
0
))
{
//Monitor.Enter(lockObj);
try
{
_serialPort
.
DiscardInBuffer
();
//清空接收缓冲区
...
...
@@ -373,7 +372,7 @@ namespace OnlineStore.Common
}
while
(
num
++
<
Overtime
)
{
if
(
_serialPort
.
BytesToRead
>=
Receive
Data
.
Length
)
if
(
_serialPort
.
BytesToRead
>=
ReceiveLength
)
break
;
System
.
Threading
.
Thread
.
Sleep
(
1
);
}
...
...
@@ -381,10 +380,10 @@ namespace OnlineStore.Common
{
LogUtil
.
error
(
PortName
+
" 发送数据"
+
ByteToString
(
SendData
)
+
"等待接受数据超时"
);
}
if
(
_serialPort
.
BytesToRead
>=
Receive
Data
.
Length
)
if
(
_serialPort
.
BytesToRead
>=
ReceiveLength
)
{
ret
=
_serialPort
.
Read
(
ReceiveData
,
0
,
Receive
Data
.
Length
);
ret
=
_serialPort
.
Read
(
ReceiveData
,
0
,
ReceiveLength
);
}
else
{
...
...
@@ -395,7 +394,7 @@ namespace OnlineStore.Common
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
PortName
+
" 发送数据"
+
ByteToString
(
SendData
)
+
" 出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
PortName
+
" 发送数据"
+
ByteToString
(
SendData
)
+
" 出错:"
+
ex
.
ToString
());
}
finally
{
...
...
@@ -512,6 +511,18 @@ namespace OnlineStore.Common
}
return
returnStr
;
}
public
static
string
byteToHexStr
(
byte
[]
bytes
,
string
spilChar
)
{
string
returnStr
=
""
;
if
(
bytes
!=
null
)
{
for
(
int
i
=
0
;
i
<
bytes
.
Length
;
i
++)
{
returnStr
+=
bytes
[
i
].
ToString
(
"X2"
)
+
spilChar
;
}
}
return
returnStr
;
}
#
endregion
#
region
计算校验码
...
...
source/DeviceLibrary/PanasonicServo/ACServerManager_Partial.cs
查看文件 @
24b7bfb
...
...
@@ -147,7 +147,11 @@ namespace OnlineStore.DeviceLibrary
}
else
{
bean
.
SendCommand
(
data
,
ref
returnData
,
outTime
,
reviceLength
);
int
ret
=
bean
.
SendCommand
(
data
,
ref
returnData
,
outTime
,
reviceLength
);
if
(!
ret
.
Equals
(
reviceLength
))
{
LogUtil
.
error
(
"串口"
+
portName
+
" 写入数据:"
+
strSend
+
",预计返回字节数【"
+
reviceLength
+
"】实际返回【"
+
ret
+
"】"
);
}
System
.
Threading
.
Thread
.
Sleep
(
2
);
}
}
...
...
source/DeviceLibrary/StoreConfig/AC/StoreConfig.csv
查看文件 @
24b7bfb
...
...
@@ -124,3 +124,6 @@ PRO,模拟信号1的地址,AIDI1_Addr,7,,,,,,,
PRO,模拟信号2的地址,AIDI2_Addr,8,,,,,,,
PRO,模拟信号3的地址,AIDI3_Addr,5,,,,,,,
PRO,模拟信号4的地址,AIDI4_Addr,6,,,,,,,
,,,,,,,,, ,
PRO,默认的料盘宽度(多种尺寸为0),Default_TrayWidth,0,,,,,,,
PRO,特殊二维码尺寸配置,CodeSizeConfig,XA=13x48#XB=13x32#FA=7x32,,,,,,,
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
查看文件 @
24b7bfb
...
...
@@ -1494,8 +1494,6 @@ namespace OnlineStore.DeviceLibrary
private
string
spiltStr
=
"##"
;
private
void
scanTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
int
height
=
GetHeight
();
DateTime
date
=
DateTime
.
Now
;
//scanTimer.Enabled = false;
KNDIOMove
(
IO_Type
.
CameraLight_Power
,
IO_VALUE
.
HIGH
);
...
...
@@ -1511,33 +1509,48 @@ namespace OnlineStore.DeviceLibrary
foreach
(
string
str
in
codeList
)
{
string
code
=
str
;
if
(
CodeManager
.
DeCodeType
.
Equals
(
1
))
//根据二维码开头获取固定尺寸
string
codeSize
=
Config
.
GetCodeSize
(
str
.
Trim
());
if
(
String
.
IsNullOrEmpty
(
codeSize
))
{
if
(
str
.
ToUpper
().
StartsWith
(
"XA"
))
{
code
=
"=1+0x0-13x48"
+
"="
+
code
;
}
else
if
(
str
.
ToUpper
().
StartsWith
(
"XB"
))
//无固定尺寸,判断宽度是否是固定,如果不是固定,直接获取当前高度宽度
codeSize
=
GetSize
()
+
"x"
+
GetHeight
();
}
if
(
str
.
Trim
().
ToUpper
().
StartsWith
(
"XA"
))
//西安料仓
{
code
=
"=1+0x0-13x32"
+
"="
+
code
;
code
=
"=1+0x0-13x48"
+
"="
+
str
.
Trim
()
;
}
else
else
if
(
str
.
Trim
().
ToUpper
().
StartsWith
(
"XB"
))
//西安料仓
{
code
=
"=1+0x0-"
+
GetSize
()
+
"x"
+
height
+
"="
+
CodeManager
.
GetBarcode
(
str
);
code
=
"=1+0x0-13x32"
+
"="
+
str
.
Trim
(
);
}
else
if
(
str
.
ToUpper
().
StartsWith
(
"FA"
))
//孝感料仓
{
code
=
"=1+0x0-7x32"
+
"="
+
code
;
}
else
if
(
CodeManager
.
DeCodeType
.
Equals
(
1
))
{
if
(
str
.
ToUpper
().
StartsWith
(
"FA"
))
//只有西安料仓使用此解码类型
string
codea
=
CodeManager
.
GetBarcode
(
str
);
if
(
String
.
IsNullOrEmpty
(
codea
))
{
code
=
"
=1+0x0-7x32"
+
"="
+
code
;
code
=
"
"
;
}
else
{
code
=
"=1+0x0-7x"
+
height
+
"="
+
code
;
code
=
"=1+0x0-"
+
codeSize
+
"="
+
codea
;
}
}
else
{
code
=
"=1+0x0-"
+
codeSize
+
"="
+
code
;
}
if
(!
String
.
IsNullOrEmpty
(
code
))
{
message
=
message
+
code
+
spiltStr
;
}
}
if
(!
outMsg
.
Equals
(
""
))
{
CodeMsg
=
"盘尺寸错误,清理二维码【"
+
message
+
"】"
;
...
...
@@ -1570,6 +1583,11 @@ namespace OnlineStore.DeviceLibrary
#
region
高度传感器处理
public
int
GetSize
()
{
if
(
Config
.
Default_TrayWidth
>
0
)
{
//如果配置了默认宽度,使用默认宽度且不能修改
return
Config
.
Default_TrayWidth
;
}
if
(
Config
.
AIDI3_Addr
<=
0
||
Config
.
AIDI4_Addr
<=
0
)
{
return
7
;
...
...
source/LoadCVSLibrary/storeConfig/config/AC_SA_Config.cs
查看文件 @
24b7bfb
...
...
@@ -532,30 +532,60 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
[
ConfigProAttribute
(
"AIDI4_Addr"
,
false
)]
public
int
AIDI4_Addr
{
get
;
set
;
}
//private List<string> TempAddrList = null;
//public static char TempAddrSpilt = '#';
///// <summary>
///// 温湿度地址列表
///// </summary>
//public List<string> GetTempAddrList()
//{
// if (TempAddrList == null)
// {
// TempAddrList = new List<string>();
// string[] array = Temperate_Serveraddress.Split(TempAddrSpilt);
// if (array.Length > 0)
// {
// foreach (string str in array)
// {
// if (!str.Equals(""))
// {
// TempAddrList.Add(str);
// }
// }
// }
// }
// return TempAddrList;
//}
/// <summary>
/// PRO,特殊二维码尺寸配置,CodeSizeConfig,XA=13x48#XB=13x32#FA=7x32,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"CodeSizeConfig"
,
false
)]
public
string
CodeSizeConfig
{
get
;
set
;
}
/// <summary>
/// PRO,默认的料盘宽度(不可更改),Default_TrayWidth,0,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Default_TrayWidth"
,
false
)]
public
int
Default_TrayWidth
{
get
;
set
;
}
private
Dictionary
<
string
,
string
>
CodeSizeMap
=
null
;
private
static
char
codeSpilt
=
'#'
;
public
string
GetCodeSize
(
string
code
)
{
try
{
if
(
CodeSizeMap
==
null
)
{
CodeSizeMap
=
new
Dictionary
<
string
,
string
>();
string
[]
array
=
CodeSizeConfig
.
Split
(
codeSpilt
);
if
(
array
.
Length
>
0
)
{
foreach
(
string
str
in
array
)
{
string
[]
codeStr
=
str
.
Split
(
'='
);
if
(
codeStr
.
Length
==
2
)
{
string
key
=
codeStr
[
0
].
Trim
();
string
value
=
codeStr
[
1
].
Trim
();
CodeSizeMap
.
Add
(
key
,
value
);
}
}
}
}
foreach
(
string
key
in
CodeSizeMap
.
Keys
)
{
if
(
code
.
Trim
().
StartsWith
(
key
))
{
return
CodeSizeMap
[
key
];
}
}
}
catch
(
Exception
ex
)
{
LOGGER
.
Error
(
"获取二维码【"
+
code
+
"】的固定尺寸出错:"
+
ex
.
ToString
());
}
return
""
;
}
protected
override
void
initMustHavePro
()
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论