Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 6d6bd292
由
LN
编写于
2023-02-10 13:22:55 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
SMDBOX_THIRD兼容:出入库完成通知时若库位号为空,根据barcode查找任务
1 个父辈
097d80a1
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
92 行增加
和
45 行删除
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/XLRBoxHandler.java
src/main/java/com/neotel/smfcore/core/system/util/TaskService.java
src/main/java/com/neotel/smfcore/core/device/bean/BoxStatusBean.java
查看文件 @
6d6bd29
...
...
@@ -141,6 +141,12 @@ public class BoxStatusBean {
public
String
getPosId
(){
return
data
.
get
(
"posId"
);
}
/**
* 获取客户端发送上来的出入库完成的条码信息
*/
public
String
getBarcode
(){
return
data
.
get
(
"barcode"
);
}
/**
* 从data中获取值
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/BaseDeviceHandler.java
查看文件 @
6d6bd29
...
...
@@ -413,16 +413,17 @@ public class BaseDeviceHandler implements IDeviceHandler {
//出库入库完成处理
int
status
=
boxStatus
.
getStatus
();
String
posName
=
boxStatus
.
getPosId
();
String
barcode
=
boxStatus
.
getBarcode
();
int
executeTime
=
boxStatus
.
getExecuteTime
();
if
(!
Strings
.
isNullOrEmpty
(
posName
))
{
//客户端发一次完成之后,会发空的 posName,不需要处理
if
(
BOX_STATUS
.
IN_FINISHED
==
status
)
{
//入仓完成
finishedPutIn
(
statusBean
.
getCid
(),
posName
,
executeTime
);
finishedPutIn
(
statusBean
.
getCid
(),
posName
,
barcode
,
executeTime
);
}
else
if
(
BOX_STATUS
.
IN_FAILED
==
status
)
{
//入库失败
//暂不处理
}
else
if
(
BOX_STATUS
.
OUT_FINISHED
==
status
)
{
//出仓完成
finishedOutPos
(
statusBean
.
getCid
(),
posName
,
executeTime
);
finishedOutPos
(
statusBean
.
getCid
(),
posName
,
barcode
,
executeTime
);
}
else
if
(
BOX_STATUS
.
OUT_END
==
status
)
{
//出库完成(放到仓门口
endOutTask
(
statusBean
.
getCid
(),
posName
);
endOutTask
(
statusBean
.
getCid
(),
posName
,
barcode
);
}
// else if (BOX_STATUS.REWARM_TAKING_END == status) {
// //回温取料完成, 将库位清空
...
...
@@ -498,7 +499,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
}
protected
void
finishedPutIn
(
String
cid
,
String
posName
)
throws
ValidateException
{
finishedPutIn
(
cid
,
posName
,-
1
);
finishedPutIn
(
cid
,
posName
,
""
,
-
1
);
}
/**
...
...
@@ -508,16 +509,18 @@ public class BaseDeviceHandler implements IDeviceHandler {
* @param executeTime 执行时间
* @throws ValidateException
*/
protected
void
finishedPutIn
(
String
cid
,
String
posName
,
int
executeTime
)
throws
ValidateException
{
DataLog
task
=
taskService
.
findExecutingTask
(
cid
,
posName
);
protected
void
finishedPutIn
(
String
cid
,
String
posName
,
String
barcode
,
int
executeTime
)
throws
ValidateException
{
DataLog
task
=
taskService
.
findExecutingTask
(
cid
,
posName
,
barcode
);
if
(
task
!=
null
&&
task
.
isPutInTask
())
{
if
(
executeTime
>
0
)
{
if
(
executeTime
>
0
)
{
task
.
setExecuteTime
(
executeTime
);
updatePosExecuteTime
(
posName
,
executeTime
);
updatePosExecuteTime
(
task
.
getPosName
(),
executeTime
);
}
log
.
info
(
task
.
getBarcode
()
+
"入仓位["
+
task
.
getPosName
()
+
"]完成,执行时间["
+
executeTime
+
"]秒"
);
log
.
info
(
task
.
getBarcode
()
+
"入仓位["
+
task
.
getPosName
()
+
"]完成,执行时间["
+
executeTime
+
"]秒"
);
ReelLockPosUtil
.
removeReelLockPosInfo
(
task
.
getBarcode
());
DataLog
cancelTask
=
taskService
.
findFinishedPutInTask
(
cid
,
posName
);
DataLog
cancelTask
=
taskService
.
findFinishedPutInTask
(
cid
,
task
.
getPosName
(),
task
.
getBarcode
()
);
if
(
cancelTask
!=
null
&&
cancelTask
.
isCancel
())
{
//将相同库位已经取消的任务从完成队列里删除
taskService
.
removeFinishedTask
(
cancelTask
);
...
...
@@ -526,38 +529,38 @@ public class BaseDeviceHandler implements IDeviceHandler {
updatePutInData
(
task
);
}
else
{
//从已完成列表中找,如果还找不到就忽略
task
=
taskService
.
findFinishedPutInTask
(
cid
,
posName
);
task
=
taskService
.
findFinishedPutInTask
(
cid
,
posName
,
barcode
);
if
(
task
!=
null
&&
task
.
isPutInTask
())
{
if
(
task
.
isCancel
())
{
//被取消的任务,客户端发完成信号过来,修改取消状态为已完成
if
(
executeTime
>
0
)
{
if
(
executeTime
>
0
)
{
task
.
setExecuteTime
(
executeTime
);
updatePosExecuteTime
(
posName
,
executeTime
);
updatePosExecuteTime
(
task
.
getPosName
(),
executeTime
);
}
log
.
info
(
task
.
getBarcode
()
+
"入仓位["
+
task
.
getPosName
()
+
"]完成,但任务已被取消,修改为完成,执行时间["
+
executeTime
+
"]秒"
);
log
.
info
(
task
.
getBarcode
()
+
"入仓位["
+
task
.
getPosName
()
+
"]完成,但任务已被取消,修改为完成,执行时间["
+
executeTime
+
"]秒"
);
updatePutInData
(
task
);
}
}
else
{
log
.
error
(
cid
+
"入仓位["
+
posName
+
"]完成时任务不存在"
);
log
.
error
(
cid
+
"入仓位["
+
posName
+
"]
ReelId["
+
barcode
+
"]
完成时任务不存在"
);
}
}
}
protected
void
finishedOutPos
(
String
cid
,
String
posName
)
throws
ValidateException
{
finishedOutPos
(
cid
,
posName
,-
1
);
finishedOutPos
(
cid
,
posName
,
""
,
-
1
);
}
protected
void
endOutTask
(
String
cid
,
String
posName
){
protected
void
endOutTask
(
String
cid
,
String
posName
,
String
barcode
){
log
.
info
(
cid
+
"将物料从库位["
+
posName
+
"]出库到门口/料串完成"
);
DataLog
task
=
taskService
.
findFinishedOutTask
(
cid
,
posName
);
DataLog
task
=
taskService
.
findFinishedOutTask
(
cid
,
posName
,
barcode
);
if
(
task
!=
null
){
task
.
setStatus
(
OP_STATUS
.
END
.
name
());
taskService
.
updateFinishedTask
(
task
);
}
}
protected
void
finishedOutPos
(
String
cid
,
String
posName
,
int
executeTime
)
throws
ValidateException
{
finishedOutPos
(
cid
,
posName
,
executeTime
,
OP_STATUS
.
FINISHED
);
protected
void
finishedOutPos
(
String
cid
,
String
posName
,
String
barcode
,
int
executeTime
)
throws
ValidateException
{
finishedOutPos
(
cid
,
posName
,
barcode
,
executeTime
,
OP_STATUS
.
FINISHED
);
}
/**
* 出仓位完成处理
...
...
@@ -566,14 +569,14 @@ public class BaseDeviceHandler implements IDeviceHandler {
* @param executeTime 执行时间
* @throws ValidateException
*/
protected
void
finishedOutPos
(
String
cid
,
String
posName
,
int
executeTime
,
OP_STATUS
outBoxStatus
)
throws
ValidateException
{
DataLog
task
=
taskService
.
findExecutingTask
(
cid
,
posName
);
protected
void
finishedOutPos
(
String
cid
,
String
posName
,
String
barcode
,
int
executeTime
,
OP_STATUS
outBoxStatus
)
throws
ValidateException
{
DataLog
task
=
taskService
.
findExecutingTask
(
cid
,
posName
,
barcode
);
if
(
task
!=
null
&&
task
.
isCheckOutTask
())
{
if
(
executeTime
>
0
)
{
task
.
setExecuteTime
(
executeTime
);
}
log
.
info
(
task
.
getBarcode
()
+
"出仓位["
+
task
.
getPosName
()
+
"]完成,执行时间["
+
executeTime
+
"]秒"
);
DataLog
cancelTask
=
taskService
.
findFinishedOutTask
(
cid
,
posName
);
DataLog
cancelTask
=
taskService
.
findFinishedOutTask
(
cid
,
task
.
getPosName
(),
task
.
getBarcode
()
);
if
(
cancelTask
!=
null
&&
cancelTask
.
isCancel
())
{
//将相同库位已经取消的任务从完成队列里删除
taskService
.
removeFinishedTask
(
cancelTask
);
...
...
@@ -583,7 +586,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
}
else
{
//log.error(operationKey + "触发仓位完成时,操作队列中不存在");
//从已完成列表中找,如果还找不到就忽略
task
=
taskService
.
findFinishedOutTask
(
cid
,
posName
);
task
=
taskService
.
findFinishedOutTask
(
cid
,
posName
,
barcode
);
if
(
task
!=
null
&&
task
.
isCheckOutTask
())
{
if
(
task
.
isCancel
())
{
//被取消的任务,客户端发完成信号过来,修改取消状态为已完成
if
(
executeTime
>
0
)
{
...
...
@@ -592,21 +595,35 @@ public class BaseDeviceHandler implements IDeviceHandler {
log
.
info
(
task
.
getBarcode
()
+
"出仓位["
+
task
.
getPosName
()
+
"]完成,但任务已被取消,修改为完成,执行时间["
+
executeTime
+
"]秒"
);
updateCheckoutData
(
task
,
outBoxStatus
);
}
}
else
{
}
else
if
(
ObjectUtil
.
isNotEmpty
(
posName
))
{
StoragePos
storagePos
=
storagePosManager
.
getByPosName
(
posName
);
if
(
storagePos
!=
null
&&
storagePos
.
isUsed
())
{
String
barcode
=
storagePos
.
getBarcode
().
getBarcode
();
barcode
=
storagePos
.
getBarcode
().
getBarcode
();
//查找库位是否为空,如果库位有料,调用清理手动出库的方法清理库存
if
(
ObjectUtil
.
isNotEmpty
(
barcode
))
{
log
.
info
(
cid
+
"出仓位["
+
posName
+
"]完成时任务不存在,清理库位中的库存["
+
barcode
+
"]"
);
taskService
.
addTaskToFinished
(
storagePos
,
null
,
cid
+
"-clear"
);
}
else
{
}
else
{
log
.
info
(
cid
+
"出仓位["
+
posName
+
"]完成时任务不存在,清理库位失败,条码为空"
);
}
}
else
{
log
.
warn
(
cid
+
"出仓位["
+
posName
+
"]完成时任务不存在"
);
}
}
else
if
(
ObjectUtil
.
isNotEmpty
(
barcode
)){
StoragePos
storagePos
=
storagePosManager
.
getByBarcode
(
barcode
);
if
(
storagePos
!=
null
&&
storagePos
.
isUsed
())
{
posName
=
storagePos
.
getPosName
();
//查找库位是否为空,如果库位有料,调用清理手动出库的方法清理库存
log
.
info
(
cid
+
"出仓位条码["
+
barcode
+
"]完成时任务不存在,根据条码["
+
barcode
+
"]找到库位["
+
posName
+
"],清理库位中的库存 "
);
taskService
.
addTaskToFinished
(
storagePos
,
null
,
cid
+
"-clear"
);
}
else
{
log
.
warn
(
cid
+
"出仓位条码["
+
barcode
+
"]完成时任务不存在"
);
}
}
else
{
log
.
error
(
cid
+
"出仓位["
+
posName
+
"]ReelId["
+
barcode
+
"]完成时任务不存在"
);
}
}
}
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/RobotBoxHandler.java
查看文件 @
6d6bd29
...
...
@@ -165,14 +165,15 @@ public class RobotBoxHandler extends BaseDeviceHandler {
//出库入库完成处理
int
status
=
boxStatus
.
getStatus
();
String
posName
=
boxStatus
.
getPosId
();
String
barcode
=
boxStatus
.
getBarcode
();
int
executeTime
=
boxStatus
.
getExecuteTime
();
if
(!
Strings
.
isNullOrEmpty
(
posName
))
{
//客户端发一次完成之后,会发空的 posName,不需要处理
if
(
BOX_STATUS
.
IN_FINISHED
==
status
)
{
//入仓完成
finishedPutIn
(
statusBean
.
getCid
(),
posName
,
executeTime
);
finishedPutIn
(
statusBean
.
getCid
(),
posName
,
barcode
,
executeTime
);
}
else
if
(
BOX_STATUS
.
IN_FAILED
==
status
)
{
//入库失败
//暂不处理
}
else
if
(
BOX_STATUS
.
OUT_FINISHED
==
status
)
{
//出仓完成
finishedOutPos
(
statusBean
.
getCid
(),
posName
,
executeTime
);
finishedOutPos
(
statusBean
.
getCid
(),
posName
,
barcode
,
executeTime
);
}
else
if
(
BOX_STATUS
.
OUT_END
==
status
)
{
//出库完成(放到仓门口
//更改出库状态为OUT_DOOR
List
<
DataLog
>
finishedTasks
=
taskService
.
getFinishedTasks
();
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/XLRBoxHandler.java
查看文件 @
6d6bd29
...
...
@@ -60,12 +60,13 @@ public class XLRBoxHandler extends BaseDeviceHandler {
//出库入库完成处理
int
status
=
boxStatus
.
getStatus
();
String
posName
=
boxStatus
.
getPosId
();
String
barcode
=
boxStatus
.
getBarcode
();
int
executeTime
=
boxStatus
.
getExecuteTime
();
if
(!
Strings
.
isNullOrEmpty
(
posName
))
{
//客户端发一次完成之后,会发空的 posName,不需要处理
if
(
BOX_STATUS
.
IN_FINISHED
==
status
)
{
//入仓完成
finishedPutIn
(
statusBean
.
getCid
(),
posName
,
executeTime
);
finishedPutIn
(
statusBean
.
getCid
(),
posName
,
barcode
,
executeTime
);
}
else
if
(
BOX_STATUS
.
OUT_FINISHED
==
status
)
{
//出仓完成
finishedOutPos
(
statusBean
.
getCid
(),
posName
,
executeTime
,
OP_STATUS
.
OUT_BOX
);
finishedOutPos
(
statusBean
.
getCid
(),
posName
,
barcode
,
executeTime
,
OP_STATUS
.
OUT_BOX
);
}
else
if
(
BOX_STATUS
.
OUT_END
==
status
)
{
//出库完成(放到仓门口
log
.
info
(
statusBean
.
getCid
()
+
"将物料从库位["
+
posName
+
"]出库到门口/料串完成"
);
reelOnShelf
(
statusBean
.
getCid
(),
posName
);
...
...
src/main/java/com/neotel/smfcore/core/system/util/TaskService.java
查看文件 @
6d6bd29
...
...
@@ -274,12 +274,17 @@ public class TaskService {
}
return
resultTasks
;
}
public
DataLog
findFinishedPutInTask
(
String
cid
,
String
posName
){
return
findFinishedTask
(
cid
,
posName
,
true
);
return
findFinishedTask
(
cid
,
posName
,
""
,
true
);
}
public
DataLog
findFinishedOutTask
(
String
cid
,
String
posName
){
return
findFinishedTask
(
cid
,
posName
,
false
);
return
findFinishedTask
(
cid
,
posName
,
""
,
false
);
}
public
DataLog
findFinishedPutInTask
(
String
cid
,
String
posName
,
String
barcode
){
return
findFinishedTask
(
cid
,
posName
,
barcode
,
true
);
}
public
DataLog
findFinishedOutTask
(
String
cid
,
String
posName
,
String
barcode
){
return
findFinishedTask
(
cid
,
posName
,
barcode
,
false
);
}
/**
* 根据料仓编号和库位获取已完成/取消的任务
...
...
@@ -288,16 +293,23 @@ public class TaskService {
* @param posName
* @return
*/
private
DataLog
findFinishedTask
(
String
cid
,
String
posName
,
boolean
putInTask
)
{
private
DataLog
findFinishedTask
(
String
cid
,
String
posName
,
String
barcode
,
boolean
putInTask
)
{
Collection
<
DataLog
>
areaFinishedTasks
=
theFinishedTaskMap
.
values
();
for
(
DataLog
task
:
areaFinishedTasks
)
{
if
(
task
.
getPosName
().
equals
(
posName
)
&&
task
.
getCid
().
equals
(
cid
))
{
if
(
putInTask
){
if
(
task
.
isPutInTask
()){
boolean
isSameTask
=
false
;
if
(
ObjectUtil
.
isNotEmpty
(
posName
)
&&
task
.
getPosName
().
equals
(
posName
)
&&
task
.
getCid
().
equals
(
cid
))
{
isSameTask
=
true
;
}
else
if
(
ObjectUtil
.
isNotEmpty
(
barcode
)
&&
task
.
getBarcode
().
equals
(
barcode
)
&&
task
.
getCid
().
equals
(
cid
))
{
isSameTask
=
true
;
}
if
(
isSameTask
)
{
if
(
putInTask
)
{
if
(
task
.
isPutInTask
())
{
return
task
;
}
}
else
{
if
(
task
.
isCheckOutTask
())
{
}
else
{
if
(
task
.
isCheckOutTask
())
{
return
task
;
}
}
...
...
@@ -307,17 +319,27 @@ public class TaskService {
}
/**
* 根据cid 和 posName 查找正在执行的任务,不存在时返回 null
* 根据cid 和 posName
,barcode
查找正在执行的任务,不存在时返回 null
*/
public
DataLog
findExecutingTask
(
String
cid
,
String
posName
)
{
public
DataLog
findExecutingTask
(
String
cid
,
String
posName
,
String
barcode
)
{
for
(
DataLog
task
:
taskMap
.
values
())
{
if
(
task
.
getCid
().
equals
(
cid
)
&&
task
.
getPosName
().
equals
(
posName
))
{
return
task
;
if
(
ObjectUtil
.
isNotEmpty
(
posName
)){
if
(
task
.
getCid
().
equals
(
cid
)
&&
task
.
getPosName
().
equals
(
posName
))
{
return
task
;
}
}
else
if
(
ObjectUtil
.
isNotEmpty
(
barcode
)){
if
(
task
.
getCid
().
equals
(
cid
)&&
task
.
getBarcode
().
equals
(
barcode
)){
return
task
;
}
}
}
return
null
;
}
public
DataLog
findExecutingTask
(
String
cid
,
String
posName
)
{
return
findExecutingTask
(
cid
,
posName
,
""
);
}
/**
* 是否有正在执行的任务
*
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论