package com.billion.main.plc.controller; import com.billion.common.annotation.Log; import com.billion.common.core.domain.AjaxResult; import com.billion.common.enums.BusinessType; import com.billion.main.da.domain.DaFailRecord; import com.billion.main.plc.domain.MesToPlcVo; import com.kangaroohy.milo.model.ReadWriteEntity; import com.kangaroohy.milo.service.MiloService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/mesToPlc") public class MesPlcControl { @Autowired private MiloService miloService; @PostMapping("/mesIssuePermissionToWork") public AjaxResult mesIssuePermissionToWork(@RequestBody MesToPlcVo mesToPlcVo) { Integer result = 21; try { miloService.writeToOpcUa(ReadWriteEntity.builder().identifier("wc.IGBT.mesAllowWork").value("21").build()); miloService.writeToOpcUa(ReadWriteEntity.builder().identifier("wc.IGBT.sfcCode").value(mesToPlcVo.getIgbtMateral()).build()); } catch (Exception e) { throw new RuntimeException("写入plc允许工作错误!请检查"); } return AjaxResult.success(result); } }