Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
SO1131-XLRStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 0f12dc1c
由
张东亮
编写于
2023-04-12 14:20:46 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
定时通讯加锁
1 个父辈
14ed3bc3
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
64 行增加
和
53 行删除
source/DeviceLibrary/storeBean/boxBean/BoxEquip_ConnectServerTimer.cs
source/DeviceLibrary/storeBean/boxBean/BoxEquip_ConnectServerTimer.cs
查看文件 @
0f12dc1
...
@@ -56,7 +56,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -56,7 +56,8 @@ namespace OnlineStore.DeviceLibrary
{
{
if
(
StoreManager
.
IsConnectServer
)
if
(
StoreManager
.
IsConnectServer
)
{
{
SendLineStatus
();
if
(!
Monitor
.
IsEntered
(
serverConnectTimer
))
SendLineStatus
();
}
}
}
}
}
}
...
@@ -107,30 +108,30 @@ namespace OnlineStore.DeviceLibrary
...
@@ -107,30 +108,30 @@ namespace OnlineStore.DeviceLibrary
{
{
boxStatus
.
status
=
(
int
)
DeviceStatus
.
Debugging
;
boxStatus
.
status
=
(
int
)
DeviceStatus
.
Debugging
;
}
}
if
(
runStatus
.
Equals
(
DeviceStatus
.
OutStoreBoxEnd
)
||
runStatus
.
Equals
(
DeviceStatus
.
InStoreEnd
))
if
(
runStatus
.
Equals
(
DeviceStatus
.
OutStoreBoxEnd
)
||
runStatus
.
Equals
(
DeviceStatus
.
InStoreEnd
))
{
{
boxStatus
.
data
.
Add
(
ParamDefine
.
posId
,
lastPosId
);
boxStatus
.
data
.
Add
(
ParamDefine
.
posId
,
lastPosId
);
boxStatus
.
data
.
Add
(
ParamDefine
.
barcode
,
lastBarcode
);
boxStatus
.
data
.
Add
(
ParamDefine
.
barcode
,
lastBarcode
);
boxStatus
.
data
.
Add
(
ParamDefine
.
executeTime
,
executeTime
);
boxStatus
.
data
.
Add
(
ParamDefine
.
executeTime
,
executeTime
);
}
}
else
if
(!
lastPosId
.
Equals
(
""
))
else
if
(!
lastPosId
.
Equals
(
""
))
{
{
boxStatus
.
data
.
Add
(
ParamDefine
.
posId
,
lastPosId
);
boxStatus
.
data
.
Add
(
ParamDefine
.
posId
,
lastPosId
);
boxStatus
.
data
.
Add
(
ParamDefine
.
barcode
,
lastBarcode
);
boxStatus
.
data
.
Add
(
ParamDefine
.
barcode
,
lastBarcode
);
boxStatus
.
data
.
Add
(
ParamDefine
.
executeTime
,
executeTime
);
boxStatus
.
data
.
Add
(
ParamDefine
.
executeTime
,
executeTime
);
boxStatus
.
status
=
(
int
)
deviceStatus
;
boxStatus
.
status
=
(
int
)
deviceStatus
;
if
(
lastPosId
!=
""
)
if
(
lastPosId
!=
""
)
{
{
LogUtil
.
info
(
"给服务器发送出入库消息:"
+
Name
+
",status【"
+
deviceStatus
+
"】posId【"
+
lastPosId
+
"】barcode【"
+
lastBarcode
+
"】"
);
LogUtil
.
info
(
"给服务器发送出入库消息:"
+
Name
+
",status【"
+
deviceStatus
+
"】posId【"
+
lastPosId
+
"】barcode【"
+
lastBarcode
+
"】"
);
}
}
lastPosId
=
""
;
lastPosId
=
""
;
lastBarcode
=
""
;
lastBarcode
=
""
;
}
}
if
(
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
InStore
)
||
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
OutStore
))
if
(
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
InStore
)
||
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
OutStore
))
{
{
if
((
MoveInfo
.
MoveParam
!=
null
)
&&(
MoveInfo
.
MoveParam
.
PosInfo
!=
null
))
if
((
MoveInfo
.
MoveParam
!=
null
)
&&
(
MoveInfo
.
MoveParam
.
PosInfo
!=
null
))
{
{
if
(!
boxStatus
.
data
.
ContainsKey
(
ParamDefine
.
posId
))
if
(!
boxStatus
.
data
.
ContainsKey
(
ParamDefine
.
posId
))
{
{
...
@@ -201,58 +202,68 @@ namespace OnlineStore.DeviceLibrary
...
@@ -201,58 +202,68 @@ namespace OnlineStore.DeviceLibrary
public
bool
ReviceInStoreCMD
(
string
posId
,
int
plateH
,
int
plateW
,
string
message
)
public
bool
ReviceInStoreCMD
(
string
posId
,
int
plateH
,
int
plateW
,
string
message
)
{
{
string
logName
=
"入库库位验证【"
+
message
+
"】【"
+
posId
+
"】:"
;
string
logName
=
"入库库位验证【"
+
message
+
"】【"
+
posId
+
"】:"
;
try
if
(
Monitor
.
TryEnter
(
serverConnectTimer
))
{
{
try
if
(
runStatus
.
Equals
(
RunStatus
.
Wait
))
{
{
LogUtil
.
info
(
logName
+
" 设备未启动,验证失败"
);
return
false
;
if
(
runStatus
.
Equals
(
RunStatus
.
Wait
))
}
//发送扫码内容到服务器进行入库操作
Operation
operation
=
getLineBoxStatus
();
operation
.
op
=
1
;
operation
.
data
=
new
Dictionary
<
string
,
string
>()
{
{
"code"
,
message
},
{
"boxId"
,
this
.
DeviceID
.
ToString
()
}
};
operation
.
data
.
Add
(
"inPos"
,
posId
);
for
(
int
i
=
1
;
i
<=
5
;
i
++)
{
bool
timeOut
=
false
;
Operation
resultOperation
=
HttpHelper
.
PostOperation
(
SServerManager
.
GetPostApi
(
server
),
operation
);
LogUtil
.
info
(
$
"入库验证请求信息【{operation.seq}】【{resultOperation?.seq??-1}】:【{JsonHelper.SerializeObject(operation)}】【{JsonHelper.SerializeObject(resultOperation)}】"
);
if
(
timeOut
)
{
LogUtil
.
error
(
logName
+
" 第"
+
i
+
"次发送超时 "
);
continue
;
}
if
(
resultOperation
==
null
)
{
// CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
LogUtil
.
error
(
logName
+
" 没有收到服务器反馈 "
);
}
else
if
(!
string
.
IsNullOrEmpty
(
resultOperation
.
msg
))
{
//如果有提示消息,直接显示提示
LogUtil
.
error
(
logName
+
"服务器反馈 :"
+
resultOperation
.
msg
);
continue
;
}
else
if
(
resultOperation
.
op
.
Equals
(
1
)&&
resultOperation
.
seq
.
Equals
(
operation
.
seq
))
{
{
LogUtil
.
info
(
logName
+
"
成功"
+
$
"【{JsonHelper.SerializeObject(resultOperation.data)}】
"
);
LogUtil
.
info
(
logName
+
"
设备未启动,验证失败
"
);
return
tru
e
;
return
fals
e
;
}
}
else
//发送扫码内容到服务器进行入库操作
Operation
operation
=
getLineBoxStatus
();
operation
.
op
=
1
;
operation
.
data
=
new
Dictionary
<
string
,
string
>()
{
{
"code"
,
message
},
{
"boxId"
,
this
.
DeviceID
.
ToString
()
}
};
operation
.
data
.
Add
(
"inPos"
,
posId
);
{
{
LogUtil
.
info
(
logName
+
"服务器反馈 :"
+
JsonHelper
.
SerializeObject
(
resultOperation
));
bool
timeOut
=
false
;
continue
;
Operation
resultOperation
=
HttpHelper
.
PostOperation
(
SServerManager
.
GetPostApi
(
server
),
operation
);
LogUtil
.
info
(
$
"入库验证请求信息【{operation.seq}】【{resultOperation?.seq ?? -1}】:【{JsonHelper.SerializeObject(operation)}】【{JsonHelper.SerializeObject(resultOperation)}】"
);
if
(
timeOut
)
{
LogUtil
.
error
(
logName
+
" 发送超时 "
);
}
if
(
resultOperation
==
null
)
{
// CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
LogUtil
.
error
(
logName
+
" 没有收到服务器反馈 "
);
}
else
if
(!
string
.
IsNullOrEmpty
(
resultOperation
.
msg
))
{
//如果有提示消息,直接显示提示
LogUtil
.
error
(
logName
+
"服务器反馈 :"
+
resultOperation
.
msg
);
}
else
if
(
resultOperation
.
op
.
Equals
(
1
))
{
Dictionary
<
string
,
string
>
data
=
resultOperation
.
data
;
if
(
data
!=
null
&&
data
.
ContainsKey
(
ParamDefine
.
posId
)
&&
data
.
ContainsKey
(
ParamDefine
.
code
))
{
if
(
data
[
ParamDefine
.
posId
].
Equals
(
posId
)
&&
data
[
ParamDefine
.
code
].
Equals
(
message
))
{
LogUtil
.
info
(
logName
+
" 成功"
+
$
"【{JsonHelper.SerializeObject(resultOperation.data)}】"
);
return
true
;
}
}
}
else
{
LogUtil
.
debug
(
logName
+
"服务器反馈 :"
+
JsonHelper
.
SerializeObject
(
resultOperation
));
}
}
}
break
;
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
logName
+
" 出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
logName
+
" 出错:"
+
ex
.
ToString
());
}
finally
{
Monitor
.
Exit
(
serverConnectTimer
);
}
}
}
return
false
;
return
false
;
}
}
//public string LastVisualRfid = "";
//public string LastVisualRfid = "";
...
@@ -314,8 +325,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -314,8 +325,8 @@ namespace OnlineStore.DeviceLibrary
try
try
{
{
//判断是否接收过此库位的出库信息
//判断是否接收过此库位的出库信息
if
(
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
OutStore
)
&&
(
MoveInfo
.
MoveParam
.
PosInfo
.
PosId
.
Equals
(
posId
)
||
if
(
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
OutStore
)
&&
(
MoveInfo
.
MoveParam
.
PosInfo
.
PosId
.
Equals
(
posId
)
||
(
MoveInfo
.
MoveParam
.
PosInfoBack
!=
null
&&
MoveInfo
.
MoveParam
.
PosInfoBack
.
PosId
.
Equals
(
posId
))))
(
MoveInfo
.
MoveParam
.
PosInfoBack
!=
null
&&
MoveInfo
.
MoveParam
.
PosInfoBack
.
PosId
.
Equals
(
posId
))))
{
{
LogUtil
.
error
(
Name
+
" 出库命令【"
+
inoutParam
.
PosInfo
.
ToStr
()
+
"】重复,正在【"
+
posId
+
"】出库中"
);
LogUtil
.
error
(
Name
+
" 出库命令【"
+
inoutParam
.
PosInfo
.
ToStr
()
+
"】重复,正在【"
+
posId
+
"】出库中"
);
continue
;
continue
;
...
@@ -328,7 +339,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -328,7 +339,7 @@ namespace OnlineStore.DeviceLibrary
reviceList
=
(
from
m
in
reviceList
where
m
.
PosInfo
.
PosId
.
Equals
(
posId
)
select
m
).
ToList
<
InOutParam
>();
reviceList
=
(
from
m
in
reviceList
where
m
.
PosInfo
.
PosId
.
Equals
(
posId
)
select
m
).
ToList
<
InOutParam
>();
if
(
reviceList
.
Count
>
0
)
if
(
reviceList
.
Count
>
0
)
{
{
// LogUtil.error(Name + " 出库命令【" + inoutParam.PosInfo.ToStr() + "】重复,排队列表中已存在【" + reviceList[0].PosInfo.ToStr() + "】");
// LogUtil.error(Name + " 出库命令【" + inoutParam.PosInfo.ToStr() + "】重复,排队列表中已存在【" + reviceList[0].PosInfo.ToStr() + "】");
continue
;
continue
;
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论