|
@@ -330,11 +330,39 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
if (!canPut) {
|
|
|
continue;
|
|
|
}
|
|
|
+ // AGV均匀任务
|
|
|
+ int agvNo;
|
|
|
+ // 推荐几号车做
|
|
|
+ agvNo = recommendedWarehousingCarNumber();
|
|
|
+ // 校验当前库位绑定的车号
|
|
|
+ boolean iscan = checkCurrentLocationCarNumber(agvNo, b);
|
|
|
+ if (!iscan) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
locationInfo = b;
|
|
|
break;
|
|
|
}
|
|
|
if (locationInfo == null) {
|
|
|
- throw new ServiceException("入库目标点没有可以分配的库位", token);
|
|
|
+ // 如果没有可用库位,去掉AGV均匀任务判断
|
|
|
+ for (BaseLocationInfo b : locationInfoList) {
|
|
|
+ if (!b.getStockStatus().equals("00") || !b.getIsEmpty().equals("Y") || redisCache.checkIsLock(RedisKey.LOCK_LOCATION + b.getId())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!redisCache.lockCacheObject(RedisKey.LOCK_LOCATION + b.getId(), b.getId().toString(), token)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 根据起始库位判断目标是否可放
|
|
|
+ Boolean canPut = checkLocCanPut(locationFrom, b);
|
|
|
+ if (!canPut) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ locationInfo = b;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if(locationInfo == null) {
|
|
|
+ throw new ServiceException("入库目标点没有可以分配的库位", token);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} else if (type.equals("SO")) {
|
|
@@ -419,6 +447,52 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
return locationInfo;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 校验当前库位车号
|
|
|
+ *
|
|
|
+ * @param agvNo
|
|
|
+ * @param b
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private boolean checkCurrentLocationCarNumber(int agvNo,BaseLocationInfo b) {
|
|
|
+ if (agvNo == 1) {
|
|
|
+ if (!b.getFoldedTag().equals("1")) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else if (agvNo == 2) {
|
|
|
+ if (!b.getFoldedTag().equals("2")) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 推荐入库车号
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private int recommendedWarehousingCarNumber() {
|
|
|
+ if (redisCache.getCacheObject(RedisKey.AGV01_TASK_NUM) == null
|
|
|
+ && redisCache.getCacheObject(RedisKey.AGV02_TASK_NUM) == null) {
|
|
|
+ return 0;
|
|
|
+ } else if (redisCache.getCacheObject(RedisKey.AGV01_TASK_NUM) == null
|
|
|
+ && redisCache.getCacheObject(RedisKey.AGV02_TASK_NUM) != null
|
|
|
+ && (int) redisCache.getCacheObject(RedisKey.AGV02_TASK_NUM) != 0) {
|
|
|
+ return 1;
|
|
|
+ } else if (redisCache.getCacheObject(RedisKey.AGV02_TASK_NUM) == null
|
|
|
+ && redisCache.getCacheObject(RedisKey.AGV01_TASK_NUM) != null
|
|
|
+ && (int) redisCache.getCacheObject(RedisKey.AGV01_TASK_NUM) != 0) {
|
|
|
+ return 2;
|
|
|
+ } else if (redisCache.getCacheObject(RedisKey.AGV01_TASK_NUM) != null
|
|
|
+ && redisCache.getCacheObject(RedisKey.AGV02_TASK_NUM) != null) {
|
|
|
+ int agv01 = redisCache.getCacheObject(RedisKey.AGV01_TASK_NUM);
|
|
|
+ int agv02 = redisCache.getCacheObject(RedisKey.AGV02_TASK_NUM);
|
|
|
+ return agv01 > agv02 ? 2 : 1;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
public Boolean checkLocCanPut(BaseLocationInfo locationFrom, BaseLocationInfo locationTo) {
|
|
|
boolean con = false;
|
|
|
// 永湖仓储区一层高度为1600,其他为2300
|
|
@@ -499,6 +573,24 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
wcsTask.setExtParam(agvCallDTO.getExtParam());
|
|
|
wcsTaskList.add(wcsTask);
|
|
|
businessService.addTask(wcsTask);
|
|
|
+ // 入库任务,统计两辆车分别发了多少任务
|
|
|
+ if (locationTo.getZoneId().equals(Constant.ZONE_TYPE.ZONE_INV.getValue())) {
|
|
|
+ if (locationTo.getFoldedTag().equals("1")) {
|
|
|
+ if (redisCache.getCacheObject(RedisKey.AGV01_TASK_NUM) == null) {
|
|
|
+ redisCache.setCacheObject(RedisKey.AGV01_TASK_NUM, 1);
|
|
|
+ } else {
|
|
|
+ int num = redisCache.getCacheObject(RedisKey.AGV01_TASK_NUM);
|
|
|
+ redisCache.setCacheObject(RedisKey.AGV01_TASK_NUM, 1 + num);
|
|
|
+ }
|
|
|
+ } else if (locationTo.getFoldedTag().equals("2")) {
|
|
|
+ if (redisCache.getCacheObject(RedisKey.AGV02_TASK_NUM) == null) {
|
|
|
+ redisCache.setCacheObject(RedisKey.AGV02_TASK_NUM, 1);
|
|
|
+ } else {
|
|
|
+ int num = redisCache.getCacheObject(RedisKey.AGV02_TASK_NUM);
|
|
|
+ redisCache.setCacheObject(RedisKey.AGV02_TASK_NUM, 1 + num);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
/*//获取对应的流程
|
|
|
List<FlowConfigHeader> headerVOList = flowConfigHeaderService.sortFlowConfigHeader(Long.parseLong(flowConfigHeaderVO.getRootFlow()));
|