|
@ -9,8 +9,11 @@ import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.http.HttpStatus; |
|
|
import cn.hutool.http.HttpStatus; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
import lombok.var; |
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.nl.common.enums.GoodsEnum; |
|
|
import org.nl.common.enums.GoodsEnum; |
|
|
import org.nl.common.exception.BadRequestException; |
|
|
import org.nl.common.exception.BadRequestException; |
|
|
import org.nl.system.service.notice.ISysNoticeService; |
|
|
import org.nl.system.service.notice.ISysNoticeService; |
|
@ -26,6 +29,7 @@ import org.nl.wms.ext.acs.service.dto.to.wms.FeedBackTaskStatusRequest; |
|
|
import org.nl.wms.ext.connector.service.WmsToConnectorService; |
|
|
import org.nl.wms.ext.connector.service.WmsToConnectorService; |
|
|
import org.nl.wms.ext.connector.service.dto.ConnectorDto; |
|
|
import org.nl.wms.ext.connector.service.dto.ConnectorDto; |
|
|
import org.nl.wms.ext.record.service.ISysInteractRecordService; |
|
|
import org.nl.wms.ext.record.service.ISysInteractRecordService; |
|
|
|
|
|
import org.nl.wms.ext.sorting.service.impl.WmsToSortingService; |
|
|
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; |
|
|
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; |
|
|
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup; |
|
|
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup; |
|
|
import org.nl.wms.sch.point.service.ISchBasePointService; |
|
|
import org.nl.wms.sch.point.service.ISchBasePointService; |
|
@ -43,6 +47,7 @@ import org.nl.wms.sch.task_manage.task.core.TaskType; |
|
|
import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper; |
|
|
import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct; |
|
|
import javax.annotation.PostConstruct; |
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
import java.lang.reflect.InvocationTargetException; |
|
@ -87,7 +92,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private WmsToConnectorService connectorService; |
|
|
private WmsToConnectorService connectorService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private ISchBaseTaskconfigService taskConfigService; |
|
|
private WmsToSortingService sortingService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private IMdBaseVehicleService iMdBaseVehicleService; |
|
|
private IMdBaseVehicleService iMdBaseVehicleService; |
|
|
|
|
|
|
|
@ -339,17 +344,27 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
*/ |
|
|
*/ |
|
|
private void releaseComplete(SchBaseTask schBaseTask, String status, String is_connector, String taskType, boolean is_empty) { |
|
|
private void releaseComplete(SchBaseTask schBaseTask, String status, String is_connector, String taskType, boolean is_empty) { |
|
|
//TODO:空料容放货完成反馈给Connector
|
|
|
//TODO:空料容放货完成反馈给Connector
|
|
|
if ("1".equals(is_connector)) { |
|
|
|
|
|
if (!is_empty) { |
|
|
if (!is_empty) { |
|
|
finishTask(schBaseTask.getTask_code(), schBaseTask.getPoint_code2()); |
|
|
finishTask(schBaseTask.getTask_code(), schBaseTask.getPoint_code2()); |
|
|
}else { |
|
|
}else { |
|
|
|
|
|
finishTask(schBaseTask.getTask_code(), schBaseTask.getPoint_code1()); |
|
|
|
|
|
|
|
|
|
|
|
if ("1".equals(is_connector)) { |
|
|
JSONObject json = new JSONObject(); |
|
|
JSONObject json = new JSONObject(); |
|
|
json.put("vehicle_code", schBaseTask.getVehicle_code()); |
|
|
json.put("vehicle_code", schBaseTask.getVehicle_code()); |
|
|
json.put("status", status); |
|
|
json.put("status", status); |
|
|
json.put("device_code", schBaseTask.getPoint_code2()); |
|
|
json.put("device_code", schBaseTask.getPoint_code2()); |
|
|
json.put("task_code", schBaseTask.getTask_code()); |
|
|
json.put("task_code", schBaseTask.getTask_code()); |
|
|
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json); |
|
|
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json); |
|
|
finishTask(schBaseTask.getTask_code(), schBaseTask.getPoint_code1()); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
if ("2".equals(is_connector)) { |
|
|
|
|
|
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 = sortingService.feedAgvTaskStatus(json); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -369,30 +384,38 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
*/ |
|
|
*/ |
|
|
private void pickupComplete(SchBaseTask schBaseTask, String status, String is_connector, String taskType) { |
|
|
private void pickupComplete(SchBaseTask schBaseTask, String status, String is_connector, String taskType) { |
|
|
//TODO:取货完成创建第二条任务:补空托盘
|
|
|
//TODO:取货完成创建第二条任务:补空托盘
|
|
|
|
|
|
String vehicle_code = schBaseTask.getVehicle_code(); |
|
|
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()) |
|
|
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())); |
|
|
.in(SchBaseTask::getTask_status, TaskStatus.APPLY.getCode(), TaskStatus.CREATED.getCode(), TaskStatus.ISSUED.getCode(), TaskStatus.EXECUTING.getCode())); |
|
|
if (CollUtil.isNotEmpty(list) || list.size() > 0) { |
|
|
if (CollectionUtils.isEmpty(list)) { |
|
|
throw new BadRequestException("该点位已有任务,请等待任务完成"); |
|
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getOne(new QueryWrapper<MdBaseVehicle>().eq("vehicle_code", vehicle_code)); |
|
|
} |
|
|
|
|
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getById(schBaseTask.getVehicle_code()); |
|
|
|
|
|
AbstractTask connectorTask = taskFactory.getTask("FTGTask"); |
|
|
AbstractTask connectorTask = taskFactory.getTask("FTGTask"); |
|
|
// 准备参数:设备编码
|
|
|
// 准备参数:设备编码
|
|
|
JSONObject param = new JSONObject(); |
|
|
JSONObject param = new JSONObject(); |
|
|
param.put("device_code", schBaseTask.getPoint_code1()); |
|
|
param.put("device_code", schBaseTask.getPoint_code1()); |
|
|
param.put("config_code", "FTGTask"); |
|
|
param.put("config_code", "FTGTask"); |
|
|
param.put("create_mode", GeneralDefinition.AUTO_CREATION); |
|
|
param.put("create_mode", GeneralDefinition.AUTO_CREATION); |
|
|
param.put("vehicle_type", StrUtil.isNotEmpty(mdBaseVehicle.getVehicle_type()) ? mdBaseVehicle.getVehicle_type() : ""); |
|
|
param.put("vehicle_type", mdBaseVehicle.getVehicle_type()); |
|
|
connectorTask.apply(param); |
|
|
connectorTask.apply(param); |
|
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) |
|
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) |
|
|
.eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1()).set(SchBasePoint::getIs_lock, true)); |
|
|
.eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1()).set(SchBasePoint::getIs_lock, true)); |
|
|
|
|
|
} |
|
|
JSONObject json = new JSONObject(); |
|
|
JSONObject json = new JSONObject(); |
|
|
json.put("vehicle_code", schBaseTask.getVehicle_code()); |
|
|
json.put("vehicle_code", vehicle_code); |
|
|
json.put("status", status); |
|
|
json.put("status", status); |
|
|
json.put("device_code", schBaseTask.getPoint_code1()); |
|
|
json.put("device_code", schBaseTask.getPoint_code1()); |
|
|
json.put("task_code", schBaseTask.getTask_code()); |
|
|
json.put("task_code", schBaseTask.getTask_code()); |
|
|
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json); |
|
|
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json); |
|
|
} |
|
|
} |
|
|
|
|
|
if ("2".equals(is_connector)) { |
|
|
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
|
|
json.put("vehicle_code", vehicle_code); |
|
|
|
|
|
json.put("status", status); |
|
|
|
|
|
json.put("device_code", schBaseTask.getPoint_code1()); |
|
|
|
|
|
json.put("task_code", schBaseTask.getTask_code()); |
|
|
|
|
|
AcsResponse acsResponse = sortingService.feedAgvTaskStatus(json); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|