春风项目四线(合箱线、总装线)
wujian
2024-09-10 51b05b093fa15dd477981372f67ae7b3b2747733
jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/service/impl/DaPassingStationCollectionServiceImpl.java
@@ -1,6 +1,7 @@
package com.jcdm.main.da.passingStationCollection.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSONObject;
import com.jcdm.common.utils.DateUtils;
import com.jcdm.common.utils.StringUtils;
@@ -213,21 +214,35 @@
    @Override
    public void insertRepairRecordByIds(DaPassingStationCollection daPassingStationCollection) {
        Long[] conditions = daPassingStationCollection.getIds();
        String sfcCode = "";
        List<RmRepairRecord> save = new ArrayList<>();
        for (int i = 0; i < conditions.length; i++) {
            DaPassingStationCollection result = daPassingStationCollectionMapper.selectDaPassingStationCollectionById(conditions[i]);
            RmRepairRecord rmRepairRecord = new RmRepairRecord();
            rmRepairRecord.setBoxCode(result.getSfcCode());
            rmRepairRecord.setProcessesCode(result.getLocationCode());
            rmRepairRecord.setOriginalResult(result.getOutRsSign());
            rmRepairRecordMapper.insertRmRepairRecord(rmRepairRecord);
            if (i==0){
                if (ObjectUtil.isNotEmpty(result)){
                    sfcCode = result.getSfcCode();
                    rmRepairRecordMapper.deleteRmRepairRecordByCode(sfcCode);
                }
            }
            if (ObjectUtil.isNotEmpty(result)){
                RmRepairRecord rmRepairRecord = new RmRepairRecord();
                rmRepairRecord.setBoxCode(result.getSfcCode());
                rmRepairRecord.setProcessesCode(result.getLocationCode());
                rmRepairRecord.setOriginalResult(result.getOutRsSign());
                rmRepairRecord.setCreateTime(new Date());
                rmRepairRecordMapper.insertRmRepairRecord(rmRepairRecord);
                daPassingStationCollectionMapper.deleteDaPassingStationCollectionById(result.getId());
            }
        }
    }
    @Override
    public String SelectSN(String SNcode,String node) {
        try {
            Map<String, Object> params = new HashMap<>();
            params.put("SNcode",SNcode);
            params.put("node",node);
            params.put("SN_CODE",SNcode);
            params.put("Node",node);
            params.put("Success","");
            daPassingStationCollectionMapper.SelectSN(params);
            return (String)params.get("Success");
@@ -236,7 +251,23 @@
        }
    }
    public String sendMessage(String message) throws Exception{
//    public String sendMessage(String message) throws Exception{
//        Map<String,Object> map = new HashMap<>();
//
//        // 获取当前日期和时间
//        LocalDateTime nowDateTime = LocalDateTime.now();
//        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
//        System.out.println(dateTimeFormatter.format(nowDateTime));
//        map.put("server_time",dateTimeFormatter.format(nowDateTime));
//        map.put("server_code","200");
//
//        map.put("server_message",message);
//        JSONObject jsonObject =  new JSONObject(map);
//        WebSocketServer.sendAllMessage(jsonObject.toString());
//        return jsonObject.toString();
//    }
    public String sendMessage(String message,String userid) throws Exception{
        Map<String,Object> map = new HashMap<>();
        // 获取当前日期和时间
@@ -248,7 +279,7 @@
        map.put("server_message",message);
        JSONObject jsonObject =  new JSONObject(map);
        WebSocketServer.sendAllMessage(jsonObject.toString());
        WebSocketServer.sendInfo(jsonObject.toString(),userid);
        return jsonObject.toString();
    }
}