forked from I3-YF/i3plus-mes-pcn-yfai
OPCLink调用
parent
ed187a2a84
commit
63c6a6e955
@ -0,0 +1,57 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.opc;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IWriteOPCEquipmentService;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.model.MesOpcLinkModel;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||||
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :opc
|
||||||
|
* @Reference :
|
||||||
|
* @Author : junsheng.li
|
||||||
|
* @CreateDate 2024/6/3 10:24
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "opc")
|
||||||
|
@RequestMapping(MesCommonConstant.MES_YANFEN + "/opc")
|
||||||
|
@Slf4j
|
||||||
|
public class MesOpcLinkController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IWriteOPCEquipmentService iWriteOPCEquipmentService;
|
||||||
|
|
||||||
|
@PostMapping("/write-variable")
|
||||||
|
@ApiOperation(value = "写值")
|
||||||
|
public ResultBean writeVariable(MesOpcLinkModel mesOpcLinkModel) {
|
||||||
|
try {
|
||||||
|
return ResultBean.success("执行成功").setResultObject(iWriteOPCEquipmentService.writeVariable(mesOpcLinkModel));
|
||||||
|
} catch (ImppBusiException imppException) {
|
||||||
|
return ResultBean.fail(imppException);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/read-variable")
|
||||||
|
@ApiOperation(value = "读值")
|
||||||
|
public ResultBean readVariable(MesOpcLinkModel mesOpcLinkModel) {
|
||||||
|
try {
|
||||||
|
return ResultBean.success("执行成功").setResultObject(iWriteOPCEquipmentService.readVariable(mesOpcLinkModel));
|
||||||
|
} catch (ImppBusiException imppException) {
|
||||||
|
return ResultBean.fail(imppException);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue