春风项目四线(合箱线、总装线)
wujian
2024-04-28 9bc5106810d7c0e6f27e904b584c9bbfb3725a19
jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/service/impl/DaPassingStationCollectionServiceImpl.java
@@ -1,15 +1,7 @@
package com.jcdm.main.da.passingStationCollection.service.impl;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import com.jcdm.common.constant.Constants;
import com.alibaba.fastjson2.JSONObject;
import com.jcdm.common.utils.DateUtils;
import com.jcdm.common.utils.StringUtils;
import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling;
@@ -21,9 +13,17 @@
import com.jcdm.main.da.passingStationCollection.vo.DaPassingStationVO;
import com.jcdm.main.rm.repairRecord.domain.RmRepairRecord;
import com.jcdm.main.rm.repairRecord.mapper.RmRepairRecordMapper;
import com.jcdm.main.websocket.WebSocketServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
 * 产品过站采集Service业务层处理
@@ -222,4 +222,33 @@
            rmRepairRecordMapper.insertRmRepairRecord(rmRepairRecord);
        }
    }
    @Override
    public String SelectSN(String SNcode,String node) {
        try {
            Map<String, Object> params = new HashMap<>();
            params.put("SN_CODE",SNcode);
            params.put("Node",node);
            params.put("Success","");
            daPassingStationCollectionMapper.SelectSN(params);
            return (String)params.get("Success");
        } catch (Exception e) {
            return "数据查询失败!";
        }
    }
    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();
    }
}