| | |
| | | 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; |
| | |
| | | @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"); |
| | |
| | | } |
| | | } |
| | | |
| | | 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<>(); |
| | | |
| | | // 获取当前日期和时间 |
| | |
| | | |
| | | map.put("server_message",message); |
| | | JSONObject jsonObject = new JSONObject(map); |
| | | WebSocketServer.sendAllMessage(jsonObject.toString()); |
| | | WebSocketServer.sendInfo(jsonObject.toString(),userid); |
| | | return jsonObject.toString(); |
| | | } |
| | | } |