admin
2 天以前 6e4a6789e948bc6a8dc9fc1aa3eebc2980be3072
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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);
    }
}