*
lsh
2025-02-14 267c1fa77770639804b4c172fd5f57ca7cc6eacf
src/main/java/com/zy/asrs/controller/MonitorController.java
@@ -7,21 +7,23 @@
import com.zy.asrs.domain.dto.WorkChartAxis;
import com.zy.asrs.domain.vo.LocChartPie;
import com.zy.asrs.mapper.ReportQueryMapper;
import com.zy.asrs.service.WrkDetlService;
import com.zy.common.model.MatDto;
import com.zy.common.service.CommonService;
import com.zy.core.CrnThread;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.SlaveType;
import com.zy.core.model.DevpSlave;
import com.zy.core.model.LedSlave;
import com.zy.core.model.command.LedCommand;
import com.zy.core.model.protocol.CrnProtocol;
import com.zy.core.model.protocol.StaProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.BarcodeThread;
import com.zy.core.thread.LedThread;
import com.zy.core.thread.SiemensDevpThread;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -39,6 +41,60 @@
    private ReportQueryMapper reportQueryMapper;
    @Autowired
    private SlaveProperties slaveProperties;
    @Autowired
    private WrkDetlService wrkDetlService;
    /**
     * 获取当前时间
     */
    @PostMapping("/barcode/two")
    public R barcodeTwo(@RequestParam Integer palletizingNo) {
        Date now = new Date();
        String barcode = "";
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 遍历入库口
            for (DevpSlave.Sta inSta : devp.getDriveSta()) {
                if (inSta.getStaNo().equals(palletizingNo)){
                    SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 2);
                    StaProtocol staProtocolPall = devpThread.getStation().get(palletizingNo);
                    if (staProtocolPall == null) {
                        continue;
                    } else {
                        staProtocolPall = staProtocolPall.clone();
                    }
                    if (!staProtocolPall.isAutoing() || !staProtocolPall.isLoading() || staProtocolPall.getWorkNo() != 0 || !staProtocolPall.isPakMk()){
                        return R.error("未就绪!!!");
                    }
                    // 获取条码扫描仪信息
                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode());
                    if (barcodeThread == null) {
                        continue;
                    }
                    barcode = barcodeThread.getBarcode();
                    if (!Cools.isEmpty(barcode)) {
//                    log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
                        if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) {
                            barcode = "";
                        }
                    } else {
                        break;
                    }
                }
            }
        }
//        Calendar calendar = Calendar.getInstance();
//        calendar.setTime(now);
        if (Cools.isEmpty(barcode) || barcode.equals("")){
            return R.error("未就绪!!!托盘条码为空!!!请检查!!!");
        }
        return R.ok(
                Cools.add("barcode", barcode).add("Date",now)
        );
    }
    /**
     * 获取当前时间
@@ -296,6 +352,19 @@
//        return R.ok(ledCommands);
        return R.ok().add(commandList);
    }
    /**
     * 获取其他信息
     */
    @GetMapping("/led/useInfo")
    public R monitorLedUseInfo(@RequestParam("ledId") Integer ledId) {
        Integer count1 = wrkDetlService.count1();
        Integer count3 = wrkDetlService.count3();
        Map<String, Object> map = new HashMap<>();
        map.put("count1", count1);
        map.put("count2", count3);
        return R.ok().add(map);
    }
    /**
     * 获取其他信息
     */