| | |
| | | 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.core.domain.R; |
| | | import com.jcdm.common.utils.DateUtils; |
| | | import com.jcdm.common.utils.StringUtils; |
| | | import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; |
| | | import com.jcdm.main.bs.orderScheduling.mapper.BsOrderSchedulingMapper; |
| | | import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService; |
| | | import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; |
| | | import com.jcdm.main.da.passingStationCollection.domain.ProductNumVO; |
| | | import com.jcdm.main.da.passingStationCollection.mapper.DaPassingStationCollectionMapper; |
| | | import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService; |
| | | import com.jcdm.main.da.passingStationCollection.vo.DaPassingStationVO; |
| | |
| | | public List<DaPassingStationCollection> selectDaPassingStationCollectionList(DaPassingStationCollection daPassingStationCollection) |
| | | { |
| | | return daPassingStationCollectionMapper.selectDaPassingStationCollectionList(daPassingStationCollection); |
| | | } |
| | | |
| | | @Override |
| | | public List<DaPassingStationCollection> selectDaPassingStationCollectionForSearch(DaPassingStationCollection daPassingStationCollection) { |
| | | return daPassingStationCollectionMapper.selectDaPassingStationCollectionForSearch(daPassingStationCollection); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @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{ |
| | | @Override |
| | | public List<ProductNumVO> getProductNum(DaPassingStationCollection daPassingStationCollection) { |
| | | String queryMonth = daPassingStationCollection.getQueryMonth(); |
| | | LocalDate queryLocalDate = daPassingStationCollection.getQueryDate(); |
| | | if (ObjectUtil.isNotEmpty(queryLocalDate)){ |
| | | LocalDate addQueryLocalDate = queryLocalDate.plusDays(1); |
| | | String queryDate = queryLocalDate.toString(); |
| | | String addQueryDate = addQueryLocalDate.toString(); |
| | | List<ProductNumVO> productNum = bsOrderSchedulingMapper.getProductNum(queryDate, addQueryDate); |
| | | if (CollUtil.isNotEmpty(productNum)){ |
| | | productNum.forEach(x -> { |
| | | x.setQueryDate(queryDate); |
| | | }); |
| | | } |
| | | return productNum; |
| | | } else if (ObjectUtil.isNull(queryLocalDate) && ObjectUtil.isNotNull(queryMonth)){ |
| | | //按月份查询 |
| | | String s = queryMonth + "-01"; |
| | | LocalDate parse = LocalDate.parse(s); |
| | | LocalDate localDate = parse.plusMonths(1); |
| | | String queryDate = parse.toString(); |
| | | String addQueryDate = localDate.toString(); |
| | | List<ProductNumVO> productNum = bsOrderSchedulingMapper.getProductNum(queryDate, addQueryDate); |
| | | if (CollUtil.isNotEmpty(productNum)){ |
| | | productNum.forEach(x -> { |
| | | x.setQueryDate(queryMonth); |
| | | }); |
| | | } |
| | | return productNum; |
| | | } |
| | | return new ArrayList<ProductNumVO>(); |
| | | } |
| | | |
| | | // 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(); |
| | | } |
| | | } |