Commit 82f882ba sunke

1 扫码后增加请求超时提醒

2 页面有时会刷不出来料架的问题
3 库位有料常亮灯功能关闭,解决透明盘问题
4 工单出库时不使用红色灯
5 出仓时忽略已存在任务,其他任务继续执行
1 个父辈 3cfc2df1
......@@ -82,12 +82,14 @@ public class NLPShelfHandler extends BaseDeviceHandler {
for (DataLog queueTask : queueTasks) {
if (queueTask.isPutInTask() && (queueTask.isWait() || queueTask.isExecuting())) {
if (!Strings.isNullOrEmpty(groupId) && queueTask.getGroupId().equals(groupId)) {
log.info("codeIn [" + code + "][" + groupId + "]入库失败:条码[" + queueTask.getBarcode() + "]的任务还未结束 ");
return ResultBean.newErrorResult(-1,"smfcore.unfinished","the task of [{0}] is unfinished",new String[]{queueTask.getBarcode()});
log.info("codeIn [" + code + "][" + groupId + "]入库时取消条码[" + queueTask.getBarcode() + "]的未完成入库任务");
//return ResultBean.newErrorResult(-1,"smfcore.unfinished","the task of [{0}] is unfinished",new String[]{queueTask.getBarcode()});
taskService.cancelTask(queueTask.getId());
}
if (!Strings.isNullOrEmpty(storageId) && queueTask.getStorageId().equals(storageId)) {
log.info("codeIn [" + code + "][" + storageId + "]入库失败:料架[" + queueTask.getStorageId() + "]的任务还未结束 ");
return ResultBean.newErrorResult(-1,"smfcore.unfinished","the task of [{0}] is unfinished",new String[]{queueTask.getStorageName()});
log.info("codeIn [" + code + "][" + storageId + "]入库时取消料架[" + queueTask.getStorageId() + "]的未完成入库任务");
//return ResultBean.newErrorResult(-1,"smfcore.unfinished","the task of [{0}] is unfinished",new String[]{queueTask.getStorageName()});
taskService.cancelTask(queueTask.getId());
}
}
}
......@@ -317,7 +319,7 @@ public class NLPShelfHandler extends BaseDeviceHandler {
List<String> newList=new ArrayList<>();
for (String posName : hasReelPosList) {
if(disabledPosNameSet.contains(posName)){
log.info(cid + "sensorChange hasReelPosList [" + posName + "]库位被禁用,忽略");
//log.info(cid + "sensorChange hasReelPosList [" + posName + "]库位被禁用,忽略");
continue;
}else if(usedPosList.contains(posName)){
log.info(cid + "sensorChange hasReelPosList [" + posName + "]库位已有物料,加入到ok列表");
......@@ -513,8 +515,8 @@ public class NLPShelfHandler extends BaseDeviceHandler {
}
}
String hasReelPosColor = "orange";
//hasReelPosColor = ORDER_COLOR.DARKGREEN.name().toLowerCase();
String hasReelPosColor = "off";
hasReelPosColor = ORDER_COLOR.FORESTGREEN.name().toLowerCase();
// if(lightPosCidList.contains(cid)){
// hasReelPosColor = ORDER_COLOR.LIGHTBLUE.name();
// }
......
......@@ -56,7 +56,6 @@ import java.util.regex.Pattern;
@RestController
@RequiredArgsConstructor
@Api(tags = "BOX看板")
@RequestMapping("api/boxkanban")
public class BoxKanbanController {
@Autowired
......@@ -76,7 +75,7 @@ public class BoxKanbanController {
@ApiOperation("获取看板数据")
@GetMapping
@GetMapping("api/boxkanban")
@PreAuthorize("@el.check('boxkanban:info')")
public BoxKanbanDto info(HttpServletRequest servletRequest) {
......@@ -121,7 +120,7 @@ public class BoxKanbanController {
}
@ApiOperation("查询看板任务列表")
@GetMapping("/task")
@GetMapping("api/boxkanban/task")
@PreAuthorize("@el.check('boxkanban:list')")
public PageData<BoxTaskDto> info(BoxTaskQueryCriter criteria, Pageable pageable) {
if(criteria.getType()!=null &&criteria.getType().equals(0) ){
......@@ -246,7 +245,7 @@ public class BoxKanbanController {
}
@ApiOperation("料仓详情")
@GetMapping("/boxView")
@GetMapping("api/boxkanban/boxView")
@PreAuthorize("@el.check('boxkanban:boxView')")
public BoxStatusDto boxView(String id,HttpServletRequest servletRequest) {
List<DataLog> allTasks=taskService.getAllTasks();
......@@ -259,7 +258,7 @@ public class BoxKanbanController {
}
@ApiOperation("保存界面的一些操作")
@AnonymousPutMapping("/saveOp")
@AnonymousPutMapping("api/boxkanban/saveOp")
public ResultBean saveOp(@RequestBody Map<String,String> params) {
String cid = params.get("cid");
if(!Strings.isNullOrEmpty(cid)){
......@@ -273,7 +272,7 @@ public class BoxKanbanController {
}
@ApiOperation("获取料架库位报警列表")
@GetMapping("/shelfPosErrors")
@GetMapping("api/boxkanban/shelfPosErrors")
@PreAuthorize("@el.check('boxkanban:list')")
public List<ShelfPosErrorDto> shelfPosErrors(String storageId,String groupId) {
// String storageId=map.get("storageId");
......@@ -362,7 +361,7 @@ public class BoxKanbanController {
@ApiOperation("清除报警库位物料")
@PutMapping("/clearPos")
@PutMapping("api/boxkanban/clearPos")
@PreAuthorize("@el.check('storagePos:edit')")
public ResultBean clearPos(@RequestBody String posName) {
......
......@@ -70,7 +70,9 @@ public enum ORDER_COLOR {
public static ORDER_COLOR nextColor(Collection<String> excludeColors){
excludeColors.add(ORDER_COLOR.BLUE.getRgb());//手动出库
excludeColors.add(ORDER_COLOR.DARKGREEN.getRgb());//入库
excludeColors.add(ORDER_COLOR.FORESTGREEN.getRgb());//入库
excludeColors.add(ORDER_COLOR.FIREBRICK.getRgb());//异常红灯
excludeColors.add(ORDER_COLOR.INDIANRED.getRgb());//异常红灯
ORDER_COLOR[] allColors = values();
if (excludeColors.size() >= allColors.length){
return null;
......
......@@ -196,7 +196,7 @@ public class MaterialController {
if(criteria.getGroupId().equals("0")||criteria.getGroupId().equals("")){
criteria.setGroupId(null);
}else{
criteria.setStorageIdList(dataCache.getStorageIdsByGroupId(criteria.getGroupId(),false));
criteria.setStorageIdList(dataCache.getStorageIdsByGroupId(criteria.getGroupId(),false));
}
}
Query query = QueryHelp.getQuery(criteria);
......@@ -273,19 +273,21 @@ public class MaterialController {
}
for (String posId : posIds) {
StoragePos pos = storagePosManager.get(posId);
if (pos == null) {
throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"posId", posId});
}
Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage == null) {
throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"storageId", pos.getStorageId()});
}
log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】");
String outResult = taskService.checkout(storage, pos, true, SecurityUtils.getCurrentUsername());
if (!Strings.isNullOrEmpty(outResult)) {
throw new ValidateException("smfcore.error", outResult);
try{
StoragePos pos = storagePosManager.get(posId);
if (pos != null) {
Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage == null) {
log.error("storageId["+pos.getStorageId()+"]不存在,忽略posId="+posId+"的任务");
}else{
log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】");
taskService.checkout(storage, pos, true, SecurityUtils.getCurrentUsername());
}
}else{
log.error("posId["+posId+"]不存在,忽略posId="+posId+"的任务");
}
}catch (Exception e){
log.error("标签出库库位"+posId+"时出错"+e.getMessage());
}
}
} else {
......@@ -296,24 +298,23 @@ public class MaterialController {
List<StoragePos> posList = storagePosManager.findByQuery(query);
if (posList.size() <= 0) {
//未找到出库信息
throw new ValidateException("smfcore.label.noReel","未找到可出库的物料");
log.info("出库标签["+labelId+"]时未找到可出库的物料");
}
for (StoragePos pos : posList
) {
Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage == null) {
throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"storageId", pos.getStorageId()});
for (StoragePos pos : posList) {
try{
Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage == null) {
log.error("storageId["+pos.getStorageId()+"]不存在,忽略posId="+pos.getId()+"的任务");
}
log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】");
taskService.checkout(storage, pos, true, SecurityUtils.getCurrentUsername());
}catch (Exception e){
log.error("标签出库库位"+pos.getPosName()+"时出错"+e.getMessage());
}
log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】");
String outResult = taskService.checkout(storage, pos, true, SecurityUtils.getCurrentUsername());
if (!Strings.isNullOrEmpty(outResult)) {
throw new ValidateException("smfcore.error", outResult);
}
}
}
return ResultBean.newOkResult("ok");
}
......
......@@ -47,6 +47,7 @@ import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
/**
......@@ -135,13 +136,41 @@ public class HellaServiceHandler extends BaseSmfApiListener implements IoHandler
}
commandMap.put(command.getEventId(),command);
log.info("发送检查物料条码请求:" + command.toReqMsg());
ResultBean resultBean = HellaTcpClient.sendMsg(command.toReqMsg());
// ResultBean resultBean = testCheckOK(command);
resultBean.setMsg("Check Material result:"+resultBean.getMsg());
waitCheckMaterialResult(command);
return resultBean;
}
/**
* 等待指令请求返回超时
*/
public void waitCheckMaterialResult(HellaReqCommand reqCommand){
try{
long sleepTime = 10;
long waitTime = 0;
boolean timeOut = true;
while(waitTime < 1500){
waitTime = waitTime + sleepTime;
TimeUnit.MILLISECONDS.sleep(sleepTime);
HellaReqCommand command = commandMap.get(reqCommand.getEventId());
if(command == null){
timeOut = false;
break;
}
}
if(timeOut){
ResultBean ngResult = ResultBean.newErrorResult(408,"smfcore.checkMaterial.timeOut","checkMaterial timeout,event Id:{0}",new String[]{reqCommand.getEventId()} );
WebSocketServer.sendMsg(new SocketMsg(Lists.newArrayList(reqCommand.getLoginUser()),ngResult.getMsg(), MsgType.ERROR,ngResult.getMsgKey(),ngResult.getParams()));
}
}catch (Exception e){
log.error("waitCheckMaterialResult Error",e);
}
}
@Override
......
......@@ -2,15 +2,15 @@ server:
port: 8800
api:
name: Neotel
name: Hella
inCheckUrl:
outNotifyUrl:
inNotifyUrl:
#codeResolveUrl: hellaCodeResolve
codeResolveUrl: hellaCodeResolve
hella:
#host: 127.0.0.1
#port: 3333
host: 127.0.0.1
port: 3333
# 文件存储路径
file:
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!