| | |
| | | private S7objectMachine s7objectMachine; |
| | | public static int thinness = 40; |
| | | public static int edgSpeed = 40; |
| | | public static Long machineId = 6L; |
| | | //public static Long machineId = 6L; |
| | | public List<Map> sendRecords = new ArrayList<>(); |
| | | |
| | | public MachineMarking(MachineMapper machineMapper, TaskingService taskingService){ |
| | | public Machine thisMachine; |
| | | public MachineMarking(Machine machine,MachineMapper machineMapper, TaskingService taskingService){ |
| | | this.thisMachine = machine; |
| | | this.machineMapper = machineMapper; |
| | | this.taskingService = taskingService; |
| | | } |
| | | |
| | | public void plcStart() { |
| | | Long machineId=12L; |
| | | Machine machine=machineMapper.selectById(machineId); |
| | | //Long machineId=12L; |
| | | Machine machine=machineMapper.selectById(thisMachine.getId()); |
| | | // S7objectMachine s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),"PlcMarking", EPlcType.S1500); |
| | | // s7objectMachine.start(); |
| | | if (s7objectMachine==null){ |
| | | s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),"PlcMarking", EPlcType.S1500); |
| | | s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),machine.getFileName(), EPlcType.S1500); |
| | | s7objectMachine.start(); |
| | | } |
| | | PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject; |
| | |
| | | if(isMark_==1){ |
| | | s7objectMachine.plccontrol.writeString(drawingMark.getAddress(), tasking.getProgramId()); |
| | | } |
| | | s7objectMachine.plccontrol.writeWord(lengthOutOfService.getAddress(), tasking.getLength().intValue()); |
| | | s7objectMachine.plccontrol.writeWord(widthOutOfService.getAddress(), tasking.getWidth().intValue()); |
| | | s7objectMachine.plccontrol.writeWord(widthOutOfService.getAddress(), tasking.getWidth().intValue());//y |
| | | s7objectMachine.plccontrol.writeWord(lengthOutOfService.getAddress(), tasking.getLength().intValue());//x |
| | | s7objectMachine.plccontrol.writeWord(isMark.getAddress(), isMark_); |
| | | s7objectMachine.plccontrol.writeWord(markingMode.getAddress(), isMarkingMode_); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 1); |
| | | |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String sendRecord=df.format(new Date())+" "+ |
| | | tasking.getScanId()+"-"+ |
| | | tasking.getProgramId()+"-"+ |
| | | tasking.getLength()+"-"+ |
| | | tasking.getWidth()+"-"+ |
| | | isMark_+"-"+ |
| | | isMarkingMode_; |
| | | if (sendRecords.size()>7){ |
| | | sendRecords.remove(0); |
| | | } |
| | | Map sendContentMap=new HashMap(); |
| | | sendContentMap.put("sendContent",sendRecord); |
| | | sendRecords.add(sendContentMap); |
| | | return; |
| | | } |
| | | } |