Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 308cbb27
由
LN
编写于
2023-07-06 11:28:37 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
获取料架剩余库位修改。
1 个父辈
fbe3b960
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
204 行增加
和
63 行删除
src/main/java/com/neotel/smfcore/core/device/util/DataCache.java
src/main/java/com/neotel/smfcore/core/shelf/bean/ShelfInfo.java
src/main/java/com/neotel/smfcore/core/shelf/rest/TaskShelfController.java
src/main/java/com/neotel/smfcore/core/shelf/util/TaskShelfUtil.java
src/main/resources/messages.properties
src/main/java/com/neotel/smfcore/core/device/util/DataCache.java
查看文件 @
308cbb2
...
@@ -164,11 +164,13 @@ public class DataCache {
...
@@ -164,11 +164,13 @@ public class DataCache {
}
}
return
lanList
;
return
lanList
;
}
}
public
void
updateCache
(
String
cacheKey
,
Object
value
)
{
updateCache
(
cacheKey
,
value
,
true
);
}
/**
/**
* 更新缓存信息
* 更新缓存信息
*/
*/
public
void
updateCache
(
String
cacheKey
,
Object
value
)
{
public
void
updateCache
(
String
cacheKey
,
Object
value
,
boolean
needLog
)
{
cacheItemDao
.
updateCacheItem
(
cacheKey
,
value
);
cacheItemDao
.
updateCacheItem
(
cacheKey
,
value
);
cacheMap
.
put
(
cacheKey
,
value
);
cacheMap
.
put
(
cacheKey
,
value
);
if
(
cacheKey
.
equals
(
Constants
.
CACHE_CodeRule
))
{
if
(
cacheKey
.
equals
(
Constants
.
CACHE_CodeRule
))
{
...
@@ -178,9 +180,10 @@ public class DataCache {
...
@@ -178,9 +180,10 @@ public class DataCache {
if
(
cacheKey
.
equals
(
Constants
.
CACHE_ExpiresDay
))
{
if
(
cacheKey
.
equals
(
Constants
.
CACHE_ExpiresDay
))
{
codeResolve
.
updateExpiresDay
((
Integer
)
value
);
codeResolve
.
updateExpiresDay
((
Integer
)
value
);
}
}
if
(
needLog
)
{
log
.
info
(
"updateCache ["
+
cacheKey
+
"]=["
+
value
+
"]"
);
log
.
info
(
"updateCache ["
+
cacheKey
+
"]=["
+
value
+
"]"
);
}
}
}
/**
/**
* 获取配置信息同时插入数据库,如果配置值为空,使用数据库配置的值
* 获取配置信息同时插入数据库,如果配置值为空,使用数据库配置的值
...
...
src/main/java/com/neotel/smfcore/core/shelf/bean/ShelfInfo.java
查看文件 @
308cbb2
...
@@ -8,6 +8,8 @@ import lombok.Data;
...
@@ -8,6 +8,8 @@ import lombok.Data;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
@Data
@Data
...
@@ -268,4 +270,31 @@ public class ShelfInfo {
...
@@ -268,4 +270,31 @@ public class ShelfInfo {
}
}
return
false
;
return
false
;
}
}
/**
* 返回剩余的空库位,包含锁定和未锁定的
* @return
*/
public
List
<
Integer
>
getEmptySlot
()
{
List
<
Integer
>
result
=
new
ArrayList
<>();
int
smallEmpty
=
0
;
int
bigEmpty
=
0
;
for
(
int
i
=
1
;
i
<=
maxLocCount
;
i
++)
{
ShelfLoc
shelfLoc
=
locMap
.
get
(
i
);
if
(
shelfLoc
!=
null
)
{
if
(!
shelfLoc
.
isEmpty
())
{
continue
;
}
}
if
(
i
<=
MAX_F_SMALL_NUM
)
{
smallEmpty
++;
}
else
{
bigEmpty
++;
}
}
result
.
add
(
smallEmpty
);
result
.
add
(
bigEmpty
);
return
result
;
}
}
}
src/main/java/com/neotel/smfcore/core/shelf/rest/TaskShelfController.java
查看文件 @
308cbb2
...
@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.shelf.rest;
...
@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.shelf.rest;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
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.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.barcode.utils.CodeResolve
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
...
@@ -22,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -22,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -59,7 +61,12 @@ public class TaskShelfController {
...
@@ -59,7 +61,12 @@ public class TaskShelfController {
//302=任务已完成
//302=任务已完成
//304=获取任务位置失败
//304=获取任务位置失败
Barcode
barcode
=
codeResolve
.
resolveOneValideBarcode
(
codeStr
);
Barcode
barcode
=
null
;
try
{
barcode
=
codeResolve
.
resolveOneValideBarcode
(
codeStr
);
}
catch
(
ValidateException
validateException
)
{
return
ResultBean
.
newErrorResult
(-
1
,
validateException
.
getMsgKey
(),
validateException
.
getDefaultMsg
(),
validateException
.
getMsgParam
());
}
if
(
barcode
==
null
)
{
if
(
barcode
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.error.barcode.invalid"
,
"未找到有效条码"
);
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.error.barcode.invalid"
,
"未找到有效条码"
);
}
}
...
@@ -104,16 +111,17 @@ public class TaskShelfController {
...
@@ -104,16 +111,17 @@ public class TaskShelfController {
resultMap
.
put
(
"rfid"
,
loc
.
getTempRfid
());
resultMap
.
put
(
"rfid"
,
loc
.
getTempRfid
());
resultMap
.
put
(
"usedRfidList"
,
String
.
join
(
","
,
usedRfidList
));
resultMap
.
put
(
"usedRfidList"
,
String
.
join
(
","
,
usedRfidList
));
resultMap
.
put
(
"rfidLoc"
,
loc
.
getLoc
());
resultMap
.
put
(
"rfidLoc"
,
loc
.
getLoc
());
resultMap
.
put
(
"orderNo"
,
ObjectUtil
.
isEmpty
(
opTask
.
getSourceName
())?
""
:
opTask
.
getSourceName
());
log
.
info
(
" getLocation barcode["
+
barcode
+
"],rfid["
+
rfid
+
"] 返回:realRfid="
+
loc
.
getRealRfid
()
+
",rfid="
+
loc
.
getTempRfid
()
+
",loc="
+
loc
.
getLoc
()
+
",usedRfidList="
+
String
.
join
(
","
,
usedRfidList
));
log
.
info
(
" getLocation barcode["
+
barcode
+
"],rfid["
+
rfid
+
"] 返回:realRfid="
+
loc
.
getRealRfid
()
+
",rfid="
+
loc
.
getTempRfid
()
+
",loc="
+
loc
.
getLoc
()
+
",usedRfidList="
+
String
.
join
(
","
,
usedRfidList
));
return
ResultBean
.
newOkResult
(
resultMap
);
return
ResultBean
.
newOkResult
(
resultMap
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"getLocation 出错 rfid="
+
rfid
+
"; ;codeStr="
+
codeStr
,
e
);
log
.
error
(
"getLocation 出错 rfid="
+
rfid
+
"; ;codeStr="
+
codeStr
,
e
);
return
ResultBean
.
newErrorResult
(
305
,
""
,
"出错:"
+
e
.
toString
());
}
}
//返回数据://Response:{"code":0,"msg":"ok","data":{"w":"7","realRfid":"","h":"8","rfid":"1-2F","usedRfidList":"F102","rfidLoc":"11","barcode":"985022*35030377*0822*3000*08220350"}}
//返回数据://Response:{"code":0,"msg":"ok","data":{"w":"7","realRfid":"","h":"8","rfid":"1-2F","usedRfidList":"F102","rfidLoc":"11","barcode":"985022*35030377*0822*3000*08220350"}}
return
ResultBean
.
newErrorResult
(-
1
,
""
,
""
);
}
}
private
DataLog
getTask
(
String
barcode
)
{
private
DataLog
getTask
(
String
barcode
)
{
...
@@ -153,7 +161,7 @@ public class TaskShelfController {
...
@@ -153,7 +161,7 @@ public class TaskShelfController {
String
barcode
=
request
.
getParameter
(
"barcode"
);
String
barcode
=
request
.
getParameter
(
"barcode"
);
DataLog
opTask
=
getTask
(
barcode
);
DataLog
opTask
=
getTask
(
barcode
);
log
.
info
(
" putShelfFinished barcode["
+
barcode
+
"],rfid["
+
rfid
+
"] rfidLoc["
+
rfidLoc
+
"]"
);
log
.
info
(
" putShelfFinished barcode["
+
barcode
+
"],rfid["
+
rfid
+
"] rfidLoc["
+
rfidLoc
+
"]"
);
if
(
opTask
==
null
)
{
if
(
opTask
==
null
)
{
log
.
info
(
" putShelfFinished barcode["
+
barcode
+
"],rfid["
+
rfid
+
"] 未找到出库任务,返回条码尺寸"
);
log
.
info
(
" putShelfFinished barcode["
+
barcode
+
"],rfid["
+
rfid
+
"] 未找到出库任务,返回条码尺寸"
);
return
ResultBean
.
newErrorResult
(
301
,
"smfcore.task.notExist"
,
"任务不存在"
);
return
ResultBean
.
newErrorResult
(
301
,
"smfcore.task.notExist"
,
"任务不存在"
);
...
@@ -177,7 +185,7 @@ public class TaskShelfController {
...
@@ -177,7 +185,7 @@ public class TaskShelfController {
int
bigEmpty
=
0
;
int
bigEmpty
=
0
;
boolean
result
=
TaskShelfUtil
.
putInShelf
(
opTask
,
rfid
,
rfidLoc
);
boolean
result
=
TaskShelfUtil
.
putInShelf
(
opTask
,
rfid
,
rfidLoc
);
if
(
result
)
{
if
(
result
)
{
//更改任务完成
//更改任务完成
opTask
.
setRealRfid
(
rfid
);
opTask
.
setRealRfid
(
rfid
);
opTask
.
setStatus
(
OP_STATUS
.
FINISHED
.
name
());
opTask
.
setStatus
(
OP_STATUS
.
FINISHED
.
name
());
...
@@ -190,16 +198,33 @@ public class TaskShelfController {
...
@@ -190,16 +198,33 @@ public class TaskShelfController {
ShelfInfo
shelfInfo
=
TaskShelfUtil
.
findSameShelf
(
orderNo
,
rfid
);
ShelfInfo
shelfInfo
=
TaskShelfUtil
.
findSameShelf
(
orderNo
,
rfid
);
if
(
shelfInfo
!=
null
)
{
if
(
shelfInfo
!=
null
)
{
Map
<
Integer
,
ShelfLoc
>
locMap
=
shelfInfo
.
getLocMap
();
for
(
ShelfLoc
shelfLoc
:
locMap
.
values
())
{
// if(shelfInfo.getOrderNo().equals(TaskShelfUtil.DEFAULT_ORDERNO)){
if
(
shelfLoc
.
isEmpty
())
{
// Map<Integer, ShelfLoc> locMap = shelfInfo.getLocMap();
if
(
shelfLoc
.
isSmallLoc
())
{
// for (ShelfLoc shelfLoc : locMap.values()) {
smallEmpty
=
smallEmpty
+
1
;
// if (shelfLoc.isEmpty()) {
}
else
if
(
shelfLoc
.
isBigLoc
())
{
// if (shelfLoc.isSmallLoc()) {
bigEmpty
=
bigEmpty
+
1
;
// smallEmpty = smallEmpty + 1;
}
// } else if (shelfLoc.isBigLoc()) {
}
// bigEmpty = bigEmpty + 1;
}
// }
// }
// }
// }else {
// Map<Integer, ShelfLoc> locMap = shelfInfo.getLocMap();
// for (ShelfLoc shelfLoc : locMap.values()) {
// if (shelfLoc.isEmpty()) {
// if (shelfLoc.isSmallLoc()) {
// smallEmpty = smallEmpty + 1;
// } else if (shelfLoc.isBigLoc()) {
// bigEmpty = bigEmpty + 1;
// }
// }
// }
// }
List
<
Integer
>
shelfEmpty
=
getEmptySlot
(
shelfInfo
);
smallEmpty
=
shelfEmpty
.
get
(
0
);
bigEmpty
=
shelfEmpty
.
get
(
1
);
}
else
{
}
else
{
smallEmpty
=
100
;
smallEmpty
=
100
;
...
@@ -222,19 +247,68 @@ public class TaskShelfController {
...
@@ -222,19 +247,68 @@ public class TaskShelfController {
// resultMap.put("smallTask", smallTask + "");
// resultMap.put("smallTask", smallTask + "");
// resultMap.put("bigTask", bigTask + "");
// resultMap.put("bigTask", bigTask + "");
if
(
result
)
{
if
(
result
)
{
ResultBean
.
newOkResult
(
resultMap
);
return
ResultBean
.
newOkResult
(
resultMap
);
}
else
{
}
else
{
log
.
info
(
" putShelfFinished barcode["
+
barcode
+
"],rfid["
+
rfid
+
"],loc["
+
rfidLoc
+
"] 放料到料架失败,未找到锁定位置"
);
log
.
info
(
" putShelfFinished barcode["
+
barcode
+
"],rfid["
+
rfid
+
"],loc["
+
rfidLoc
+
"] 放料到料架失败,未找到锁定位置"
);
return
ResultBean
.
newErrorResult
(
304
,
"smfcore.task.locNotFind"
,
"{0}放料到料架{0}的位置{0}失败,未找到锁定位置"
,
new
String
[]{
opTask
.
getBarcode
(),
rfid
,
rfidLoc
+
""
});
return
ResultBean
.
newErrorResult
(
304
,
"smfcore.task.locNotFind"
,
"{0}放料到料架{0}的位置{0}失败,未找到锁定位置"
,
new
String
[]{
opTask
.
getBarcode
(),
rfid
,
rfidLoc
+
""
});
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"putShelfFinished 出错 rfid="
+
rfid
+
";rfidLoc="
+
rfidLoc
+
";barcode="
+
barcode
,
e
);
log
.
error
(
"putShelfFinished 出错 rfid="
+
rfid
+
";rfidLoc="
+
rfidLoc
+
";barcode="
+
barcode
,
e
);
return
ResultBean
.
newErrorResult
(
305
,
""
,
"出错:"
+
e
.
toString
());
}
// return ResultBean.newErrorResult(-1, "", "");
}
private
List
<
Integer
>
getEmptySlot
(
ShelfInfo
shelfInfo
)
{
int
smallEmpty
=
0
;
int
bigEmpty
=
0
;
if
(
shelfInfo
!=
null
)
{
if
(
shelfInfo
.
getOrderNo
().
equals
(
TaskShelfUtil
.
DEFAULT_ORDERNO
))
{
List
<
DataLog
>
allTask
=
taskService
.
getAllTasks
();
for
(
DataLog
log
:
allTask
)
{
if
(
log
.
isFinished
()||
log
.
isEnd
()||
log
.
isCancel
()){
continue
;
}
if
(
shelfInfo
.
isSmallReel
(
log
)){
smallEmpty
++;
}
else
{
bigEmpty
++;
}
}
}
return
ResultBean
.
newErrorResult
(-
1
,
""
,
""
);
List
<
Integer
>
shelfEmpty
=
shelfInfo
.
getEmptySlot
();
if
(
smallEmpty
>
shelfEmpty
.
get
(
0
)){
smallEmpty
=
shelfEmpty
.
get
(
0
);
}
if
(
bigEmpty
>
shelfEmpty
.
get
(
1
)){
bigEmpty
=
shelfEmpty
.
get
(
0
);
}
}
}
else
{
Map
<
Integer
,
ShelfLoc
>
locMap
=
shelfInfo
.
getLocMap
();
for
(
ShelfLoc
shelfLoc
:
locMap
.
values
())
{
if
(
shelfLoc
.
isEmpty
())
{
if
(
shelfLoc
.
isSmallLoc
())
{
smallEmpty
=
smallEmpty
+
1
;
}
else
if
(
shelfLoc
.
isBigLoc
())
{
bigEmpty
=
bigEmpty
+
1
;
}
}
}
}
}
List
<
Integer
>
result
=
new
ArrayList
<>();
result
.
add
(
smallEmpty
);
result
.
add
(
bigEmpty
);
return
result
;
}
@ApiOperation
(
"获取料架空位置"
)
@ApiOperation
(
"获取料架空位置"
)
@PostMapping
(
value
=
"/getShelfEmptySlot"
)
@PostMapping
(
value
=
"/getShelfEmptySlot"
)
...
@@ -248,16 +322,18 @@ public class TaskShelfController {
...
@@ -248,16 +322,18 @@ public class TaskShelfController {
HashMap
<
String
,
Object
>
rfidMap
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
rfidMap
=
new
HashMap
<>();
if
(!
Strings
.
isBlank
(
rfids
))
{
if
(!
Strings
.
isBlank
(
rfids
))
{
for
(
String
rfid
:
rfids
.
split
(
","
))
{
for
(
String
rfid
:
rfids
.
split
(
TaskShelfUtil
.
ShelfSpilt
))
{
Integer
emptyPos
=
0
;
Integer
emptyPos
=
0
;
ShelfInfo
shelfInfo
=
TaskShelfUtil
.
findShelfByRealRfid
(
rfid
);
ShelfInfo
shelfInfo
=
TaskShelfUtil
.
findShelfByRealRfid
(
rfid
);
if
(
shelfInfo
!=
null
)
{
if
(
shelfInfo
!=
null
)
{
Map
<
Integer
,
ShelfLoc
>
locMap
=
shelfInfo
.
getLocMap
();
// Map<Integer, ShelfLoc> locMap = shelfInfo.getLocMap();
for
(
ShelfLoc
shelfLoc
:
locMap
.
values
())
{
// for (ShelfLoc shelfLoc : locMap.values()) {
if
(
shelfLoc
.
isEmpty
())
{
// if (shelfLoc.isEmpty()) {
emptyPos
++;
// emptyPos++;
}
// }
}
// }
List
<
Integer
>
shelfEmpty
=
getEmptySlot
(
shelfInfo
);
emptyPos
=
shelfEmpty
.
get
(
0
)+
shelfEmpty
.
get
(
1
);
}
else
{
}
else
{
//空料架
//空料架
emptyPos
=
100
;
emptyPos
=
100
;
...
@@ -272,13 +348,15 @@ public class TaskShelfController {
...
@@ -272,13 +348,15 @@ public class TaskShelfController {
shelfInfoMap
.
values
())
{
shelfInfoMap
.
values
())
{
for
(
ShelfInfo
shelf
:
for
(
ShelfInfo
shelf
:
map
.
values
())
{
map
.
values
())
{
Map
<
Integer
,
ShelfLoc
>
locMap
=
shelf
.
getLocMap
();
// Map<Integer, ShelfLoc> locMap = shelf.getLocMap();
int
emptyPos
=
0
;
// int emptyPos = 0;
for
(
ShelfLoc
shelfLoc
:
locMap
.
values
())
{
// for (ShelfLoc shelfLoc : locMap.values()) {
if
(
shelfLoc
.
isEmpty
())
{
// if (shelfLoc.isEmpty()) {
emptyPos
++;
// emptyPos++;
}
// }
}
// }
List
<
Integer
>
shelfEmpty
=
getEmptySlot
(
shelf
);
int
emptyPos
=
shelfEmpty
.
get
(
0
)+
shelfEmpty
.
get
(
1
);
if
(
ObjectUtil
.
isNotEmpty
(
shelf
.
getRealRfid
()))
{
if
(
ObjectUtil
.
isNotEmpty
(
shelf
.
getRealRfid
()))
{
rfidMap
.
put
(
shelf
.
getRealRfid
(),
emptyPos
);
rfidMap
.
put
(
shelf
.
getRealRfid
(),
emptyPos
);
}
else
{
}
else
{
...
@@ -290,9 +368,10 @@ public class TaskShelfController {
...
@@ -290,9 +368,10 @@ public class TaskShelfController {
return
ResultBean
.
newOkResult
(
rfidMap
);
return
ResultBean
.
newOkResult
(
rfidMap
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"getShelfEmptySlot 出错 rfids="
+
rfids
,
e
);
log
.
error
(
"getShelfEmptySlot 出错 rfids="
+
rfids
,
e
);
return
ResultBean
.
newErrorResult
(
305
,
""
,
"出错:"
+
e
.
toString
());
}
}
return
ResultBean
.
newErrorResult
(-
1
,
""
,
""
);
//
return ResultBean.newErrorResult(-1, "", "");
}
}
...
@@ -302,19 +381,24 @@ public class TaskShelfController {
...
@@ -302,19 +381,24 @@ public class TaskShelfController {
public
ResultBean
clearRfid
(
@RequestParam
String
orderNo
,
@RequestParam
String
rfid
)
{
public
ResultBean
clearRfid
(
@RequestParam
String
orderNo
,
@RequestParam
String
rfid
)
{
if
(
ObjectUtil
.
isNotEmpty
(
orderNo
))
{
if
(
ObjectUtil
.
isNotEmpty
(
orderNo
))
{
if
(
ObjectUtil
.
isNotEmpty
(
rfid
))
{
if
(
ObjectUtil
.
isNotEmpty
(
rfid
))
{
ShelfInfo
shelfInfo
=
TaskShelfUtil
.
findSameShelf
(
orderNo
,
rfid
);
ShelfInfo
shelfInfo
=
TaskShelfUtil
.
findSameShelf
(
orderNo
,
rfid
);
if
(
shelfInfo
==
null
)
{
if
(
shelfInfo
==
null
)
{
log
.
info
(
"clearRfid 未找到工单["
+
orderNo
+
"]的rfid["
+
rfid
+
"]"
);
log
.
info
(
"clearRfid 未找到工单["
+
orderNo
+
"]的rfid["
+
rfid
+
"]"
);
return
ResultBean
.
newErrorResult
(
99
,
"smfcore.taskShelf.notExist"
,
"未找到工单["
+
orderNo
+
"]的rfid["
+
rfid
+
"]"
);
return
ResultBean
.
newErrorResult
(
99
,
"smfcore.taskShelf.notExist"
,
"未找到工单["
+
orderNo
+
"]的rfid["
+
rfid
+
"]"
,
new
String
[]{
orderNo
,
rfid
});
}
boolean
result
=
TaskShelfUtil
.
clearShelf
(
orderNo
,
rfid
);
if
(
result
)
{
log
.
info
(
"clearRfid orderNo["
+
orderNo
+
"],rfid["
+
rfid
+
"] OK"
);
}
}
TaskShelfUtil
.
clearShelf
(
orderNo
,
rfid
);
}
else
{
}
else
{
TaskShelfUtil
.
clearShelf
(
orderNo
);
boolean
result
=
TaskShelfUtil
.
clearShelf
(
orderNo
);
if
(
result
)
{
log
.
info
(
"clearRfid orderNo["
+
orderNo
+
"] OK "
);
}
}
}
}
}
return
ResultBean
.
newOkResult
(
""
);
return
ResultBean
.
newOkResult
(
"
未找到可清除的料架
"
);
}
}
...
...
src/main/java/com/neotel/smfcore/core/shelf/util/TaskShelfUtil.java
查看文件 @
308cbb2
...
@@ -30,13 +30,18 @@ public class TaskShelfUtil {
...
@@ -30,13 +30,18 @@ public class TaskShelfUtil {
/**料架所在的产线位置
/**料架所在的产线位置
*key=rfid,value=位置
*key=rfid,value=位置
*/
*/
public
static
Map
<
String
,
String
>
shelfLocMap
=
null
;
public
static
Map
<
String
,
String
>
lineShelfLocMap
=
null
;
public
static
Map
<
String
,
ShelfInfo
>
lineShelfMap
=
null
;
private
static
String
HSERIAL_SHELF_MAP_KEY
=
"HSERIAL_SHELF_MAP_KEY"
;
private
static
String
HSERIAL_SHELF_MAP_KEY
=
"HSERIAL_SHELF_MAP_KEY"
;
private
static
String
SHELF_LOC_MAP_KEY
=
"SHELF_LOC_MAP_KEY"
;
private
static
String
LINE_SHELF_LOC_MAP_KEY
=
"LINE_SHELF_LOC_MAP_KEY"
;
private
static
String
LINE_SHELF_MAP_KEY
=
"LINE_SHELF_MAP_KEY"
;
public
static
String
DEFAULT_ORDERNO
=
"1"
;
p
rivate
static
String
DEFAULT_ORDERNO
=
"1
"
;
p
ublic
static
String
ShelfSpilt
=
",
"
;
public
static
void
initData
(){
public
static
void
initData
(){
initShelfMap
();
initShelfMap
();
...
@@ -45,16 +50,29 @@ public class TaskShelfUtil {
...
@@ -45,16 +50,29 @@ public class TaskShelfUtil {
private
static
void
initShelfLocMap
()
{
private
static
void
initShelfLocMap
()
{
if
(
shelfLocMap
==
null
)
{
if
(
lineShelfLocMap
==
null
)
{
shelfLocMap
=
dataCache
.
getCache
(
SHELF_LOC_MAP_KEY
);
lineShelfLocMap
=
dataCache
.
getCache
(
LINE_SHELF_LOC_MAP_KEY
);
if
(
shelfLocMap
==
null
){
if
(
lineShelfLocMap
==
null
){
shelfLocMap
=
new
ConcurrentHashMap
<>();
lineShelfLocMap
=
new
ConcurrentHashMap
<>();
}
}
}
}
}
private
static
void
saveShelfLocMap
(
Map
<
String
,
String
>
map
)
{
if
(
lineShelfMap
==
null
){
dataCache
.
updateCache
(
SHELF_LOC_MAP_KEY
,
map
);
lineShelfMap
=
dataCache
.
getCache
(
LINE_SHELF_MAP_KEY
);
if
(
lineShelfMap
==
null
){
lineShelfMap
=
new
ConcurrentHashMap
<>();
}
}
}
private
static
void
saveLineShelfMap
(
Map
<
String
,
ShelfInfo
>
map
)
{
dataCache
.
updateCache
(
LINE_SHELF_MAP_KEY
,
map
);
}
private
static
void
AddShelfToLineMap
(
ShelfInfo
shelfInfo
){
lineShelfMap
.
put
(
shelfInfo
.
getRealRfid
(),
shelfInfo
);
saveLineShelfMap
(
lineShelfMap
);
}
private
static
void
saveLineShelfLocMap
(
Map
<
String
,
String
>
map
)
{
dataCache
.
updateCache
(
LINE_SHELF_LOC_MAP_KEY
,
map
);
}
}
...
@@ -66,23 +84,27 @@ public class TaskShelfUtil {
...
@@ -66,23 +84,27 @@ public class TaskShelfUtil {
}
}
}
}
}
}
private
static
void
saveShelfMap
(
Map
<
String
,
Map
<
String
,
ShelfInfo
>>
map
)
{
private
static
void
saveShelfMap
(
Map
<
String
,
Map
<
String
,
ShelfInfo
>>
map
)
{
dataCache
.
updateCache
(
HSERIAL_SHELF_MAP_KEY
,
map
,
false
);
dataCache
.
updateCache
(
HSERIAL_SHELF_MAP_KEY
,
map
);
}
private
static
void
saveShelfMap
(
Map
<
String
,
Map
<
String
,
ShelfInfo
>>
map
,
boolean
needLog
)
{
dataCache
.
updateCache
(
HSERIAL_SHELF_MAP_KEY
,
map
,
needLog
);
}
}
/**
/**
* 清理使用过的料架
* 清理使用过的料架
*/
*/
public
static
void
clearShelf
(
String
orderNo
)
{
public
static
boolean
clearShelf
(
String
orderNo
)
{
if
(
orderNo
!=
null
)
{
if
(
orderNo
!=
null
)
{
Map
<
String
,
ShelfInfo
>
shelfMap
=
taskShelfMap
.
get
(
orderNo
);
Map
<
String
,
ShelfInfo
>
shelfMap
=
taskShelfMap
.
get
(
orderNo
);
if
(
shelfMap
!=
null
)
{
if
(
shelfMap
!=
null
)
{
log
.
info
(
"清理["
+
orderNo
+
"]使用过的料架"
);
log
.
info
(
"清理["
+
orderNo
+
"]使用过的料架
成功
"
);
taskShelfMap
.
remove
(
orderNo
);
taskShelfMap
.
remove
(
orderNo
);
saveShelfMap
(
taskShelfMap
);
saveShelfMap
(
taskShelfMap
,
true
);
return
true
;
}
}
}
}
return
false
;
}
}
public
static
boolean
clearShelf
(
String
orderNo
,
String
rfid
)
{
public
static
boolean
clearShelf
(
String
orderNo
,
String
rfid
)
{
...
@@ -96,8 +118,9 @@ public class TaskShelfUtil {
...
@@ -96,8 +118,9 @@ public class TaskShelfUtil {
String
tempRfid
=
shelfInfo
.
tempRfid
();
String
tempRfid
=
shelfInfo
.
tempRfid
();
shelfMap
.
remove
(
tempRfid
);
shelfMap
.
remove
(
tempRfid
);
taskShelfMap
.
put
(
orderNo
,
shelfMap
);
taskShelfMap
.
put
(
orderNo
,
shelfMap
);
log
.
info
(
"清理["
+
orderNo
+
"]使用的过料架["
+
rfid
+
"]成功"
);
clearResult
=
true
;
clearResult
=
true
;
saveShelfMap
(
taskShelfMap
);
saveShelfMap
(
taskShelfMap
,
true
);
}
}
}
}
}
}
...
@@ -260,7 +283,7 @@ public class TaskShelfUtil {
...
@@ -260,7 +283,7 @@ public class TaskShelfUtil {
addLoc
(
task
);
addLoc
(
task
);
}
}
ShelfInfo
shelfInfo
=
null
;
ShelfInfo
shelfInfo
=
null
;
List
<
String
>
rfidList
=
Lists
.
newArrayList
(
rfidStr
.
split
(
";"
));
List
<
String
>
rfidList
=
Lists
.
newArrayList
(
rfidStr
.
split
(
ShelfSpilt
));
ShelfLoc
lockLoc
=
null
;
ShelfLoc
lockLoc
=
null
;
if
(
orderNo
!=
null
)
{
if
(
orderNo
!=
null
)
{
Map
<
String
,
ShelfInfo
>
shelfMap
=
taskShelfMap
.
get
(
orderNo
);
Map
<
String
,
ShelfInfo
>
shelfMap
=
taskShelfMap
.
get
(
orderNo
);
...
@@ -457,8 +480,9 @@ public class TaskShelfUtil {
...
@@ -457,8 +480,9 @@ public class TaskShelfUtil {
public
static
void
updateShelfLoc
(
String
rfid
,
String
loc
){
public
static
void
updateShelfLoc
(
String
rfid
,
String
loc
){
shelfLocMap
.
put
(
rfid
,
loc
);
lineShelfLocMap
.
put
(
rfid
,
loc
);
saveShelfLocMap
(
shelfLocMap
);
saveLineShelfLocMap
(
lineShelfLocMap
);
}
}
...
...
src/main/resources/messages.properties
查看文件 @
308cbb2
...
@@ -350,6 +350,7 @@ smfcore.selfAudit.noPos=\u76D8\u70B9{0}\u672A\u627E\u5230\u5E93\u4F4D\u53F7
...
@@ -350,6 +350,7 @@ smfcore.selfAudit.noPos=\u76D8\u70B9{0}\u672A\u627E\u5230\u5E93\u4F4D\u53F7
smfcore.mesApi.inCheck.error
=
MES
\u
9A8C
\u
8BC1
\u
51FA
\u9519\u
FF1A{0}
smfcore.mesApi.inCheck.error
=
MES
\u
9A8C
\u
8BC1
\u
51FA
\u9519\u
FF1A{0}
smfcore.mesApi.loginCheck.fail
=
MES
\u
767B
\u9646\u
9A8C
\u
8BC1
\u5931\u
8D25
smfcore.mesApi.loginCheck.fail
=
MES
\u
767B
\u9646\u
9A8C
\u
8BC1
\u5931\u
8D25
smfcore.mesApi.loginCheck.error
=
MES
\u
767B
\u9646\u
9A8C
\u
8BC1
\u9519\u
8BEF
\u
FF1A{0}
smfcore.mesApi.loginCheck.error
=
MES
\u
767B
\u9646\u
9A8C
\u
8BC1
\u9519\u
8BEF
\u
FF1A{0}
smfcore.taskShelf.notExist
=
\u
672A
\u
627E
\u5230\u
5DE5
\u5355
[{0}]
\u7684
rfid[{1}]
#smfclient.nlp.onlyOneTray=\u4E0D\u53EF\u540C\u65F6\u653E\u5165\u591A\u76D8\u7269\u6599:{0}
#smfclient.nlp.onlyOneTray=\u4E0D\u53EF\u540C\u65F6\u653E\u5165\u591A\u76D8\u7269\u6599:{0}
#smfclient.nlp.cannotFindPos={0}\u672A\u627E\u5230\u5E93\u4F4D:{1}
#smfclient.nlp.cannotFindPos={0}\u672A\u627E\u5230\u5E93\u4F4D:{1}
#smfclient.nlp.inputOk={0}\u5165\u5E93\u5230{1}\u6210\u529F
#smfclient.nlp.inputOk={0}\u5165\u5E93\u5230{1}\u6210\u529F
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论