|
@@ -148,18 +148,81 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
}
|
|
}
|
|
|
|
|
|
if (flowConfigHeaderVO.getFlowType().equals("ASN")) {
|
|
if (flowConfigHeaderVO.getFlowType().equals("ASN")) {
|
|
- // 判断队列中是否有未完成的出库任务
|
|
|
|
- BaseLocationInfo baseLocInfo = baseLocationInfoMapper.selectBaseLocationInfoById(Long.parseLong(paramLocationFrom));
|
|
|
|
- boolean isFinish = checkWcsSameColumnNotFinish(baseLocInfo.getColNo(), baseLocInfo.getColIndex(), baseLocInfo.getZoneId(),"ASN");
|
|
|
|
- if (!isFinish){
|
|
|
|
- throw new ServiceException("当前列有未完成的出库任务");
|
|
|
|
- }
|
|
|
|
|
|
|
|
List<BaseLocationInfo> locationFromList = this.convertLocation(paramLocationFrom, agvCallDTO.getWarehouseId(), null);
|
|
List<BaseLocationInfo> locationFromList = this.convertLocation(paramLocationFrom, agvCallDTO.getWarehouseId(), null);
|
|
- //
|
|
|
|
List<BaseLocationInfo> locationToList = this.convertLocation(paramLocationTo, agvCallDTO.getWarehouseId(), null);
|
|
List<BaseLocationInfo> locationToList = this.convertLocation(paramLocationTo, agvCallDTO.getWarehouseId(), null);
|
|
- locationFrom = this.zoneLocationAllocation(locationFromList, "locationFrom", "ASN", asnSoStrategy, token);
|
|
|
|
- locationTo = this.zoneLocationAllocation(locationToList, "locationTo", "ASN", asnSoStrategy, token);
|
|
|
|
|
|
+
|
|
|
|
+ // 如果是废料入库 需要判断同列是否有出库任务
|
|
|
|
+ if (flowConfigHeaderVO.getId().equals(Long.valueOf("4"))
|
|
|
|
+ || flowConfigHeaderVO.getId().equals(Long.valueOf("6"))) {
|
|
|
|
+ String currentColNo = null;// 当前列
|
|
|
|
+ Long currentZoneId = null; // 当前库区
|
|
|
|
+ List<BaseLocationInfo> locationInfos = new ArrayList();
|
|
|
|
+ for (BaseLocationInfo baseLocationInfo : locationToList) {
|
|
|
|
+ // 如果当前库位的列和库区和标记的列和库区相同 跳过当前库位
|
|
|
|
+ if (baseLocationInfo.getColNo().equals(currentColNo) && baseLocationInfo.getZoneId().equals(currentZoneId)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ boolean hasDiff = checkCurrentColumnDiffTaskType(baseLocationInfo, null);
|
|
|
|
+ // 同列有未完成的其他类型任务
|
|
|
|
+ if (hasDiff){
|
|
|
|
+ // 记录当前库位区域和列id
|
|
|
|
+ currentColNo = baseLocationInfo.getColNo();
|
|
|
|
+ currentZoneId = baseLocationInfo.getZoneId();
|
|
|
|
+ continue;
|
|
|
|
+ }else {
|
|
|
|
+ locationInfos.add(baseLocationInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ locationToList = locationInfos;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 如果是成品入库任务需要进行判断班组信息和同列是否有出库任务
|
|
|
|
+ if (flowConfigHeaderVO.getId().equals(Long.valueOf("9")) || flowConfigHeaderVO.getId().equals(Long.valueOf("10"))
|
|
|
|
+ || flowConfigHeaderVO.getId().equals(Long.valueOf("12"))
|
|
|
|
+ || flowConfigHeaderVO.getId().equals(Long.valueOf("13"))) {
|
|
|
|
+ // 查询同班组的库存
|
|
|
|
+ String team = agvCallDTO.getTeamNo();
|
|
|
|
+ List<BaseLocationInfo> locationInfos = new ArrayList();
|
|
|
|
+ String currentColNo = null;// 当前列
|
|
|
|
+ Long currentZoneId = null; // 当前库区
|
|
|
|
+ for (BaseLocationInfo baseLocationInfo : locationToList) {
|
|
|
|
+ // 如果当前库位的列和库区和标记的列和库区相同 跳过当前库位
|
|
|
|
+ if (baseLocationInfo.getColNo().equals(currentColNo) && baseLocationInfo.getZoneId().equals(currentZoneId)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ // 标记当前列是否可分配
|
|
|
|
+ Boolean columnAvailable = true;
|
|
|
|
+ // 查询当前库位的库存包含批次属性
|
|
|
|
+ List<InvLotLocIdLotattVO> invLotLocIdLotattVOS = invLotLocIdService.selectInvLocIdLotattByLocationId(baseLocationInfo.getId());
|
|
|
|
+ for (InvLotLocIdLotattVO invLotLocIdLotattVO : invLotLocIdLotattVOS) {
|
|
|
|
+ // 当前库存某列有不同班组
|
|
|
|
+ if (Objects.nonNull(invLotLocIdLotattVO) && !invLotLocIdLotattVO.getLotatt09().equals(team)) {
|
|
|
|
+ // 标记当前列不分配
|
|
|
|
+ columnAvailable = false;
|
|
|
|
+ currentColNo = baseLocationInfo.getColNo();
|
|
|
|
+ currentZoneId = baseLocationInfo.getZoneId();
|
|
|
|
+ log.info("==========当前库位有不同班组批次{}{}", baseLocationInfo, invLotLocIdLotattVO.getLotatt09());
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (columnAvailable) {
|
|
|
|
+ // 检查同列是否有不同班组的库存
|
|
|
|
+ boolean hasDiff = checkCurrentColumnDiffTaskType(baseLocationInfo, team);
|
|
|
|
+ if (hasDiff){
|
|
|
|
+ currentColNo = baseLocationInfo.getColNo();
|
|
|
|
+ currentZoneId = baseLocationInfo.getZoneId();
|
|
|
|
+ continue;
|
|
|
|
+ }else {
|
|
|
|
+ locationInfos.add(baseLocationInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ locationToList = locationInfos;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ locationFrom = this.zoneLocationAllocation(locationFromList, "locationFrom", "ASN", asnSoStrategy, token, flowConfigHeaderVO.getId());
|
|
|
|
+ locationTo = this.zoneLocationAllocation(locationToList, "locationTo", "ASN", asnSoStrategy, token, flowConfigHeaderVO.getId());
|
|
// 初始化库存
|
|
// 初始化库存
|
|
if (agvCallDTO.getAgvCallItemDTOList().size() > 0) {
|
|
if (agvCallDTO.getAgvCallItemDTOList().size() > 0) {
|
|
iInvLotAttService.deleteInvLotAttBylocationId(locationFrom.getId());
|
|
iInvLotAttService.deleteInvLotAttBylocationId(locationFrom.getId());
|
|
@@ -170,13 +233,6 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
|
|
|
} else if (flowConfigHeaderVO.getFlowType().equals("SO")) {
|
|
} else if (flowConfigHeaderVO.getFlowType().equals("SO")) {
|
|
|
|
|
|
- // 判断同列中是否有未完成的入库任务
|
|
|
|
- BaseLocationInfo baseLocInfo = baseLocationInfoMapper.selectBaseLocationInfoById(Long.parseLong(paramLocationFrom));
|
|
|
|
- boolean isFinish = checkWcsSameColumnNotFinish(baseLocInfo.getColNo(), baseLocInfo.getColIndex(), baseLocInfo.getZoneId(),"SO");
|
|
|
|
- if (!isFinish){
|
|
|
|
- throw new ServiceException("当前列有未完成的入库任务");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
List<BaseLocationInfo> locationFromListEnd = new ArrayList<>();
|
|
List<BaseLocationInfo> locationFromListEnd = new ArrayList<>();
|
|
boolean isLocation = baseLocationInfoService.checkIsLocation(paramLocationFrom, Constant.WAREHOUSE_ID);
|
|
boolean isLocation = baseLocationInfoService.checkIsLocation(paramLocationFrom, Constant.WAREHOUSE_ID);
|
|
if (isLocation) {
|
|
if (isLocation) {
|
|
@@ -192,15 +248,21 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
locationFromListEnd = locationFromList;
|
|
locationFromListEnd = locationFromList;
|
|
}
|
|
}
|
|
List<BaseLocationInfo> locationToList = this.convertLocation(paramLocationTo, agvCallDTO.getWarehouseId(), null);
|
|
List<BaseLocationInfo> locationToList = this.convertLocation(paramLocationTo, agvCallDTO.getWarehouseId(), null);
|
|
- locationFrom = this.zoneLocationAllocation(locationFromListEnd, "locationFrom", "SO", asnSoStrategy, token);
|
|
|
|
- locationTo = this.zoneLocationAllocation(locationToList, "locationTo", "SO", asnSoStrategy, token);
|
|
|
|
|
|
+
|
|
|
|
+ // 如果是从仓储区出库的任务 检查同列是否有未完成的其它类型任务
|
|
|
|
+ if (flowConfigHeaderVO.getId().equals(Long.valueOf("14")) || flowConfigHeaderVO.getId().equals(Long.valueOf("15"))) {
|
|
|
|
+ Assert.isTrue(checkWcsSameColumnNotFinish(locationFromListEnd, "SO"), "同列有未完成的入库任务");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ locationFrom = this.zoneLocationAllocation(locationFromListEnd, "locationFrom", "SO", asnSoStrategy, token, flowConfigHeaderVO.getId());
|
|
|
|
+ locationTo = this.zoneLocationAllocation(locationToList, "locationTo", "SO", asnSoStrategy, token, flowConfigHeaderVO.getId());
|
|
wcsTaskList.addAll(this.genTask(locationFrom, locationTo, flowConfigHeaderVO, agvCallDTO, token));
|
|
wcsTaskList.addAll(this.genTask(locationFrom, locationTo, flowConfigHeaderVO, agvCallDTO, token));
|
|
|
|
|
|
} else if (flowConfigHeaderVO.getFlowType().equals("MV")) {
|
|
} else if (flowConfigHeaderVO.getFlowType().equals("MV")) {
|
|
List<BaseLocationInfo> locationFromList = this.convertLocation(paramLocationFrom, agvCallDTO.getWarehouseId(), null);
|
|
List<BaseLocationInfo> locationFromList = this.convertLocation(paramLocationFrom, agvCallDTO.getWarehouseId(), null);
|
|
List<BaseLocationInfo> locationToList = this.convertLocation(paramLocationTo, agvCallDTO.getWarehouseId(), null);
|
|
List<BaseLocationInfo> locationToList = this.convertLocation(paramLocationTo, agvCallDTO.getWarehouseId(), null);
|
|
- locationFrom = this.zoneLocationAllocation(locationFromList, "locationFrom", "MV", asnSoStrategy, token);
|
|
|
|
- locationTo = this.zoneLocationAllocation(locationToList, "locationTo", "MV", asnSoStrategy, token);
|
|
|
|
|
|
+ locationFrom = this.zoneLocationAllocation(locationFromList, "locationFrom", "MV", asnSoStrategy, token, flowConfigHeaderVO.getId());
|
|
|
|
+ locationTo = this.zoneLocationAllocation(locationToList, "locationTo", "MV", asnSoStrategy, token, flowConfigHeaderVO.getId());
|
|
// 初始化库存
|
|
// 初始化库存
|
|
if (agvCallDTO.getAgvCallItemDTOList().size() > 0) {
|
|
if (agvCallDTO.getAgvCallItemDTOList().size() > 0) {
|
|
iInvLotAttService.deleteInvLotAttBylocationId(locationFrom.getId());
|
|
iInvLotAttService.deleteInvLotAttBylocationId(locationFrom.getId());
|
|
@@ -219,29 +281,67 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 检查同列的未完成任务类型是否与当前任务类型一致
|
|
|
|
- * @param colNo
|
|
|
|
- * @param colIndex
|
|
|
|
- * @param zoneId
|
|
|
|
- * @param type 任务类型
|
|
|
|
|
|
+ * 入库检查同列是否有出库类型(且不同班组)的任务
|
|
|
|
+ * @param baseLocationInfo
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public boolean checkWcsSameColumnNotFinish(String colNo, Long colIndex, Long zoneId,String type){
|
|
|
|
|
|
+ public boolean checkCurrentColumnDiffTaskType(BaseLocationInfo baseLocationInfo,String team){
|
|
|
|
+ log.info("============检查入库任务同列的未完成任务类型及班组是否与当前任务类型一致");
|
|
|
|
+ // 判断当前库位同列是否有不同类型任务
|
|
|
|
+ List<BaseLocationInfo> blsList = baseLocationInfoService.selectWcsSameColumnAndTeamNotFinish(baseLocationInfo.getColNo(),
|
|
|
|
+ team, baseLocationInfo.getZoneId(), Constant.WAREHOUSE_ID, "ASN");
|
|
|
|
+ // 当前列有不同类型未完成任务 继续遍历下一库位
|
|
|
|
+ if (blsList != null && blsList.size() > 0) {
|
|
|
|
+ log.info("==========当前库位同列有未完成的出库任务,库位编号:{},列:{}", baseLocationInfo.getId(), baseLocationInfo.getColNo());
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 出库检查同列的未完成任务类型是否与当前任务类型一致
|
|
|
|
+ *
|
|
|
|
+ * @param baseLocationInfoList
|
|
|
|
+ * @param type
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public Boolean checkWcsSameColumnNotFinish(List<BaseLocationInfo> baseLocationInfoList, String type) {
|
|
log.info("检查同列的未完成任务类型是否与当前任务类型一致============");
|
|
log.info("检查同列的未完成任务类型是否与当前任务类型一致============");
|
|
- // 查询任务状态不为2(完成),6(卸货完成),7(取消)的同列任务
|
|
|
|
- List<WcsTask> wcsTaskList = wcsTaskService.selectWcsSameColumnNotFinish(colNo, colIndex, zoneId,Constant.WAREHOUSE_ID);
|
|
|
|
- if (wcsTaskList != null && wcsTaskList.size()>0){
|
|
|
|
- for(WcsTask wcsTask : wcsTaskList){
|
|
|
|
- FlowConfigHeaderVO flowConfigHeaderVO = flowConfigHeaderService.selectFlowConfigHeaderById(Long.valueOf(wcsTask.getExt7()));
|
|
|
|
- if (Objects.nonNull(flowConfigHeaderVO) && !flowConfigHeaderVO.getFlowType().equals(type)){
|
|
|
|
- log.info("同列的未完成任务类型与当前任务类型不同{}====",wcsTask);
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
|
|
+ for (BaseLocationInfo locationInfo : baseLocationInfoList) {
|
|
|
|
+ // 查询任务状态不为2(完成),6(卸货完成),7(取消)的同列任务
|
|
|
|
+ List<BaseLocationInfo> blsList = baseLocationInfoService.selectWcsSameColumnNotFinish(locationInfo.getColNo(),
|
|
|
|
+ locationInfo.getColIndex(), locationInfo.getZoneId(), Constant.WAREHOUSE_ID, type);
|
|
|
|
+ // 如果同列有不同类型的未完成任务
|
|
|
|
+ if (blsList != null && blsList.size() > 0) {
|
|
|
|
+ log.info("==========当前库位同列有未完成的入库任务,库位编号:{},列:{}", locationInfo.getId(), locationInfo.getColNo());
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 检查同列的未完成任务类型及班组是否与当前任务类型一致
|
|
|
|
+ *
|
|
|
|
+ * @param baseLocationInfoList
|
|
|
|
+ * @param type
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public List<BaseLocationInfo> checkWcsSameColumnAndTeamNotFinish(List<BaseLocationInfo> baseLocationInfoList, String type, String team) {
|
|
|
|
+ log.info("检查同列的未完成任务类型及班组是否与当前任务类型一致============");
|
|
|
|
+ List<BaseLocationInfo> resultList = new ArrayList<>();
|
|
|
|
+ for (BaseLocationInfo locationInfo : baseLocationInfoList) {
|
|
|
|
+ // 查询任务状态不为2(完成),6(卸货完成),7(取消)的同列任务
|
|
|
|
+ List<BaseLocationInfo> blsList = baseLocationInfoService.selectWcsSameColumnAndTeamNotFinish(locationInfo.getColNo(),
|
|
|
|
+ team, locationInfo.getZoneId(), Constant.WAREHOUSE_ID, type);
|
|
|
|
+ // 如果同列有不同类型的未完成任务
|
|
|
|
+ if (blsList != null && blsList.size() > 0) {
|
|
|
|
+ resultList.addAll(blsList);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return resultList;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
public BaseLocationInfo inLocationAllocation(InWarehouseDTO inWarehouseDTO, Long token) {
|
|
public BaseLocationInfo inLocationAllocation(InWarehouseDTO inWarehouseDTO, Long token) {
|
|
@@ -335,7 +435,7 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public BaseLocationInfo zoneLocationAllocation(List<BaseLocationInfo> locationInfoList, String locationType
|
|
public BaseLocationInfo zoneLocationAllocation(List<BaseLocationInfo> locationInfoList, String locationType
|
|
- , String type, AsnSoStrategy asnSoStrategy, Long token) {
|
|
|
|
|
|
+ , String type, AsnSoStrategy asnSoStrategy, Long token, Long flowId) {
|
|
BaseLocationInfo locationInfo = null;
|
|
BaseLocationInfo locationInfo = null;
|
|
String fromMsg = "";
|
|
String fromMsg = "";
|
|
String toMsg = "";
|
|
String toMsg = "";
|
|
@@ -354,10 +454,10 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
}
|
|
}
|
|
if (locationType.equals("locationFrom")) {
|
|
if (locationType.equals("locationFrom")) {
|
|
|
|
|
|
- // 如果是出库 调用无需判断阻挡的方法
|
|
|
|
- if (type.equals("SO")){
|
|
|
|
|
|
+ // 如果是从仓储区出库 调用无需判断阻挡的方法
|
|
|
|
+ if (type.equals("SO") && (flowId.equals(Long.valueOf("14")) || flowId.equals(Long.valueOf("15")))) {
|
|
locationInfo = checkTheSameColumnLocationSO(locationInfoList, token);
|
|
locationInfo = checkTheSameColumnLocationSO(locationInfoList, token);
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
locationInfo = checkTheSameColumnLocation(locationInfoList, token, false);
|
|
locationInfo = checkTheSameColumnLocation(locationInfoList, token, false);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -372,8 +472,15 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
throw new ServiceException(fromMsg, token);
|
|
throw new ServiceException(fromMsg, token);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
-
|
|
|
|
- locationInfo = checkTheSameColumnLocation(locationInfoList, token, true);
|
|
|
|
|
|
+ // 是到仓储区的入库任务
|
|
|
|
+ if (type.equals("ASN") && !flowId.equals(Long.valueOf("8"))
|
|
|
|
+ && !flowId.equals(Long.valueOf("11"))
|
|
|
|
+ && !flowId.equals(Long.valueOf("16"))) {
|
|
|
|
+ // 不判断同列任务和阻挡情况
|
|
|
|
+ locationInfo = checkTheSameColumnLocationASN(locationInfoList, token, true);
|
|
|
|
+ } else {
|
|
|
|
+ locationInfo = checkTheSameColumnLocation(locationInfoList, token, true);
|
|
|
|
+ }
|
|
if (locationInfo == null) {
|
|
if (locationInfo == null) {
|
|
if (type.equals("ASN")) { // 入库
|
|
if (type.equals("ASN")) { // 入库
|
|
toMsg = "目标点没有可以分配的库位";
|
|
toMsg = "目标点没有可以分配的库位";
|
|
@@ -388,6 +495,37 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
return locationInfo;
|
|
return locationInfo;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 入库判断目标点位
|
|
|
|
+ *
|
|
|
|
+ * @param locationInfoList
|
|
|
|
+ * @param token
|
|
|
|
+ * @param isReleaseGoods
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private BaseLocationInfo checkTheSameColumnLocationASN(List<BaseLocationInfo> locationInfoList, Long token, boolean isReleaseGoods) {
|
|
|
|
+ BaseLocationInfo basLocation = null;
|
|
|
|
+ //筛选2次 第2次去除同列占用和阻挡条件 todo 先筛选一次吧
|
|
|
|
+ for (int i = 0; i < 1 && basLocation == null; i++) {
|
|
|
|
+ for (BaseLocationInfo location : locationInfoList) {
|
|
|
|
+ // 目标点位必须空闲、空且没有被锁住
|
|
|
|
+ if (!location.getStockStatus().equals(Constant.STOCK_STATUS.STOCK00.getValue())
|
|
|
|
+ || !location.getIsEmpty().equals(Constant.IS_YES.Y.name())
|
|
|
|
+ || redisCache.checkIsLock(RedisKey.LOCK_LOCATION + location.getId())) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if (!redisCache.lockCacheObject(RedisKey.LOCK_LOCATION + location.getId()
|
|
|
|
+ , location.getId().toString()
|
|
|
|
+ , token)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ basLocation = location;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return basLocation;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 校验同列任务任务状态和阻挡
|
|
* 校验同列任务任务状态和阻挡
|
|
*
|
|
*
|
|
@@ -412,13 +550,13 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
//同列是否有任务
|
|
//同列是否有任务
|
|
List<BaseLocationInfo> occupyByLocs = baseLocationInfoMapper.queryByListOccupyByLoc(location);
|
|
List<BaseLocationInfo> occupyByLocs = baseLocationInfoMapper.queryByListOccupyByLoc(location);
|
|
if (occupyByLocs.size() > 0) {
|
|
if (occupyByLocs.size() > 0) {
|
|
- log.info("同列有任务=========={}",occupyByLocs);
|
|
|
|
|
|
+ log.info("同列有任务=========={}", occupyByLocs);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
//同列前方是否有阻挡
|
|
//同列前方是否有阻挡
|
|
List<BaseLocationInfo> inStockByLocs = baseLocationInfoMapper.queryByListInStockByLoc(location);
|
|
List<BaseLocationInfo> inStockByLocs = baseLocationInfoMapper.queryByListInStockByLoc(location);
|
|
if (inStockByLocs.size() > 0) {
|
|
if (inStockByLocs.size() > 0) {
|
|
- log.info("同列有阻挡=========={}",inStockByLocs);
|
|
|
|
|
|
+ log.info("同列有阻挡=========={}", inStockByLocs);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -449,6 +587,7 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
|
|
|
/**
|
|
/**
|
|
* AGV出库任务生成时的起始位置不判断是否阻挡
|
|
* AGV出库任务生成时的起始位置不判断是否阻挡
|
|
|
|
+ *
|
|
* @param basLocationList
|
|
* @param basLocationList
|
|
* @param token
|
|
* @param token
|
|
* @return
|
|
* @return
|
|
@@ -656,7 +795,7 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
public AjaxResult sendTask(WcsTask wcsTask) {
|
|
public AjaxResult sendTask(WcsTask wcsTask) {
|
|
BaseLocationInfo locFrom = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(wcsTask.getLocationFrom(), Constant.WAREHOUSE_ID);
|
|
BaseLocationInfo locFrom = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(wcsTask.getLocationFrom(), Constant.WAREHOUSE_ID);
|
|
BaseLocationInfo locTo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(wcsTask.getLocationTo(), Constant.WAREHOUSE_ID);
|
|
BaseLocationInfo locTo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(wcsTask.getLocationTo(), Constant.WAREHOUSE_ID);
|
|
- log.info("进入AMS任务下发=========={}",wcsTask);
|
|
|
|
|
|
+ log.info("进入AMS任务下发=========={}", wcsTask);
|
|
AmsTask amsTask = new AmsTask();
|
|
AmsTask amsTask = new AmsTask();
|
|
amsTask.setTaskNo(wcsTask.getTaskNo());
|
|
amsTask.setTaskNo(wcsTask.getTaskNo());
|
|
if (wcsTask.getBusinessType() == null || wcsTask.getBusinessType().equals("")) {
|
|
if (wcsTask.getBusinessType() == null || wcsTask.getBusinessType().equals("")) {
|
|
@@ -671,11 +810,11 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
amsTask.setExt1(wcsTask.getExt1());
|
|
amsTask.setExt1(wcsTask.getExt1());
|
|
amsTask.setExt2(wcsTask.getExt2());
|
|
amsTask.setExt2(wcsTask.getExt2());
|
|
amsTask.setExt3(wcsTask.getExt3());
|
|
amsTask.setExt3(wcsTask.getExt3());
|
|
- if(wcsTask.getBusinessType().equals(Constant.TASK_BUSINESS_TYPE.TASK_POWER.getValue())){
|
|
|
|
|
|
+ if (wcsTask.getBusinessType().equals(Constant.TASK_BUSINESS_TYPE.TASK_POWER.getValue())) {
|
|
amsTask.setStFrom(Integer.valueOf(wcsTask.getLocationFrom()));
|
|
amsTask.setStFrom(Integer.valueOf(wcsTask.getLocationFrom()));
|
|
amsTask.setStTo(Integer.valueOf(wcsTask.getLocationTo()));
|
|
amsTask.setStTo(Integer.valueOf(wcsTask.getLocationTo()));
|
|
amsTask.setDeviceName(wcsTask.getDeviceName());
|
|
amsTask.setDeviceName(wcsTask.getDeviceName());
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
amsTask.setStFrom(locFrom.getAgvStation().intValue());
|
|
amsTask.setStFrom(locFrom.getAgvStation().intValue());
|
|
amsTask.setStTo(locTo.getAgvStation().intValue());
|
|
amsTask.setStTo(locTo.getAgvStation().intValue());
|
|
}
|
|
}
|
|
@@ -725,34 +864,59 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
//转发任务
|
|
//转发任务
|
|
if (StringUtils.isNotEmpty(wcsTask.getTaskType())
|
|
if (StringUtils.isNotEmpty(wcsTask.getTaskType())
|
|
&& wcsTask.getTaskType().equals(Constant.TASK_TYPE.FORWARD.getValue())) {
|
|
&& wcsTask.getTaskType().equals(Constant.TASK_TYPE.FORWARD.getValue())) {
|
|
- log.info("进入转发任务{}=={}========", wcsTask.getTaskType(),wcsTask.getExt7());
|
|
|
|
|
|
+ log.info("进入转发任务{}=={}========", wcsTask.getTaskType(), wcsTask.getExt7());
|
|
// 判断如果是出库任务
|
|
// 判断如果是出库任务
|
|
if (StringUtils.isNotEmpty(wcsTask.getExt7())
|
|
if (StringUtils.isNotEmpty(wcsTask.getExt7())
|
|
&& (wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.FOURTEEN.getValue()))
|
|
&& (wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.FOURTEEN.getValue()))
|
|
- || wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.FIFTEEN.getValue())))){
|
|
|
|
|
|
+ || wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.FIFTEEN.getValue())))) {
|
|
log.info("出库任务下发AMS调用AGV{}", JSON.toJSONString(wcsTask));
|
|
log.info("出库任务下发AMS调用AGV{}", JSON.toJSONString(wcsTask));
|
|
// 根据起始地查询库位信息
|
|
// 根据起始地查询库位信息
|
|
BaseLocationInfo baseLocationInfo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(wcsTask.getLocationFrom(), Constant.WAREHOUSE_ID);
|
|
BaseLocationInfo baseLocationInfo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(wcsTask.getLocationFrom(), Constant.WAREHOUSE_ID);
|
|
- //同列是否有任务
|
|
|
|
|
|
+ // 同列外方是否有任务
|
|
List<BaseLocationInfo> occupyByLocs = baseLocationInfoMapper.queryByListOccupyByLoc(baseLocationInfo);
|
|
List<BaseLocationInfo> occupyByLocs = baseLocationInfoMapper.queryByListOccupyByLoc(baseLocationInfo);
|
|
if (occupyByLocs.size() > 0) {
|
|
if (occupyByLocs.size() > 0) {
|
|
- log.info("同列有任务=========={}",occupyByLocs);
|
|
|
|
|
|
+ log.info("同列外面有任务=========={}", occupyByLocs);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ //同列前方是否有阻挡
|
|
|
|
+ List<BaseLocationInfo> inStockByLocs = baseLocationInfoMapper.queryByListInStockByLoc(baseLocationInfo);
|
|
|
|
+ if (inStockByLocs.size() > 0) {
|
|
|
|
+ log.info("同列有阻挡=========={}", inStockByLocs);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ } else if (StringUtils.isNotEmpty(wcsTask.getExt7()) // 判断如果是入库且到仓储区的任务
|
|
|
|
+ && (wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.NINE.getValue()))
|
|
|
|
+ || wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.TEN.getValue()))
|
|
|
|
+ || wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.TWELVE.getValue()))
|
|
|
|
+ || wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.THIRTEEN.getValue()))
|
|
|
|
+ || wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.FOUR.getValue()))
|
|
|
|
+ || wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.SIX.getValue())))) {
|
|
|
|
+ log.info("入库任务下发AMS调用AGV{}", JSON.toJSONString(wcsTask));
|
|
|
|
+ // 根据起始地查询库位信息
|
|
|
|
+ BaseLocationInfo baseLocationInfo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(wcsTask.getLocationFrom(), Constant.WAREHOUSE_ID);
|
|
|
|
+ // 同列里面是否有任务
|
|
|
|
+ List<BaseLocationInfo> occupyByLocs = baseLocationInfoMapper.queryByListOccupyByLocOR(baseLocationInfo);
|
|
|
|
+ for (int i = 0; i < occupyByLocs.size(); i++) {
|
|
|
|
+ // 查询前方是否有未取货完成的任务
|
|
|
|
+ WcsTask wTask = wcsTaskService.selectWcsTaskByLocationTo(occupyByLocs.get(i).getId());
|
|
|
|
+ if (wTask != null) {
|
|
|
|
+ wcsTask.setRemark("目标库位同列后方存在未取货完成的任务,请等待!");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
//同列前方是否有阻挡
|
|
//同列前方是否有阻挡
|
|
List<BaseLocationInfo> inStockByLocs = baseLocationInfoMapper.queryByListInStockByLoc(baseLocationInfo);
|
|
List<BaseLocationInfo> inStockByLocs = baseLocationInfoMapper.queryByListInStockByLoc(baseLocationInfo);
|
|
if (inStockByLocs.size() > 0) {
|
|
if (inStockByLocs.size() > 0) {
|
|
- log.info("同列有阻挡=========={}",inStockByLocs);
|
|
|
|
|
|
+ log.info("同列有阻挡=========={}", inStockByLocs);
|
|
|
|
+ wcsTask.setRemark("目标库位同列有阻挡,请处理!");
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
sendTask(wcsTask);
|
|
sendTask(wcsTask);
|
|
wcsTask.setState(10L);
|
|
wcsTask.setState(10L);
|
|
wcsTaskService.updateWcsTask(wcsTask);
|
|
wcsTaskService.updateWcsTask(wcsTask);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
-
|
|
|
|
try {
|
|
try {
|
|
//任务下发判断
|
|
//任务下发判断
|
|
businessService.taskDispatchStack(wcsTask);
|
|
businessService.taskDispatchStack(wcsTask);
|
|
@@ -760,6 +924,7 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|