Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 20f70078
由
zshaohui
编写于
2022-09-30 10:35:51 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1131 外仓功能提交
1 个父辈
6e7fda45
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
94 行增加
和
17 行删除
src/main/java/com/neotel/smfcore/core/device/enums/OP_STATUS.java
src/main/java/com/neotel/smfcore/core/system/service/po/DataLog.java
src/main/java/com/neotel/smfcore/custom/lizhen/bean/Station.java
src/main/java/com/neotel/smfcore/custom/lizhen/rest/AgvBoxDeviceClientController.java
src/main/java/com/neotel/smfcore/custom/lizhen/rest/TaskRestController.java
src/main/java/com/neotel/smfcore/custom/lizhen/rest/WarehouseController.java
src/main/java/com/neotel/smfcore/custom/lizhen/util/StationCacheUtil.java
src/main/java/com/neotel/smfcore/core/device/enums/OP_STATUS.java
查看文件 @
20f7007
...
...
@@ -47,6 +47,7 @@ public enum OP_STATUS {
IN_ON_LINE
,
IN_ON_AGV
,
OUT_ON_LINE
,
OUT_ON_AGV
OUT_ON_AGV
,
ERROR
;
}
src/main/java/com/neotel/smfcore/core/system/service/po/DataLog.java
查看文件 @
20f7007
...
...
@@ -302,9 +302,9 @@ public class DataLog extends BasePo implements Serializable {
*/
public
boolean
needRemoveFromCache
(){
if
(
isFinished
()
||
isCancel
()){
if
(
System
.
currentTimeMillis
()
-
super
.
getUpdateDate
().
getTime
()
>
5
*
60
*
1000
){
//
if(System.currentTimeMillis() - super.getUpdateDate().getTime() > 5 * 60 * 1000){
return
true
;
}
//
}
}
return
false
;
}
...
...
src/main/java/com/neotel/smfcore/custom/lizhen/bean/Station.java
查看文件 @
20f7007
package
com
.
neotel
.
smfcore
.
custom
.
lizhen
.
bean
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author sunke
* @date 2022/9/22 4:32 PM
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
Station
{
/**
...
...
@@ -19,10 +23,26 @@ public class Station {
*/
private
String
currentRfid
=
""
;
/**
* 物料当前扫描数量
*/
private
int
reelCurrentNum
=
0
;
/**
* 物料总数量
*/
private
int
reelNum
;
/**
* 料箱当前数量
*/
private
int
boxCurrentNum
=
0
;
/**
* 数量
*
料箱
数量
*/
private
int
n
um
;
private
int
boxN
um
;
/**
* 宽
...
...
@@ -38,4 +58,7 @@ public class Station {
* GR标签
*/
private
String
grLabel
;
private
String
lastScanBoxCode
=
""
;
}
src/main/java/com/neotel/smfcore/custom/lizhen/rest/AgvBoxDeviceClientController.java
查看文件 @
20f7007
package
com
.
neotel
.
smfcore
.
custom
.
lizhen
.
rest
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.utils.ReelLockPosUtil
;
import
com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
...
...
@@ -10,6 +11,7 @@ import com.neotel.smfcore.core.storage.enums.DeviceType;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.system.service.dao.IDataLogDao
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.custom.lizhen.bean.Station
;
...
...
@@ -48,6 +50,9 @@ public class AgvBoxDeviceClientController {
@Autowired
private
IStoragePosManager
storagePosManager
;
@Autowired
private
IDataLogDao
dataLogDao
;
/**
* 料箱锁定的目的地
*/
...
...
@@ -62,7 +67,7 @@ public class AgvBoxDeviceClientController {
@ResponseBody
@AnonymousAccess
public
ResultBean
stationInfo
(
HttpServletRequest
request
)
{
for
(
int
i
=
1
;
i
<
5
;
i
++)
{
for
(
int
i
=
1
;
i
<
=
5
;
i
++)
{
String
stationName
=
"s"
+
i
;
String
rfid
=
request
.
getParameter
(
stationName
);
StationCacheUtil
.
updateCurrentRfid
(
stationName
,
rfid
);
...
...
@@ -92,10 +97,10 @@ public class AgvBoxDeviceClientController {
* 根据料箱RFID获取工位信息
*/
private
String
getStationByRfid
(
String
rfid
)
{
String
prefixRfid
=
rfid
+
"-"
;
//
String prefixRfid = rfid + "-";
for
(
Station
station
:
StationCacheUtil
.
getAllStations
())
{
String
stationRfid
=
station
.
getCurrentRfid
();
if
(
stationRfid
.
startsWith
(
prefixR
fid
))
{
if
(
stationRfid
.
startsWith
(
r
fid
))
{
return
station
.
getName
();
}
}
...
...
@@ -149,7 +154,7 @@ public class AgvBoxDeviceClientController {
DataLog
opTask
=
null
;
Collection
<
DataLog
>
tasks
=
taskService
.
getAllTasks
();
for
(
DataLog
task
:
tasks
)
{
if
(!
task
.
isFinished
())
{
if
(!
task
.
isFinished
()
&&
!
task
.
isCancel
()
)
{
Storage
storage
=
dataCache
.
getStorageById
(
task
.
getStorageId
());
if
(
storage
.
isStorage
(
DeviceType
.
AGV_BOX
))
{
if
(
isSameBarcodeTask
(
rfid
,
task
))
{
...
...
@@ -238,7 +243,9 @@ public class AgvBoxDeviceClientController {
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
for
(
DataLog
task
:
allTasks
)
{
if
(
rfid
.
startsWith
(
task
.
getBarcode
()))
{
opTask
=
task
;
if
(!
task
.
isCancel
())
{
opTask
=
task
;
}
break
;
}
}
...
...
@@ -277,6 +284,8 @@ public class AgvBoxDeviceClientController {
if
(
OP_STATUS
.
OUT_ON_AGV
.
name
().
equals
(
statusStr
))
{
//从库位中取出,需要移到完成队列中,并且清理库存
outFromPos
(
opTask
);
//清理锁定库位
ReelLockPosUtil
.
removeReelLockPosInfo
(
rfid
);
}
taskService
.
updateFinishedTask
(
opTask
);
...
...
src/main/java/com/neotel/smfcore/custom/lizhen/rest/TaskRestController.java
查看文件 @
20f7007
...
...
@@ -4,10 +4,13 @@ import com.neotel.smfcore.common.bean.ResultBean;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.storage.service.manager.IStorageManager
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.system.service.manager.IDataLogManager
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -16,7 +19,8 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.Map
;
@RestController
public
class
TaskRestController
{
@Slf4j
public
class
TaskRestController
{
@Autowired
private
IDataLogManager
dataLogManager
;
...
...
@@ -25,12 +29,15 @@ public class TaskRestController{
private
DataCache
dataCache
;
@Autowired
private
IStorageManager
storageManager
;
private
TaskService
taskService
;
@Autowired
private
IStoragePosManager
storagePosManager
;
@RequestMapping
(
"/putIn"
)
@AnonymousAccess
public
ResultBean
putIn
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
public
ResultBean
putIn
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
barcode
=
paramMap
.
get
(
"barcode"
);
String
posName
=
paramMap
.
get
(
"posName"
);
String
cid
=
paramMap
.
get
(
"cid"
);
...
...
@@ -38,12 +45,36 @@ public class TaskRestController{
DataLog
dataLog
=
new
DataLog
();
dataLog
.
setStorageId
(
storage
.
getId
());
dataLog
.
setPosName
(
posName
);
dataLog
.
setPosId
(
storagePosManager
.
getByPosName
(
posName
).
getId
());
dataLog
.
setCid
(
cid
);
dataLog
.
setBarcode
(
barcode
);
dataLog
.
setPartNumber
(
barcode
);
dataLog
.
setType
(
1
);
dataLog
.
setStatus
(
OP_STATUS
.
WAIT
.
name
());
dataLogManager
.
save
(
dataLog
);
taskService
.
addTaskToExecute
(
dataLog
);
return
ResultBean
.
newOkResult
(
""
);
}
@RequestMapping
(
"/outIn"
)
@AnonymousAccess
public
ResultBean
outIn
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
barcode
=
paramMap
.
get
(
"barcode"
);
String
posName
=
paramMap
.
get
(
"posName"
);
String
cid
=
paramMap
.
get
(
"cid"
);
String
name
=
paramMap
.
get
(
"name"
);
Storage
storage
=
dataCache
.
getStorage
(
cid
);
DataLog
dataLog
=
new
DataLog
();
dataLog
.
setStorageId
(
storage
.
getId
());
dataLog
.
setPosName
(
posName
);
dataLog
.
setPosId
(
storagePosManager
.
getByPosName
(
posName
).
getId
());
dataLog
.
setCid
(
cid
);
dataLog
.
setBarcode
(
barcode
);
dataLog
.
setPartNumber
(
barcode
);
dataLog
.
setType
(
2
);
dataLog
.
setStatus
(
OP_STATUS
.
WAIT
.
name
());
dataLog
.
setLoc
(
name
);
log
.
info
(
"工位信息--"
+
name
);
taskService
.
addTaskToExecute
(
dataLog
);
return
ResultBean
.
newOkResult
(
""
);
}
...
...
src/main/java/com/neotel/smfcore/custom/lizhen/rest/WarehouseController.java
0 → 100644
查看文件 @
20f7007
此文件的差异被折叠,
点击展开。
src/main/java/com/neotel/smfcore/custom/lizhen/util/StationCacheUtil.java
查看文件 @
20f7007
package
com
.
neotel
.
smfcore
.
custom
.
lizhen
.
util
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.custom.lizhen.bean.Station
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -22,6 +23,13 @@ public class StationCacheUtil {
*/
private
static
Map
<
String
,
Station
>
stationMap
=
new
ConcurrentHashMap
<>();
public
static
void
saveReelToBoxCode
(
Station
station
)
{
int
reelCurrentNum
=
station
.
getReelCurrentNum
();
reelCurrentNum
++;
station
.
setReelCurrentNum
(
reelCurrentNum
);
StationCacheUtil
.
updateStation
(
station
);
}
@PostConstruct
public
void
init
()
{
log
.
info
(
"开始工位缓存信息"
);
...
...
@@ -31,13 +39,13 @@ public class StationCacheUtil {
if
(
station
==
null
){
station
=
new
Station
();
station
.
setName
(
stationName
);
stationMap
.
put
(
stationName
,
station
);
dataCache
.
updateCache
(
stationName
,
station
);
}
stationMap
.
put
(
stationName
,
station
);
dataCache
.
updateCache
(
stationName
,
station
);
}
}
p
rivate
static
synchronized
void
updateStation
(
Station
station
){
p
ublic
static
synchronized
void
updateStation
(
Station
station
){
stationMap
.
put
(
station
.
getName
(),
station
);
dataCache
.
updateCache
(
station
.
getName
(),
station
);
}
...
...
@@ -59,6 +67,11 @@ public class StationCacheUtil {
station
.
setCurrentRfid
(
rfid
);
updateStation
(
station
);
}
}
else
{
station
=
new
Station
();
station
.
setName
(
stationName
);
station
.
setCurrentRfid
(
rfid
);
updateStation
(
station
);
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论