add 项目更新

This commit is contained in:
zhoujj
2026-01-30 17:44:28 +08:00
parent 0f979310d7
commit d0c14a6b58
63 changed files with 1748 additions and 411 deletions

View File

@@ -46,14 +46,7 @@ public interface NDCAgvService {
*/
public byte[] sendAgvOneModeInst(int phase, int index, int result, int startPoint, int nextPoint, int startHigh, int nextHigh);
/**
* 下发二号agv指令
* @param phase
* @param index
* @param result
* @return
*/
public byte[] sendAgvTwoModeInst(int phase, int index, int result);
/**
* 下发一号agv指令
@@ -65,6 +58,17 @@ public interface NDCAgvService {
public byte[] sendAgvOneModeInst(int phase, int index, int result);
/**
* 下发二次分配
* @param phase
* @param index
* @param result
* @return
*/
public byte[] sendAgvTwoModeInst(int phase, int index, int result,Instruction inst);
/**
* 下发充电任务
*

View File

@@ -80,7 +80,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
public void sendAgvInstToNDC(String agv_system_type, Instruction inst) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
String instcode = inst.getInstruction_code();
int type = Integer.parseInt(inst.getInstruction_type());
Integer type = Integer.parseInt(inst.getInstruction_type());
int priority = Integer.parseInt(inst.getPriority()) + 128;
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
@@ -109,7 +109,11 @@ public class NDCAgvServiceImpl implements NDCAgvService {
str1 += "/priority:" + hexToString(prioritylow & 0xFF);
System.out.println(str);
System.out.println(str1);
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
String car_type=inst.getCar_type();
byte[] b=new byte[]{};
if(car_type.equals("1")&& type.equals(1)){
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X12,
(byte) 0X00, (byte) 0X01,
@@ -122,7 +126,62 @@ public class NDCAgvServiceImpl implements NDCAgvService {
(byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow,
(byte) fhdhigh, (byte) fhdlow
};
};}else if(car_type.equals("2")&& type.equals(1)){
int car_width=Integer.parseInt(inst.getCar_width());
byte car_width1=(byte) IntToHexHigh(car_width);
byte car_width2=(byte) IntToHexLow(car_width);
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X14,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X10,
(byte) 0X01, prioritylow,
(byte) 0X00, (byte) 0X01,
(byte) ikeyhigh, (byte) ikeylow,
(byte) ikeyhigh, (byte) ikeylow,
(byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow,
(byte) fhdhigh, (byte) fhdlow,
(byte) car_width1,(byte) car_width2,
};}else if(car_type.equals("1")&& type.equals(2)){
fhdhigh=2;
fhdlow=3;
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X12,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X0E,
(byte) 0X01, prioritylow,
(byte) 0X00, (byte) 0X01,
(byte) ikeyhigh, (byte) ikeylow,
(byte) ikeyhigh, (byte) ikeylow,
(byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow,
(byte) fhdhigh, (byte) fhdlow
};}else if(car_type.equals("2")&& type.equals(2)){
fhdhigh=2;
fhdlow=3;
int car_width=Integer.parseInt(inst.getCar_width());
byte car_width1=(byte) IntToHexHigh(car_width);
byte car_width2=(byte) IntToHexLow(car_width);
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X14,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X10,
(byte) 0X01, prioritylow,
(byte) 0X00, (byte) 0X01,
(byte) ikeyhigh, (byte) ikeylow,
(byte) ikeyhigh, (byte) ikeylow,
(byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow,
(byte) fhdhigh, (byte) fhdlow,
(byte) car_width1,(byte) car_width2,
};}
log.info("下发AGV作业指令--{}", str1);
OneNDCSocketConnectionAutoRun.write(b);
System.out.println("下发agv指令数据:" + Bytes2HexString(b));
@@ -160,9 +219,39 @@ public class NDCAgvServiceImpl implements NDCAgvService {
}
@Override
public byte[] sendAgvTwoModeInst(int phase, int index, int result) {
return new byte[0];
public byte[] sendAgvTwoModeInst(int phase, int index, int result,Instruction inst) {
if (phase < 0 || index < 0) {
return null;
}
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
int finish_code = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
log.info("最终指{}",inst.getNext_point_code());
byte indexhigh = (byte) IntToHexHigh(index);
byte indexlow = (byte) IntToHexLow(index);
byte phasehigh = (byte) IntToHexHigh(phase);
byte phaselow = (byte) IntToHexLow(phase);
byte resulthigh = (byte) IntToHexHigh(result);
byte resultlow = (byte) IntToHexLow(result);
byte finish_code1= (byte) IntToHexHigh(finish_code);
byte finish_code2 = (byte) IntToHexLow(finish_code);
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X0C,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X6D,
(byte) 0X00, (byte) 0X08,
(byte) indexhigh, (byte) indexlow,
(byte) 0X01, (byte) 0X12,
(byte) phasehigh, (byte) phaselow,
(byte) finish_code1, (byte) finish_code2
};
log.info("反馈agv二次分配动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF));
System.out.println("反馈agv二次分配动作数据:" + Bytes2HexString(b));
return b;
}

View File

@@ -1,13 +1,18 @@
package org.nl.acs.device.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import lombok.RequiredArgsConstructor;
import org.nl.acs.device.device_driver.DriverTypeEnum;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.dto.DeviceDto;
import org.nl.common.logging.annotation.Log;
import org.nl.common.utils.IdUtil;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -19,7 +24,12 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
/**
* @author jiaolm
@@ -356,4 +366,50 @@ public class DeviceController {
deviceService.excelImport(file, request);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/batchSaveAttr")
@SaIgnore
public ResponseEntity<Object> batchSaveDevice(@Validated @RequestBody JSONObject config) {
int = config.getInteger("x");
int = config.getInteger("y");
int = config.getInteger("z");
String pre = config.getString("pre");
String now = DateUtil.now();
ArrayList<Device> list = new ArrayList<>();
for (int x = 1; x <= ; x++) {
for (int y = 1; y <= ; y++) {
for (int z = 1; z <= ; z++) {
Device device = new Device();
device.setDevice_id(IdUtil.getStringId());
String nx = "" + x;
String ny = "" + y;
String nz = "" + z;
if(x<10){
nx="0"+nx;
}
if(y<10){
ny="0"+ny;
}
device.setDevice_code(pre+nx+ny+"0"+nz);
device.setDevice_name(pre+nx+ny+"0"+nz);
device.setDevice_type("station");
device.setIs_config("false");
device.setIs_route("false");
device.setDriver_code("standard_ordinary_site");
device.setIs_active("1");
device.setSeq_num(BigDecimal.valueOf(1));
device.setIs_delete("0");
device.setCreate_by("admin");
device.setCreate_time("2025-12-26 17:29:33");
list.add(device);
}
}
}
Lists.partition(list,1000).stream().map((Function<List<Device>, CompletableFuture>) o->CompletableFuture.runAsync(() -> {
for (Device stIvtStructattr : o) {
deviceService.save(stIvtStructattr);
}
})).parallel().forEach(CompletableFuture::join);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -33,6 +33,7 @@ import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.common.exception.BadRequestException;
import org.nl.config.SpringContextHolder;
import org.nl.config.thread.ThreadPoolExecutorUtil;
import org.nl.system.service.lucene.LuceneExecuteLogService;
@@ -166,11 +167,26 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
//取货完毕
//(需要WCS反馈)
} else if (phase == 0x05) {
task.setTask_status("8");
taskserver.update(task);
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("agv进入" + device_code + "取货完成");
flag = true;
} else if (phase == 0x06) {
data = getData(data, index, inst, task);
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_id", task.getExt_task_id());
feed_jo.put("task_code", task.getTask_code());
feed_jo.put("task_status","10");
JSONArray ja = new JSONArray();
ja.add(feed_jo);
acsToWmsService.feedTaskStatus(ja);
Instruction inst1 = instructionService.findBytaskCode(inst.getTask_id());
log.info("二次分配指令终点是{}",inst1.getNext_point_code());
if(inst1.getNext_point_code().equals("CKFPW")){
throw new BadRequestException("没有出库点位了请释放");
}
data=ndcAgvService.sendAgvTwoModeInst(phase,index,0,inst1);
flag = true;
//到达放货点
//(需要WCS反馈)
} else if (phase == 0x07) {

View File

@@ -14,6 +14,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.domain.InstructionMybatis;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;

View File

@@ -87,13 +87,7 @@ public class CreateTaskRequest extends BaseRequest {
/**
* 任务标识
*/
private String ext_task_id;
private String ext_task_uuid;
/**
@@ -226,4 +220,10 @@ public class CreateTaskRequest extends BaseRequest {
* 17 木箱堆叠行架任务
*/
private String class_type;
}
/**
* 车辆类型 1 ps20 2 RT
*/
private String car_type;
private String car_width;
}

