| | |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.dispatcher.ShuttleDispatchUtils; |
| | | import com.zy.core.enums.*; |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.LiftSlave; |
| | | import com.zy.core.model.ShuttleSlave; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.*; |
| | | import com.zy.core.model.command.*; |
| | | import com.zy.core.model.protocol.ForkLiftStaProtocol; |
| | | import com.zy.core.model.protocol.LiftProtocol; |
| | |
| | | import com.zy.core.thread.LiftThread; |
| | | import com.zy.core.thread.ShuttleThread; |
| | | import com.zy.core.thread.impl.FyDevpThread; |
| | | import com.zy.core.thread.impl.NormalLedThread; |
| | | import com.zy.system.service.ConfigService; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | } |
| | | // 退回 |
| | | if (back) { |
| | | if (!staProtocol.isLoading()) { |
| | | continue; |
| | | } |
| | | if (!staProtocol.isPakMk()) { |
| | | continue; |
| | | } |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | | MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg)); |
| | | ledThread.error(errMsg); |
| | | } |
| | | } |
| | |
| | | wrkMast.setWrkSts(WrkStsType.INBOUND_DEVICE_RUN.sts); |
| | | wrkMast.setModiTime(new Date()); |
| | | wrkMastService.updateById(wrkMast); |
| | | setLedData(wrkMast.getWrkNo(), wrkMast.getStaNo()); |
| | | |
| | | } else if (wrkMast != null && wrkMast.getWrkSts() != WrkStsType.NEW_INBOUND.sts) { |
| | | continue; |
| | | } |
| | |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | String errMsg = ""; |
| | | boolean back = false; |
| | | if (!back && staProtocol.isBackErr()) { |
| | | errMsg = "超宽异常"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isHighErr()) { |
| | | errMsg = "超高异常"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isRightErr()) { |
| | | errMsg = "超长异常"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isWeightErr()) { |
| | | errMsg = "超重"; |
| | | back = true; |
| | | } |
| | | // 退回 |
| | | if (back) { |
| | | |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | | ledThread.error(errMsg); |
| | | } |
| | | } |
| | | |
| | | Short workNo = staProtocol.getWorkNo(); |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && isInEnable(devpThread, inSta.getStaNo()) && !staProtocol.isEmptyMk() && (workNo == 0 || (workNo >= 9990 && workNo <= 9999)) && staProtocol.isPakMk()) { |
| | | String barcode = staProtocol.getBarcode(); |
| | |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | Integer code = jsonObject.getInteger("code"); |
| | | if (code.equals(200)) { |
| | | setLedData(wrkMast.getWrkNo(), wrkMast.getStaNo()); |
| | | |
| | | } else { |
| | | String msg = jsonObject.getString("msg"); |
| | |
| | | wrkMast.setModiTime(new Date()); |
| | | if (!wrkMastService.updateById(wrkMast)) { |
| | | News.info("{}任务,更新工作档失败", wrkMast.getWrkNo()); |
| | | } else { |
| | | setLedData(Integer.parseInt(wrkMast.getWmsWrkNo()), wrkMast.getStaNo()); |
| | | } |
| | | } |
| | | } |
| | |
| | | wrkMast.setModiTime(new Date()); |
| | | wrkMast.setShuttleNo(null); |
| | | wrkMastService.updateById(wrkMast); |
| | | setLedData(wrkMast.getWrkNo(), wrkMast.getStaNo()); |
| | | setLedData(Integer.parseInt(wrkMast.getWmsWrkNo()), wrkMast.getStaNo()); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | private void setLedData(Integer wrkNo, Integer staNo) { |
| | | try { |
| | | List<LedCommand> commands = new ArrayList<>(); |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("taskNo", wrkNo); |
| | | String response = null; |
| | |
| | | if (code.equals(200)) { |
| | | String data = jsonObject.getString("data"); |
| | | List<LedCommand> wrkDetls = JSONArray.parseArray(data, LedCommand.class); |
| | | commands.addAll(wrkDetls); |
| | | redisUtil.set("LED_" + staNo, commands, 10); |
| | | log.info("电视机数据设置:{}", data); |
| | | redisUtil.set("LED_" + staNo, wrkDetls, 30); |
| | | log.info("电视机数据设置:{},{}", staNo, data); |
| | | } else { |
| | | log.info("电视机数据设置异常:{},{}", wrkNo, response); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | } |
| | | String barcode = staProtocol.getBarcode(); |
| | | if (Cools.isEmpty(barcode) || "?".endsWith(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) { |
| | | return false; |
| | | } |
| | | if (!staProtocol.isAutoing()) { |
| | | News.info("{}任务,{}站点,不在自动状态", wrkMast.getWrkNo(), staProtocol.getSiteId()); |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | if (!staProtocol.isLoading()) { |
| | | News.info("{}任务,{}站点,无托盘", wrkMast.getWrkNo(), staProtocol.getSiteId()); |
| | | return false; |
| | | } |
| | | if (wrkMast.getSourceStaNo() != 1031) { |
| | | if (!staProtocol.isAutoing()) { |
| | | News.info("{}任务,{}站点,不在自动状态", wrkMast.getWrkNo(), staProtocol.getSiteId()); |
| | | return false; |
| | | } |
| | | if (Cools.isEmpty(barcode) || "?".endsWith(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) { |
| | | return false; |
| | | } |
| | | if (!staProtocol.getBarcode().equals(wrkMast.getBarcode())) { |
| | | News.info("{}任务,{}站点,托盘码不匹配,站点托盘码:{},任务托盘码:{}", wrkMast.getWrkNo(), staProtocol.getSiteId(), staProtocol.getBarcode(), wrkMast.getBarcode()); |
| | | return false; |
| | |
| | | wrkMast.setSystemMsg("");//清空消息 |
| | | wrkMast.setModiTime(now); |
| | | if (wrkMastService.updateById(wrkMast)) { |
| | | setLedData(Integer.parseInt(wrkMast.getWmsWrkNo()), wrkMast.getStaNo()); |
| | | return false; |
| | | } |
| | | return false; |
| | |
| | | wrkMast.setModiTime(now); |
| | | |
| | | if (wrkMastService.updateById(wrkMast)) { |
| | | setLedData(wrkMast.getWrkNo(), wrkMast.getStaNo()); |
| | | setLedData(Integer.parseInt(wrkMast.getWmsWrkNo()), wrkMast.getStaNo()); |
| | | //下发任务 |
| | | liftAction.assignWork(wrkMast.getLiftNo(), assignCommand); |
| | | return false; |
| | |
| | | * 入出库模式切换函数 |
| | | */ |
| | | public synchronized void ioConvert() { |
| | | for (LedSlave led : slaveProperties.getLed()) { |
| | | NormalLedThread ledThread = (NormalLedThread) SlaveConnection.get(SlaveType.Led, led.getId()); |
| | | ledThread.reset(); |
| | | } |
| | | try { |
| | | // 根据输送线plc遍历 |
| | | FyDevpThread devpThread = (FyDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |