|
@@ -444,20 +444,21 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
}
|
|
|
|
|
|
} else { //目标库位
|
|
|
- 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;
|
|
|
- }
|
|
|
- locationInfo = b;
|
|
|
- break;
|
|
|
- }
|
|
|
- if (locationInfo == null) {
|
|
|
- // 出库没有可分配库位,不报错,返回空
|
|
|
+ // 出库默认先不给分配目标库位 这里不能改 会破坏出库均匀任务
|
|
|
+// 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;
|
|
|
+// }
|
|
|
+// locationInfo = b;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// if (locationInfo == null) {
|
|
|
+ // 出库没有可分配库位,不报错,返回空
|
|
|
// throw new ServiceException("出库目标点没有可以分配的库位", token);
|
|
|
- }
|
|
|
+// }
|
|
|
}
|
|
|
} else { //移库
|
|
|
if (locationType.equals("locationFrom")) {
|
|
@@ -849,6 +850,14 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
}
|
|
|
// 出库任务分配目标库位
|
|
|
if (wcsTask.getLocationTo().equals("待分配")) {
|
|
|
+ // 出库均匀任务判断
|
|
|
+ BaseLocationInfo baseLocationInfo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(wcsTask.getLocationFrom(), Constant.WAREHOUSE_ID);
|
|
|
+ String agvNo = baseLocationInfo.getFoldedTag(); // 车号
|
|
|
+ boolean isCan = uniformOutboundTaskJudgment(agvNo);
|
|
|
+ if (!isCan) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 分配目标库位
|
|
|
AjaxResult ajaxResult = allocateTargetLocation(wcsTask);
|
|
|
if (!ajaxResult.isSuccess()) {
|
|
|
continue;
|
|
@@ -857,6 +866,13 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
wcsTask.setAreaTo(locationInfo.getZoneId().toString());
|
|
|
wcsTask.setLocationTo(locationInfo.getId().toString());
|
|
|
wcsTaskService.updateWcsTask(wcsTask);
|
|
|
+ // 修改出库位置是哪台车在做
|
|
|
+ BaseLocationInfo baseLocationInfoUpdate = new BaseLocationInfo();
|
|
|
+ baseLocationInfoUpdate.setId(locationInfo.getId());
|
|
|
+ baseLocationInfoUpdate.setFoldedTag(agvNo);
|
|
|
+ baseLocationInfoUpdate.setStockStatus(Constant.STOCK_STATUS.STOCK10.getValue());
|
|
|
+ baseLocationInfoService.updateBaseLocationInfo(baseLocationInfoUpdate);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -880,6 +896,46 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 出库均匀任务判断
|
|
|
+ *
|
|
|
+ * @return true 可以分配目标点 false 不可分配目标点
|
|
|
+ */
|
|
|
+ private boolean uniformOutboundTaskJudgment(String agvNo) {
|
|
|
+ int lock = 0; // 占用
|
|
|
+ int goods = 0; // 有货
|
|
|
+ // 查出两个出库缓存位
|
|
|
+ List<BaseLocationInfo> baseLocationInfos = baseLocationInfoService.selectLocatinListByZoneId(Constant.ZONE_TYPE.ZONE_OUT.getValue());
|
|
|
+ // 判断两个位置有几个任务占用
|
|
|
+ List<BaseLocationInfo> baseLocationInfosLock
|
|
|
+ = baseLocationInfos.stream()
|
|
|
+ .filter(v -> v.getStockStatus().equals(Constant.STOCK_STATUS.STOCK10.getValue()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ lock = baseLocationInfosLock.size();
|
|
|
+ // 如果两个都占用 返回false
|
|
|
+ if (lock == 2) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 判断两个位置有几个有货
|
|
|
+ List<BaseLocationInfo> baseLocationInfosGoods
|
|
|
+ = baseLocationInfos.stream()
|
|
|
+ .filter(v -> v.getIsEmpty().equals(Constant.IS_YES.N.name()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ goods = baseLocationInfosGoods.size();
|
|
|
+ // 如果两个都占用
|
|
|
+ if (goods == 2) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 如果没有占用
|
|
|
+ if (lock == 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ // 如果一个库位被占用
|
|
|
+ BaseLocationInfo locationInfoLock = baseLocationInfosLock.get(0);
|
|
|
+ String agvNoIng = locationInfoLock.getFoldedTag(); // 正在任务的车号
|
|
|
+ return !agvNo.equals(agvNoIng);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 分配出库目标库位
|
|
|
* 目标库位为待分配
|
|
@@ -890,13 +946,26 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
private AjaxResult allocateTargetLocation(WcsTask wcsTask) {
|
|
|
List<BaseLocationInfo> locationToList = this.convertLocation(Constant.ZONE_TYPE.ZONE_OUT.getValue().toString()
|
|
|
, Constant.WAREHOUSE_ID, null);
|
|
|
- BaseLocationInfo locationTo = this.zoneLocationAllocation(locationToList, "locationTo", "SO"
|
|
|
- , null, null, Long.valueOf(wcsTask.getExt8()));
|
|
|
+ BaseLocationInfo locationTo = this.zoneLocationAllocation(locationToList, Long.valueOf(wcsTask.getExt8()));
|
|
|
if (locationTo == null) {
|
|
|
return AjaxResult.error("");
|
|
|
}
|
|
|
return AjaxResult.success("", locationTo);
|
|
|
}
|
|
|
+ private BaseLocationInfo zoneLocationAllocation(List<BaseLocationInfo> locationInfoList, Long token) {
|
|
|
+ BaseLocationInfo locationInfo = null;
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ locationInfo = b;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return locationInfo;
|
|
|
+ }
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|