View File

@@ -8,6 +8,7 @@ import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yomahub.tlog.hutoolhttp.TLogHutoolhttpInterceptor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -23,6 +24,9 @@ import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingRequest;
import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingResponse;
import org.nl.acs.ext.wms.data.one.BaseRequest;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.domain.InstructionMybatis;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
@@ -54,6 +58,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Autowired
DeviceExecuteLogService logServer;
@Autowired
InstructionService instructionService;
@Autowired
private LuceneExecuteLogService luceneLogService;
@@ -161,6 +168,21 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
if (ObjectUtil.isNotEmpty(result2) && result2.getStatus() == 200) {
type = "info";
JSONObject jo = JSONObject.parseObject(result2.body());
if(!StrUtil.isEmpty(jo.getString("finish_code"))){
String finish_code=jo.getString("finish_code");
if(taskDto.getCar_type().equals("2")){
finish_code=finish_code+"-R";
}
taskDto.setNext_point_code(finish_code);
taskDto.setNext_device_code(finish_code);
taskDto.setTask_status("1");
taskService.update(taskDto);
Instruction instruction=instructionService.findBytaskCode(taskDto.getTask_id());
instruction.setNext_device_code(finish_code);
instruction.setNext_point_code(finish_code);
instructionService.update(instruction);
//找到最新的一条指令
}
log.info("feedbackTaskStatusToWms-----输出参数{}", jo.toString());
LuceneLogDto luceneLogDto = new LuceneLogDto(4,"feedTaskStatus", String.valueOf(result2.getStatus()),
String.valueOf(data), String.valueOf(result2.body()), "ACS向WMS反馈任务状态");
@@ -169,6 +191,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} else {
type = "error";
}
return null;
} finally {
MDC.remove(log_file_type);

View File

@@ -76,19 +76,26 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
String data = datas.get(i).toString();
CreateTaskRequest request = JsonUtl.format(data, CreateTaskRequest.class);
String paper_array = request.getPaper_array();
String ext_task_id = request.getExt_task_id();
String ext_task_id = request.getExt_task_uuid();
String task_code = request.getTask_code();
//车辆类型
String car_type=request.getCar_type();
String car_width=request.getCar_width();
String start_device_code = request.getStart_device_code();
String start_device_code2 = request.getStart_device_code2();
String next_device_code = request.getNext_device_code();
String next_device_code2 = request.getNext_device_code2();
String put_device_code = request.getPut_device_code();
String task_type = request.getTask_type();
if(task_type.equals("1")&&car_type.equals("2")){
start_device_code=start_device_code+"-R";
}
String priority = request.getPriority();
String vehicle_code = request.getVehicle_code();
String vehicle_code2 = request.getVehicle_code2();
String vehicle_type = request.getVehicle_type();
String route_plan_code = request.getRoute_plan_code();
String task_type = request.getTask_type();
String class_type = request.getClass_type();
String truss_type = request.getTruss_type();
Integer agv_action_type = request.getAgv_action_type();
@@ -300,6 +307,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("size", JSONUtil.toJsonStr(size));
jo.put("version", JSONUtil.toJsonStr(version));
jo.put("bushing_num", JSONUtil.toJsonStr(bushing_num));
jo.put("car_type",car_type);
jo.put("car_width",car_width);
if (!StrUtil.isEmpty(ext_task_id)) {
jo.put("ext_task_id", ext_task_id);
}

View File

@@ -232,6 +232,10 @@ public class InstructionMybatis extends CommonModel<InstructionMybatis> implemen
/** AGV系统类型 */
private String agv_system_type;
private String car_type;
private String car_width;
public void copyFrom(Instruction source) {
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
}

View File

@@ -444,4 +444,10 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
* @return
*/
Boolean querySameNextDeviceCodeInstByOut(String nextDeviceCode);
/**
*
*
*/
Instruction findBytaskCode(String task_id);
}

