Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit eb568c6d
由
LN
编写于
2023-02-16 09:22:44 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1053 麦康尼料仓修改。增加获取条码尺寸接口
1 个父辈
c4a633b0
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
137 行增加
和
7 行删除
src/main/java/com/neotel/smfcore/core/device/bean/BoxStatusBean.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/BaseDeviceHandler.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/RobotBoxHandler.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/ThirdBoxHandler.java
src/main/java/com/neotel/smfcore/core/device/bean/BoxStatusBean.java
查看文件 @
eb568c6
...
@@ -160,7 +160,7 @@ public class BoxStatusBean {
...
@@ -160,7 +160,7 @@ public class BoxStatusBean {
if
(
ObjectUtil
.
isNotEmpty
(
ar
))
{
if
(
ObjectUtil
.
isNotEmpty
(
ar
))
{
String
[]
ar2
=
ar
.
split
(
"="
);
String
[]
ar2
=
ar
.
split
(
"="
);
if
(
ar2
.
length
==
2
)
{
if
(
ar2
.
length
==
2
)
{
caMap
.
put
(
ar2
[
0
],
Integer
.
valueOf
(
ar2
[
1
]));
caMap
.
put
(
ar2
[
0
]
.
toUpperCase
()
,
Integer
.
valueOf
(
ar2
[
1
]));
}
}
}
}
}
}
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/BaseDeviceHandler.java
查看文件 @
eb568c6
...
@@ -632,7 +632,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
...
@@ -632,7 +632,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
* @param posId
* @param posId
* @param exTime
* @param exTime
*/
*/
pr
ivate
void
updatePosExecuteTime
(
String
posId
,
double
exTime
)
{
pr
otected
void
updatePosExecuteTime
(
String
posId
,
double
exTime
)
{
if
(
posId
==
null
||
exTime
<=
0
)
{
if
(
posId
==
null
||
exTime
<=
0
)
{
return
;
return
;
}
}
...
@@ -653,7 +653,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
...
@@ -653,7 +653,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
/**
/**
* 入仓位完成
* 入仓位完成
*/
*/
pr
ivate
void
updatePutInData
(
DataLog
task
)
throws
ValidateException
{
pr
otected
void
updatePutInData
(
DataLog
task
)
throws
ValidateException
{
//从队列里面移除操作
//从队列里面移除操作
taskService
.
removeQueueTask
(
task
);
taskService
.
removeQueueTask
(
task
);
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/RobotBoxHandler.java
查看文件 @
eb568c6
...
@@ -7,7 +7,10 @@ import com.google.common.collect.Maps;
...
@@ -7,7 +7,10 @@ import com.google.common.collect.Maps;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.core.barcode.bean.CodeBean
;
import
com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.utils.CodeResolve
;
import
com.neotel.smfcore.core.device.bean.BoxStatusBean
;
import
com.neotel.smfcore.core.device.bean.BoxStatusBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.enums.BOX_STATUS
;
import
com.neotel.smfcore.core.device.enums.BOX_STATUS
;
...
@@ -26,6 +29,7 @@ import io.swagger.annotations.ApiOperation;
...
@@ -26,6 +29,7 @@ import io.swagger.annotations.ApiOperation;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -262,6 +266,10 @@ public class RobotBoxHandler extends BaseDeviceHandler {
...
@@ -262,6 +266,10 @@ public class RobotBoxHandler extends BaseDeviceHandler {
try
{
try
{
Barcode
barcode
=
codeResolve
.
resolveOneValideBarcode
(
code
);
Barcode
barcode
=
codeResolve
.
resolveOneValideBarcode
(
code
);
for
(
DataLog
dataLog
:
taskService
.
getQueueTasks
())
{
for
(
DataLog
dataLog
:
taskService
.
getQueueTasks
())
{
//已取消或已完成的任务不返回
if
(
dataLog
.
isFinished
()||
dataLog
.
isCancel
()){
continue
;
}
if
(
dataLog
.
getBarcode
().
equals
(
barcode
.
getBarcode
()))
{
if
(
dataLog
.
getBarcode
().
equals
(
barcode
.
getBarcode
()))
{
if
(
dataLog
.
isPutInTask
())
{
if
(
dataLog
.
isPutInTask
())
{
//已有入库任务
//已有入库任务
...
@@ -419,7 +427,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
...
@@ -419,7 +427,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
String
barcode
=
request
.
getParameter
(
"barcode"
);
String
barcode
=
request
.
getParameter
(
"barcode"
);
String
statusStr
=
request
.
getParameter
(
"status"
);
String
statusStr
=
request
.
getParameter
(
"status"
);
String
locInfo
=
request
.
getParameter
(
"locInfo"
);
String
locInfo
=
request
.
getParameter
(
"locInfo"
);
log
.
debug
(
"收到
料盘["
+
barcode
+
"]更新位置指令["
+
statusStr
+
"]="
+
locInfo
);
log
.
info
(
"收到taskId["
+
taskId
+
"],
料盘["
+
barcode
+
"]更新位置指令["
+
statusStr
+
"]="
+
locInfo
);
if
(
ObjectUtil
.
isEmpty
(
locInfo
))
{
if
(
ObjectUtil
.
isEmpty
(
locInfo
))
{
locInfo
=
statusStr
;
locInfo
=
statusStr
;
...
@@ -427,11 +435,30 @@ public class RobotBoxHandler extends BaseDeviceHandler {
...
@@ -427,11 +435,30 @@ public class RobotBoxHandler extends BaseDeviceHandler {
DataLog
opTask
=
null
;
DataLog
opTask
=
null
;
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
for
(
DataLog
task
:
allTasks
)
{
for
(
DataLog
task
:
allTasks
)
{
if
(
task
.
getId
().
equals
(
taskId
)
&&
task
.
getBarcode
().
equals
(
barcode
))
{
if
(
task
.
isFinished
()){
continue
;
}
if
(
ObjectUtil
.
isNotEmpty
(
task
)&&
task
.
getId
().
equals
(
taskId
))
{
opTask
=
task
;
break
;
}
else
if
(
ObjectUtil
.
isNotEmpty
(
barcode
)
&&
task
.
getBarcode
().
equals
(
barcode
))
{
opTask
=
task
;
opTask
=
task
;
break
;
break
;
}
}
}
}
//如果任务为空,重新查找已完成的任务
if
(
opTask
==
null
)
{
for
(
DataLog
task
:
allTasks
)
{
if
(
ObjectUtil
.
isNotEmpty
(
task
)
&&
task
.
getId
().
equals
(
taskId
))
{
opTask
=
task
;
break
;
}
else
if
(
ObjectUtil
.
isNotEmpty
(
barcode
)
&&
task
.
getBarcode
().
equals
(
barcode
))
{
opTask
=
task
;
break
;
}
}
}
if
(
opTask
==
null
)
{
if
(
opTask
==
null
)
{
return
ResultBean
.
newErrorResult
(
301
,
"smfcore.task.notExist"
,
"任务不存在"
);
return
ResultBean
.
newErrorResult
(
301
,
"smfcore.task.notExist"
,
"任务不存在"
);
}
}
...
@@ -470,6 +497,9 @@ public class RobotBoxHandler extends BaseDeviceHandler {
...
@@ -470,6 +497,9 @@ public class RobotBoxHandler extends BaseDeviceHandler {
if
(
opTask
.
isPutInTask
())
{
if
(
opTask
.
isPutInTask
())
{
taskService
.
updateQueueTask
(
opTask
);
taskService
.
updateQueueTask
(
opTask
);
}
else
{
}
else
{
if
(
opTask
.
isFinished
())
{
taskService
.
removeQueueTask
(
opTask
);
}
taskService
.
updateFinishedTask
(
opTask
);
taskService
.
updateFinishedTask
(
opTask
);
}
}
...
@@ -545,6 +575,55 @@ public class RobotBoxHandler extends BaseDeviceHandler {
...
@@ -545,6 +575,55 @@ public class RobotBoxHandler extends BaseDeviceHandler {
}
}
@Autowired
private
CodeResolve
codeResolve
;
@ApiOperation
(
"获取条码尺寸"
)
@PostMapping
(
value
=
"/service/store/robotBox/getSize"
)
@ResponseBody
@AnonymousAccess
public
ResultBean
getSize
(
HttpServletRequest
request
)
{
try
{
String
barcodeStr
=
request
.
getParameter
(
"barcode"
);
log
.
info
(
" 获取["
+
barcodeStr
+
"]的尺寸信息"
);
Collection
<
CodeBean
>
codeBeans
=
codeResolve
.
resolveCodeStr
(
barcodeStr
,
COMPONENT_TYPE
.
COMPONENT
);
;
Barcode
barcode
=
null
;
for
(
CodeBean
codeBean
:
codeBeans
)
{
if
(
codeBean
.
isValid
())
{
if
(
barcode
!=
null
)
{
String
msg
=
"获取尺寸时找到多个有效条码"
;
return
ResultBean
.
newErrorResult
(
105
,
"smfcore.getSize.error"
,
"获取"
+
barcodeStr
+
"尺寸失败:有多个条码"
);
}
else
{
barcode
=
codeBean
.
getBarcode
();
}
}
}
if
(
barcode
==
null
)
{
return
ResultBean
.
newErrorResult
(
105
,
"smfcore.getSize.error"
,
"获取"
+
barcodeStr
+
"尺寸失败:未找到有效条码"
);
}
if
(
barcode
.
getPlateSize
()
>
0
&&
barcode
.
getHeight
()
>
0
)
{
Map
<
String
,
String
>
returnData
=
new
HashMap
<>();
returnData
.
put
(
"barcode"
,
barcode
.
getBarcode
());
returnData
.
put
(
"plateW"
,
barcode
.
getPlateSize
()
+
""
);
returnData
.
put
(
"plateH"
,
barcode
.
getHeight
()
+
""
);
return
ResultBean
.
newOkResult
(
returnData
);
}
else
{
return
ResultBean
.
newErrorResult
(
105
,
"smfcore.getSize.error"
,
"获取"
+
barcodeStr
+
"尺寸失败:未找到对应尺寸"
);
}
}
catch
(
ValidateException
e
)
{
log
.
warn
(
" 获取尺寸信息出错:"
+
e
.
getMessage
());
return
ResultBean
.
newErrorResult
(
105
,
"smfcore.getSize.error"
,
"获取尺寸信息出错:"
+
e
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
"获取尺寸信息出错"
,
e
);
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.getSize.error"
,
"获取尺寸信息出错:"
+
e
.
getMessage
());
}
}
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/ThirdBoxHandler.java
查看文件 @
eb568c6
...
@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.device.handler.impl;
...
@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.device.handler.impl;
import
com.google.common.base.Strings
;
import
com.google.common.base.Strings
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.ReelLockPosUtil
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.device.bean.BoxStatusBean
;
import
com.neotel.smfcore.core.device.bean.BoxStatusBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
...
@@ -154,15 +155,24 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
...
@@ -154,15 +155,24 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
int
status
=
boxStatus
.
getStatus
();
int
status
=
boxStatus
.
getStatus
();
String
posName
=
boxStatus
.
getPosId
();
String
posName
=
boxStatus
.
getPosId
();
String
barcode
=
boxStatus
.
getBarcode
();
String
barcode
=
boxStatus
.
getBarcode
();
Map
<
String
,
Integer
>
posCapMap
=
boxStatus
.
getCapacity
();
int
executeTime
=
boxStatus
.
getExecuteTime
();
int
executeTime
=
boxStatus
.
getExecuteTime
();
if
((!
Strings
.
isNullOrEmpty
(
posName
))||(!
Strings
.
isNullOrEmpty
(
barcode
)))
{
//客户端发一次完成之后,会发空的 posName,不需要处理
if
((!
Strings
.
isNullOrEmpty
(
posName
))||(!
Strings
.
isNullOrEmpty
(
barcode
)))
{
//客户端发一次完成之后,会发空的 posName,不需要处理
if
(
BOX_STATUS
.
IN_FINISHED
==
status
)
{
//入仓完成
if
(
BOX_STATUS
.
IN_FINISHED
==
status
)
{
//入仓完成
finishedPutIn
(
statusBean
.
getCid
()
,
posName
,
barcode
,
executeTime
);
thirdBoxFinishedPutIn
(
statusBean
.
getCid
(),
posCapMap
,
posName
,
barcode
,
executeTime
);
}
else
if
(
BOX_STATUS
.
IN_FAILED
==
status
)
{
//入库失败
}
else
if
(
BOX_STATUS
.
IN_FAILED
==
status
)
{
//入库失败
//暂不处理
//暂不处理
}
else
if
(
BOX_STATUS
.
OUT_FINISHED
==
status
)
{
//出仓完成
}
else
if
(
BOX_STATUS
.
OUT_FINISHED
==
status
)
{
//出仓完成
finishedOutPos
(
statusBean
.
getCid
(),
posName
,
barcode
,
executeTime
);
}
else
if
(
BOX_STATUS
.
OUT_END
==
status
)
{
//出库完成(放到仓门口
}
else
if
(
BOX_STATUS
.
OUT_END
==
status
)
{
//出库完成(放到仓门口
try
{
//麦康尼料仓不发OUT_FINISHED,收到OutEnd的时候处理
finishedOutPos
(
statusBean
.
getCid
(),
posName
,
barcode
,
executeTime
);
}
catch
(
Exception
ex
){
}
//更改出库状态为OUT_DOOR
//更改出库状态为OUT_DOOR
List
<
DataLog
>
finishedTasks
=
taskService
.
getFinishedTasks
();
List
<
DataLog
>
finishedTasks
=
taskService
.
getFinishedTasks
();
for
(
DataLog
finishedTask
:
finishedTasks
)
{
for
(
DataLog
finishedTask
:
finishedTasks
)
{
...
@@ -207,6 +217,47 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
...
@@ -207,6 +217,47 @@ public class ThirdBoxHandler extends BaseDeviceHandler{
}
}
return
statusBean
;
return
statusBean
;
}
}
protected
void
thirdBoxFinishedPutIn
(
String
cid
,
Map
<
String
,
Integer
>
posCapMap
,
String
posName
,
String
barcode
,
int
executeTime
)
throws
ValidateException
{
DataLog
task
=
taskService
.
findExecutingTask
(
cid
,
posName
,
barcode
);
if
(
task
!=
null
&&
task
.
isPutInTask
())
{
//对比容量,更新库位号
if
(
executeTime
>
0
)
{
task
.
setExecuteTime
(
executeTime
);
updatePosExecuteTime
(
task
.
getPosName
(),
executeTime
);
}
log
.
info
(
task
.
getBarcode
()
+
"入仓位["
+
task
.
getPosName
()
+
"]完成,执行时间["
+
executeTime
+
"]秒"
);
ReelLockPosUtil
.
removeReelLockPosInfo
(
task
.
getBarcode
());
DataLog
cancelTask
=
taskService
.
findFinishedPutInTask
(
cid
,
task
.
getPosName
(),
task
.
getBarcode
());
if
(
cancelTask
!=
null
&&
cancelTask
.
isCancel
())
{
//将相同库位已经取消的任务从完成队列里删除
taskService
.
removeFinishedTask
(
cancelTask
);
log
.
info
(
"从已完成的任务列表中删除之前取消的任务:"
+
cancelTask
.
getPosName
()
+
" ReelId:"
+
cancelTask
.
getBarcode
());
}
updatePutInData
(
task
);
}
else
{
//从已完成列表中找,如果还找不到就忽略
task
=
taskService
.
findFinishedPutInTask
(
cid
,
posName
,
barcode
);
if
(
task
!=
null
&&
task
.
isPutInTask
())
{
if
(
task
.
isCancel
())
{
//被取消的任务,客户端发完成信号过来,修改取消状态为已完成
if
(
executeTime
>
0
)
{
task
.
setExecuteTime
(
executeTime
);
updatePosExecuteTime
(
task
.
getPosName
(),
executeTime
);
}
log
.
info
(
task
.
getBarcode
()
+
"入仓位["
+
task
.
getPosName
()
+
"]完成,但任务已被取消,修改为完成,执行时间["
+
executeTime
+
"]秒"
);
updatePutInData
(
task
);
}
}
else
{
log
.
error
(
cid
+
"入仓位["
+
posName
+
"]ReelId["
+
barcode
+
"]完成时任务不存在"
);
}
}
}
@Override
@Override
public
DeviceType
getDeviceType
()
{
public
DeviceType
getDeviceType
()
{
return
DeviceType
.
SMDBOX_THIRD
;
return
DeviceType
.
SMDBOX_THIRD
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论