add: 添加取放货逻辑
This commit is contained in:
@@ -13,10 +13,10 @@ public enum GoodsEnum {
|
||||
|
||||
OUT_OF_STOCK("无货","0"),
|
||||
|
||||
IN_STOCK("有货","1"),
|
||||
|
||||
EMPTY_PALLETS("空料容","1"),
|
||||
|
||||
IN_STOCK("有货","2"),
|
||||
|
||||
PICK_UP("取货","1"),
|
||||
|
||||
DELIVER_GOODS("送货","2");
|
||||
|
||||
@@ -91,11 +91,20 @@ public class AcsToWmsController {
|
||||
|
||||
|
||||
@PostMapping("/feedAgvTaskStatus")
|
||||
@Log("acs通知wms")
|
||||
@ApiOperation("acs通知wms")
|
||||
@Log("agv取放货反馈")
|
||||
@ApiOperation("agv取放货反馈")
|
||||
@SaIgnore
|
||||
@Deprecated
|
||||
public ResponseEntity<Object> feedAgvTaskStatus(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(acsToWmsService.feedAgvTaskStatus(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/feedAgvAgain")
|
||||
@Log("acs申请二次放货点")
|
||||
@ApiOperation("acs申请二次放货点")
|
||||
@SaIgnore
|
||||
@Deprecated
|
||||
public ResponseEntity<Object> feedAgvAgain(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(acsToWmsService.feedAgvAgain(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,4 +35,11 @@ public interface AcsToWmsService {
|
||||
* @return
|
||||
*/
|
||||
Object feedAgvTaskStatus(JSONObject param);
|
||||
|
||||
/**
|
||||
* 申请二次分配点位
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Object feedAgvAgain(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.ext.acs.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -8,12 +9,15 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.enums.GoodsEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.cockpit.service.dao.DasDeviceFault;
|
||||
import org.nl.wms.cockpit.service.mapper.CockpitMapper;
|
||||
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
|
||||
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle;
|
||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.ext.acs.service.dto.to.acs.AgainApplyResponse;
|
||||
@@ -23,6 +27,7 @@ import org.nl.wms.ext.connector.service.WmsToConnectorService;
|
||||
import org.nl.wms.ext.connector.service.dto.ConnectorDto;
|
||||
import org.nl.wms.ext.record.service.ISysInteractRecordService;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
@@ -34,6 +39,7 @@ import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.task.TaskFactory;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskType;
|
||||
import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -67,7 +73,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService;
|
||||
private ISchBaseVehiclematerialgroupService iSchBaseVehiclematerialgroupService;
|
||||
@Autowired
|
||||
private TaskFactory taskFactory;
|
||||
@Autowired
|
||||
@@ -82,6 +88,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
private WmsToConnectorService connectorService;
|
||||
@Autowired
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private IMdBaseVehicleService iMdBaseVehicleService;
|
||||
|
||||
/**
|
||||
* 初始化反射方法
|
||||
@@ -269,7 +277,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
if (ObjectUtil.isNotEmpty(param)) {
|
||||
String status = param.getString("status");
|
||||
String task_code = param.getString("task_code");
|
||||
// 1.connector;2.sorting
|
||||
String is_connector = param.getString("is_connector");
|
||||
String task_type = param.getString("task_type");
|
||||
boolean is_empty = param.getBoolean("is_empty");
|
||||
if (StrUtil.isEmpty(status) || StrUtil.isEmpty(task_code)) {
|
||||
throw new BadRequestException("状态或任务号为空!");
|
||||
}
|
||||
@@ -280,15 +291,15 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
switch (status) {
|
||||
case "1":
|
||||
//申请取货
|
||||
requestPickup(schBaseTask, status);
|
||||
requestPickup(schBaseTask, status, is_connector);
|
||||
break;
|
||||
case "2":
|
||||
//取货完成
|
||||
pickupComplete(schBaseTask, status, is_connector);
|
||||
pickupComplete(schBaseTask, status, is_connector, task_type);
|
||||
break;
|
||||
case "4":
|
||||
//放货完成
|
||||
releaseComplete(schBaseTask, status);
|
||||
releaseComplete(schBaseTask, status, is_connector, task_type, is_empty);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -297,15 +308,56 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object feedAgvAgain(JSONObject param) {
|
||||
if(ObjectUtil.isNotEmpty(param)){
|
||||
String task_id = param.getString("task_id");
|
||||
String device_code = param.getString("device_code");
|
||||
if(StrUtil.isEmpty(task_id) || StrUtil.isEmpty(device_code)){
|
||||
throw new BadRequestException("task_id或device_code为空!");
|
||||
}
|
||||
SchBaseTask schBaseTask = taskService.getById(task_id);
|
||||
if(ObjectUtil.isEmpty(schBaseTask)){
|
||||
throw new BadRequestException("任务不存在!task_id:" + task_id);
|
||||
}
|
||||
if(device_code.equals(schBaseTask.getPoint_code2())) throw new BadRequestException("设备号与任务设备不匹配!");
|
||||
//查询点位是否存在
|
||||
SchBasePoint schBasePoint = pointService.selectByPointCode(device_code);
|
||||
if(ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("点位不存在!device_code:" + device_code);
|
||||
SchBasePoint schBasePoint1 = pointService.selectByNextWaitPoint(device_code);
|
||||
//
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 放货完成
|
||||
*
|
||||
* @param schBaseTask
|
||||
* @param status
|
||||
*/
|
||||
private void releaseComplete(SchBaseTask schBaseTask, String status) {
|
||||
//TODO:放货完成反馈给Connector
|
||||
private void releaseComplete(SchBaseTask schBaseTask, String status, String is_connector, String taskType, boolean is_empty) {
|
||||
//TODO:空料容放货完成反馈给Connector
|
||||
if ("1".equals(is_connector)) {
|
||||
if (!is_empty) {
|
||||
finishTask(schBaseTask.getTask_code(), schBaseTask.getPoint_code2());
|
||||
} else {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("vehicle_code", schBaseTask.getVehicle_code());
|
||||
json.put("status", status);
|
||||
json.put("device_code", schBaseTask.getPoint_code2());
|
||||
json.put("task_code", schBaseTask.getTask_code());
|
||||
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json);
|
||||
finishTask(schBaseTask.getTask_code(), schBaseTask.getPoint_code1());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void finishTask(String task_code, String point_code) {
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
taskService.update(Wrappers.lambdaUpdate(SchBaseTask.class).eq(SchBaseTask::getTask_code, task_code)
|
||||
.set(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -314,20 +366,31 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
* @param schBaseTask
|
||||
* @param status
|
||||
*/
|
||||
private void pickupComplete(SchBaseTask schBaseTask, String status, String is_connector) {
|
||||
private void pickupComplete(SchBaseTask schBaseTask, String status, String is_connector, String taskType) {
|
||||
//TODO:取货完成创建第二条任务:补空托盘
|
||||
if("1".equals(is_connector)){
|
||||
if ("1".equals(is_connector)) {
|
||||
List<SchBaseTask> list = taskService.list(Wrappers.lambdaQuery(SchBaseTask.class).eq(SchBaseTask::getPoint_code2, schBaseTask.getPoint_code1())
|
||||
.in(SchBaseTask::getTask_status, TaskStatus.APPLY.getCode(), TaskStatus.CREATED.getCode(), TaskStatus.ISSUED.getCode(), TaskStatus.EXECUTING.getCode()));
|
||||
if (CollUtil.isNotEmpty(list) || list.size() > 0) {
|
||||
throw new BadRequestException("该点位已有任务,请等待任务完成");
|
||||
}
|
||||
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getById(schBaseTask.getVehicle_code());
|
||||
AbstractTask connectorTask = taskFactory.getTask("FTGTask");
|
||||
// 准备参数:设备编码
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", schBaseTask.getPoint_code2());
|
||||
param.put("device_code", schBaseTask.getPoint_code1());
|
||||
param.put("config_code", "FTGTask");
|
||||
param.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
/*param.put("vehicle_code", vehicle_code);
|
||||
param.put("task_type", task_type);
|
||||
param.put("task_code", task_code);
|
||||
param.put("remark",remark);*/
|
||||
param.put("vehicle_type", StrUtil.isNotEmpty(mdBaseVehicle.getVehicle_type()) ? mdBaseVehicle.getVehicle_type() : "");
|
||||
connectorTask.apply(param);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1()).set(SchBasePoint::getIs_lock, true));
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("vehicle_code", schBaseTask.getVehicle_code());
|
||||
json.put("status", status);
|
||||
json.put("device_code", schBaseTask.getPoint_code1());
|
||||
json.put("task_code", schBaseTask.getTask_code());
|
||||
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,27 +399,39 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
*
|
||||
* @param schBaseTask
|
||||
*/
|
||||
private void requestPickup(SchBaseTask schBaseTask, String status) {
|
||||
//反馈connector申请取货
|
||||
SchBaseTaskconfig schBaseTaskconfig = taskConfigService.selectByConfigCode(schBaseTask.getConfig_code());
|
||||
JSONObject json = new JSONObject();
|
||||
if (GoodsEnum.PICK_UP.getValue().equals(schBaseTaskconfig.getTask_qf_type())) {
|
||||
json.put("vehicle_code", schBaseTask.getVehicle_code());
|
||||
json.put("status", status);
|
||||
json.put("device_code", schBaseTask.getPoint_code2());
|
||||
json.put("task_code", schBaseTask.getTask_code());
|
||||
} else if (GoodsEnum.DELIVER_GOODS.getValue().equals(schBaseTaskconfig.getTask_qf_type())) {
|
||||
private void requestPickup(SchBaseTask schBaseTask, String status, String is_connector) {
|
||||
if ("1".equals(is_connector)) {
|
||||
//反馈connector申请取货
|
||||
/*SchBaseTaskconfig schBaseTaskconfig = taskConfigService.selectByConfigCode(schBaseTask.getConfig_code());*/
|
||||
JSONObject json = new JSONObject();
|
||||
// if (GoodsEnum.PICK_UP.getValue().equals(schBaseTaskconfig.getTask_qf_type())) {
|
||||
// json.put("vehicle_code", schBaseTask.getVehicle_code());
|
||||
// json.put("status", status);
|
||||
// json.put("device_code", schBaseTask.getPoint_code2());
|
||||
// json.put("task_code", schBaseTask.getTask_code());
|
||||
// } else if (GoodsEnum.DELIVER_GOODS.getValue().equals(schBaseTaskconfig.getTask_qf_type())) {
|
||||
json.put("vehicle_code", schBaseTask.getVehicle_code());
|
||||
json.put("status", status);
|
||||
json.put("device_code", schBaseTask.getPoint_code1());
|
||||
json.put("task_code", schBaseTask.getTask_code());
|
||||
}
|
||||
boolean flag = true;
|
||||
while (flag) {
|
||||
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json);
|
||||
if (acsResponse.getStatus() == 200 && StrUtil.isNotEmpty(acsResponse.getData())) {
|
||||
vehiclematerialgroupService.updateByVehicleCode(schBaseTask.getVehicle_code(), acsResponse.getData());
|
||||
flag = false;
|
||||
boolean flag = true;
|
||||
while (flag) {
|
||||
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json);
|
||||
if (acsResponse.getStatus() == 200 && StrUtil.isNotEmpty(acsResponse.getData())) {
|
||||
JSONArray objects = JSONObject.parseArray(acsResponse.getData());
|
||||
List<ConnectorDto> connectorDtos = BeanUtil.copyToList(objects, ConnectorDto.class);
|
||||
for (ConnectorDto connectorDto : connectorDtos) {
|
||||
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
|
||||
schBaseVehiclematerialgroup.setVehicle_code(connectorDto.getVehicle_code());
|
||||
schBaseVehiclematerialgroup.setJob_name(connectorDto.getJobname());
|
||||
schBaseVehiclematerialgroup.setMaterial_id(connectorDto.getProductID());
|
||||
schBaseVehiclematerialgroup.setMaterial_qty(connectorDto.getCurrentqty());
|
||||
schBaseVehiclematerialgroup.setRegion_code(connectorDto.getProductionOrder());
|
||||
iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
|
||||
}
|
||||
// vehiclematerialgroupService.updateByVehicleCode(schBaseTask.getVehicle_code(), acsResponse.getData());
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ConnectorDto {
|
||||
/**
|
||||
* 装载数量
|
||||
*/
|
||||
private String Currentqty;
|
||||
private Integer Currentqty;
|
||||
/**
|
||||
* X尺寸
|
||||
*/
|
||||
|
||||
@@ -59,17 +59,22 @@ public class ConnectorToWmsServiceImpl implements ConnectorToWmsService {
|
||||
if (StrUtil.isEmpty(task_code) || StrUtil.isEmpty(start_device_code) || StrUtil.isEmpty(vehicle_code)) {
|
||||
map1.put("task_code", task_code);
|
||||
map1.put("status", HttpStatus.HTTP_INTERNAL_ERROR);
|
||||
map1.put("message",StrUtil.isEmpty(task_code) ? "任务号不能为空!"
|
||||
map1.put("message", StrUtil.isEmpty(task_code) ? "任务号不能为空!"
|
||||
: StrUtil.isEmpty(start_device_code) ? "起点参数不能为空!" : StrUtil.isEmpty(vehicle_code) ? "载具号不能为空!" : "未知");
|
||||
objects.add(map1);
|
||||
continue;
|
||||
}
|
||||
SchBasePoint schBasePoint = schBasePointService.selectByPointCode(start_device_code);
|
||||
if(ObjectUtil.isEmpty(schBasePoint) || StrUtil.isNotEmpty(schBasePoint.getIng_task_code())){
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
map1.put("task_code", task_code);
|
||||
map1.put("status", HttpStatus.HTTP_INTERNAL_ERROR);
|
||||
map1.put("message",ObjectUtil.isEmpty(schBasePoint)
|
||||
? start_device_code + "起点设备不存在!" : start_device_code + "该设备正在执行任务!");
|
||||
map1.put("message", start_device_code + "起点设备不存在!");
|
||||
objects.add(map1);
|
||||
continue;
|
||||
} else if (schBasePoint.getIs_lock()) {
|
||||
map1.put("task_code", task_code);
|
||||
map1.put("status", HttpStatus.HTTP_INTERNAL_ERROR);
|
||||
map1.put("message", start_device_code + "该设备正在执行任务!");
|
||||
objects.add(map1);
|
||||
continue;
|
||||
}
|
||||
@@ -88,9 +93,10 @@ public class ConnectorToWmsServiceImpl implements ConnectorToWmsService {
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("task_type", task_type);
|
||||
param.put("task_code", task_code);
|
||||
param.put("remark",remark);
|
||||
param.put("remark", remark);
|
||||
param.put("ext_data", data);
|
||||
connectorTask.apply(param);
|
||||
/*schBasePoint.setIng_task_code(task_code);
|
||||
/*schBasePoint.setIs_lock(true);
|
||||
schBasePointService.updateById(schBasePoint);*/
|
||||
map1.put("task_code", task_code);
|
||||
map1.put("status", HttpStatus.HTTP_OK);
|
||||
|
||||
@@ -65,6 +65,9 @@ public class SchBaseVehiclematerialgroup implements Serializable {
|
||||
@ApiModelProperty(value = "物料数量")
|
||||
private Integer material_qty;
|
||||
|
||||
@ApiModelProperty(value = "connector任务号")
|
||||
private String job_name;
|
||||
|
||||
@ApiModelProperty(value = "物料重量")
|
||||
private BigDecimal material_weight;
|
||||
|
||||
|
||||
@@ -101,4 +101,12 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
|
||||
* @return
|
||||
*/
|
||||
SchBasePoint selectByReassign(String region_code ,String vehicleCode);
|
||||
|
||||
/**
|
||||
* 根据终点等待设备查询
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
SchBasePoint selectByNextWaitPoint(String device_code);
|
||||
|
||||
}
|
||||
|
||||
@@ -237,8 +237,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
if(ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!");
|
||||
//查询满足条件的站点
|
||||
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false).
|
||||
isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getRegion_code, region_code)
|
||||
.eq(SchBasePoint::getVehicle_type, mdBaseVehicle.getVehicle_type()).eq(SchBasePoint::getIs_used, true));
|
||||
isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getRegion_code, region_code).eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||
.eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type()).eq(SchBasePoint::getIs_used, true));
|
||||
if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){
|
||||
SchBasePoint schBasePoint = schBasePoints.get(0);
|
||||
schBasePoint.setVehicle_code(vehicleCode);
|
||||
@@ -254,8 +254,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
}
|
||||
//分配载具类型相同的站点
|
||||
List<SchBasePoint> schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false).
|
||||
isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getVehicle_type, mdBaseVehicle.getVehicle_type())
|
||||
.eq(SchBasePoint::getIs_used, true));
|
||||
isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type())
|
||||
.eq(SchBasePoint::getIs_used, true).eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()));
|
||||
if(CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0){
|
||||
SchBasePoint schBasePoint = schBasePoints.get(0);
|
||||
schBasePoint.setVehicle_code(vehicleCode);
|
||||
@@ -274,7 +274,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
|
||||
@Override
|
||||
public SchBasePoint selectByPointCode(String start_device_code) {
|
||||
return getById(start_device_code);
|
||||
return pointMapper.selectOne(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getPoint_code, start_device_code)
|
||||
.eq(SchBasePoint::getIs_used, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -284,8 +285,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
if(ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!");
|
||||
//查询满足条件的站点
|
||||
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false).
|
||||
isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getRegion_code, region_code)
|
||||
.eq(SchBasePoint::getVehicle_type, mdBaseVehicle.getVehicle_type()).eq(SchBasePoint::getIs_used, true));
|
||||
isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getRegion_code, region_code).eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||
.eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type()).eq(SchBasePoint::getIs_used, true));
|
||||
if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){
|
||||
SchBasePoint schBasePoint = pointMapper.selectById(schBasePoints.get(0).getNext_wait_point());
|
||||
if(ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("没有找到等待点!");
|
||||
@@ -302,8 +303,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
}
|
||||
//分配载具类型相同的站点
|
||||
List<SchBasePoint> schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false).
|
||||
isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getVehicle_type, mdBaseVehicle.getVehicle_type())
|
||||
.eq(SchBasePoint::getIs_used, true));
|
||||
isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type())
|
||||
.eq(SchBasePoint::getIs_used, true).eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()));
|
||||
if(CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0){
|
||||
SchBasePoint schBasePoint = pointMapper.selectById(schBasePoints.get(0).getNext_wait_point());
|
||||
if(ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("没有找到等待点!");
|
||||
@@ -321,6 +322,17 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchBasePoint selectByNextWaitPoint(String device_code) {
|
||||
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getNext_wait_point, device_code).eq(SchBasePoint::getIs_used, true)
|
||||
.eq(SchBasePoint::getIs_lock, false).isNull(SchBasePoint::getVehicle_code)
|
||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()));
|
||||
if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){
|
||||
return schBasePoints.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation= Propagation.REQUIRES_NEW)
|
||||
public SchBasePoint selectEmpVehicleByRegionCode(String region_code, String...vehicleType) {
|
||||
|
||||
@@ -266,13 +266,14 @@ public abstract class AbstractTask {
|
||||
? param.getString("create_mode") : GeneralDefinition.ACS_CREATION);
|
||||
task.setVehicle_code(param.getString("vehicle_code"));
|
||||
task.setVehicle_qty(param.getInteger("vehicle_qty"));
|
||||
task.setVehicle_type(param.getString("vehicle_type"));
|
||||
task.setTask_status(TaskStatus.APPLY.getCode());
|
||||
task.setTask_type(StrUtil.isNotEmpty(param.getString("task_type")) ? param.getString("task_type") : taskConfig.getTask_type());
|
||||
task.setWorkshop_code(taskConfig.getWorkshop_code());
|
||||
task.setRemark(param.getString("remark"));
|
||||
// 设置起/终点
|
||||
this.setTaskPoint(taskConfig, task, apply_point_code);
|
||||
task.setRequest_param(JSONObject.toJSONString(param));
|
||||
task.setRequest_param(JSONObject.toJSONString(param.get("ext_data")));
|
||||
// 设置创建人信息
|
||||
TaskUtils.setCreateByAcsOrPda(task, param);
|
||||
AbstractTask bean = SpringContextHolder.getBean(this.getClass());
|
||||
|
||||
@@ -3,7 +3,9 @@ package org.nl.wms.sch.task_manage.task.tasks.cnt;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.enums.GoodsEnum;
|
||||
import org.nl.common.enums.region.RegionEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
@@ -87,7 +89,7 @@ public class CNTTask extends AbstractTask {
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
taskService.updateById(task);
|
||||
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
}
|
||||
@@ -153,13 +155,15 @@ public class CNTTask extends AbstractTask {
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||
.set(SchBasePoint::getIs_lock, false).set(SchBasePoint::getVehicle_code, null));
|
||||
}
|
||||
String point_code2 = taskObj.getPoint_code2();
|
||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||
pointService.updateById(schBasePoint2);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
||||
.set(SchBasePoint::getIs_lock, false).set(SchBasePoint::getVehicle_code, null));
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.enums.GoodsEnum;
|
||||
import org.nl.common.enums.region.RegionEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
@@ -56,10 +57,8 @@ public class FTGTask extends AbstractTask {
|
||||
// 找起点
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
// 根据对接位查找对应的载具类型
|
||||
SchBasePoint schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(),task.getVehicle_code());
|
||||
if(ObjectUtil.isEmpty(schBasePoint)) continue;
|
||||
jsonObject.put("vehicle_type", schBasePoint.getCan_vehicle_type());
|
||||
// 查找空载具点位
|
||||
SchBasePoint schBasePoint = schBasePointService.selectEmpVehicleByRegionCode(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(),task.getVehicle_type());
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
task.setRemark("未找到所需点位!");
|
||||
taskService.updateById(task);
|
||||
@@ -81,7 +80,8 @@ public class FTGTask extends AbstractTask {
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
taskService.updateById(task);
|
||||
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
schBasePoint.setIs_lock(true);
|
||||
schBasePoint.setPoint_status(GoodsEnum.OUT_OF_STOCK.getValue());
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,8 @@ public class PointUtils {
|
||||
* @param schBasePoint
|
||||
*/
|
||||
public static void updateByIngTaskCode(SchBasePoint schBasePoint) {
|
||||
schBasePoint.setIng_task_code(null);
|
||||
schBasePoint.setVehicle_code(null);
|
||||
schBasePoint.setIs_lock(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user