View File

@@ -363,5 +363,6 @@ public class InstructionDto implements Serializable {
* 单工位堆垛机101-199 双工位堆垛机201-255
*/
private String to_device_code;
private String car_type;
private String car_width;
}

View File

@@ -11,6 +11,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
@@ -243,6 +244,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) {
wrapper.between(InstructionMybatis::getCreate_time, create_time, end_time);
}
wrapper.orderByDesc(InstructionMybatis::getCreate_time);
IPage<InstructionMybatis> insPage = instructionMapper.selectPage(queryPage, wrapper);
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(insPage, InstructionDto.class));
return json;
@@ -362,9 +364,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
if (StrUtil.isEmpty(dto.getIs_send())) {
dto.setIs_send(task.getIs_send());
}
if (StrUtil.isEmpty(dto.getLink_num())) {
dto.setIs_send(task.getLink_num());
}
// if (StrUtil.isEmpty(dto.getLink_num())) {
// dto.setIs_send(task.getLink_num());
// }
// if (task.getTask_type().equals(CommonFinalParam.ONE) || task.getTask_type().equals("2")) {
dto.setInstruction_type(task.getTask_type());
// } else if (false) {
@@ -396,7 +398,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
dto.setCreate_time(now);
dto.setStart_parent_code(task.getStart_parent_code());
dto.setNext_parent_code(task.getNext_parent_code());
dto.setCar_width(task.getCar_width());
dto.setCar_type(task.getCar_type());
if (ObjectUtil.isNotEmpty(task.getTask_type())) {
dto.setInstruction_type(task.getTask_type());
}
@@ -409,26 +412,26 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
String start_device_code = dto.getStart_device_code();
String next_device_code = dto.getNext_device_code();
String route_plan_code = task.getRoute_plan_code();
List<RouteLineDto> shortPathsList =
routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
RouteLineDto route = null;
for (int i = 0; i < shortPathsList.size(); i++) {
RouteLineDto routeLineDto = shortPathsList.get(i);
String route_device = routeLineDto.getDevice_code();
String route_next_device = routeLineDto.getNext_device_code();
if (route_device.equals(dto.getStart_device_code())
&& route_next_device.equals(dto.getNext_device_code())) {
route = routeLineDto;
break;
}
}
if (ObjectUtil.isEmpty(route)) {
throw new BadRequestException(LangProcess.msg("error_isNull", "route"));
}
if (StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
// List<RouteLineDto> shortPathsList =
// routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
// RouteLineDto route = null;
// for (int i = 0; i < shortPathsList.size(); i++) {
// RouteLineDto routeLineDto = shortPathsList.get(i);
// String route_device = routeLineDto.getDevice_code();
// String route_next_device = routeLineDto.getNext_device_code();
// if (route_device.equals(dto.getStart_device_code())
// && route_next_device.equals(dto.getNext_device_code())) {
// route = routeLineDto;
// break;
// }
// }
// if (ObjectUtil.isEmpty(route)) {
// throw new BadRequestException(LangProcess.msg("error_isNull", "route"));
// }
// if (StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
}
// }
//判断是否是仙工AGV
/* if(CommonFinalParam.ONE.equals(route.getType())){
HttpResponse response = xiangGongAgvService.sendOrderSequencesToXZ(dto);
@@ -642,6 +645,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
dto.setUpdate_by(currentUsername);
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
instructionMapper.updateById(entity);
if (dto.getExecute_status() != null && dto.getExecute_status().equals("2")) {
taskService.finishmove(dto.getTask_id());
}
removeByCodeFromCache(dto.getInstruction_code());
instructions.add(dto);
}
@@ -710,7 +716,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
String insttaskid = entity.getTask_id();
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device startdevice = appService.findDeviceByCode(entity.getStart_device_code());
Device startdevice = appService.findDeviceByCode(entity.getStart_point_code());
if (ObjectUtils.isEmpty(startdevice)) {
log.debug("地址对应设备未找到");
throw new BadRequestException(LangProcess.msg("error_isNull", entity.getStart_device_code()));
@@ -1237,13 +1243,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} else {
next_device_code = next_point_code;
}
if (StrUtil.contains(start_point_code, commonFinalParam.getBARRE()) && StrUtil.count(start_point_code, commonFinalParam.getBARRE()) == 2) {
String[] start_point = start_point_code.split(commonFinalParam.getBARRE());
inst.setFrom_x(start_point[0]);
inst.setStart_device_code(start_point[0]);
inst.setFrom_y(start_point[1]);
inst.setFrom_z(start_point[2]);
} else {
// if (StrUtil.contains(start_point_code, commonFinalParam.getBARRE()) && StrUtil.count(start_point_code, commonFinalParam.getBARRE()) == 2) {
// String[] start_point = start_point_code.split(commonFinalParam.getBARRE());
// inst.setFrom_x(start_point[0]);
// inst.setStart_device_code(start_point[0]);
// inst.setFrom_y(start_point[1]);
// inst.setFrom_z(start_point[2]);
// } else {
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(start_point_code).getDeviceDriverDefination();
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
String start_device =
@@ -1261,7 +1267,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
inst.setStart_device_code(start_device_code);
}
}
}
// }
if (StrUtil.contains(next_point_code, commonFinalParam.getBARRE()) && StrUtil.count(next_point_code, commonFinalParam.getBARRE()) == 2) {
String[] next_point = next_point_code.split(commonFinalParam.getBARRE());
@@ -1270,10 +1276,10 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
inst.setTo_y(next_point[1]);
inst.setTo_z(next_point[2]);
} else {
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(next_device_code).getDeviceDriverDefination();
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
DeviceDriverDefination deviceDriverDefination1 = deviceAppService.findDeviceByCode(next_device_code).getDeviceDriverDefination();
if (BeanUtil.isNotEmpty(deviceDriverDefination1)) {
String next_device =
deviceDriverDefination
deviceDriverDefination1
.getFitDeviceTypes()
.get(0)
.name();
@@ -1619,6 +1625,18 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.collect(Collectors.toList())
.isEmpty();
}
@Override
public Instruction findBytaskCode(String task_id) {
InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper)
.eq(InstructionMybatis::getTask_id, task_id)
.orderByDesc(InstructionMybatis::getCreate_time)
.last("LIMIT 1") // 关键:限制结果只返回第一条
.one();
if (ObjectUtil.isEmpty(ins)) {
return null;
}
return ConvertUtil.convert(ins, Instruction.class);
}
}

View File

@@ -673,7 +673,7 @@ public class RouteLineServiceImpl extends CommonServiceImpl<RouteLineMapper, Rou
@Override
public void autoInitial() throws Exception {
this.reload();
// this.reload();
}

View File

@@ -229,6 +229,10 @@ public class Task extends CommonModel<Task> implements Serializable {
/** 交互字段 */
private String interaction_json;
private String car_type;
private String car_width;
public void copyFrom(Task source) {
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
}

