This commit is contained in:
USER-20220102CG\noblelift
2022-10-09 14:59:38 +08:00
parent b62845d031
commit fd19c38bd5
4 changed files with 46 additions and 41 deletions

View File

@@ -121,6 +121,14 @@ public class JMHandController {
return new ResponseEntity<>(HandService.queryMaterial(), HttpStatus.OK);
}
@PostMapping("/addBarcode")
@Log("输送补码")
@ApiOperation("输送补码")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> addBarcode(@RequestBody Map<String, String> whereJson) throws Exception {
return new ResponseEntity<>(HandService.addBarcode(whereJson), HttpStatus.OK);
}
@AnonymousPostMapping("/task2")
@Log("创建任务")
@ApiOperation("创建任务")

View File

@@ -90,5 +90,11 @@ public interface JMHandService {
*/
Map<String, Object> queryMaterial();
/**
* 补码
* @return
*/
Map<String, Object> addBarcode(Map<String, String> whereJson) throws Exception;
Map<String, Object> createTask2(Map<String, String> whereJson);
}

View File

@@ -19,11 +19,15 @@ import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.ScannerDeviceDriver;
import org.nl.acs.device_driver.special_ordinary_site.SpecialOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
import org.nl.acs.device_driver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
import org.nl.acs.device_driver.standard_emptypallet_site.StandardEmptyPalletSiteDeviceDriver;
import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.standard_manipulator_inspect_site.StandardManipulatorInspectSiteDeviceDriver;
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.standard_scanner.StandardScannerDeviceDriver;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
@@ -892,4 +896,27 @@ public class JMHandServiceImpl implements JMHandService {
}
@Override
public Map<String, Object> addBarcode(Map<String, String> whereJson) throws Exception {
String vehicle_code = whereJson.get("vehicle_code");
String device_code = whereJson.get("device_code");
DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class);
DeviceAppService deviceappservice = SpringContextHolder.getBean(DeviceAppService.class);
Device device = deviceappservice.findDeviceByCode(device_code);
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
if (device.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver();
String link_scanner = standardCoveyorControlWithScannerDeviceDriver.getExtraValue().get("link_scanner").toString();
device_code = link_scanner;
}
JSONObject jo = new JSONObject();
jo.put("barcode",vehicle_code);
jo.put("device_code",device_code);
deviceservice.updateBarcode(jo);
jo.put("code", "1");
jo.put("desc", "创建成功");
return jo;
}
}

View File

@@ -800,46 +800,6 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
break;
} else {
// Instruction dto = null;
// String next_agv_jobno = "";
// String next_inst_code = "";
// String next_task_id = "";
// String next_task_code = "";
// String next_carno = "";
// List<Instruction> insts = instructionService.findAllInstFromCache();
// for (int i = 0; i < insts.size(); i++) {
// dto = insts.get(i);
// List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), dto.getRoute_plan_code());
// String routeType = shortPathsList.get(0).getType();
// if (routeType.equals("1")) {
// TaskDto taskDto = taskService.findByCode(dto.getTask_code());
// if (taskDto.getTask_type().equals("2")) {
// if (dto.getAgv_jobno().equals(inst.getAgv_jobno())) {
// break;
// }
// next_agv_jobno = dto.getAgv_jobno();
// next_inst_code = dto.getInstruction_code();
// next_task_id = dto.getTask_id();
// next_task_code = dto.getTask_code();
// next_carno = dto.getCarno();
//
// dto.setAgv_jobno(String.valueOf(index));
// dto.setInstruction_code(String.valueOf(ikey));
// dto.setTask_id(inst.getTask_id());
// dto.setTask_code(inst.getTask_code());
// dto.setCarno(inst.getCarno());
// instructionService.update(dto);
//
// inst.setAgv_jobno(next_agv_jobno);
// inst.setInstruction_code(next_inst_code);
// inst.setTask_id(next_task_id);
// inst.setTask_code(next_task_code);
// inst.setCarno(next_carno);
// instructionService.update(inst);
// break;
// }
// }
// }
int start_point_address = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
int next_point_address = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
data = AgvService.sendAgvOneModeInst(phase, index, start_point_address,next_point_address);
@@ -866,6 +826,8 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
standardCoveyorControlDeviceDriver.writing(1, 2);
standardCoveyorControlDeviceDriver.writing(1, 2);
log.info("AGV取货完成下发输送取货完成指令号{}", ikey);
flag = true;
}
if (device.getDeviceDriver() instanceof StandardEmptyPalletSiteDeviceDriver) {
@@ -1068,7 +1030,8 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0,0);
standardCoveyorControlDeviceDriver.writing(1, 3);
log.info("任务号:{} AGV放货完成请求离开设备{} 下发输送to_commad{}",inst.getTask_code(), device_code, 3);
standardCoveyorControlDeviceDriver.writing(1, 3);
log.info("AGV放货完成下发输送放货完成设备号{},指令号{}",device_code, ikey);
flag = true;
} else {
log.info("AGV放货完成请求离开设备{}无货,无法反馈", device_code);
@@ -2470,6 +2433,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
standardCoveyorControlDeviceDriver.writing(1, 2);
flag = true;
}
if (device.getDeviceDriver() instanceof StandardEmptyPalletSiteDeviceDriver) {