Commit 5106b78e sunke

料架分配逻辑

1 个父辈 8f158bb5
...@@ -227,13 +227,15 @@ public class InquiryShelfBean { ...@@ -227,13 +227,15 @@ public class InquiryShelfBean {
for (ShelfInfo shelf : shelfInfoMap.values()) { for (ShelfInfo shelf : shelfInfoMap.values()) {
String shelfRFID = shelf.getRealRfid(); String shelfRFID = shelf.getRealRfid();
if(StorageConstants.SHEFL_TYPE.judgeType(bigRfid, shelf.getShelfType())){ if(StorageConstants.SHEFL_TYPE.judgeType(bigRfid, shelf.getShelfType())){
if(shelfRFID != null){ if(shelfRFID.equals(bigRfid)){
if(shelfRFID.equals(bigRfid)){ //已经绑定过该Temp料架
//已经绑定过该Temp料架 return shelf;
return shelf;
}
}else{ }else{
//未绑定过的 if(shelf.isFull()){
//已经放满,查找下一个
continue;
}
if(minIndexShelf == null){ if(minIndexShelf == null){
minIndexShelf = shelf; minIndexShelf = shelf;
}else if(shelf.getRfidIndex() < minIndexShelf.getRfidIndex()){ }else if(shelf.getRfidIndex() < minIndexShelf.getRfidIndex()){
...@@ -261,11 +263,9 @@ public class InquiryShelfBean { ...@@ -261,11 +263,9 @@ public class InquiryShelfBean {
} }
for (ShelfInfo shelf : shSerialShelfInfoMap.values()) { for (ShelfInfo shelf : shSerialShelfInfoMap.values()) {
String shelfRFID = shelf.getRealRfid(); String shelfRFID = shelf.getRealRfid();
if(shelfRFID != null){ if(shelfRFID.equals(packageRfid)){
if(shelfRFID.equals(packageRfid)){ //已经绑定过该Temp料架
//已经绑定过该Temp料架 return shelf;
return shelf;
}
} }
} }
return null; return null;
...@@ -301,17 +301,21 @@ public class InquiryShelfBean { ...@@ -301,17 +301,21 @@ public class InquiryShelfBean {
ShelfInfo minIndexShelf = null; ShelfInfo minIndexShelf = null;
for (ShelfInfo shelf : shelfMap.values()) { for (ShelfInfo shelf : shelfMap.values()) {
if(StorageConstants.SHEFL_TYPE.judgeType(shelfType, shelf.getShelfType())){ if(StorageConstants.SHEFL_TYPE.judgeType(shelfType, shelf.getShelfType())){
if(shelf.isFull()){
//已经放满,查找下一个
continue;
}
//同一种料架 //同一种料架
if(minIndexShelf == null){ if(minIndexShelf == null){
minIndexShelf = shelf; minIndexShelf = shelf;
} }
if(shelf.getRfidIndex() > minIndexShelf.getRfidIndex()){ if(shelf.getRfidIndex() < minIndexShelf.getRfidIndex()){
minIndexShelf = shelf; minIndexShelf = shelf;
} }
} }
} }
if(minIndexShelf != null){ if(minIndexShelf != null){
log.info("找到类型为["+shelfType+"]最小序号同种料架["+minIndexShelf.tempRfid()+"]"); log.info("找到类型为["+shelfType+"]最小序号未绑定同种料架["+minIndexShelf.tempRfid()+"]");
}else{ }else{
log.info("已没有与["+shelfType+"]类型相同的料架");; log.info("已没有与["+shelfType+"]类型相同的料架");;
} }
...@@ -346,15 +350,20 @@ public class InquiryShelfBean { ...@@ -346,15 +350,20 @@ public class InquiryShelfBean {
//未找到已经有实际RFID的料架,查找库位最多的料架 //未找到已经有实际RFID的料架,查找库位最多的料架
if(shelfInfo == null){ if(shelfInfo == null){
log.info(task.getBarcode() + "未找到实际绑定的["+rfid+"]料架,开始查找序号最小同种料架["+task.getAppendInfo().getShelfType()+"]"); log.info(task.getBarcode() + "未找到实际绑定的["+rfid+"]料架,开始查找序号最小且未绑定过的同种料架["+task.getAppendInfo().getShelfType()+"]");
ShelfInfo minIndexShelf = null; ShelfInfo minIndexShelf = null;
for (ShelfInfo shelf : shelfMap.values()) { for (ShelfInfo shelf : shelfMap.values()) {
if(StorageConstants.SHEFL_TYPE.judgeType(task.getAppendInfo().getShelfType(), shelf.getShelfType())){ if(StorageConstants.SHEFL_TYPE.judgeType(task.getAppendInfo().getShelfType(), shelf.getShelfType())){
if(shelf.isFull()){
//已经放满,查找下一个
continue;
}
//同一种料架 //同一种料架
if(minIndexShelf == null){ if(minIndexShelf == null){
minIndexShelf = shelf; minIndexShelf = shelf;
} }
if(shelf.getRfidIndex() > minIndexShelf.getRfidIndex()){ if(shelf.getRfidIndex() < minIndexShelf.getRfidIndex()){
minIndexShelf = shelf; minIndexShelf = shelf;
} }
} }
......
...@@ -167,7 +167,7 @@ public class QisdaApiController extends BaseController { ...@@ -167,7 +167,7 @@ public class QisdaApiController extends BaseController {
Map<String, String> bodyParamMap = getParamMapFromBody(request); Map<String, String> bodyParamMap = getParamMapFromBody(request);
paramInfo = bodyParamMap.get("paramInfo"); paramInfo = bodyParamMap.get("paramInfo");
} }
log.info("收到出库请求:"+paramInfo); log.info("收到需求单请求:"+paramInfo);
if(paramInfo == null){ if(paramInfo == null){
return ResultBean.newErrorResult(-1,"参数为空"); return ResultBean.newErrorResult(-1,"参数为空");
} }
...@@ -176,7 +176,7 @@ public class QisdaApiController extends BaseController { ...@@ -176,7 +176,7 @@ public class QisdaApiController extends BaseController {
//key为需求单号 //key为需求单号
Map<String, OutInfo> outInfoMap = new HashMap<>(); Map<String, OutInfo> outInfoMap = new HashMap<>();
log.info("出库请求解析成功,开始处理"); log.info("需求单请求解析成功,开始处理");
for (RequestOutItemBean itemBean : items) { for (RequestOutItemBean itemBean : items) {
OutItem outItem = new OutItem(itemBean); OutItem outItem = new OutItem(itemBean);
String hSerial = outItem.gethSerial(); String hSerial = outItem.gethSerial();
...@@ -196,9 +196,9 @@ public class QisdaApiController extends BaseController { ...@@ -196,9 +196,9 @@ public class QisdaApiController extends BaseController {
bindOutInfoList(outInfoMap.values()); bindOutInfoList(outInfoMap.values());
log.info("出库请求处理完成"); log.info("需求单请求处理完成");
} catch (Exception e) { } catch (Exception e) {
log.error("出库请求处理出错", e); log.error("需求单请求处理出错", e);
return ResultBean.newErrorResult(1001,"内部错误:" + e.getMessage()); return ResultBean.newErrorResult(1001,"内部错误:" + e.getMessage());
} }
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
......
...@@ -200,7 +200,7 @@ public class QisdaDeviceController extends BaseController { ...@@ -200,7 +200,7 @@ public class QisdaDeviceController extends BaseController {
//包装料RFID //包装料RFID
String packageRfid = request.getParameter("packageRfid"); String packageRfid = request.getParameter("packageRfid");
String hSerial = outInfoCache.getCurrentOrderHSerial(); String hSerial = outInfoCache.getCurrentOrderHSerial();
log.info("收到包装料摆放位置信息请求:[packageRfid=" + packageRfid + "]bigRfid=" + bigRfid + "当前工单料需求:["+hSerial+"]"); log.info("收到机器人[3]获取包装料摆放位置信息请求:[packageRfid=" + packageRfid + "]bigRfid=" + bigRfid + "当前工单料需求:["+hSerial+"]");
ShelfInfo packageShelf = inquiryShelfBean.findPackageShelf(hSerial, packageRfid); ShelfInfo packageShelf = inquiryShelfBean.findPackageShelf(hSerial, packageRfid);
ShelfInfo bigShelf = inquiryShelfBean.findSameShelf(hSerial,bigRfid); ShelfInfo bigShelf = inquiryShelfBean.findSameShelf(hSerial,bigRfid);
...@@ -238,7 +238,7 @@ public class QisdaDeviceController extends BaseController { ...@@ -238,7 +238,7 @@ public class QisdaDeviceController extends BaseController {
String packageLoc = ""; String packageLoc = "";
int reelInPackage = 0; int reelInPackage = 0;
if(packageShelf == null){ if(packageShelf == null){
log.info("未找到包装料架["+packageRfid+"]的信息"); log.info("机器人[3]获取包装料摆放位置信息,未找到包装料架["+packageRfid+"]的信息");
}else{ }else{
//查找包装料架上的物料 //查找包装料架上的物料
Map<Integer, ShelfLoc> packageLocMap = packageShelf.getLocMap(); Map<Integer, ShelfLoc> packageLocMap = packageShelf.getLocMap();
...@@ -258,7 +258,7 @@ public class QisdaDeviceController extends BaseController { ...@@ -258,7 +258,7 @@ public class QisdaDeviceController extends BaseController {
//包装料架上有料,且大料架有空位,从大料架上查找空位 //包装料架上有料,且大料架有空位,从大料架上查找空位
DataLog task = taskService.getFinishedTask(barcode); DataLog task = taskService.getFinishedTask(barcode);
if(task == null){ if(task == null){
String msg = "未找到待包装料架上条码["+barcode+"]的任务"; String msg = "机器人[3]获取包装料摆放位置信息,未找到待包装料架上条码["+barcode+"]的任务";
log.error(msg); log.error(msg);
return ResultBean.newErrorResult(103, msg); return ResultBean.newErrorResult(103, msg);
} }
...@@ -312,7 +312,7 @@ public class QisdaDeviceController extends BaseController { ...@@ -312,7 +312,7 @@ public class QisdaDeviceController extends BaseController {
resultMap.put("realBigRfid",bigShelf.getRealRfid()); resultMap.put("realBigRfid",bigShelf.getRealRfid());
resultMap.put("bigLoc", bigLoc); resultMap.put("bigLoc", bigLoc);
log.info("大料架信息返回:"+resultMap); log.info("机器人[3]获取包装料摆放位置信息返回:"+resultMap);
return ResultBean.newOkResult(resultMap); return ResultBean.newOkResult(resultMap);
}else{ }else{
return ResultBean.newErrorResult(-2, "未找到大料架["+bigRfid+"]"); return ResultBean.newErrorResult(-2, "未找到大料架["+bigRfid+"]");
...@@ -335,7 +335,7 @@ public class QisdaDeviceController extends BaseController { ...@@ -335,7 +335,7 @@ public class QisdaDeviceController extends BaseController {
try{ try{
String robotIndex = request.getParameter("robotIndex"); String robotIndex = request.getParameter("robotIndex");
String rfid = request.getParameter("rfid"); String rfid = request.getParameter("rfid");
log.info("机器人["+robotIndex+"]获取摆放位置信息请求:rfid=" + rfid); log.info("收到机器人["+robotIndex+"]获取摆放位置信息请求:rfid=" + rfid);
if(robotIndex == null){ if(robotIndex == null){
return ResultBean.newErrorResult(-2, "参数错误:无robotIndex参数"); return ResultBean.newErrorResult(-2, "参数错误:无robotIndex参数");
} }
...@@ -552,17 +552,19 @@ public class QisdaDeviceController extends BaseController { ...@@ -552,17 +552,19 @@ public class QisdaDeviceController extends BaseController {
String packageLoc = request.getParameter("packageLoc"); String packageLoc = request.getParameter("packageLoc");
String bigLoc = request.getParameter("bigLoc"); String bigLoc = request.getParameter("bigLoc");
String barcode = request.getParameter("barcode"); String barcode = request.getParameter("barcode");
log.info("收到包装线机器人放置料盘["+barcode+"]完成请求"+packageRfid+"["+packageLoc+"]=>"+bigRfid+"["+bigLoc+"]"); String msg = "机器人[3]将包装料盘["+barcode+"]从"+packageRfid+"["+packageLoc+"]放入料架=>"+bigRfid+"["+bigLoc+"]";
log.info(msg);
if(Strings.isNotBlank(barcode)) { if(Strings.isNotBlank(barcode)) {
DataLog cacheTask = taskService.getFinishedTask(barcode); DataLog cacheTask = taskService.getFinishedTask(barcode);
if (cacheTask == null) { if (cacheTask == null) {
return ResultBean.newErrorResult(501,"料盘[" + barcode + "]的任务不存在"); return ResultBean.newErrorResult(501,msg+"失败, 料盘[" + barcode + "]的任务不存在");
} else { } else {
boolean putInResult = reelPutInFinished(cacheTask,bigRfid, bigLoc); boolean putInResult = reelPutInFinished(cacheTask,bigRfid, bigLoc);
if(putInResult){ if(putInResult){
//清理包装料架的位置 //清理包装料架的位置
ShelfInfo packageShelf = inquiryShelfBean.findPackageShelf(cacheTask.getAppendInfo().gethSerial(), packageRfid); ShelfInfo packageShelf = inquiryShelfBean.findPackageShelf(cacheTask.getAppendInfo().gethSerial(), packageRfid);
if(packageShelf != null){ if(packageShelf != null){
log.info(msg + "成功,清空包装料架信息");
Map<Integer, ShelfLoc> packageLocMap = packageShelf.getLocMap(); Map<Integer, ShelfLoc> packageLocMap = packageShelf.getLocMap();
for (ShelfLoc shelfLoc : packageLocMap.values()) { for (ShelfLoc shelfLoc : packageLocMap.values()) {
if(shelfLoc.isInThisLoc(barcode)){ if(shelfLoc.isInThisLoc(barcode)){
...@@ -574,14 +576,14 @@ public class QisdaDeviceController extends BaseController { ...@@ -574,14 +576,14 @@ public class QisdaDeviceController extends BaseController {
} }
} }
}else{ }else{
return ResultBean.newErrorResult(502,"包装料盘[" + barcode + "]放入完成时,未找到包装料架["+packageRfid+"]的缓存信息"); return ResultBean.newErrorResult(502,msg + "失败,未找到包装料架["+packageRfid+"]的缓存信息");
} }
} }
} }
} }
String msg = "包装线机器人放置料盘["+barcode+"]从"+packageRfid+"["+packageLoc+"]=>"+bigRfid+"["+bigLoc+"]失败"; String errorMsg = "包装线机器人放置料盘["+barcode+"]从"+packageRfid+"["+packageLoc+"]=>"+bigRfid+"["+bigLoc+"]失败";
return ResultBean.newErrorResult(501,msg); return ResultBean.newErrorResult(501,errorMsg);
} }
/** /**
......
...@@ -956,6 +956,10 @@ public class TaskService implements ITaskService { ...@@ -956,6 +956,10 @@ public class TaskService implements ITaskService {
} }
} }
} }
if(storageTask != null){
log.info("出库首盘料任务[包装料]"+storageTask.getBarcode()+"["+storageTask.getPosName()+"]" + storageTask.getAppendInfo());
}
return storageTask;
}else{ }else{
//首套料需要先出D料架,再出C料架,并且要按料架顺序 //首套料需要先出D料架,再出C料架,并且要按料架顺序
//架位顺序随机,保证左右机器人均衡 //架位顺序随机,保证左右机器人均衡
...@@ -1023,7 +1027,10 @@ public class TaskService implements ITaskService { ...@@ -1023,7 +1027,10 @@ public class TaskService implements ITaskService {
if(waitTask.isExecuting() && waitTask.isCheckOutTask()){ if(waitTask.isExecuting() && waitTask.isCheckOutTask()){
//待执行队列中正在执行的出库任务 //待执行队列中正在执行的出库任务
if(appendInfo.isDShelfTask() || appendInfo.isCShelfTask()){ if(appendInfo.isDShelfTask() || appendInfo.isCShelfTask()){
shelfNameList.add(appendInfo.getTempRfid()); String shelName = appendInfo.getTempRfid();
if(!shelfNameList.contains(shelName)){
shelfNameList.add(shelName);
}
} }
} }
} }
...@@ -1033,7 +1040,10 @@ public class TaskService implements ITaskService { ...@@ -1033,7 +1040,10 @@ public class TaskService implements ITaskService {
if(!finishedTask.isCancel() && !finishedTask.isFinished() && finishedTask.isCheckOutTask()){ if(!finishedTask.isCancel() && !finishedTask.isFinished() && finishedTask.isCheckOutTask()){
//未完成的出库工单任务 //未完成的出库工单任务
if(appendInfo.isDShelfTask() || appendInfo.isCShelfTask()){ if(appendInfo.isDShelfTask() || appendInfo.isCShelfTask()){
shelfNameList.add(appendInfo.getTempRfid()); String shelName = appendInfo.getTempRfid();
if(!shelfNameList.contains(shelName)){
shelfNameList.add(shelName);
}
} }
} }
} }
...@@ -1043,7 +1053,7 @@ public class TaskService implements ITaskService { ...@@ -1043,7 +1053,7 @@ public class TaskService implements ITaskService {
//判断未完成的工单料架中是否有大料架 //判断未完成的工单料架中是否有大料架
if(StorageConstants.SHEFL_TYPE.isCShelf(shelfName)){ if(StorageConstants.SHEFL_TYPE.isCShelf(shelfName)){
//大料(C料架)只能同时出一个架子,不然到包装料工位时无法切换 //大料(C料架)只能同时出一个架子,不然到包装料工位时无法切换
log.info("未完成的工单料架为:["+String.join(",",shelfNameList)+ "]大料架任务["+storageTask.getBarcode()+"]暂停出库,以免包装工位无法切换"); log.info("未完成的工单料架为:["+String.join(",",shelfNameList)+ "]大料架任务["+storageTask.getBarcode()+"]["+shelfName+"]暂停出库,以免包装工位无法切换");
return null; return null;
} }
} }
...@@ -1090,101 +1100,6 @@ public class TaskService implements ITaskService { ...@@ -1090,101 +1100,6 @@ public class TaskService implements ITaskService {
} }
//} //}
//指定紧急单盘出库的优先出库,否则按批量出库处理
// for (DataLog task : waitTasks) {//优先分配单盘任务和没有工单的任务
// if(cid.equals(task.getCid()) && task.isCheckOutTask()){
// if(task.isSingleOut()){
// //只有等待或执行中的任务
// if(task.isWait()) {
// String posName = task.getPosName();
// if(!Strings.isNullOrEmpty(posName)){
// //从等待列表中删除,加入到执行列表中
// log.info("分配优先(单盘或无工单)出库任务"+task.getBarcode()+"["+posName+"]到 BOX"+boxId);
// task.setStatus(StorageConstants.OP_STATUS.EXECUTING.name());
// taskMap.put(task.getId(), task);
// dataLogDao.save(task);
// return task;
// }
// }
// }
//
// }
// }
//没有小盘任务了再出大盘
//首套料的话需要按顺序执行,一个料架满了之后再出另一个料架
//优先查找有库位信息的
// Map<String,DataLog> partNumberTaskMap = new HashMap<>();
// for (DataLog task : waitTasks) {//分配任务
// //只有等待或执行中的任务
// if(task.isWait() || task.isExecuting()){
// String posName = task.getPosName();
// if(!Strings.isNullOrEmpty(posName)){//已经有位置信息的,分配到执行列表
// if (cid.equals(task.getCid())) {//是同一个仓库
// //从等待列表中删除,加入到执行列表中
// log.info("分配任务"+task.getBarcode()+"["+posName+"]到 BOX"+boxId);
// task.setStatus(StorageConstants.OP_STATUS.EXECUTING.name());
// taskMap.put(task.getId(), task);
// dataLogDao.save(task);
// return task;
// }
// } else { //无位置信息的根据 partNumber 进行分配
// String partNumber = task.getPartNumber();
// partNumberTaskMap.put(partNumber,task);
// }
// }else{
// //取消或超时或已完成的任务加入到完成列表中
// //log.warn("将取消或已完成的任务["+task.getId()+"]barcode:"+task.getBarcode()+" PartNumber: "+task.getPartNumber()+"加入到完成列表中,并从等待列表中删除");
// //waitingTasks.remove(areaId, task);
// //finishedTasks.put(areaId,task.getBarcode(), task);
// }
// }
//
//
// if(!partNumberTaskMap.isEmpty()){
// //排除掉正在执行的仓位
// Collection<String> excludePosIds = excludePosIds();
//
// StorageConstants.CHECKOUT_TYPE checkOutType = dataCache.getCheckOutType();
// StoragePos pos = storagePosManager.findComponent(storage.getId(), boxId.toString(), partNumberTaskMap.keySet(),excludePosIds,checkOutType);
//
// if (pos != null) {//找到了,出库
// Barcode barcode = pos.getBarcode();
// if (barcode != null) {
// DataLog task = partNumberTaskMap.get(barcode.getPartNumber());
//
// String partNumber = barcode.getPartNumber();
// String reelId = barcode.getBarcode();
// task.setBarcode(reelId);
// task.setAppendInfo(barcode.getAppendInfo());
// task.setNum(barcode.getAmount());
//
// task.setCid(cid);
// task.setStorageId(storage.getId());
// task.setStorageName(storage.getName());
//
// task.setPosId(pos.getId());
// task.setPosName(pos.getPosName());
//
// task.setStatus(StorageConstants.OP_STATUS.EXECUTING.name());
// //从等待列表中删除,加入到执行列表中
// taskMap.put(task.getId(), task);
// dataLogDao.save(task);
//
// log.info("查找到物料" + partNumber + "[" + reelId + "]分配任务" + task.getBarcode() + "[" + pos.getPosName() + "]到" + cid);
// return task;
// }else{
// log.error("查找BOX["+boxId+"]出库找到库位"+storage.getName()+"["+pos.getPosName()+"],但里面没有 barcode,忽略");
// }
// }else{
// //这个 box 没找到
// //log.info("从 BOX["+boxId+"] 中未找到查找物料"+StringUtils.join(taskPartNumbers,","));
// }
// }
return null; return null;
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!