|  |  | 
 |  |  | package com.zy.core.thread; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSON; | 
 |  |  | import com.core.common.Cools; | 
 |  |  | import com.zy.common.entity.Parameter; | 
 |  |  | import com.zy.common.model.MatDto; | 
 |  |  | import com.zy.core.Slave; | 
 |  |  | import com.zy.core.ThreadHandler; | 
 |  |  | import com.zy.core.cache.MessageQueue; | 
 |  |  | import com.zy.core.enums.SlaveType; | 
 |  |  | import com.zy.core.model.ErrMsg; | 
 |  |  | import com.zy.core.model.Task; | 
 |  |  | import com.zy.core.model.command.LedCommand; | 
 |  |  | import lombok.Data; | 
 |  |  | 
 |  |  | import onbon.bx05.utils.DisplayStyleFactory; | 
 |  |  |  | 
 |  |  | import java.awt.*; | 
 |  |  | import java.util.HashSet; | 
 |  |  | import java.util.*; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Set; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2020/9/1 | 
 |  |  | 
 |  |  |     private StringBuffer stringBuffer = new StringBuffer(); | 
 |  |  |     private List<LedCommand> commandList; | 
 |  |  |  | 
 |  |  |     private StringBuffer errorMsg = new StringBuffer(); | 
 |  |  | //    private StringBuffer errorMsg = new StringBuffer(); | 
 |  |  |     private List<ErrMsg> errorMsg = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |     public LedThread(Slave slave) { | 
 |  |  |         this.slave = slave; | 
 |  |  | 
 |  |  |                             reset7(); | 
 |  |  |                             break; | 
 |  |  |                         case 5: | 
 |  |  |                             error((String) task.getData()); | 
 |  |  |                             error((ErrMsg)task.getData()); | 
 |  |  |                             break; | 
 |  |  |                         case 6: | 
 |  |  |                             errorReset(); | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     private void error(String msg) { | 
 |  |  |         errorMsg.delete(0, errorMsg.length()); | 
 |  |  |         errorMsg.append(msg); | 
 |  |  |     private void error(ErrMsg errMsg) { | 
 |  |  | //        errorMsg.clear(); | 
 |  |  |         ErrMsg errMsOld = null; | 
 |  |  |         for (ErrMsg errMsg1 : errorMsg){ | 
 |  |  |             if (errMsg1.getId()==1){ | 
 |  |  |                 errMsOld = errMsg1; | 
 |  |  |             } | 
 |  |  |             errMsg1.setId(errMsg1.getId()-1); | 
 |  |  |         } | 
 |  |  |         if (errMsOld != null){ | 
 |  |  |             errorMsg.remove(errMsOld); | 
 |  |  |         } | 
 |  |  |         errMsg.setId(errMsg.getIdCode()); | 
 |  |  |         errorMsg.add(errMsg); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void errorReset() { | 
 |  |  |         this.errorMsg.delete(0, errorMsg.length()); | 
 |  |  |         this.errorMsg.clear(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override |