View File

@@ -16,6 +16,7 @@ public enum TaskStatusEnum {
READY("0", "READY", "就绪"),
BUSY("1", "BUSY", "执行中"),
FINISHED("2", "FINISHED", "完成"),
FINISHEDMOVE("4", "FINISHEDMOVE", "取货完成"),
CANCEL("3", "CANCEL", "取消"),
ERROR("99", "ERROR", "异常");

View File

@@ -286,6 +286,13 @@ public interface TaskService extends CommonService<Task> {
*/
void finish(String ids);
/**
* 取货完成
*
* @param ids
*/
void finishmove(String ids);
/**
* 取消任务
*

View File

@@ -311,4 +311,7 @@ public class TaskDto implements Serializable {
* 行架任务类型
*/
private String truss_type;
private String car_type;
private String car_width;
}

View File

@@ -55,6 +55,7 @@ import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.CodeUtil;
import org.nl.common.utils.FileUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.common.utils.StringUtils;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.system.service.param.ISysParamService;
@@ -192,6 +193,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
List<Task> taskList = new LambdaQueryChainWrapper<>(taskMapper)
.eq(Task::getTask_status, task_status)
.eq(Task::getIs_delete, "0")
.orderByAsc(Task::getCreate_time)
.orderByAsc(Task::getTask_code)
.list();
return ConvertUtil.convertList(taskList, TaskDto.class);
}
@@ -230,7 +233,14 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
wrapper.lt(Task::getTask_status, TaskStatusEnum.FINISHED.getIndex());
}
}
wrapper.le(Task::getTask_status, 1);
// 关键修改:替换原有的 wrapper.le(Task::getTask_status, 1)
// 方案1使用 in 方法,直接指定需要的 task_status 值(推荐,简洁高效)
wrapper.in(Task::getTask_status, 1, 4 ,10 ,0);
// 方案2使用 or 拼接 eq 条件效果与方案1一致适合复杂条件扩展
// wrapper.eq(Task::getTask_status, 1).or().eq(Task::getTask_status, 4);
wrapper.orderByDesc(Task::getCreate_time);
IPage<Task> taskPage = taskMapper.selectPage(queryPage, wrapper);
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(taskPage, TaskDto.class));
@@ -330,6 +340,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) {
wrapper.between(Task::getCreate_time, create_time, end_time);
}
wrapper.orderByDesc(Task::getCreate_time);
IPage<Task> taskPage = taskMapper.selectPage(queryPage, wrapper);
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(taskPage, TaskDto.class));
JSONArray array = json.getJSONArray("content");
@@ -488,6 +499,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
task_code = CodeUtil.getNewCode("TASK_NO");
task_code = CommonFinalParam.HYPHEN_ + task_code;
}
String start_point_code;
String next_point_code = dto.getNext_point_code();
String start_device_code = dto.getStart_device_code();
@@ -495,6 +507,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
String route_plan_code = dto.getRoute_plan_code();
dto.setCreate_by("auto");
dto.setUpdate_by(currentUsername);
dto.setCar_type(dto.getCar_type());
dto.setCar_width(dto.getCar_width());
dto.setUpdate_time(now);
dto.setCreate_time(now);
dto.setTask_code(task_code);
@@ -510,13 +524,13 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
// 判断起点终点设备类型
String startDeviceType = deviceAppService.findDeviceTypeByCode(dto.getStart_device_code());
String nextDeviceType = deviceAppService.findDeviceTypeByCode(dto.getNext_device_code());
if (routeLineService
.getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code)
.size()
== 0) {
throw new BadRequestException(dto.getStart_point_code() + "->" + dto.getNext_point_code() + " " + LangProcess.msg("route_isNull"));
}
String createTaskCheck = paramService.findByCode(AcsConfig.CREATETASKCHECK).getValue();
// if (routeLineService
// .getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code)
// .size()
// == 0) {
// throw new BadRequestException(dto.getStart_point_code() + "->" + dto.getNext_point_code() + " " + LangProcess.msg("route_isNull"));
// }
// String createTaskCheck = paramService.findByCode(AcsConfig.CREATETASKCHECK).getValue();
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device nextdevice = appService.findDeviceByCode(next_device_code);
@@ -538,61 +552,61 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
next_point_code = next_device_code + CommonFinalParam.HYPHEN_ + dto.getTo_y() + CommonFinalParam.HYPHEN_ + dto.getTo_z();
dto.setNext_point_code(next_point_code);
}
if (StrUtil.equals(createTaskCheck, CommonFinalParam.ONE)) {
// 判断起点为输送设备
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
}
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
}
} else {
// 判断起点为输送设备
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
}
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
// if (nextdevice.getDeviceDriver() instanceof
// StandardOrdinarySiteDeviceDriver) {
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver)
// nextdevice.getDeviceDriver();
// if (nextdevice.getHas_goods() != 0) {
// throw new Exception("任务终点需满足无货!");
// }
// }
JSONObject jo = new JSONObject();
JSONObject jo2 = new JSONObject();
if (!StrUtil.isEmpty(dto.getMaterial())) {
if (!StrUtil.equals(dto.getMaterial(), CommonFinalParam.ONE)) {
jo.put("hasGoodStatus", "2");
jo.put("material_type", dto.getMaterial());
} else {
jo.put("hasGoodStatus", CommonFinalParam.ONE);
jo.put("material_type", CommonFinalParam.ONE);
}
} else {
jo.put("hasGoodStatus", CommonFinalParam.ONE);
jo.put("material_type", CommonFinalParam.ONE);
}
jo.put("device_code", dto.getStart_device_code());
jo.put("quantity", dto.getQuantity());
jo.put("remark", dto.getRemark());
jo.put("batch", startdevice.getBatch());
jo.put("islock", "true");
deviceService.changeDeviceStatus(jo);
Device deviceByCode = deviceAppService.findDeviceByCode(dto.getNext_device_code());
jo2.put("device_code", dto.getNext_device_code());
jo2.put("hasGoodStatus", deviceByCode.getHas_goods());
jo2.put("quantity", deviceByCode.getQuantity());
jo2.put("remark", deviceByCode.getRemark());
jo2.put("material_type", deviceByCode.getMaterial_type());
jo2.put("batch", deviceByCode.getBatch());
jo2.put("islock", "true");
deviceService.changeDeviceStatus(jo2);
}
}
// if (StrUtil.equals(createTaskCheck, CommonFinalParam.ONE)) {
// // 判断起点为输送设备
// if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
//
// }
//
// if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
// }
// } else {
// // 判断起点为输送设备
// if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
// }
//
// if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
// // if (nextdevice.getDeviceDriver() instanceof
// // StandardOrdinarySiteDeviceDriver) {
// // standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver)
// // nextdevice.getDeviceDriver();
// // if (nextdevice.getHas_goods() != 0) {
// // throw new Exception("任务终点需满足无货!");
// // }
// // }
//
// JSONObject jo = new JSONObject();
// JSONObject jo2 = new JSONObject();
// if (!StrUtil.isEmpty(dto.getMaterial())) {
// if (!StrUtil.equals(dto.getMaterial(), CommonFinalParam.ONE)) {
// jo.put("hasGoodStatus", "2");
// jo.put("material_type", dto.getMaterial());
// } else {
// jo.put("hasGoodStatus", CommonFinalParam.ONE);
// jo.put("material_type", CommonFinalParam.ONE);
// }
//
// } else {
// jo.put("hasGoodStatus", CommonFinalParam.ONE);
// jo.put("material_type", CommonFinalParam.ONE);
// }
// jo.put("device_code", dto.getStart_device_code());
// jo.put("quantity", dto.getQuantity());
// jo.put("remark", dto.getRemark());
// jo.put("batch", startdevice.getBatch());
// jo.put("islock", "true");
// deviceService.changeDeviceStatus(jo);
// Device deviceByCode = deviceAppService.findDeviceByCode(dto.getNext_device_code());
// jo2.put("device_code", dto.getNext_device_code());
// jo2.put("hasGoodStatus", deviceByCode.getHas_goods());
// jo2.put("quantity", deviceByCode.getQuantity());
// jo2.put("remark", deviceByCode.getRemark());
// jo2.put("material_type", deviceByCode.getMaterial_type());
// jo2.put("batch", deviceByCode.getBatch());
// jo2.put("islock", "true");
// deviceService.changeDeviceStatus(jo2);
// }
// }
Task entity = ConvertUtil.convert(dto, Task.class);
taskMapper.insert(entity);
tasks.add(dto);
@@ -736,7 +750,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
//反馈上位系统任务状态
//判断是否为WMS下发的任务如果是反馈任务状态给WMS
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")&& !StrUtil.equals(dto.getTask_status(), "8")) {
this.feedWmsTaskStatus(entity);
}
}
@@ -780,6 +794,14 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
this.feedWmsTaskStatus(entity);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void finishmove(String id) {
TaskDto entity = this.findById(id);
entity.setTask_status(TaskStatusEnum.FINISHEDMOVE.getIndex());
Task task = ConvertUtil.convert(entity, Task.class);
taskMapper.updateById(task);
}
@Override
@Transactional(rollbackFor = Exception.class)
@@ -828,6 +850,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
String taskid = acsTask.getTask_id();
String taskcode = acsTask.getTask_code();
String car_type=acsTask.getCar_type();
String vehiclecode = acsTask.getVehicle_code();
String priority = acsTask.getPriority();
String start_point_code = acsTask.getStart_point_code();
@@ -842,34 +865,34 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
String next_point_code2 = acsTask.getNext_point_code2();
String agv_system_type = acsTask.getAgv_system_type();
String task_type = acsTask.getTask_type();
/** 开始平均分解校验 */
String this_device_code =
this.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code());
if (StrUtil.isEmpty(this_device_code)) {
List<RouteLineDto> shortPathsList =
routeLineService.getShortPathLines(
start_device_code, acsTask.getNext_device_code(), route_plan_code);
RouteLineDto routeLineDto = shortPathsList.get(0);
String path = routeLineDto.getPath();
String type = routeLineDto.getType();
String[] str = path.split("->");
List<String> pathlist = Arrays.asList(str);
int index = 0;
for (int m = 0; m < pathlist.size(); m++) {
if (pathlist.get(m).equals(start_device_code)) {
index = m + 1;
break;
}
}
next_device_code = pathlist.get(index);
} else {
next_device_code = this_device_code;
}
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
next_point_code = next_device_code + CommonFinalParam.HYPHEN_ + acsTask.getTo_y() + CommonFinalParam.HYPHEN_ + acsTask.getTo_z();
} else {
next_point_code = next_device_code;
}
// /** 开始平均分解校验 */
// String this_device_code =
// this.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code());
// if (StrUtil.isEmpty(this_device_code)) {
// List<RouteLineDto> shortPathsList =
// routeLineService.getShortPathLines(
// start_device_code, acsTask.getNext_device_code(), route_plan_code);
// RouteLineDto routeLineDto = shortPathsList.get(0);
// String path = routeLineDto.getPath();
// String type = routeLineDto.getType();
// String[] str = path.split("->");
// List<String> pathlist = Arrays.asList(str);
// int index = 0;
// for (int m = 0; m < pathlist.size(); m++) {
// if (pathlist.get(m).equals(start_device_code)) {
// index = m + 1;
// break;
// }
// }
// next_device_code = pathlist.get(index);
// } else {
// next_device_code = this_device_code;
// }
// if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
// next_point_code = next_device_code + CommonFinalParam.HYPHEN_ + acsTask.getTo_y() + CommonFinalParam.HYPHEN_ + acsTask.getTo_z();
// } else {
// next_point_code = next_device_code;
// }
Instruction instdto = new Instruction();
instdto.setInstruction_type(task_type);
@@ -878,6 +901,10 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
instdto.setRemark(acsTask.getRemark());
instdto.setMaterial(acsTask.getMaterial());
instdto.setQuantity(acsTask.getQuantity());
instdto.setCar_type(car_type);
if(car_type.equals("2")){
instdto.setCar_width(acsTask.getCar_width());
}
instdto.setTask_id(taskid);
instdto.setTask_code(taskcode);
instdto.setVehicle_code(vehiclecode);
@@ -898,7 +925,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
instdto.setNext_point_code2(next_point_code2);
instdto.setAgv_system_type(agv_system_type);
instdto.setAgv_inst_type(CommonFinalParam.ONE);
instructionservice.create2(instdto);
instructionservice.create(instdto);
acsTask.setTask_status(CommonFinalParam.ONE);
this.update(acsTask);
@@ -1036,24 +1063,24 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
String to_y = null;
String to_z = null;
if (StrUtil.contains(start_point_code, "-") && StrUtil.count(start_point_code, "-") == 2) {
String[] start_point = start_point_code.split("-");
task.setFrom_x(start_point[0]);
task.setStart_device_code(start_point[0]);
if (Integer.parseInt(start_point[1]) < 10 && start_point[1].length() == 1) {
from_y = "0" + start_point[1];
task.setFrom_y(from_y);
} else {
from_y = start_point[1];
task.setFrom_y(from_y);
}
if (Integer.parseInt(start_point[2]) < 10 && start_point[2].length() == 1) {
from_z = "0" + start_point[2];
task.setFrom_z(from_z);
} else {
from_z = start_point[2];
}
task.setStart_point_code(task.getStart_device_code() + "-" + from_y + "-" + from_z);
task.setStart_device_code(task.getStart_device_code());
// String[] start_point = start_point_code.split("-");
// task.setFrom_x(start_point[0]);
// task.setStart_device_code(start_point[0]);
// if (Integer.parseInt(start_point[1]) < 10 && start_point[1].length() == 1) {
// from_y = "0" + start_point[1];
// task.setFrom_y(from_y);
// } else {
// from_y = start_point[1];
// task.setFrom_y(from_y);
// }
// if (Integer.parseInt(start_point[2]) < 10 && start_point[2].length() == 1) {
// from_z = "0" + start_point[2];
// task.setFrom_z(from_z);
// } else {
// from_z = start_point[2];
// }
// task.setStart_point_code(task.getStart_device_code() + "-" + from_y + "-" + from_z);
// task.setStart_device_code(task.getStart_device_code());
} else {
String start_device = deviceAppService.findDeviceByCode(start_point_code).getDeviceDriverDefination().getFitDeviceTypes().get(0).name();
@@ -1108,35 +1135,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
task.setNext_device_code(task.getNext_device_code());
} else {
String next_device = deviceAppService.findDeviceByCode(next_point_code).getDeviceDriverDefination().getFitDeviceTypes().get(0).name();
if (StrUtil.equals("storage", next_device)) {
if (StrUtil.isEmpty(task.getTo_x())) {
throw new BadRequestException("货位信息终点需要包含列信息");
}
if (StrUtil.isEmpty(task.getTo_y())) {
throw new BadRequestException("货位信息终点需要包含层信息");
}
if (Integer.parseInt(task.getTo_y()) < 10 && task.getTo_y().length() == 1) {
to_y = "0" + task.getTo_y();
task.setTo_y(to_y);
} else {
to_y = task.getTo_y();
}
if (Integer.parseInt(task.getTo_z()) < 10 && task.getTo_z().length() == 1) {
to_z = "0" + task.getTo_z();
task.setTo_z(to_z);
} else {
to_z = task.getTo_z();
}
task.setTo_x(next_point_code);
task.setNext_point_code(next_point_code + "-" + to_y + "-" + to_z);
task.setNext_device_code(next_point_code);
} else {
task.setNext_point_code(next_point_code);
task.setNext_device_code(next_point_code);
}
}
return task;
}

