1
This commit is contained in:
parent
5af579e36a
commit
507feb9219
|
|
@ -33,7 +33,7 @@ public class AppConstants {
|
||||||
public static final String OUT_ORDER_STATUS_0 = "0";
|
public static final String OUT_ORDER_STATUS_0 = "0";
|
||||||
public static final String OUT_ORDER_STATUS_1 = "1";
|
public static final String OUT_ORDER_STATUS_1 = "1";
|
||||||
public static final String OUT_ORDER_STATUS_2 = "2";
|
public static final String OUT_ORDER_STATUS_2 = "2";
|
||||||
//1:出库 2:入库 9:移库 4:拣选
|
//1:入库 2:出库 9:移库 4:拣选
|
||||||
public static final Integer TASK_TYPE_OUT = 2;
|
public static final Integer TASK_TYPE_OUT = 2;
|
||||||
public static final Integer TASK_TYPE_IN = 1;
|
public static final Integer TASK_TYPE_IN = 1;
|
||||||
public static final Integer TASK_TYPE_TRANSFER = 9;
|
public static final Integer TASK_TYPE_TRANSFER = 9;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@ public class AppLocation extends BaseEntity
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
private Long id;
|
private Long id;
|
||||||
|
/** 库位编码 */
|
||||||
|
@Excel(name = "库位编码")
|
||||||
|
private String locationId;
|
||||||
/**
|
/**
|
||||||
* 排
|
* 排
|
||||||
*/
|
*/
|
||||||
|
|
@ -33,9 +36,7 @@ public class AppLocation extends BaseEntity
|
||||||
@Excel(name = "货架层")
|
@Excel(name = "货架层")
|
||||||
private Integer wLayer;
|
private Integer wLayer;
|
||||||
|
|
||||||
/** 库位编码 */
|
|
||||||
@Excel(name = "库位编码")
|
|
||||||
private String locationId;
|
|
||||||
|
|
||||||
/** 备注 */
|
/** 备注 */
|
||||||
@Excel(name = "备注")
|
@Excel(name = "备注")
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,16 @@ import java.util.stream.Collectors;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.ruoyi.app.domain.AppLocation;
|
import com.ruoyi.app.domain.AppLocation;
|
||||||
|
import com.ruoyi.app.domain.AppStock;
|
||||||
|
import com.ruoyi.app.domain.AppTask;
|
||||||
import com.ruoyi.app.mapper.AppLocationMapper;
|
import com.ruoyi.app.mapper.AppLocationMapper;
|
||||||
|
import com.ruoyi.app.mapper.AppStockMapper;
|
||||||
|
import com.ruoyi.app.mapper.AppTaskMapper;
|
||||||
import com.ruoyi.app.service.IAppLocationService;
|
import com.ruoyi.app.service.IAppLocationService;
|
||||||
import com.ruoyi.common.constant.AppConstants;
|
import com.ruoyi.common.constant.AppConstants;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -28,11 +33,16 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class AppLocationServiceImpl implements IAppLocationService {
|
public class AppLocationServiceImpl implements IAppLocationService {
|
||||||
private static final Logger log = LoggerFactory.getLogger(AppLocationServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(AppLocationServiceImpl.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AppLocationMapper appLocationMapper;
|
private AppLocationMapper appLocationMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AppStockMapper appStockMapper;
|
||||||
|
@Autowired
|
||||||
|
private AppTaskMapper appTaskMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】
|
* 查询【请填写功能名称】
|
||||||
*
|
*
|
||||||
|
|
@ -128,28 +138,59 @@ public class AppLocationServiceImpl implements IAppLocationService {
|
||||||
locationQuery.setLocationStatus(0);
|
locationQuery.setLocationStatus(0);
|
||||||
locationQuery.setIsLock(0);
|
locationQuery.setIsLock(0);
|
||||||
// todo 先放进二深度后
|
// todo 先放进二深度后
|
||||||
locationQuery.setwDepth(2);
|
// locationQuery.setwDepth(2);
|
||||||
List<AppLocation> appLocationList = appLocationMapper.selectAppLocationList(locationQuery);
|
List<AppLocation> appLocationList = appLocationMapper.selectAppLocationList(locationQuery);
|
||||||
if (appLocationList == null || appLocationList.isEmpty()) {
|
if (appLocationList == null || appLocationList.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 结果库位
|
// 结果库位
|
||||||
AppLocation resultLocation = null;
|
AppLocation resultLocation = null;
|
||||||
// 可用库位列表
|
for(AppLocation appLocation1 : appLocationList) {
|
||||||
// List<AppLocation> availableLocationList = appLocationList.stream().filter(item ->
|
String locId = appLocation1.getLocationId();
|
||||||
// item.getIsWorking() == 0 && item.getIsLock() == 0 && item.getLocationStatus() == 0).sorted(Comparator
|
AppLocation appLocation = appLocationMapper.selectAppLocationByLocationId(locId);
|
||||||
// .comparingInt(AppLocation::getwCol).thenComparingInt(AppLocation::getwLayer).thenComparingInt(AppLocation::getwDepth)).collect(Collectors.toList());
|
if (appLocation.getwDepth() == 2) {
|
||||||
// // 排序
|
//判断01是否有货
|
||||||
// for (AppLocation appLocation : availableLocationList) {
|
String locationId = locId.substring(0, locId.length() - 1) + "1";
|
||||||
// if (appLocation.getIsWorking() == 1 || appLocation.getIsLock() == 1 || appLocation.getLocationStatus() == 1) {
|
List<AppTask> appTasks = getAppTaskByVehicleId(null, locationId);
|
||||||
// continue;
|
if (!CollectionUtils.isEmpty(appTasks)) {
|
||||||
// }
|
logger.error(locationId + "有任务执行,请稍后再试");
|
||||||
// if (isMaxDepthAvailable(appLocationList, appLocation)) {
|
throw new RuntimeException(locationId + "有任务执行,请稍后再试!");
|
||||||
// resultLocation = appLocation;
|
}
|
||||||
// break;
|
|
||||||
// }
|
AppLocation areaLocation = new AppLocation();
|
||||||
// }
|
areaLocation.setLocationStatus(1);
|
||||||
return appLocationList.get(0);
|
areaLocation.setLocationId(locationId);
|
||||||
|
List<AppLocation> tBaseStorageAreaLocations = appLocationMapper.selectAppLocationList(areaLocation);
|
||||||
|
if (!tBaseStorageAreaLocations.isEmpty()) {
|
||||||
|
AppStock AppStock1 = new AppStock();
|
||||||
|
AppStock1.setLocationId(locationId);
|
||||||
|
List<AppStock> tMiStocks1 = appStockMapper.selectAppStockList(AppStock1);
|
||||||
|
if (!tMiStocks1.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
throw new RuntimeException("库位状态异常:"+ locationId);
|
||||||
|
} else {
|
||||||
|
AppStock tMiStock1 = new AppStock();
|
||||||
|
tMiStock1.setLocationId(locationId);
|
||||||
|
List<AppStock> tMiStocks1 = appStockMapper.selectAppStockList(tMiStock1);
|
||||||
|
if (!tMiStocks1.isEmpty()) {
|
||||||
|
throw new RuntimeException("库位状态异常:"+ locationId);
|
||||||
|
}
|
||||||
|
resultLocation = appLocation1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
AppStock tMiStock1 = new AppStock();
|
||||||
|
tMiStock1.setLocationId(locId);
|
||||||
|
List<AppStock> tMiStocks1 = appStockMapper.selectAppStockList(tMiStock1);
|
||||||
|
if (!tMiStocks1.isEmpty()) {
|
||||||
|
throw new RuntimeException("库位状态异常:"+ locId);
|
||||||
|
}
|
||||||
|
resultLocation = appLocation1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
|
|
@ -185,7 +226,16 @@ public class AppLocationServiceImpl implements IAppLocationService {
|
||||||
// return locationId;
|
// return locationId;
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
private List<AppTask> getAppTaskByVehicleId(String vehicleId,String locationId) {
|
||||||
|
AppTask appTask =new AppTask();
|
||||||
|
appTask.setVehicleId(vehicleId);
|
||||||
|
appTask.setLocationId(locationId);
|
||||||
|
if(StringUtils.isBlank(locationId)) {
|
||||||
|
appTask.setTaskType(AppConstants.TASK_TYPE_OUT);
|
||||||
|
}
|
||||||
|
//判断该托盘是否产生任务
|
||||||
|
return appTaskMapper.selectAppTaskList(appTask);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 是否是最内层可用库位
|
* 是否是最内层可用库位
|
||||||
*
|
*
|
||||||
|
|
@ -292,7 +342,7 @@ public class AppLocationServiceImpl implements IAppLocationService {
|
||||||
failureNum++;
|
failureNum++;
|
||||||
String msg = "<br/>" + failureNum + "、库位 " + appLocation.getLocationId() + " 导入失败:";
|
String msg = "<br/>" + failureNum + "、库位 " + appLocation.getLocationId() + " 导入失败:";
|
||||||
failureMsg.append(msg + e.getMessage());
|
failureMsg.append(msg + e.getMessage());
|
||||||
log.error(msg, e);
|
logger.error(msg, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (failureNum > 0) {
|
if (failureNum > 0) {
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,8 @@
|
||||||
</where>
|
</where>
|
||||||
order by
|
order by
|
||||||
w_layer asc,
|
w_layer asc,
|
||||||
w_col asc,
|
|
||||||
w_depth desc,
|
w_depth desc,
|
||||||
|
w_col asc,
|
||||||
w_row asc
|
w_row asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user