Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 9bbcc26b
由
zshaohui
编写于
2024-03-14 13:01:48 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.科博达获取库位接口
2.mes亮灯颜色问题修复
1 个父辈
d87ef1da
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
342 行增加
和
1 行删除
src/main/java/com/neotel/smfcore/custom/keboda1335/KebodaController.java
src/main/java/com/neotel/smfcore/custom/smdbox/MesApiController.java
src/main/java/com/neotel/smfcore/custom/keboda1335/KebodaController.java
0 → 100644
查看文件 @
9bbcc26
package
com
.
neotel
.
smfcore
.
custom
.
keboda1335
;
import
com.google.common.base.Strings
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.neotel.smfcore.common.bean.ReelLockPosInfo
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.ReelLockPosUtil
;
import
com.neotel.smfcore.core.api.SmfApi
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.utils.CodeResolve
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.message.util.DeviceMessageUtil
;
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.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.system.service.dao.IAlarmInfoDao
;
import
com.neotel.smfcore.core.system.service.po.AlarmInfo
;
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
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
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.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
@RestController
@RequestMapping
(
"/keboda"
)
public
class
KebodaController
{
@Autowired
private
DataCache
dataCache
;
@Autowired
private
TaskService
taskService
;
@Autowired
private
IAlarmInfoDao
alarmInfoDao
;
@Autowired
private
SmfApi
smfApi
;
@Autowired
private
CodeResolve
codeResolve
;
@Autowired
private
IStoragePosManager
storagePosManager
;
/**
* 流水线提示消息
*/
private
static
String
lineMsg
=
""
;
/**
* 流水线入库查找空的料格
*/
@ApiOperation
(
"环行线扫码获取库位号"
)
@PostMapping
(
value
=
"/service/store/emptyPosForPutin"
)
@ResponseBody
@AnonymousAccess
public
Map
<
String
,
Object
>
emptyPosForPutin
(
HttpServletRequest
request
)
{
String
code
=
request
.
getParameter
(
"code"
);
String
cids
=
request
.
getParameter
(
"cids"
);
String
rfid
=
request
.
getParameter
(
"rfid"
);
String
rfidLoc
=
request
.
getParameter
(
"rfidLoc"
);
String
lastPosId
=
request
.
getParameter
(
"lastPosId"
);
lineMsg
=
""
;
log
.
info
(
"流水线["
+
cids
+
"]获取["
+
rfid
+
"]["
+
code
+
"]的入库库位"
);
Map
<
String
,
Object
>
resultMap
=
Maps
.
newHashMap
();
if
(
dataCache
.
getCache
(
Constants
.
CACHE_StopOut
))
{
lineMsg
=
"系统更新中,暂停出入库"
;
DeviceMessageUtil
.
updateLineMsg
(
lineMsg
,
code
,
cids
,
""
,
"smfcore.linemsg.update"
,
null
);
resultMap
.
put
(
"result"
,
"100"
);
resultMap
.
put
(
"msg"
,
lineMsg
);
return
resultMap
;
}
String
okMsg
=
""
;
String
errorMsg
=
""
;
List
<
String
>
needRemoveReelLockPosIdList
=
new
ArrayList
<>();
if
(
Strings
.
isNullOrEmpty
(
cids
))
{
resultMap
.
put
(
"result"
,
"101"
);
resultMap
.
put
(
"msg"
,
"未指定料仓 cids "
);
}
else
{
List
<
Storage
>
storageList
=
Lists
.
newArrayList
();
List
<
String
>
cidList
=
Lists
.
newArrayList
();
for
(
String
cid
:
cids
.
split
(
","
))
{
String
notIntoCids
=
dataCache
.
getSettings
().
getNotIntoCids
();
if
(
notIntoCids
!=
null
)
{
if
(
notIntoCids
.
contains
(
cid
))
{
log
.
info
(
"料仓["
+
cid
+
"]已被屏蔽入库"
);
continue
;
}
}
Storage
storage
=
dataCache
.
getStorage
(
cid
);
if
(
storage
!=
null
)
{
storageList
.
add
(
storage
);
cidList
.
add
(
cid
);
}
}
if
(
storageList
.
isEmpty
())
{
resultMap
.
put
(
"result"
,
"99"
);
errorMsg
=
"无可用的料仓"
;
resultMap
.
put
(
"msg"
,
errorMsg
);
}
else
{
try
{
CodeValidateParam
params
=
new
CodeValidateParam
(
""
,
""
,
""
,
code
,
""
);
params
.
setStorageList
(
storageList
);
Barcode
barcode
=
resolveBarcodeFromApi
(
params
);
if
(
barcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"未找到有效的条码"
);
}
for
(
DataLog
dataLog
:
taskService
.
getQueueTasks
())
{
// if(!dataLog.isPackageReel()){
//已经在任务当中,返回对应的信息
if
(
dataLog
.
getBarcode
().
equals
(
barcode
.
getBarcode
()))
{
if
(
dataLog
.
isPutInTask
())
{
//已有入库任务
errorMsg
=
"物料["
+
dataLog
.
getBarcode
()
+
"]已有入库任务,需继续执行入库动作"
;
resultMap
.
put
(
"pos"
,
dataLog
.
getPosName
());
resultMap
.
put
(
"barcode"
,
barcode
.
getBarcode
());
resultMap
.
put
(
"cid"
,
dataLog
.
getCid
());
return
resultMap
;
}
else
{
//已有出库任务
errorMsg
=
"物料["
+
dataLog
.
getBarcode
()
+
"]已有出库任务,需继续执行出库动作"
;
resultMap
.
put
(
"result"
,
"98"
);
resultMap
.
put
(
"msg"
,
errorMsg
);
resultMap
.
put
(
"posId"
,
dataLog
.
getPosName
());
resultMap
.
put
(
"plateW"
,
barcode
.
getPlateSize
());
resultMap
.
put
(
"plateH"
,
barcode
.
getHeight
());
resultMap
.
put
(
"singleOut"
,
dataLog
.
isSingleOut
()
+
""
);
//紧急料
resultMap
.
put
(
"urgentReel"
,
dataLog
.
isUrgentReel
()
+
""
);
//需要分盘,进入分盘料
resultMap
.
put
(
"cutReel"
,
dataLog
.
isCutReel
()
+
""
);
resultMap
.
put
(
"rfid"
,
""
);
resultMap
.
put
(
"realRfid"
,
""
);
resultMap
.
put
(
"rfidLoc"
,
""
);
// resultMap.put("rfid", dataLog.getTempRfid());
// resultMap.put("realRfid",dataLog.getAppendInfo().getRfid());
// resultMap.put("rfidLoc", dataLog.getAppendInfo().getRfidLoc() + "");
resultMap
.
put
(
"barcode"
,
dataLog
.
getBarcode
());
boolean
smallReel
=
barcode
.
isSmallReel
();
resultMap
.
put
(
"smallReel"
,
smallReel
+
""
);
return
resultMap
;
}
// }
}
}
StoragePos
pos
=
null
;
while
(
pos
==
null
){
pos
=
taskService
.
findEmptyPosForPutIn
(
storageList
,
barcode
,
rfid
,
lastPosId
);
if
(
pos
==
null
){
break
;
}
//如果是以S结尾的,则判断不带S的有没有料
String
posName
=
pos
.
getPosName
();
if
(
posName
.
endsWith
(
"S"
)
||
posName
.
endsWith
(
"s"
)){
log
.
info
(
posName
+
"以S结尾,需要判断外层有没有物料"
);
posName
=
posName
.
substring
(
0
,
posName
.
length
()-
1
);
StoragePos
storagePos
=
storagePosManager
.
getByPosName
(
posName
);
if
(
storagePos
!=
null
){
if
(
storagePos
.
getBarcode
()
!=
null
){
log
.
info
(
posName
+
"有物料信息,重新查找库位"
);
ReelLockPosInfo
reelLocInfo
=
new
ReelLockPosInfo
();
reelLocInfo
.
setBarcode
(
pos
.
getId
());
reelLocInfo
.
setCid
(
dataCache
.
getStorageById
(
pos
.
getStorageId
()).
getCid
());
reelLocInfo
.
setLockPosName
(
pos
.
getPosName
());
reelLocInfo
.
setLockPosId
(
pos
.
getId
());
ReelLockPosUtil
.
addReelLockPosInfo
(
reelLocInfo
,
cidList
);
needRemoveReelLockPosIdList
.
add
(
pos
.
getId
());
pos
=
null
;
}
}
}
}
if
(
pos
!=
null
)
{
// Storage storage = dataCache.getStorageById(pos.getStorageId());
// if(!storage.isPackage()){
// //不是包装仓,如果所在料仓有出库任务,暂停入库
// Collection<DataLog> tasks = taskService.getQueueTasks();
// for (DataLog task : tasks) {
// if(task.isCheckOutTask() && task.getStorageId().equals(pos.getStorageId())){
// errorMsg = "库位["+ pos.getPosName() + "]所在料仓有出库任务,暂停入库";
// lineMsg = errorMsg;
// resultMap.put("result","99");
// resultMap.put("msg",errorMsg);
// return resultMap;
// }
// }
// }
Storage
theStorage
=
dataCache
.
getStorageById
(
pos
.
getStorageId
());
resultMap
.
put
(
"result"
,
"0"
);
resultMap
.
put
(
"msg"
,
""
);
okMsg
=
"["
+
rfid
+
"]["
+
barcode
.
getBarcode
()
+
"]锁定库位["
+
pos
.
getPosName
()
+
"]优先级["
+
pos
.
getPriority
()
+
"] 上个库位号["
+
lastPosId
+
"]"
;
ReelLockPosInfo
oldLockInfo
=
ReelLockPosUtil
.
getLockPosInfoByCode
(
barcode
.
getBarcode
());
if
(
oldLockInfo
!=
null
)
{
if
(!
oldLockInfo
.
getBarcode
().
equals
(
barcode
.
getBarcode
()))
{
String
result
=
"-1"
;
okMsg
=
rfid
+
"["
+
rfidLoc
+
"]["
+
barcode
.
getBarcode
()
+
"]锁定库位["
+
pos
.
getPosName
()
+
"],清理旧有锁定信息"
;
resultMap
.
put
(
"result"
,
result
);
resultMap
.
put
(
"msg"
,
okMsg
);
//已经锁定过库位,但不是同一个条码,需要把对应位置的锁定信息清理掉
ReelLockPosUtil
.
removeReelLockPosInfo
(
oldLockInfo
.
getBarcode
());
log
.
info
(
"清理锁定库位:库位号["
+
oldLockInfo
.
getLockPosName
()
+
"]上物料["
+
oldLockInfo
.
getBarcode
()
+
"]锁定的库位"
);
}
}
log
.
info
(
okMsg
+
oldLockInfo
);
ReelLockPosInfo
reelLocInfo
=
new
ReelLockPosInfo
();
reelLocInfo
.
setBarcode
(
barcode
.
getBarcode
());
reelLocInfo
.
setCid
(
theStorage
.
getCid
());
reelLocInfo
.
setLockPosName
(
pos
.
getPosName
());
reelLocInfo
.
setLockPosId
(
pos
.
getId
());
reelLocInfo
=
ReelLockPosUtil
.
addReelLockPosInfo
(
reelLocInfo
,
cidList
);
if
(
reelLocInfo
==
null
)
{
errorMsg
=
"["
+
barcode
.
getBarcode
()
+
"]库位["
+
reelLocInfo
.
getLockPosName
()
+
"]已被锁定,暂停入库"
;
lineMsg
=
errorMsg
;
DeviceMessageUtil
.
updateLineMsg
(
lineMsg
,
code
,
cids
,
reelLocInfo
.
getLockPosName
(),
"smfcore.linemsg.posLock"
,
new
String
[]{
barcode
.
getBarcode
(),
reelLocInfo
.
getLockPosName
()});
resultMap
.
put
(
"result"
,
"99"
);
resultMap
.
put
(
"msg"
,
errorMsg
);
return
resultMap
;
}
else
{
resultMap
.
put
(
"pos"
,
pos
.
getPosName
());
resultMap
.
put
(
"barcode"
,
barcode
.
getBarcode
());
resultMap
.
put
(
"cid"
,
theStorage
.
getCid
());
}
}
else
{
resultMap
.
put
(
"result"
,
"104"
);
errorMsg
=
"["
+
barcode
.
getBarcode
()
+
"]未找到可用的["
+
barcode
.
getPlateSize
()
+
"x"
+
barcode
.
getHeight
()
+
"]仓位"
;
resultMap
.
put
(
"msg"
,
errorMsg
);
}
}
catch
(
ValidateException
ve
)
{
errorMsg
=
ve
.
getMessage
();
log
.
info
(
"查找空库位失败:"
+
errorMsg
);
resultMap
.
put
(
"result"
,
"105"
);
resultMap
.
put
(
"msg"
,
MessageUtils
.
getText
(
ve
.
getMsgKey
(),
ve
.
getMsgParam
(),
request
.
getLocale
(),
ve
.
getDefaultMsg
()));
}
catch
(
Exception
e
)
{
errorMsg
=
e
.
getMessage
();
log
.
info
(
"查找空库位失败,"
,
e
);
resultMap
.
put
(
"result"
,
"105"
);
resultMap
.
put
(
"msg"
,
errorMsg
);
}
}
}
//没入成功
if
(!
errorMsg
.
isEmpty
())
{
//有错误,记录日志
AlarmInfo
alarmInfo
=
new
AlarmInfo
();
alarmInfo
.
setBoxId
(
"0"
);
alarmInfo
.
setStorageName
(
"流水线"
);
alarmInfo
.
setInOutStatus
(
"1"
);
alarmInfo
.
setAlarmType
(
"入库"
);
Date
date
=
new
Date
();
alarmInfo
.
setStartTime
(
date
);
alarmInfo
.
setEndTime
(
date
);
String
msg
=
"["
+
code
+
"]"
+
errorMsg
;
alarmInfo
.
setAlarmMsg
(
msg
);
alarmInfoDao
.
save
(
alarmInfo
);
lineMsg
=
errorMsg
;
DeviceMessageUtil
.
updateLineMsg
(
lineMsg
,
code
,
cids
,
""
,
""
,
null
);
}
else
{
lineMsg
=
okMsg
;
DeviceMessageUtil
.
lastLineMsg
=
null
;
}
if
(
needRemoveReelLockPosIdList
!=
null
&&
!
needRemoveReelLockPosIdList
.
isEmpty
())
{
for
(
String
posId
:
needRemoveReelLockPosIdList
)
{
ReelLockPosUtil
.
removeReelLockPosInfo
(
posId
);
}
}
return
resultMap
;
}
public
Barcode
resolveBarcodeFromApi
(
CodeValidateParam
params
)
{
Barcode
barcodeSave
=
smfApi
.
canPutInBeforeResolve
(
params
);
if
(
barcodeSave
==
null
)
{
barcodeSave
=
codeResolve
.
resolveOneValideBarcode
(
params
.
getCode
());
}
//从API验证
Barcode
barcodeFromApi
=
smfApi
.
canPutInAfterResolve
(
params
,
barcodeSave
);
if
(
barcodeFromApi
!=
null
)
{
barcodeSave
=
barcodeFromApi
;
}
return
barcodeSave
;
}
}
src/main/java/com/neotel/smfcore/custom/smdbox/MesApiController.java
查看文件 @
9bbcc26
...
@@ -250,8 +250,12 @@ public class MesApiController {
...
@@ -250,8 +250,12 @@ public class MesApiController {
return
"Error: RI 为必须项"
;
return
"Error: RI 为必须项"
;
}
}
//rgbCode为空时,默认是蓝色
if
(
StringUtils
.
isBlank
(
rgbCode
)){
rgbCode
=
"0000FF"
;
}
//判断亮灯颜色是否在这20种内
//判断亮灯颜色是否在这20种内
if
(
StringUtils
.
isBlank
(
colorMap
.
get
(
rgbCode
))
||
StringUtils
.
isBlank
(
rgbCode
))
{
if
(
StringUtils
.
isBlank
(
rgbCode
)
||
StringUtils
.
isBlank
(
colorMap
.
get
(
rgbCode
)))
{
return
"Error :rgbCode不在指定范围内"
;
return
"Error :rgbCode不在指定范围内"
;
//return "Error: rgbCode 不在颜色范围内";
//return "Error: rgbCode 不在颜色范围内";
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论