View File

@@ -54,6 +54,7 @@ public class AutoCreateInst {
if (StrUtil.equals(acsTask.getTask_type(), TaskTypeEnum.Truss_Task.getIndex()) && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
continue;
}
Boolean flag=false;
String taskid = acsTask.getTask_id();
String taskcode = acsTask.getTask_code();
String task_type = acsTask.getTask_type();
@@ -62,6 +63,100 @@ public class AutoCreateInst {
String is_send = acsTask.getIs_send();
String start_device_code = acsTask.getStart_device_code();
String start_point=null;
if(start_device_code.contains("BCPRK")){
String[] parts = start_device_code.split("-", 2);
start_point=parts[0];
}else if(start_device_code.contains("CPRK")){
String[] parts = start_device_code.split("-", 2);
start_point=parts[0];
}
if(start_point != null) {
if (start_point.equals("CPRK1")) {
List<TaskDto> list1 = taskserver.queryAllByStatus("1");
for (int j = 0; j < list1.size(); j++) {
String start_device_code1 = list1.get(j).getStart_device_code();
String[] parts = start_device_code1.split("-", 2);
start_point = parts[0];
if (start_point.equals("CPRK1")) {
flag = true;
}
}
} else if (start_point.equals("CPRK2")) {
List<TaskDto> list1 = taskserver.queryAllByStatus("1");
for (int j = 0; j < list1.size(); j++) {
String start_device_code1 = list1.get(j).getStart_device_code();
String[] parts = start_device_code1.split("-", 2);
start_point = parts[0];
if (start_point.equals("CPRK2")) {
flag = true;
}
}
} else if (start_point.equals("CPRK3")) {
List<TaskDto> list1 = taskserver.queryAllByStatus("1");
for (int j = 0; j < list1.size(); j++) {
String start_device_code1 = list1.get(j).getStart_device_code();
String[] parts = start_device_code1.split("-", 2);
start_point = parts[0];
if (start_point.equals("CPRK3")) {
flag = true;
}
}
} else if (start_point.equals("CPRK4")) {
List<TaskDto> list1 = taskserver.queryAllByStatus("1");
for (int j = 0; j < list1.size(); j++) {
String start_device_code1 = list1.get(j).getStart_device_code();
String[] parts = start_device_code1.split("-", 2);
start_point = parts[0];
if (start_point.equals("CPRK4")) {
flag = true;
}
}
} else if (start_point.equals("BCPRK1")) {
List<TaskDto> list1 = taskserver.queryAllByStatus("1");
for (int j = 0; j < list1.size(); j++) {
String start_device_code1 = list1.get(j).getStart_device_code();
String[] parts = start_device_code1.split("-", 2);
start_point = parts[0];
if (start_point.equals("BCPRK1")) {
flag = true;
}
}
} else if (start_point.equals("BCPRK2")) {
List<TaskDto> list1 = taskserver.queryAllByStatus("1");
for (int j = 0; j < list1.size(); j++) {
String start_device_code1 = list1.get(j).getStart_device_code();
String[] parts = start_device_code1.split("-", 2);
start_point = parts[0];
if (start_point.equals("BCPRK2")) {
flag = true;
}
}
} else if (start_point.equals("BCPRK3")) {
List<TaskDto> list1 = taskserver.queryAllByStatus("1");
for (int j = 0; j < list1.size(); j++) {
String start_device_code1 = list1.get(j).getStart_device_code();
String[] parts = start_device_code1.split("-", 2);
start_point = parts[0];
if (start_point.equals("BCPRK3")) {
flag = true;
}
}
} else if (start_point.equals("BCPRK4")) {
List<TaskDto> list1 = taskserver.queryAllByStatus("1");
for (int j = 0; j < list1.size(); j++) {
String start_device_code1 = list1.get(j).getStart_device_code();
String[] parts = start_device_code1.split("-", 2);
start_point = parts[0];
if (start_point.equals("BCPRK4")) {
flag = true;
}
}
}
}
if (flag){
continue;
}
String start_point_code = acsTask.getStart_point_code();
String put_device_code = acsTask.getPut_device_code();
@@ -76,37 +171,38 @@ public class AutoCreateInst {
String start_height = acsTask.getStart_height();
String next_height = acsTask.getNext_height();
String car_type=acsTask.getCar_type();
String car_width=acsTask.getCar_width();
if (StrUtil.equals(is_send, "0")) {
continue;
}
//校验路由关系
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
if (ObjectUtils.isEmpty(shortPathsList)) {
acsTask.setRemark("路由不通无法生成指令");
taskserver.updateByCodeFromCache(acsTask);
continue;
}
if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
continue;
}
RouteLineDto routeLineDto = shortPathsList.get(0);
String path = routeLineDto.getPath();
String type = routeLineDto.getType();
String[] str = path.split("->");
List<String> pathlist = Arrays.asList(str);
int index = 0;
for (int m = 0; m < pathlist.size(); m++) {
if (pathlist.get(m).equals(start_device_code)) {
index = m + 1;
break;
}
}
next_device_code = pathlist.get(index);
// //校验路由关系
// List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
// if (ObjectUtils.isEmpty(shortPathsList)) {
// acsTask.setRemark("路由不通无法生成指令");
// taskserver.updateByCodeFromCache(acsTask);
// continue;
// }
//
// if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
// continue;
// }
// RouteLineDto routeLineDto = shortPathsList.get(0);
// String path = routeLineDto.getPath();
// String type = routeLineDto.getType();
// String[] str = path.split("->");
// List<String> pathlist = Arrays.asList(str);
// int index = 0;
// for (int m = 0; m < pathlist.size(); m++) {
// if (pathlist.get(m).equals(start_device_code)) {
// index = m + 1;
// break;
// }
// }
// next_device_code = pathlist.get(index);
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();
@@ -128,14 +224,14 @@ public class AutoCreateInst {
instdto.setCreate_time(now);
instdto.setCreate_by(SecurityUtils.getCurrentNickName());
instdto.setStart_device_code(start_device_code);
instdto.setStart_device_code(start_point_code);
instdto.setStart_point_code(start_point_code);
instdto.setPut_device_code(put_device_code);
instdto.setPut_point_code(put_point_code);
instdto.setNext_device_code(next_device_code);
instdto.setNext_point_code(next_point_code);
instdto.setCar_type(car_type);
instdto.setCar_width(car_width);
instdto.setPriority(priority);
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
instdto.setExecute_device_code(start_point_code);

View File

@@ -23,7 +23,9 @@ export default {
'start_or_end': '起点或终点',
'time': '时间段',
'empty_shaft_position': '空轴位',
'extension_field': '扩展字段'
'extension_field': '扩展字段',
'car_type': '车辆类型',
'car_width': '货叉宽度'
},
'select': {
'automated_warehouse_task_type': '立库任务类型',

View File

@@ -138,6 +138,25 @@
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('task.txt_box.car_type')">
<el-select
v-model="form.car_type"
style="width: 370px;"
filterable
:placeholder="$t('task.select.Placeholder')"
@change="isDisabled=false"
>
<el-option
v-for="item in carList"
:key="item.key"
:label="item.key"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('task.txt_box.car_width')">
<el-input v-model="form.car_width" style="width: 370px;" @change="isDisabled=false" />
</el-form-item>
<el-form-item :label="$t('task.txt_box.Task_type')">
<el-select
v-model="form.task_type"
@@ -700,6 +719,10 @@ export default {
{ key: '防货二次分配', value: 3 },
{ key: '取放货二次分配', value: 4 }
],
carList: [
{ key: 'PS20', value: 1 },
{ key: 'RT', value: 2 }
],
task_type: [],
fromYList: [],
fromZList: [],
@@ -732,6 +755,8 @@ export default {
material: null,
route_plan_code: 'normal',
agv_action_type: 1,
car_type: null,
car_width: null,
from_x: null,
from_y: null,
from_z: null,