Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 1aec0429
由
sunke
编写于
2021-08-10 09:01:15 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
料架调试
1 个父辈
99d84092
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
314 行增加
和
30 行删除
pom.xml
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
src/main/java/com/neotel/smfcore/core/device/bean/StatusBean.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/BaseDeviceHandler.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/SensorShelfHandler.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/VerticalBoxHandler.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/XlBoxHandler.java
src/main/java/com/neotel/smfcore/core/system/websocket/MsgType.java
src/main/java/com/neotel/smfcore/core/system/websocket/SocketMsg.java
src/main/java/com/neotel/smfcore/core/system/websocket/WebSocketConfig.java
src/main/java/com/neotel/smfcore/core/system/websocket/WebSocketServer.java
src/main/java/com/neotel/smfcore/hella/handler/HellaServiceHandler.java
src/main/java/com/neotel/smfcore/hella/rest/HellaSensorShelfController.java
src/main/java/com/neotel/smfcore/hella/tcp/command/HellaReqCommand.java
src/main/java/com/neotel/smfcore/hella/tcp/command/HellaRespCommand.java
src/main/resources/config/application.yml
pom.xml
查看文件 @
1aec042
...
@@ -70,6 +70,10 @@
...
@@ -70,6 +70,10 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-log4j2
</artifactId>
<artifactId>
spring-boot-starter-log4j2
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-websocket
</artifactId>
</dependency>
<dependency>
<dependency>
...
...
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
查看文件 @
1aec042
...
@@ -161,8 +161,8 @@ public class DataInitManager {
...
@@ -161,8 +161,8 @@ public class DataInitManager {
List
<
Menu
>
menus
=
new
ArrayList
<
Menu
>();
List
<
Menu
>
menus
=
new
ArrayList
<
Menu
>();
//料架分组
//料架分组
Menu
menukanban
=
new
Menu
(
new
ArrayList
<
Menu
>(),
1
,
"boxkanban"
,
"锁定物料"
,
1
,
"lockMaterial"
,
"lockMaterial/material/index"
,
""
,
0
,
"app"
);
//
Menu menukanban = new Menu(new ArrayList<Menu>(), 1, "boxkanban", "锁定物料", 1, "lockMaterial", "lockMaterial/material/index", "", 0, "app");
menus
.
addAll
(
createMenus
(
menukanban
));
//
menus.addAll(createMenus(menukanban ));
//料架分组
//料架分组
Menu
menuShelf
=
new
Menu
(
new
ArrayList
<
Menu
>(),
1
,
"menu:list"
,
"料架分组"
,
1
,
"lightGroup"
,
"neolight/lightGroup/index"
,
""
,
0
,
"list"
);
Menu
menuShelf
=
new
Menu
(
new
ArrayList
<
Menu
>(),
1
,
"menu:list"
,
"料架分组"
,
1
,
"lightGroup"
,
"neolight/lightGroup/index"
,
""
,
0
,
"list"
);
menus
.
addAll
(
createMenus
(
menuShelf
));
menus
.
addAll
(
createMenus
(
menuShelf
));
...
...
src/main/java/com/neotel/smfcore/core/device/bean/StatusBean.java
查看文件 @
1aec042
...
@@ -68,7 +68,7 @@ public class StatusBean {
...
@@ -68,7 +68,7 @@ public class StatusBean {
/// <summary>
/// <summary>
/// 包含的多个 BOX 的状态信息
/// 包含的多个 BOX 的状态信息
/// </summary>
/// </summary>
private
Map
<
Integer
,
BoxStatusBean
>
boxStatus
=
new
HashMap
<>();
private
Map
<
String
,
BoxStatusBean
>
boxStatus
=
new
HashMap
<>();
/**
/**
* 报警集合
* 报警集合
...
@@ -346,11 +346,11 @@ public class StatusBean {
...
@@ -346,11 +346,11 @@ public class StatusBean {
this
.
msg
=
showMsg
;
this
.
msg
=
showMsg
;
}
}
public
Map
<
Integer
,
BoxStatusBean
>
getBoxStatus
()
{
public
Map
<
String
,
BoxStatusBean
>
getBoxStatus
()
{
return
boxStatus
;
return
boxStatus
;
}
}
public
void
setBoxStatus
(
Map
<
Integer
,
BoxStatusBean
>
boxStatus
)
{
public
void
setBoxStatus
(
Map
<
String
,
BoxStatusBean
>
boxStatus
)
{
this
.
boxStatus
=
boxStatus
;
this
.
boxStatus
=
boxStatus
;
}
}
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/BaseDeviceHandler.java
查看文件 @
1aec042
...
@@ -744,7 +744,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
...
@@ -744,7 +744,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
needSaveToMongo
=
statusBean
.
needSaveToMongo
();
needSaveToMongo
=
statusBean
.
needSaveToMongo
();
}
}
statusBean
.
setTime
(
System
.
currentTimeMillis
());
statusBean
.
setTime
(
System
.
currentTimeMillis
());
Map
<
Integer
,
BoxStatusBean
>
statusOfBoxes
=
statusBeanToSave
.
getBoxStatus
();
Map
<
String
,
BoxStatusBean
>
statusOfBoxes
=
statusBeanToSave
.
getBoxStatus
();
statusBean
.
setBoxStatus
(
statusOfBoxes
);
statusBean
.
setBoxStatus
(
statusOfBoxes
);
statusBean
.
setData
(
statusBeanToSave
.
getData
());
statusBean
.
setData
(
statusBeanToSave
.
getData
());
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/SensorShelfHandler.java
查看文件 @
1aec042
...
@@ -33,7 +33,7 @@ import javax.servlet.http.HttpSession;
...
@@ -33,7 +33,7 @@ import javax.servlet.http.HttpSession;
import
java.util.*
;
import
java.util.*
;
/**
/**
*
锡膏料仓
*
感应料架
* Created by sunke on 2021/7/12.
* Created by sunke on 2021/7/12.
*/
*/
@RestController
@RestController
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/VerticalBoxHandler.java
查看文件 @
1aec042
...
@@ -70,7 +70,7 @@ public class VerticalBoxHandler extends BaseDeviceHandler {
...
@@ -70,7 +70,7 @@ public class VerticalBoxHandler extends BaseDeviceHandler {
}
}
}
}
Map
<
Integer
,
BoxStatusBean
>
statusOfBoxes
=
statusBean
.
getBoxStatus
();
Map
<
String
,
BoxStatusBean
>
statusOfBoxes
=
statusBean
.
getBoxStatus
();
if
(
statusOfBoxes
!=
null
)
{
if
(
statusOfBoxes
!=
null
)
{
for
(
BoxStatusBean
boxStatus
:
statusOfBoxes
.
values
())
{
for
(
BoxStatusBean
boxStatus
:
statusOfBoxes
.
values
())
{
try
{
try
{
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/XlBoxHandler.java
查看文件 @
1aec042
...
@@ -75,7 +75,7 @@ public class XlBoxHandler extends BaseDeviceHandler {
...
@@ -75,7 +75,7 @@ public class XlBoxHandler extends BaseDeviceHandler {
String
cid
=
statusBean
.
getCid
();
String
cid
=
statusBean
.
getCid
();
Collection
<
DataLog
>
queueTasks
=
taskService
.
getQueueTasks
(
cid
);
Collection
<
DataLog
>
queueTasks
=
taskService
.
getQueueTasks
(
cid
);
Map
<
Integer
,
BoxStatusBean
>
statusOfBoxes
=
statusBean
.
getBoxStatus
();
Map
<
String
,
BoxStatusBean
>
statusOfBoxes
=
statusBean
.
getBoxStatus
();
if
(
statusOfBoxes
!=
null
)
{
if
(
statusOfBoxes
!=
null
)
{
for
(
BoxStatusBean
boxStatus
:
statusOfBoxes
.
values
())
{
for
(
BoxStatusBean
boxStatus
:
statusOfBoxes
.
values
())
{
try
{
try
{
...
...
src/main/java/com/neotel/smfcore/core/system/websocket/MsgType.java
0 → 100644
查看文件 @
1aec042
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
neotel
.
smfcore
.
core
.
system
.
websocket
;
/**
* @author ZhangHouYing
* @date 2019-08-10 9:56
*/
public
enum
MsgType
{
/** 连接 */
CONNECT
,
/** 关闭 */
CLOSE
,
/** 信息 */
INFO
,
/** 错误 */
ERROR
}
src/main/java/com/neotel/smfcore/core/system/websocket/SocketMsg.java
0 → 100644
查看文件 @
1aec042
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
neotel
.
smfcore
.
core
.
system
.
websocket
;
import
lombok.Data
;
/**
* @author ZhangHouYing
* @date 2019-08-10 9:55
*/
@Data
public
class
SocketMsg
{
private
String
msg
;
private
MsgType
msgType
;
public
SocketMsg
(
String
msg
,
MsgType
msgType
)
{
this
.
msg
=
msg
;
this
.
msgType
=
msgType
;
}
}
src/main/java/com/neotel/smfcore/core/system/websocket/WebSocketConfig.java
0 → 100644
查看文件 @
1aec042
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
neotel
.
smfcore
.
core
.
system
.
websocket
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.socket.server.standard.ServerEndpointExporter
;
@Configuration
public
class
WebSocketConfig
{
@Bean
public
ServerEndpointExporter
serverEndpointExporter
()
{
return
new
ServerEndpointExporter
();
}
}
src/main/java/com/neotel/smfcore/core/system/websocket/WebSocketServer.java
0 → 100644
查看文件 @
1aec042
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
neotel
.
smfcore
.
core
.
system
.
websocket
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
javax.websocket.*
;
import
javax.websocket.server.PathParam
;
import
javax.websocket.server.ServerEndpoint
;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.Objects
;
import
java.util.concurrent.CopyOnWriteArraySet
;
/**
* WebSocket与客户端通信
*/
@ServerEndpoint
(
"/webSocket/{sid}"
)
@Slf4j
@Component
public
class
WebSocketServer
{
/**
* concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。
*/
private
static
CopyOnWriteArraySet
<
WebSocketServer
>
webSocketSet
=
new
CopyOnWriteArraySet
<
WebSocketServer
>();
/**
* 与某个客户端的连接会话,需要通过它来给客户端发送数据
*/
private
Session
session
;
/**
* 接收sid
*/
private
String
sid
=
""
;
/**
* 连接建立成功调用的方法
* */
@OnOpen
public
void
onOpen
(
Session
session
,
@PathParam
(
"sid"
)
String
sid
)
{
log
.
info
(
sid
+
"的webSocket已连接:"
+
session
.
getId
());
this
.
session
=
session
;
//如果存在就先删除一个,防止重复推送消息
for
(
WebSocketServer
webSocket:
webSocketSet
)
{
if
(
webSocket
.
sid
.
equals
(
sid
))
{
log
.
info
(
"清理旧的["
+
this
.
sid
+
"]的连接:"
+
session
.
getId
());
webSocketSet
.
remove
(
webSocket
);
}
}
webSocketSet
.
add
(
this
);
this
.
sid
=
sid
;
for
(
int
i
=
0
;
i
<
10
;
i
++){
try
{
Thread
.
sleep
(
1000
);
WebSocketServer
.
sendInfo
(
new
SocketMsg
(
new
Date
()
+
"的消息"
,
MsgType
.
ERROR
),
"hella"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"发送失败"
,
e
);
}
}
}
/**
* 连接关闭调用的方法
*/
@OnClose
public
void
onClose
()
{
log
.
info
(
"清理连接:"
+
session
.
getId
());
webSocketSet
.
remove
(
this
);
}
/**
* 收到客户端消息后调用的方法
* @param message 客户端发送过来的消息*/
@OnMessage
public
void
onMessage
(
String
message
,
Session
session
)
{
log
.
info
(
"收到来"
+
sid
+
"的信息:"
+
message
);
//群发消息
for
(
WebSocketServer
item
:
webSocketSet
)
{
try
{
item
.
sendMessage
(
message
);
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
@OnError
public
void
onError
(
Session
session
,
Throwable
error
)
{
log
.
error
(
"发生错误"
);
error
.
printStackTrace
();
}
/**
* 实现服务器主动推送
*/
private
void
sendMessage
(
String
message
)
throws
IOException
{
this
.
session
.
getBasicRemote
().
sendText
(
message
);
}
/**
* 群发自定义消息
* */
public
static
void
sendInfo
(
SocketMsg
socketMsg
,
@PathParam
(
"sid"
)
String
sid
)
throws
IOException
{
String
message
=
JSONObject
.
toJSONString
(
socketMsg
);
log
.
info
(
"推送消息到"
+
sid
+
",推送内容:"
+
message
);
for
(
WebSocketServer
item
:
webSocketSet
)
{
try
{
//这里可以设定只推送给这个sid的,为null则全部推送
if
(
sid
==
null
)
{
item
.
sendMessage
(
message
);
}
else
if
(
item
.
sid
.
equals
(
sid
)){
item
.
sendMessage
(
message
);
}
}
catch
(
IOException
ignored
)
{
}
}
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
WebSocketServer
that
=
(
WebSocketServer
)
o
;
return
Objects
.
equals
(
session
,
that
.
session
)
&&
Objects
.
equals
(
sid
,
that
.
sid
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
session
,
sid
);
}
}
src/main/java/com/neotel/smfcore/hella/handler/HellaServiceHandler.java
查看文件 @
1aec042
...
@@ -94,9 +94,10 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
...
@@ -94,9 +94,10 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
* <STX>checkMaterial;eventId;scannedCode<CR><LF>
* <STX>checkMaterial;eventId;scannedCode<CR><LF>
* @return
* @return
*/
*/
public
ResultBean
checkMaterial
(
String
loginUser
,
String
groupId
,
String
scannedCode
){
public
ResultBean
checkMaterial
(
String
loginUser
,
String
groupId
,
String
groupName
,
String
scannedCode
){
HellaReqCommand
command
=
HellaReqCommand
.
newCheckMaterialCmd
(
eventId
.
incrementAndGet
(),
scannedCode
);
HellaReqCommand
command
=
HellaReqCommand
.
newCheckMaterialCmd
(
eventId
.
incrementAndGet
(),
scannedCode
);
command
.
setGroupId
(
groupId
);
command
.
setGroupId
(
groupId
);
command
.
setGroupName
(
groupName
);
command
.
setLoginUser
(
loginUser
);
command
.
setLoginUser
(
loginUser
);
for
(
HellaReqCommand
hellaReqCommand
:
commandMap
.
values
())
{
for
(
HellaReqCommand
hellaReqCommand
:
commandMap
.
values
())
{
...
@@ -118,8 +119,6 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
...
@@ -118,8 +119,6 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
@Override
@Override
public
void
sessionIdle
(
IoSession
session
,
IdleStatus
status
)
throws
Exception
{
public
void
sessionIdle
(
IoSession
session
,
IdleStatus
status
)
throws
Exception
{
log
.
info
(
"客户端与服务端连接[空闲] - "
+
status
.
toString
());
log
.
info
(
"客户端与服务端连接[空闲] - "
+
status
.
toString
());
...
@@ -279,6 +278,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
...
@@ -279,6 +278,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
return
;
return
;
}
}
String
groupId
=
requestCommand
.
getGroupId
();
String
groupId
=
requestCommand
.
getGroupId
();
String
groupName
=
requestCommand
.
getGroupName
();
String
loginUser
=
requestCommand
.
getLoginUser
();
String
loginUser
=
requestCommand
.
getLoginUser
();
String
fullCode
=
requestCommand
.
getData
().
toString
();
String
fullCode
=
requestCommand
.
getData
().
toString
();
if
(
respCommand
.
isOkResp
()){
if
(
respCommand
.
isOkResp
()){
...
@@ -288,7 +288,14 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
...
@@ -288,7 +288,14 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
String
reelId
=
resposArr
[
5
];
String
reelId
=
resposArr
[
5
];
String
qty
=
resposArr
[
6
];
String
qty
=
resposArr
[
6
];
String
msl
=
resposArr
[
7
];
String
msl
=
resposArr
[
7
];
String
lightClass
=
resposArr
[
8
];
String
lightClass
=
""
;
if
(
resposArr
.
length
>=
9
){
lightClass
=
resposArr
[
8
];
}
//checkMaterialResp;1;0;OK;714.758-41;48200085SIA1531JU2N15;1000.0;1;
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
reelId
);
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
reelId
);
if
(
barcode
==
null
){
if
(
barcode
==
null
){
...
@@ -299,7 +306,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
...
@@ -299,7 +306,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
log
.
info
(
"自动添加["
+
pn
+
"]的档案信息"
);
log
.
info
(
"自动添加["
+
pn
+
"]的档案信息"
);
component
=
new
Component
();
component
=
new
Component
();
component
.
setPartNumber
(
pn
);
component
.
setPartNumber
(
pn
);
component
.
setAmount
(
Integer
.
valueOf
(
qty
));
component
.
setAmount
(
Double
.
valueOf
(
qty
).
intValue
(
));
component
.
setPlateSize
(
1
);
component
.
setPlateSize
(
1
);
component
.
setHeight
(
1
);
component
.
setHeight
(
1
);
component
.
setName
(
pn
);
component
.
setName
(
pn
);
...
@@ -310,7 +317,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
...
@@ -310,7 +317,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
barcode
.
setPartNumber
(
pn
);
barcode
.
setPartNumber
(
pn
);
barcode
.
setMsl
(
msl
);
barcode
.
setMsl
(
msl
);
barcode
.
setBatch
(
lightClass
);
barcode
.
setBatch
(
lightClass
);
barcode
.
setAmount
(
Integer
.
valueOf
(
qty
));
barcode
.
setAmount
(
Double
.
valueOf
(
qty
).
intValue
(
));
barcode
.
setFullCode
(
fullCode
);
barcode
.
setFullCode
(
fullCode
);
barcode
=
barcodeManager
.
save
(
barcode
);
barcode
=
barcodeManager
.
save
(
barcode
);
...
@@ -320,7 +327,8 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
...
@@ -320,7 +327,8 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
dataLog
.
setType
(
OP
.
PUT_IN
);
dataLog
.
setType
(
OP
.
PUT_IN
);
dataLog
.
setNum
(
barcode
.
getAmount
());
dataLog
.
setNum
(
barcode
.
getAmount
());
dataLog
.
setStatus
(
OP_STATUS
.
WAIT
.
name
());
dataLog
.
setStatus
(
OP_STATUS
.
WAIT
.
name
());
dataLog
.
setSourceName
(
groupId
);
dataLog
.
setSourceId
(
groupId
);
dataLog
.
setSourceName
(
groupName
);
dataLog
.
setMemo
(
barcode
.
getMemo
());
dataLog
.
setMemo
(
barcode
.
getMemo
());
dataLog
.
setOperator
(
loginUser
);
dataLog
.
setOperator
(
loginUser
);
dataLog
=
dataLogDao
.
save
(
dataLog
);
dataLog
=
dataLogDao
.
save
(
dataLog
);
...
@@ -439,9 +447,10 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
...
@@ -439,9 +447,10 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
* <STX>loadMaterial;eventId;scannedCode;shelfNumber;shelfSlot<CR><LF>
* <STX>loadMaterial;eventId;scannedCode;shelfNumber;shelfSlot<CR><LF>
* @return
* @return
*/
*/
private
void
loadMaterial
(
String
groupId
,
String
scannedCode
,
String
shelfNumber
,
String
shelfSlot
){
private
void
loadMaterial
(
String
groupId
,
String
goupName
,
String
scannedCode
,
String
shelfNumber
,
String
shelfSlot
){
HellaReqCommand
command
=
HellaReqCommand
.
newLoadMaterialCmd
(
eventId
.
incrementAndGet
(),
scannedCode
,
shelfNumber
,
shelfSlot
);
HellaReqCommand
command
=
HellaReqCommand
.
newLoadMaterialCmd
(
eventId
.
incrementAndGet
(),
scannedCode
,
shelfNumber
,
shelfSlot
);
command
.
setGroupId
(
groupId
);
command
.
setGroupId
(
groupId
);
command
.
setGroupName
(
goupName
);
commandMap
.
put
(
command
.
getEventId
(),
command
);
commandMap
.
put
(
command
.
getEventId
(),
command
);
log
.
info
(
"发送入库完成通知:"
+
command
.
toReqMsg
());
log
.
info
(
"发送入库完成通知:"
+
command
.
toReqMsg
());
HellaTcpClient
.
sendMsg
(
command
.
toReqMsg
());
HellaTcpClient
.
sendMsg
(
command
.
toReqMsg
());
...
@@ -452,12 +461,13 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
...
@@ -452,12 +461,13 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
if
(
task
.
isFinished
()){
if
(
task
.
isFinished
()){
if
(
task
.
isPutInTask
()){
if
(
task
.
isPutInTask
()){
String
groupId
=
task
.
getSourceId
();
String
groupId
=
task
.
getSourceId
();
String
groupName
=
task
.
getSourceName
();
String
fullCode
=
task
.
getBarcode
();
String
fullCode
=
task
.
getBarcode
();
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
task
.
getBarcode
());
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
task
.
getBarcode
());
if
(
barcode
!=
null
){
if
(
barcode
!=
null
){
fullCode
=
barcode
.
getFullCode
();
fullCode
=
barcode
.
getFullCode
();
}
}
loadMaterial
(
groupId
,
barcode
.
getFullCode
()
,
task
.
getStorageName
(),
task
.
getPosName
());
loadMaterial
(
groupId
,
groupName
,
fullCode
,
task
.
getStorageName
(),
task
.
getPosName
());
}
}
}
}
}
}
...
...
src/main/java/com/neotel/smfcore/hella/rest/HellaSensorShelfController.java
查看文件 @
1aec042
...
@@ -12,6 +12,8 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos;
...
@@ -12,6 +12,8 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.hella.handler.HellaServiceHandler
;
import
com.neotel.smfcore.hella.handler.HellaServiceHandler
;
import
com.neotel.smfcore.security.service.manager.IGroupManager
;
import
com.neotel.smfcore.security.service.po.Group
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -52,34 +54,41 @@ public class HellaSensorShelfController {
...
@@ -52,34 +54,41 @@ public class HellaSensorShelfController {
@Autowired
@Autowired
protected
IBarcodeManager
barcodeManager
;
protected
IBarcodeManager
barcodeManager
;
@Autowired
protected
IGroupManager
groupManager
;
/**
/**
* 扫码
* 扫码
*/
*/
@ApiOperation
(
"扫码入库"
)
@ApiOperation
(
"扫码入库"
)
@PostMapping
(
"/codeIn"
)
@PostMapping
(
"/codeIn"
)
@PreAuthorize
(
"@el.check('sensorShelf:putIn')"
)
@PreAuthorize
(
"@el.check('sensorShelf:putIn')"
)
public
Res
ponseEntity
<
ResultBean
>
codeIn
(
@RequestBody
Map
<
String
,
String
>
mapValues
)
{
public
Res
ultBean
codeIn
(
@RequestBody
Map
<
String
,
String
>
mapValues
)
{
String
code
=
mapValues
.
get
(
"code"
);
String
code
=
mapValues
.
get
(
"code"
);
String
group
=
mapValues
.
get
(
"group"
);
String
group
Id
=
mapValues
.
get
(
"group"
);
if
(
ObjectUtils
.
isEmpty
(
code
)){
if
(
ObjectUtils
.
isEmpty
(
code
)){
throw
new
ValidateException
(
"smfcode.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"code"
});
throw
new
ValidateException
(
"smfcode.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"code"
});
}
}
if
(
ObjectUtils
.
isEmpty
(
group
)){
if
(
ObjectUtils
.
isEmpty
(
group
Id
)){
throw
new
ValidateException
(
"smfcode.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"group"
});
throw
new
ValidateException
(
"smfcode.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"group"
});
}
}
Group
opGroup
=
groupManager
.
get
(
groupId
);
String
loginUser
=
SecurityUtils
.
getLoginUsername
();
String
loginUser
=
SecurityUtils
.
getLoginUsername
();
Collection
<
DataLog
>
queueTasks
=
taskService
.
getQueueTasks
();
Collection
<
DataLog
>
queueTasks
=
taskService
.
getQueueTasks
();
ResultBean
resultBean
=
null
;
ResultBean
resultBean
=
null
;
for
(
DataLog
queueTask
:
queueTasks
)
{
for
(
DataLog
queueTask
:
queueTasks
)
{
if
(
queueTask
.
isPutInTask
()
&&
queueTask
.
getSource
Name
().
equals
(
group
))
{
if
(
queueTask
.
isPutInTask
()
&&
queueTask
.
getSource
Id
().
equals
(
groupId
))
{
log
.
info
(
"codeIn ["
+
code
+
"]["
+
group
+
"]入库失败:条码["
+
queueTask
.
getBarcode
()+
"]的任务还未结束 "
);
log
.
info
(
"codeIn ["
+
code
+
"]["
+
opGroup
.
getGroupName
()
+
"]入库失败:条码["
+
queueTask
.
getBarcode
()+
"]的任务还未结束 "
);
throw
new
ValidateException
(
"smfcore.unfinished"
,
"the task of [{0}] is unfinished"
,
new
String
[]{
queueTask
.
getBarcode
()});
throw
new
ValidateException
(
"smfcore.unfinished"
,
"the task of [{0}] is unfinished"
,
new
String
[]{
queueTask
.
getBarcode
()});
// resultBean = ResultBean.newErrorResult(-1, "the task of [" + queueTask.getBarcode() + "] is unfinished.");
// resultBean = ResultBean.newErrorResult(-1, "the task of [" + queueTask.getBarcode() + "] is unfinished.");
// return new ResponseEntity<ResultBean>(resultBean, HttpStatus.OK);
// return new ResponseEntity<ResultBean>(resultBean, HttpStatus.OK);
}
}
}
}
resultBean
=
hellaServiceHandler
.
checkMaterial
(
loginUser
,
group
,
code
);
resultBean
=
hellaServiceHandler
.
checkMaterial
(
loginUser
,
opGroup
.
getId
(),
opGroup
.
getGroupName
()
,
code
);
return
new
ResponseEntity
<
ResultBean
>(
resultBean
,
HttpStatus
.
OK
)
;
return
resultBean
;
}
}
...
...
src/main/java/com/neotel/smfcore/hella/tcp/command/HellaReqCommand.java
查看文件 @
1aec042
...
@@ -6,11 +6,16 @@ package com.neotel.smfcore.hella.tcp.command;
...
@@ -6,11 +6,16 @@ package com.neotel.smfcore.hella.tcp.command;
public
class
HellaReqCommand
extends
HellaCommand
{
public
class
HellaReqCommand
extends
HellaCommand
{
/**
/**
*
来源
*
组Id
*/
*/
private
String
groupId
;
private
String
groupId
;
/**
/**
* 组名称
*/
private
String
groupName
;
/**
* 料仓Id;
* 料仓Id;
*/
*/
private
String
loginUser
;
private
String
loginUser
;
...
@@ -65,4 +70,12 @@ public class HellaReqCommand extends HellaCommand {
...
@@ -65,4 +70,12 @@ public class HellaReqCommand extends HellaCommand {
public
void
setGroupId
(
String
groupId
)
{
public
void
setGroupId
(
String
groupId
)
{
this
.
groupId
=
groupId
;
this
.
groupId
=
groupId
;
}
}
public
String
getGroupName
()
{
return
groupName
;
}
public
void
setGroupName
(
String
groupName
)
{
this
.
groupName
=
groupName
;
}
}
}
src/main/java/com/neotel/smfcore/hella/tcp/command/HellaRespCommand.java
查看文件 @
1aec042
...
@@ -30,11 +30,11 @@ public class HellaRespCommand extends HellaCommand {
...
@@ -30,11 +30,11 @@ public class HellaRespCommand extends HellaCommand {
}
}
public
boolean
isCheckMaterialResp
(){
public
boolean
isCheckMaterialResp
(){
return
getCmd
().
equalsIgnoreCase
(
"
checkMaterial
"
);
return
getCmd
().
equalsIgnoreCase
(
"
\u0002checkMaterialResp
"
);
}
}
public
boolean
isLoadMaterialResp
(){
public
boolean
isLoadMaterialResp
(){
return
getCmd
().
equalsIgnoreCase
(
"loadMaterial"
);
return
getCmd
().
equalsIgnoreCase
(
"loadMaterial
Resp
"
);
}
}
public
boolean
isUnloadMaterialCmd
(){
public
boolean
isUnloadMaterialCmd
(){
...
...
src/main/resources/config/application.yml
查看文件 @
1aec042
...
@@ -2,8 +2,8 @@ server:
...
@@ -2,8 +2,8 @@ server:
port
:
8800
port
:
8800
hella
:
hella
:
host
:
#host: 127.0.0.1
port
:
9900
port
:
3333
# 文件存储路径
# 文件存储路径
file
:
file
:
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论