Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 6484b6f1
由
LN
编写于
2020-02-22 19:31:48 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
bug修改
1 个父辈
7576c1ca
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
128 行增加
和
59 行删除
source/ACSingleStore/ResourceCulture.cs
source/ACSingleStore/记录.txt
source/Common/util/TcpClient.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Partial.cs
source/DeviceLibrary/dataLogic/DLScanSocket.cs
source/DeviceLibrary/store/KTK_DeviceBase.cs
source/ACSingleStore/ResourceCulture.cs
查看文件 @
6484b6f
...
...
@@ -260,7 +260,7 @@ namespace OnlineStore
{
if
(
ResourceMap
!=
null
)
{
if
(!
ResourceMap
.
ContainsKey
(
CurrL
anguage
))
if
(!
ResourceMap
.
ContainsKey
(
l
anguage
))
{
if
(
ShowMsg
)
{
...
...
@@ -270,9 +270,9 @@ namespace OnlineStore
}
else
{
if
(
ResourceMap
[
CurrL
anguage
].
ContainsKey
(
id
.
Trim
()))
if
(
ResourceMap
[
l
anguage
].
ContainsKey
(
id
.
Trim
()))
{
return
ResourceMap
[
CurrL
anguage
][
id
];
return
ResourceMap
[
l
anguage
][
id
];
}
else
{
...
...
source/ACSingleStore/记录.txt
查看文件 @
6484b6f
...
...
@@ -95,4 +95,10 @@ DeCodeType=解码类型,0=halcon,1=zxing解码 西安料仓解析方式。2=
20200114 在RC1258-ACSingleStore 的基础上新建分支,扫码枪改为datalogic扫码枪。
20200210中英文功能修改,与服务器通信增加msgEn,表示英文提示消息。
\ No newline at end of file
20200210中英文功能修改,与服务器通信增加msgEn,表示英文提示消息。
20200222
1.发给服务器的英文错误,英文内容和中文一样。
2.自动出入库修改,先当前库位入库,然后出库,再继续下一个库位。
3.扫码枪重连修改。
\ No newline at end of file
source/Common/util/TcpClient.cs
查看文件 @
6484b6f
...
...
@@ -12,6 +12,10 @@ namespace OnlineStore.Common
{
public
class
TcpClient
{
private
static
string
ServerIp
=
""
;
private
static
int
ServerPort
=
0
;
private
System
.
Timers
.
Timer
ReConnectTimer
=
null
;
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
public
delegate
void
HandleMessage
(
string
message
);
...
...
@@ -77,13 +81,30 @@ namespace OnlineStore.Common
#
endregion
}
/// <summary>
/// 是否在运行中
/// </summary>
/// <returns></returns>
public
bool
IsRun
()
{
return
ReConnectTimer
.
Enabled
;
}
/// <summary>
/// 连接服务器
/// </summary>
public
bool
connect
(
string
serverIP
,
int
serverPort
,
HandleMessage
HandleMessage
)
public
bool
StartConnect
(
string
serverIP
,
int
serverPort
,
HandleMessage
HandleMessage
,
int
ReConnectMs
=
0
)
{
m_clientSocket
=
new
Socket
(
AddressFamily
.
InterNetwork
,
SocketType
.
Stream
,
ProtocolType
.
Tcp
);
IPEndPoint
remoteEndPoint
=
new
IPEndPoint
(
IPAddress
.
Parse
(
serverIP
),
serverPort
);
onReceived
=
HandleMessage
;
ServerIp
=
serverIP
;
ServerPort
=
serverPort
;
ReConnectTimer
=
new
System
.
Timers
.
Timer
();
ReConnectTimer
.
Interval
=
ReConnectMs
;
if
(
ReConnectMs
>
0
)
{
ReConnectTimer
.
AutoReset
=
true
;
ReConnectTimer
.
Elapsed
+=
ReConnectTimer_Elapsed
;
}
try
{
m_clientSocket
.
Connect
(
remoteEndPoint
);
...
...
@@ -92,6 +113,7 @@ namespace OnlineStore.Common
m_clientSocket
.
BeginReceive
(
m_receiveBuffer
,
0
,
m_receiveBuffer
.
Length
,
0
,
new
AsyncCallback
(
ReceiveCallBack
),
null
);
onReceived
=
HandleMessage
;
LogUtil
.
info
(
LOGGER
,
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" success!"
);
ReConnectTimer
.
Start
();
return
true
;
}
else
...
...
@@ -101,25 +123,78 @@ namespace OnlineStore.Common
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" fail!"
+
ex
.
ToString
(),
3
);
LogUtil
.
error
(
LOGGER
,
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" fail!"
+
ex
.
ToString
(),
3
);
m_clientSocket
=
null
;
}
ReConnectTimer
.
Start
();
return
false
;
}
private
bool
isInProcess
=
false
;
private
void
ReConnectTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
try
{
if
(
isInProcess
)
{
return
;
}
isInProcess
=
true
;
if
(
m_clientSocket
!=
null
)
{
if
(
m_clientSocket
.
Connected
)
{
isInProcess
=
false
;
return
;
}
}
try
{
if
(
m_clientSocket
!=
null
)
{
m_clientSocket
.
Close
();
LogUtil
.
debug
(
LOGGER
,
"Socket closed!"
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"m_clientSocket.Close Error"
+
ex
.
ToString
());
}
m_clientSocket
=
new
Socket
(
AddressFamily
.
InterNetwork
,
SocketType
.
Stream
,
ProtocolType
.
Tcp
);
IPEndPoint
remoteEndPoint
=
new
IPEndPoint
(
IPAddress
.
Parse
(
ServerIp
),
ServerPort
);
m_clientSocket
.
Connect
(
remoteEndPoint
);
if
(
m_clientSocket
.
Connected
)
{
m_clientSocket
.
BeginReceive
(
m_receiveBuffer
,
0
,
m_receiveBuffer
.
Length
,
0
,
new
AsyncCallback
(
ReceiveCallBack
),
null
);
LogUtil
.
info
(
LOGGER
,
"Connect to "
+
ServerIp
+
":"
+
ServerPort
+
" success!"
);
}
isInProcess
=
false
;
}
catch
(
Exception
ex
)
{
isInProcess
=
false
;
LogUtil
.
error
(
LOGGER
,
"重连处理出错:"
+
ex
.
ToString
(),
9
);
}
}
/// <summary>
/// 断开连接
/// </summary>
public
void
close
()
{
ReConnectTimer
.
Stop
();
if
(
m_clientSocket
!=
null
)
{
m_clientSocket
.
Close
();
LogUtil
.
info
(
LOGGER
,
"Socket closed!"
);
LogUtil
.
info
(
LOGGER
,
"Socket closed!"
);
}
else
{
LogUtil
.
error
(
LOGGER
,
"No socket is running!"
);
LogUtil
.
error
(
LOGGER
,
"No socket is running!"
);
}
}
...
...
@@ -135,7 +210,7 @@ namespace OnlineStore.Common
{
m_clientSocket
.
Send
(
sendBuffer
);
LogUtil
.
debug
(
LOGGER
,
"Send >> "
+
strSendData
);
LogUtil
.
debug
(
LOGGER
,
"Send >> "
+
strSendData
);
}
}
...
...
@@ -153,8 +228,9 @@ namespace OnlineStore.Common
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"socket received error:"
+
ex
.
ToString
(),
4
);
LogUtil
.
error
(
LOGGER
,
"socket received error:"
+
ex
.
ToString
(),
4
);
}
}
}
}
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
查看文件 @
6484b6f
...
...
@@ -1743,7 +1743,7 @@ namespace OnlineStore.DeviceLibrary
{
LOGGER
.
Error
(
"定时给服务器发送消息出错:"
,
ex
);
}
dlScanSocket
.
TimerCheck
();
//
dlScanSocket.TimerCheck();
}
HumitureController
.
QueryData
();
HumidityProcess
();
...
...
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Partial.cs
查看文件 @
6484b6f
...
...
@@ -793,28 +793,28 @@ namespace OnlineStore.DeviceLibrary
}
if
(
storeMoveType
.
Equals
(
StoreMoveType
.
InStore
))
{
int
newIndex
=
autoPositionIndex
-
1
;
//
int newIndex = autoPositionIndex - 1;
//if (autoJiange == 0)
//{
// newIndex = autoPositionIndex;
//}
if
(
newIndex
<
0
)
{
if
(
AutoStartIndex
>=
0
&&
AutoStartIndex
<
PositionNumList
.
Count
)
{
newIndex
=
AutoStartIndex
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
"下一个索引不存在,重新开始自动出入库,索引【"
+
AutoStartIndex
+
"】"
);
}
else
{
autoNext
=
false
;
autoMsg
=
"自动出入库结束!"
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
"下一个索引不存在,自动 出入库结束!"
);
}
}
else
{
autoPositionIndex
=
newIndex
;
//
if (newIndex < 0)
//
{
//
if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count)
//
{
//
newIndex = AutoStartIndex;
//
LogUtil.info(LOGGER, StoreName + "下一个索引不存在,重新开始自动出入库,索引【" + AutoStartIndex + "】");
//
}
//
else
//
{
//
autoNext = false;
//
autoMsg = "自动出入库结束!";
//
LogUtil.info(LOGGER, StoreName + "下一个索引不存在,自动 出入库结束!");
//
}
//
}
//
else
//
{
//
autoPositionIndex = newIndex;
string
posid
=
PositionNumList
[
autoPositionIndex
];
//判断是否需要重置
...
...
@@ -838,7 +838,7 @@ namespace OnlineStore.DeviceLibrary
autoMsg
=
"自动出库:"
+
posid
;
StartOutStoreMove
(
new
InOutStoreParam
(
""
,
posid
));
}
}
//
}
}
else
if
(
storeMoveType
.
Equals
(
StoreMoveType
.
OutStore
))
{
...
...
@@ -857,9 +857,10 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
info
(
LOGGER
,
StoreName
+
"下一个索引不存在,自动 出入库结束!"
);
}
}
else
if
(
autoNext
)
{
string
posid
=
PositionNumList
[
newIndex
];
autoPositionIndex
=
newIndex
;
string
posid
=
PositionNumList
[
autoPositionIndex
];
//判断是否需要重置
if
(
CurrInOutACount
>=
Config
.
Box_ResetACount
)
{
...
...
source/DeviceLibrary/dataLogic/DLScanSocket.cs
查看文件 @
6484b6f
...
...
@@ -40,7 +40,7 @@ namespace OnlineStore.DeviceLibrary
{
scannerSocket
=
new
TcpClient
();
}
result
=
scannerSocket
.
connect
(
ScannerIP
,
ScannerPort
,
new
TcpClient
.
HandleMessage
(
onCodeReceived
)
);
result
=
scannerSocket
.
StartConnect
(
ScannerIP
,
ScannerPort
,
new
TcpClient
.
HandleMessage
(
onCodeReceived
),
2000
);
if
(
result
)
{
isScannerRun
=
true
;
...
...
@@ -53,14 +53,14 @@ namespace OnlineStore.DeviceLibrary
}
return
result
;
}
public
void
TimerCheck
()
{
if
(!
scannerSocket
.
IsConnected
())
{
StartConnect
(
false
);
LogUtil
.
info
(
"重新连接扫码枪【"
+
ScannerIP
+
"】 "
);
}
}
//
public void TimerCheck()
//
{
//
if (!scannerSocket.IsConnected())
//
{
//
StartConnect( false );
//
LogUtil.info( "重新连接扫码枪【" + ScannerIP + "】 ");
//
}
//
}
/// <summary>
/// 停止扫码枪
/// </summary>
...
...
@@ -101,21 +101,7 @@ namespace OnlineStore.DeviceLibrary
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"
,
""
);
...
...
source/DeviceLibrary/store/KTK_DeviceBase.cs
查看文件 @
6484b6f
...
...
@@ -104,7 +104,7 @@ namespace OnlineStore.DeviceLibrary
public
string
GetRunStr
(
StoreRunStatus
runStatus
)
public
string
GetRunStr
(
StoreRunStatus
runStatus
)
{
string
sta
=
ResourceControl
.
GetString
(
ResourceControl
.
Run
,
"运行中"
);
string
aa
=
""
;
...
...
@@ -165,7 +165,7 @@ namespace OnlineStore.DeviceLibrary
aa
=
ResourceControl
.
GetString
(
ResourceControl
.
OutStoreFailed
,
"出库失败"
)
+
"("
+
WarnObj
.
WarnMsg
+
")"
;
break
;
}
if
(!
aa
.
Equals
(
""
))
if
(!
String
.
IsNullOrEmpty
(
aa
))
{
return
sta
+
"_"
+
aa
;
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论