diff --git a/acs/acs2/nladmin-system/doc/ZHBS专用充电桩和调度通讯协议.pdf b/acs/acs2/nladmin-system/doc/ZHBS专用充电桩和调度通讯协议.pdf new file mode 100644 index 0000000..4ae4d87 Binary files /dev/null and b/acs/acs2/nladmin-system/doc/ZHBS专用充电桩和调度通讯协议.pdf differ diff --git a/acs/acs2/nladmin-system/doc/副本株洲项目调度通讯协议V2 2.docx b/acs/acs2/nladmin-system/doc/副本株洲项目调度通讯协议V2 2.docx new file mode 100644 index 0000000..e69f4bd Binary files /dev/null and b/acs/acs2/nladmin-system/doc/副本株洲项目调度通讯协议V2 2.docx differ diff --git a/acs/acs2/nladmin-system/doc/副本锂电池充电机通讯协议.docx b/acs/acs2/nladmin-system/doc/副本锂电池充电机通讯协议.docx new file mode 100644 index 0000000..b0d6ce5 Binary files /dev/null and b/acs/acs2/nladmin-system/doc/副本锂电池充电机通讯协议.docx differ diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/domain/DeviceEnableInter.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/domain/DeviceEnableInter.java new file mode 100644 index 0000000..55a9a1d --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/domain/DeviceEnableInter.java @@ -0,0 +1,51 @@ +package org.nl.acs.device.domain; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import org.nl.acs.common.base.CommonModel; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author Codex + * @date 2026-07-19 + */ +@Data +@Builder +@Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = false) +@TableName("acs_device_enable_inter") +public class DeviceEnableInter extends CommonModel implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + @NotBlank + private String device_code; + + @NotBlank + private String enable_inter; + + private String remark; + + private String update_by; + + private String update_time; + + public void copyFrom(DeviceEnableInter source) { + BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/rest/DeviceEnableInterController.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/rest/DeviceEnableInterController.java new file mode 100644 index 0000000..19400bd --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/rest/DeviceEnableInterController.java @@ -0,0 +1,72 @@ +package org.nl.acs.device.rest; + +import lombok.RequiredArgsConstructor; +import org.nl.acs.device.service.DeviceEnableInterService; +import org.nl.acs.device.service.dto.DeviceEnableInterBatchDto; +import org.nl.acs.device.service.dto.DeviceEnableInterDto; +import org.nl.acs.device.service.dto.DeviceEnableInterQueryParam; +import org.nl.common.logging.annotation.Log; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Set; + +/** + * @author Codex + * @date 2026-07-19 + **/ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/deviceEnableInter") +public class DeviceEnableInterController { + + private final DeviceEnableInterService deviceEnableInterService; + + @GetMapping + @Log("查询设备交互启用配置") + public ResponseEntity query(DeviceEnableInterQueryParam query, Pageable pageable) { + return new ResponseEntity<>(deviceEnableInterService.queryAll(query, pageable), HttpStatus.OK); + } + + @GetMapping("/deviceCode/{device_code}") + @Log("根据设备编码查询设备交互启用配置") + public ResponseEntity findByDeviceCode(@PathVariable String device_code) { + return new ResponseEntity<>(deviceEnableInterService.findByDeviceCode(device_code), HttpStatus.OK); + } + + @PostMapping + @Log("新增设备交互启用配置") + public ResponseEntity create(@Validated @RequestBody DeviceEnableInterDto resources) { + return new ResponseEntity<>(deviceEnableInterService.insert(resources), HttpStatus.CREATED); + } + + @PutMapping + @Log("修改设备交互启用配置") + public ResponseEntity update(@Validated @RequestBody DeviceEnableInterDto resources) { + deviceEnableInterService.updateById(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @PutMapping("/batch") + @Log("批量修改设备交互启用配置") + public ResponseEntity batchUpdate(@Validated @RequestBody DeviceEnableInterBatchDto resources) { + return new ResponseEntity<>(deviceEnableInterService.updateBatch(resources.getIds(), resources.getEnable_inter(), resources.getRemark()), HttpStatus.OK); + } + + @DeleteMapping + @Log("删除设备交互启用配置") + public ResponseEntity delete(@RequestBody Set ids) { + deviceEnableInterService.removeByIds(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/DeviceEnableInterService.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/DeviceEnableInterService.java new file mode 100644 index 0000000..f8b838b --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/DeviceEnableInterService.java @@ -0,0 +1,40 @@ +package org.nl.acs.device.service; + +import org.nl.acs.common.base.CommonService; +import org.nl.acs.common.base.PageInfo; +import org.nl.acs.device.domain.DeviceEnableInter; +import org.nl.acs.device.service.dto.DeviceEnableInterDto; +import org.nl.acs.device.service.dto.DeviceEnableInterQueryParam; +import org.springframework.data.domain.Pageable; + +import java.util.List; +import java.util.Set; + +/** + * @author Codex + * @date 2026-07-19 + */ +public interface DeviceEnableInterService extends CommonService { + + String CACHE_KEY = "deviceEnableInter"; + + PageInfo queryAll(DeviceEnableInterQueryParam query, Pageable pageable); + + List queryAll(DeviceEnableInterQueryParam query); + + DeviceEnableInter getById(Long id); + + DeviceEnableInterDto findById(Long id); + + DeviceEnableInterDto findByDeviceCode(String device_code); + + int insert(DeviceEnableInterDto resources); + + int updateById(DeviceEnableInterDto resources); + + int updateBatch(Set ids, String enable_inter, String remark); + + int removeById(Long id); + + int removeByIds(Set ids); +} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/dto/DeviceEnableInterBatchDto.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/dto/DeviceEnableInterBatchDto.java new file mode 100644 index 0000000..acb0725 --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/dto/DeviceEnableInterBatchDto.java @@ -0,0 +1,26 @@ +package org.nl.acs.device.service.dto; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.Set; + +/** + * @author Codex + * @date 2026-07-19 + */ +@Data +public class DeviceEnableInterBatchDto implements Serializable { + private static final long serialVersionUID = 1L; + + @NotEmpty + private Set ids; + + @NotBlank + private String enable_inter; + + @NotBlank + private String remark; +} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/dto/DeviceEnableInterDto.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/dto/DeviceEnableInterDto.java new file mode 100644 index 0000000..c28fb3c --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/dto/DeviceEnableInterDto.java @@ -0,0 +1,36 @@ +package org.nl.acs.device.service.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * @author Codex + * @date 2026-07-19 + */ +@Data +@Builder +@Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = false) +public class DeviceEnableInterDto implements Serializable { + private static final long serialVersionUID = 1L; + + private Long id; + + private String device_code; + + private String enable_inter; + + private String remark; + + private String update_by; + + private String update_time; +} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/dto/DeviceEnableInterQueryParam.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/dto/DeviceEnableInterQueryParam.java new file mode 100644 index 0000000..249a017 --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/dto/DeviceEnableInterQueryParam.java @@ -0,0 +1,20 @@ +package org.nl.acs.device.service.dto; + +import lombok.Getter; +import lombok.Setter; +import org.nl.common.annotation.Query; + +/** + * @author Codex + * @date 2026-07-19 + */ +@Getter +@Setter +public class DeviceEnableInterQueryParam { + + @Query(type = Query.Type.INNER_LIKE) + private String device_code; + + @Query + private String enable_inter; +} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceEnableInterServiceImpl.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceEnableInterServiceImpl.java new file mode 100644 index 0000000..f8748ae --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceEnableInterServiceImpl.java @@ -0,0 +1,141 @@ +package org.nl.acs.device.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import lombok.AllArgsConstructor; +import org.nl.acs.common.base.PageInfo; +import org.nl.acs.common.base.QueryHelpMybatisPlus; +import org.nl.acs.common.base.impl.CommonServiceImpl; +import org.nl.acs.device.domain.DeviceEnableInter; +import org.nl.acs.device.service.DeviceEnableInterService; +import org.nl.acs.device.service.dto.DeviceEnableInterDto; +import org.nl.acs.device.service.dto.DeviceEnableInterQueryParam; +import org.nl.acs.device.service.mapper.DeviceEnableInterMapper; +import org.nl.acs.utils.ConvertUtil; +import org.nl.acs.utils.PageUtil; +import org.nl.common.exception.BadRequestException; +import org.nl.common.utils.SecurityUtils; +import org.nl.system.service.param.ISysParamService; +import org.nl.system.service.param.dao.Param; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * @author Codex + * @date 2026-07-19 + */ +@Service +@AllArgsConstructor +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class DeviceEnableInterServiceImpl extends CommonServiceImpl implements DeviceEnableInterService { + + private final DeviceEnableInterMapper deviceEnableInterMapper; + private final ISysParamService sysParamService; + + @Override + public PageInfo queryAll(DeviceEnableInterQueryParam query, Pageable pageable) { + IPage queryPage = PageUtil.toMybatisPage(pageable); + IPage page = deviceEnableInterMapper.selectPage(queryPage, QueryHelpMybatisPlus.getPredicate(query)); + return ConvertUtil.convertPage(page, DeviceEnableInterDto.class); + } + + @Override + public List queryAll(DeviceEnableInterQueryParam query) { + return ConvertUtil.convertList(deviceEnableInterMapper.selectList(QueryHelpMybatisPlus.getPredicate(query)), DeviceEnableInterDto.class); + } + + @Override + public DeviceEnableInter getById(Long id) { + return deviceEnableInterMapper.selectById(id); + } + + @Override + public DeviceEnableInterDto findById(Long id) { + return ConvertUtil.convert(getById(id), DeviceEnableInterDto.class); + } + + @Override + public DeviceEnableInterDto findByDeviceCode(String device_code) { + return ConvertUtil.convert(deviceEnableInterMapper.findByDeviceCode(device_code), DeviceEnableInterDto.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int insert(DeviceEnableInterDto resources) { + checkEnableInterOperateAllowed(); + DeviceEnableInter entity = ConvertUtil.convert(resources, DeviceEnableInter.class); + if (entity.getUpdate_time() == null) { + entity.setUpdate_time(DateUtil.now()); + } + if (entity.getUpdate_by() == null) { + entity.setUpdate_by(SecurityUtils.getCurrentNickName()); + } + return deviceEnableInterMapper.insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int updateById(DeviceEnableInterDto resources) { + checkEnableInterOperateAllowed(); + DeviceEnableInter entity = ConvertUtil.convert(resources, DeviceEnableInter.class); + entity.setUpdate_time(DateUtil.now()); + entity.setUpdate_by(SecurityUtils.getCurrentNickName()); + return deviceEnableInterMapper.updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int updateBatch(Set ids, String enable_inter, String remark) { + if (ids == null || ids.isEmpty()) { + throw new BadRequestException("请选择需要操作的数据"); + } + if (StrUtil.isBlank(remark)) { + throw new BadRequestException("备注不能为空"); + } + String now = DateUtil.now(); + String currentUsername = SecurityUtils.getCurrentNickName(); + int count = 0; + for (Long id : ids) { + DeviceEnableInter entity = new DeviceEnableInter(); + entity.setId(id); + entity.setEnable_inter(enable_inter); + entity.setRemark(remark); + entity.setUpdate_by(currentUsername); + entity.setUpdate_time(now); + count += deviceEnableInterMapper.updateById(entity); + } + return count; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int removeByIds(Set ids) { + checkEnableInterOperateAllowed(); + return deviceEnableInterMapper.deleteBatchIds(ids); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int removeById(Long id) { + Set set = new HashSet<>(1); + set.add(id); + return this.removeByIds(set); + } + + private void checkEnableInterOperateAllowed() { + Param param = sysParamService.findByCode("is_enable_inter"); + if (param == null) { + throw new BadRequestException("当前不允许操作"); + } + if ("0".equals(param.getValue())) { + throw new BadRequestException("当前不允许操作"); + } + } +} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/mapper/DeviceEnableInterMapper.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/mapper/DeviceEnableInterMapper.java new file mode 100644 index 0000000..3453975 --- /dev/null +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/mapper/DeviceEnableInterMapper.java @@ -0,0 +1,18 @@ +package org.nl.acs.device.service.mapper; + +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.nl.acs.common.base.CommonMapper; +import org.nl.acs.device.domain.DeviceEnableInter; +import org.springframework.stereotype.Repository; + +/** + * @author Codex + * @date 2026-07-19 + */ +@Repository +public interface DeviceEnableInterMapper extends CommonMapper { + + @Select("select * from acs_device_enable_inter where device_code = #{device_code} limit 1") + DeviceEnableInter findByDeviceCode(@Param("device_code") String device_code); +} diff --git a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index 76b836b..a6938dc 100644 --- a/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/acs/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -13,7 +13,9 @@ import org.nl.acs.auto.run.BMSSocketConnectionAutoRun; import org.nl.acs.auto.run.NDCSocketConnectionAutoRun; import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; +import org.nl.acs.device.service.DeviceEnableInterService; import org.nl.acs.device.service.DeviceService; +import org.nl.acs.device.service.dto.DeviceEnableInterDto; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.agv.utils.TwoAgvPhase; @@ -22,6 +24,7 @@ import org.nl.acs.device_driver.driver.AbstractDeviceDriver; import org.nl.acs.device_driver.zz_driver.elevator.ElevatorDoorDeviceDriver; import org.nl.acs.device_driver.zz_driver.production_line_docking_station.ProductionLineDockingStationDeviceDriver; import org.nl.acs.device_driver.zz_driver.remove_seal_cover_position.RemoveSealCoverPositionDriver; +import org.nl.acs.device_driver.zz_driver.unpacking_machine.UnpackingMachineDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.history.ErrorUtil; @@ -63,6 +66,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); + DeviceEnableInterService deviceEnableInterService = SpringContextHolder.getBean(DeviceEnableInterService.class); TwoAgvPhase twoAgvPhase = new TwoAgvPhase(); ISysDictService dictService = SpringContextHolder.getBean(ISysDictService.class); @@ -158,6 +162,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; RemoveSealCoverPositionDriver removeSealCoverPositionDriver; ProductionLineDockingStationDeviceDriver productionLineDockingStationDeviceDriver; + UnpackingMachineDeviceDriver unpackingMachineDeviceDriver; if (phase == 0x02) { logServer.interfaceExecuteLog(LuceneLogDto.builder() @@ -224,43 +229,71 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); - //需要判断终点是料筒缓存库还是其它区域,若是料筒缓存库则是取带盖的,否则是取无盖的 - String nextDeviceCode = inst.getNext_device_code(); - Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode); - if (nextDevice != null) { - if ("7".equals(nextDevice.getRegion())) { - if (removeSealCoverPositionDriver.getAction() == 4) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + if (isEnableInterOpen(removeSealCoverPositionDriver.getDevice_code())) { + //需要判断终点是料筒缓存库还是其它区域,若是料筒缓存库则是取带盖的,否则是取无盖的 + String nextDeviceCode = inst.getNext_device_code(); + Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode); + if (nextDevice != null) { + if ("7".equals(nextDevice.getRegion())) { + if (removeSealCoverPositionDriver.getAction() == 4) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 取货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 取货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + if (removeSealCoverPositionDriver.getAction() == 3) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 取货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } } } else { - if (removeSealCoverPositionDriver.getAction() == 3) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); - } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 取货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); - } + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到nextDeviceCode=" + nextDeviceCode + "对应设备"); } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到nextDeviceCode=" + nextDeviceCode + "对应设备"); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); - // 下发到达取货点,判断是否允许取货 - try { - productionLineDockingStationDeviceDriver.writing("to_command", 1); - - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发取货指令异常: " + e.getMessage()); - return; - } - if (productionLineDockingStationDeviceDriver.getAction() == 1) { + if (isEnableInterOpen(productionLineDockingStationDeviceDriver.getDevice_code())) { + // 下发到达取货点,判断是否允许取货 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 1); + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发取货指令异常: " + e.getMessage()); + return; + } + if (productionLineDockingStationDeviceDriver.getAction() == 1) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许取货, action=" + productionLineDockingStationDeviceDriver.getAction()); + } + } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + } else if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) { + unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver(); + if (isEnableInterOpen(unpackingMachineDeviceDriver.getDevice_code())){ + try { + unpackingMachineDeviceDriver.writing("to_command", 1); + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发取货指令异常: " + e.getMessage()); + return; + } + if (unpackingMachineDeviceDriver.getAction() == 1) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许取货, action=" + unpackingMachineDeviceDriver.getAction()); + } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许取货, action=" + productionLineDockingStationDeviceDriver.getAction()); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -317,46 +350,71 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); - //需要判断终点是料筒缓存库还是其它区域,若是料筒缓存库则是取完带盖的,否则是取完无盖的 - String nextDeviceCode = inst.getNext_device_code(); - Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode); - if (nextDevice != null) { - if ("7".equals(nextDevice.getRegion())) { - try { - removeSealCoverPositionDriver.writing("to_command", 3); + if (isEnableInterOpen(removeSealCoverPositionDriver.getDevice_code())) { + //需要判断终点是料筒缓存库还是其它区域,若是料筒缓存库则是取完带盖的,否则是取完无盖的 + String nextDeviceCode = inst.getNext_device_code(); + Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode); + if (nextDevice != null) { + if ("7".equals(nextDevice.getRegion())) { + try { + removeSealCoverPositionDriver.writing("to_command", 3); - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发取货完成动作异常: " + e.getMessage()); - return; + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发取货完成动作异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + try { + removeSealCoverPositionDriver.writing("to_command", 4); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发取货完成动作异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else { - try { - removeSealCoverPositionDriver.writing("to_command", 4); - - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发取货完成动作异常: " + e.getMessage()); - return; - } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到nextDeviceCode=" + nextDeviceCode + "对应设备"); } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到nextDeviceCode=" + nextDeviceCode + "对应设备"); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); - // 下发取货完成 - try { - productionLineDockingStationDeviceDriver.writing("to_command", 2); + if (isEnableInterOpen(productionLineDockingStationDeviceDriver.getDevice_code())) { + // 下发取货完成 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 2); - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发取货完成指令异常: " + e.getMessage()); - return; + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发取货完成指令异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + } else if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) { + unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver(); + if (isEnableInterOpen(unpackingMachineDeviceDriver.getDevice_code())) { + try { + unpackingMachineDeviceDriver.writing("to_command", 2); + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发取货完成指令异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); @@ -404,43 +462,72 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); - //需要判断起点是料桶缓存库还是其它区域的,若是料桶缓存库,则是放带盖的,否则是放无盖的 - String startDeviceCode = inst.getStart_device_code(); - Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode); - if (startDevice != null) { - if ("7".equals(startDevice.getRegion())) { - if (removeSealCoverPositionDriver.getAction() == 1) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + if (isEnableInterOpen(removeSealCoverPositionDriver.getDevice_code())) { + //需要判断起点是料桶缓存库还是其它区域的,若是料桶缓存库,则是放带盖的,否则是放无盖的 + String startDeviceCode = inst.getStart_device_code(); + Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode); + if (startDevice != null) { + if ("7".equals(startDevice.getRegion())) { + if (removeSealCoverPositionDriver.getAction() == 1) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 放货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 放货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + if (removeSealCoverPositionDriver.getAction() == 2) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 放货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } } } else { - if (removeSealCoverPositionDriver.getAction() == 2) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); - } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 放货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); - } + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到startDeviceCode=" + startDeviceCode + "对应设备"); } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到startDeviceCode=" + startDeviceCode + "对应设备"); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); - // 下发到达放货点,判断是否允许放货 - try { - productionLineDockingStationDeviceDriver.writing("to_command", 3); + if (isEnableInterOpen(productionLineDockingStationDeviceDriver.getDevice_code())) { + // 下发到达放货点,判断是否允许放货 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 3); - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发放货指令异常: " + e.getMessage()); - return; - } - if (productionLineDockingStationDeviceDriver.getAction() == 2) { + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发放货指令异常: " + e.getMessage()); + return; + } + if (productionLineDockingStationDeviceDriver.getAction() == 2) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许放货, action=" + productionLineDockingStationDeviceDriver.getAction()); + } + } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + } else if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) { + unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver(); + if (isEnableInterOpen(unpackingMachineDeviceDriver.getDevice_code())) { + try { + unpackingMachineDeviceDriver.writing("to_command", 3); + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发放货指令异常: " + e.getMessage()); + return; + } + if (unpackingMachineDeviceDriver.getAction() == 1) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许放货, action=" + unpackingMachineDeviceDriver.getAction()); + } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许放货, action=" + productionLineDockingStationDeviceDriver.getAction()); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -492,46 +579,71 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); - //需要判断起点是料桶缓存库还是其它区域的,若是料桶缓存库,则是放带盖的完成,否则是放无盖的完成 - String startDeviceCode = inst.getStart_device_code(); - Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode); - if (startDevice != null) { - if ("7".equals(startDevice.getRegion())) { - try { - removeSealCoverPositionDriver.writing("to_command", 1); + if (isEnableInterOpen(removeSealCoverPositionDriver.getDevice_code())) { + //需要判断起点是料桶缓存库还是其它区域的,若是料桶缓存库,则是放带盖的完成,否则是放无盖的完成 + String startDeviceCode = inst.getStart_device_code(); + Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode); + if (startDevice != null) { + if ("7".equals(startDevice.getRegion())) { + try { + removeSealCoverPositionDriver.writing("to_command", 1); - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发放货完成动作异常: " + e.getMessage()); - return; + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发放货完成动作异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + try { + removeSealCoverPositionDriver.writing("to_command", 2); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发放货完成动作异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else { - try { - removeSealCoverPositionDriver.writing("to_command", 2); - - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发放货完成动作异常: " + e.getMessage()); - return; - } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到startDeviceCode=" + startDeviceCode + "对应设备"); } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到startDeviceCode=" + startDeviceCode + "对应设备"); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); - // 下发放货完成 - try { - productionLineDockingStationDeviceDriver.writing("to_command", 4); + if (isEnableInterOpen(productionLineDockingStationDeviceDriver.getDevice_code())) { + // 下发放货完成 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 4); - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发放货完成指令异常: " + e.getMessage()); - return; + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发放货完成指令异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + } else if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) { + unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver(); + if (isEnableInterOpen(unpackingMachineDeviceDriver.getDevice_code())) { + try { + unpackingMachineDeviceDriver.writing("to_command", 4); + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发放货完成指令异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); @@ -578,43 +690,72 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); - //需要判断终点是料筒缓存库还是其它区域,若是料筒缓存库则是取带盖的,否则是取无盖的 - String nextDeviceCode2 = inst.getNext_device_code2(); - Device nextDevice2 = deviceAppService.findDeviceByCode(nextDeviceCode2); - if (nextDevice2 != null) { - if ("7".equals(nextDevice2.getRegion())) { - if (removeSealCoverPositionDriver.getAction() == 4) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + if (isEnableInterOpen(removeSealCoverPositionDriver.getDevice_code())) { + //需要判断终点是料筒缓存库还是其它区域,若是料筒缓存库则是取带盖的,否则是取无盖的 + String nextDeviceCode2 = inst.getNext_device_code2(); + Device nextDevice2 = deviceAppService.findDeviceByCode(nextDeviceCode2); + if (nextDevice2 != null) { + if ("7".equals(nextDevice2.getRegion())) { + if (removeSealCoverPositionDriver.getAction() == 4) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 第二次取货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 第二次取货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + if (removeSealCoverPositionDriver.getAction() == 3) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 第二次取货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } } } else { - if (removeSealCoverPositionDriver.getAction() == 3) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); - } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 第二次取货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); - } + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到nextDeviceCode2=" + nextDeviceCode2 + "对应设备"); } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到nextDeviceCode2=" + nextDeviceCode2 + "对应设备"); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); - // 下发到达取货点,判断是否允许取货 - try { - productionLineDockingStationDeviceDriver.writing("to_command", 1); + if (isEnableInterOpen(productionLineDockingStationDeviceDriver.getDevice_code())) { + // 下发到达取货点,判断是否允许取货 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 1); - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次取货指令异常: " + e.getMessage()); - return; - } - if (productionLineDockingStationDeviceDriver.getAction() == 1) { + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次取货指令异常: " + e.getMessage()); + return; + } + if (productionLineDockingStationDeviceDriver.getAction() == 1) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许第二次取货, action=" + productionLineDockingStationDeviceDriver.getAction()); + } + } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + } else if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) { + unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver(); + if (isEnableInterOpen(unpackingMachineDeviceDriver.getDevice_code())) { + try { + unpackingMachineDeviceDriver.writing("to_command", 1); + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次取货指令异常: " + e.getMessage()); + return; + } + if (unpackingMachineDeviceDriver.getAction() == 1) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许第二次取货, action=" + unpackingMachineDeviceDriver.getAction()); + } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许第二次取货, action=" + productionLineDockingStationDeviceDriver.getAction()); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -665,45 +806,70 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); - //需要判断终点是料筒缓存库还是其它区域,若是料筒缓存库则是取完带盖的,否则是取完无盖的 - String nextDeviceCode2 = inst.getNext_device_code2(); - Device nextDevice2 = deviceAppService.findDeviceByCode(nextDeviceCode2); - if (nextDevice2 != null) { - if ("7".equals(nextDevice2.getRegion())) { - try { - removeSealCoverPositionDriver.writing("to_command", 3); + if (isEnableInterOpen(removeSealCoverPositionDriver.getDevice_code())) { + //需要判断终点是料筒缓存库还是其它区域,若是料筒缓存库则是取完带盖的,否则是取完无盖的 + String nextDeviceCode2 = inst.getNext_device_code2(); + Device nextDevice2 = deviceAppService.findDeviceByCode(nextDeviceCode2); + if (nextDevice2 != null) { + if ("7".equals(nextDevice2.getRegion())) { + try { + removeSealCoverPositionDriver.writing("to_command", 3); - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次取货完成动作异常: " + e.getMessage()); - return; + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次取货完成动作异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + try { + removeSealCoverPositionDriver.writing("to_command", 4); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次取货完成动作异常: " + e.getMessage()); + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else { - try { - removeSealCoverPositionDriver.writing("to_command", 4); - - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次取货完成动作异常: " + e.getMessage()); - } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到nextDeviceCode2=" + nextDeviceCode2 + "对应设备"); } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到nextDeviceCode2=" + nextDeviceCode2 + "对应设备"); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); - // 下发取货完成 - try { - productionLineDockingStationDeviceDriver.writing("to_command", 2); + if (isEnableInterOpen(productionLineDockingStationDeviceDriver.getDevice_code())) { + // 下发取货完成 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 2); - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次取货完成指令异常: " + e.getMessage()); - return; + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次取货完成指令异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + } else if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) { + unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver(); + if (isEnableInterOpen(unpackingMachineDeviceDriver.getDevice_code())) { + try { + unpackingMachineDeviceDriver.writing("to_command", 2); + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次取货完成指令异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); @@ -750,42 +916,71 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); - //需要判断起点是料桶缓存库还是其它区域的,若是料桶缓存库,则是放带盖的,否则是放无盖的 - String startDeviceCode2 = inst.getStart_device_code2(); - Device startDevice2 = deviceAppService.findDeviceByCode(startDeviceCode2); - if (startDevice2 != null) { - if ("7".equals(startDevice2.getRegion())) { - if (removeSealCoverPositionDriver.getAction() == 1) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + if (isEnableInterOpen(removeSealCoverPositionDriver.getDevice_code())) { + //需要判断起点是料桶缓存库还是其它区域的,若是料桶缓存库,则是放带盖的,否则是放无盖的 + String startDeviceCode2 = inst.getStart_device_code2(); + Device startDevice2 = deviceAppService.findDeviceByCode(startDeviceCode2); + if (startDevice2 != null) { + if ("7".equals(startDevice2.getRegion())) { + if (removeSealCoverPositionDriver.getAction() == 1) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 第二次放货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 第二次放货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + if (removeSealCoverPositionDriver.getAction() == 2) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 第二次放货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); + } } } else { - if (removeSealCoverPositionDriver.getAction() == 2) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); - } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 第二次放货点动作未到位, action=" + removeSealCoverPositionDriver.getAction()); - } + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到startDeviceCode2=" + startDeviceCode2 + "对应设备"); } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到startDeviceCode2=" + startDeviceCode2 + "对应设备"); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); - // 下发到达放货点,判断是否允许放货 - try { - productionLineDockingStationDeviceDriver.writing("to_command", 3); - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次放货指令异常: " + e.getMessage()); - return; - } - if (productionLineDockingStationDeviceDriver.getAction() == 2) { + if (isEnableInterOpen(productionLineDockingStationDeviceDriver.getDevice_code())) { + // 下发到达放货点,判断是否允许放货 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 3); + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次放货指令异常: " + e.getMessage()); + return; + } + if (productionLineDockingStationDeviceDriver.getAction() == 2) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许第二次放货, action=" + productionLineDockingStationDeviceDriver.getAction()); + } + } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + } else if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) { + unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver(); + if (isEnableInterOpen(unpackingMachineDeviceDriver.getDevice_code())) { + try { + unpackingMachineDeviceDriver.writing("to_command", 3); + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次放货指令异常: " + e.getMessage()); + return; + } + if (unpackingMachineDeviceDriver.getAction() == 1) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许第二次放货, action=" + unpackingMachineDeviceDriver.getAction()); + } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 不允许第二次放货, action=" + productionLineDockingStationDeviceDriver.getAction()); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -835,46 +1030,71 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else if (device.getDeviceDriver() instanceof RemoveSealCoverPositionDriver) { removeSealCoverPositionDriver = (RemoveSealCoverPositionDriver) device.getDeviceDriver(); - //需要判断起点是料桶缓存库还是其它区域的,若是料桶缓存库,则是放带盖的完成,否则是放无盖的完成 - String startDeviceCode2 = inst.getStart_device_code2(); - Device startDevice2 = deviceAppService.findDeviceByCode(startDeviceCode2); - if (startDevice2 != null) { - if ("7".equals(startDevice2.getRegion())) { - try { - removeSealCoverPositionDriver.writing("to_command", 1); + if (isEnableInterOpen(removeSealCoverPositionDriver.getDevice_code())) { + //需要判断起点是料桶缓存库还是其它区域的,若是料桶缓存库,则是放带盖的完成,否则是放无盖的完成 + String startDeviceCode2 = inst.getStart_device_code2(); + Device startDevice2 = deviceAppService.findDeviceByCode(startDeviceCode2); + if (startDevice2 != null) { + if ("7".equals(startDevice2.getRegion())) { + try { + removeSealCoverPositionDriver.writing("to_command", 1); - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次放货完成动作异常: " + e.getMessage()); - return; + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次放货完成动作异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + try { + removeSealCoverPositionDriver.writing("to_command", 2); + + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次放货完成动作异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else { - try { - removeSealCoverPositionDriver.writing("to_command", 2); - - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次放货完成动作异常: " + e.getMessage()); - return; - } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到startDeviceCode2=" + startDeviceCode2 + "对应设备"); } } else { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 未找到startDeviceCode2=" + startDeviceCode2 + "对应设备"); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } } else if (device.getDeviceDriver() instanceof ProductionLineDockingStationDeviceDriver) { productionLineDockingStationDeviceDriver = (ProductionLineDockingStationDeviceDriver) device.getDeviceDriver(); - // 下发放货完成 - try { - productionLineDockingStationDeviceDriver.writing("to_command", 4); + if (isEnableInterOpen(productionLineDockingStationDeviceDriver.getDevice_code())) { + // 下发放货完成 + try { + productionLineDockingStationDeviceDriver.writing("to_command", 4); - } catch (Exception e) { - logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次放货完成指令异常: " + e.getMessage()); - return; + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次放货完成指令异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } + } else if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) { + unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver(); + if (isEnableInterOpen(unpackingMachineDeviceDriver.getDevice_code())) { + try { + unpackingMachineDeviceDriver.writing("to_command", 4); + } catch (Exception e) { + logPhaseNoAck(phase, ikey, index, agvaddr, device_code, carno, arr, "原因: 下发第二次放货完成指令异常: " + e.getMessage()); + return; + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); logPhaseAck(phase, ikey, index, agvaddr, device_code, carno, arr, data); @@ -1086,4 +1306,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic return hex.length() == 1 ? "0" + hex : hex; } + private boolean isEnableInterOpen(String deviceCode) { + DeviceEnableInterDto deviceEnableInterDto = deviceEnableInterService.findByDeviceCode(deviceCode); + return ObjectUtil.isEmpty(deviceEnableInterDto) || !"0".equals(deviceEnableInterDto.getEnable_inter()); + } + } diff --git a/acs/acs2/nladmin-ui/src/api/acs/device/deviceEnableInter.js b/acs/acs2/nladmin-ui/src/api/acs/device/deviceEnableInter.js new file mode 100644 index 0000000..0b13ec0 --- /dev/null +++ b/acs/acs2/nladmin-ui/src/api/acs/device/deviceEnableInter.js @@ -0,0 +1,42 @@ +import request from '@/utils/request' + +export function add(data) { + return request({ + url: 'api/deviceEnableInter', + method: 'post', + data + }) +} + +export function del(ids) { + return request({ + url: 'api/deviceEnableInter', + method: 'delete', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/deviceEnableInter', + method: 'put', + data + }) +} + +export function batchEdit(data) { + return request({ + url: 'api/deviceEnableInter/batch', + method: 'put', + data + }) +} + +export function findByDeviceCode(deviceCode) { + return request({ + url: 'api/deviceEnableInter/deviceCode/' + deviceCode, + method: 'get' + }) +} + +export default { add, edit, del, findByDeviceCode, batchEdit } diff --git a/acs/acs2/nladmin-ui/src/views/acs/device/deviceEnableInter/index.vue b/acs/acs2/nladmin-ui/src/views/acs/device/deviceEnableInter/index.vue new file mode 100644 index 0000000..122ae95 --- /dev/null +++ b/acs/acs2/nladmin-ui/src/views/acs/device/deviceEnableInter/index.vue @@ -0,0 +1,314 @@ + + + + +